LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] powerpc/fsl_pci: Fix pci stack build bug with FRAME_WARN
@ 2015-01-20 20:03 Kim Phillips
2015-01-21 0:31 ` Scott Wood
0 siblings, 1 reply; 7+ messages in thread
From: Kim Phillips @ 2015-01-20 20:03 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Scott Wood, Wang Dongsheng, Anton Blanchard, Himangi Saraogi,
Aaron Sierra
Cc: linux-kernel, linuxppc-dev
Fix this:
CC arch/powerpc/sysdev/fsl_pci.o
arch/powerpc/sysdev/fsl_pci.c: In function 'fsl_pcie_check_link':
arch/powerpc/sysdev/fsl_pci.c:91:1: error: the frame size of 1360 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
when configuring FRAME_WARN, by converting the allocation from the
stack to the heap. We use GFP_ATOMIC since this function can be
called with interrupts disabled.
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
---
arch/powerpc/sysdev/fsl_pci.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 6455c1e..635d743 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -69,11 +69,13 @@ static int fsl_pcie_check_link(struct pci_controller *hose)
if (hose->indirect_type & PPC_INDIRECT_TYPE_FSL_CFG_REG_LINK) {
if (hose->ops->read == fsl_indirect_read_config) {
- struct pci_bus bus;
- bus.number = hose->first_busno;
- bus.sysdata = hose;
- bus.ops = hose->ops;
- indirect_read_config(&bus, 0, PCIE_LTSSM, 4, &val);
+ struct pci_bus *bus;
+ bus = kmalloc(sizeof(*bus), GFP_ATOMIC);
+ bus->number = hose->first_busno;
+ bus->sysdata = hose;
+ bus->ops = hose->ops;
+ indirect_read_config(bus, 0, PCIE_LTSSM, 4, &val);
+ kfree(bus);
} else
early_read_config_dword(hose, 0, 0, PCIE_LTSSM, &val);
if (val < PCIE_LTSSM_L0)
--
2.2.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc/fsl_pci: Fix pci stack build bug with FRAME_WARN
2015-01-20 20:03 [PATCH] powerpc/fsl_pci: Fix pci stack build bug with FRAME_WARN Kim Phillips
@ 2015-01-21 0:31 ` Scott Wood
2015-01-22 2:48 ` Kim Phillips
0 siblings, 1 reply; 7+ messages in thread
From: Scott Wood @ 2015-01-21 0:31 UTC (permalink / raw)
To: Kim Phillips
Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Wang Dongsheng, Anton Blanchard, Himangi Saraogi, Aaron Sierra,
linux-kernel, linuxppc-dev
On Tue, 2015-01-20 at 14:03 -0600, Kim Phillips wrote:
> Fix this:
>
> CC arch/powerpc/sysdev/fsl_pci.o
> arch/powerpc/sysdev/fsl_pci.c: In function 'fsl_pcie_check_link':
> arch/powerpc/sysdev/fsl_pci.c:91:1: error: the frame size of 1360 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
>
> when configuring FRAME_WARN, by converting the allocation from the
> stack to the heap. We use GFP_ATOMIC since this function can be
> called with interrupts disabled.
>
> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
> ---
> arch/powerpc/sysdev/fsl_pci.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
> index 6455c1e..635d743 100644
> --- a/arch/powerpc/sysdev/fsl_pci.c
> +++ b/arch/powerpc/sysdev/fsl_pci.c
> @@ -69,11 +69,13 @@ static int fsl_pcie_check_link(struct pci_controller *hose)
>
> if (hose->indirect_type & PPC_INDIRECT_TYPE_FSL_CFG_REG_LINK) {
> if (hose->ops->read == fsl_indirect_read_config) {
> - struct pci_bus bus;
> - bus.number = hose->first_busno;
> - bus.sysdata = hose;
> - bus.ops = hose->ops;
> - indirect_read_config(&bus, 0, PCIE_LTSSM, 4, &val);
> + struct pci_bus *bus;
> + bus = kmalloc(sizeof(*bus), GFP_ATOMIC);
> + bus->number = hose->first_busno;
Missing check for allocation failure.
Do we not have a real struct pci_bus we can use here? Or refactor
indirect_read_config() to take hose and bus number instead?
If putting a pci_bus struct on the stack is no longer OK, then
fake_pci_bus() should be fixed as well. I wonder if GCC is allocating
separate pci_bus structs on the stack for this one and the one that
early_read_config_dword() uses...
-Scott
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc/fsl_pci: Fix pci stack build bug with FRAME_WARN
2015-01-21 0:31 ` Scott Wood
@ 2015-01-22 2:48 ` Kim Phillips
2015-01-22 3:02 ` Scott Wood
0 siblings, 1 reply; 7+ messages in thread
From: Kim Phillips @ 2015-01-22 2:48 UTC (permalink / raw)
To: Scott Wood
Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Wang Dongsheng, Anton Blanchard, Himangi Saraogi, Aaron Sierra,
linux-kernel, linuxppc-dev
On Tue, 20 Jan 2015 18:31:32 -0600
Scott Wood <scottwood@freescale.com> wrote:
> On Tue, 2015-01-20 at 14:03 -0600, Kim Phillips wrote:
> > Fix this:
> >
> > CC arch/powerpc/sysdev/fsl_pci.o
> > arch/powerpc/sysdev/fsl_pci.c: In function 'fsl_pcie_check_link':
> > arch/powerpc/sysdev/fsl_pci.c:91:1: error: the frame size of 1360 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> >
> > when configuring FRAME_WARN, by converting the allocation from the
> > stack to the heap. We use GFP_ATOMIC since this function can be
> > called with interrupts disabled.
> >
> > Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
> > ---
> > arch/powerpc/sysdev/fsl_pci.c | 12 +++++++-----
> > 1 file changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
> > index 6455c1e..635d743 100644
> > --- a/arch/powerpc/sysdev/fsl_pci.c
> > +++ b/arch/powerpc/sysdev/fsl_pci.c
> > @@ -69,11 +69,13 @@ static int fsl_pcie_check_link(struct pci_controller *hose)
> >
> > if (hose->indirect_type & PPC_INDIRECT_TYPE_FSL_CFG_REG_LINK) {
> > if (hose->ops->read == fsl_indirect_read_config) {
> > - struct pci_bus bus;
> > - bus.number = hose->first_busno;
> > - bus.sysdata = hose;
> > - bus.ops = hose->ops;
> > - indirect_read_config(&bus, 0, PCIE_LTSSM, 4, &val);
> > + struct pci_bus *bus;
> > + bus = kmalloc(sizeof(*bus), GFP_ATOMIC);
> > + bus->number = hose->first_busno;
>
> Missing check for allocation failure.
thanks.
> Do we not have a real struct pci_bus we can use here? Or refactor
> indirect_read_config() to take hose and bus number instead?
indirect_read_config() can't be refactored because it is also used
in the generic struct pci_ops. Unless you mean making an
__indirect_read_config that the original would call, but that
doesn't look that trivial given it calls pci_exclude_device with a
struct pci_controller hose.
> If putting a pci_bus struct on the stack is no longer OK, then
> fake_pci_bus() should be fixed as well. I wonder if GCC is allocating
> separate pci_bus structs on the stack for this one and the one that
> early_read_config_dword() uses...
fake_pci_bus()' version is static, so it's not on the stack.
given that, maybe fsl_pcie_check_link()'s should be static too?
Kim
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc/fsl_pci: Fix pci stack build bug with FRAME_WARN
2015-01-22 2:48 ` Kim Phillips
@ 2015-01-22 3:02 ` Scott Wood
2015-01-23 0:20 ` Kim Phillips
0 siblings, 1 reply; 7+ messages in thread
From: Scott Wood @ 2015-01-22 3:02 UTC (permalink / raw)
To: Kim Phillips
Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Wang Dongsheng, Anton Blanchard, Himangi Saraogi, Aaron Sierra,
linux-kernel, linuxppc-dev
On Wed, 2015-01-21 at 20:48 -0600, Kim Phillips wrote:
> On Tue, 20 Jan 2015 18:31:32 -0600
> Scott Wood <scottwood@freescale.com> wrote:
>
> > On Tue, 2015-01-20 at 14:03 -0600, Kim Phillips wrote:
> > > Fix this:
> > >
> > > CC arch/powerpc/sysdev/fsl_pci.o
> > > arch/powerpc/sysdev/fsl_pci.c: In function 'fsl_pcie_check_link':
> > > arch/powerpc/sysdev/fsl_pci.c:91:1: error: the frame size of 1360 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> > >
> > > when configuring FRAME_WARN, by converting the allocation from the
> > > stack to the heap. We use GFP_ATOMIC since this function can be
> > > called with interrupts disabled.
> > >
> > > Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
> > > ---
> > > arch/powerpc/sysdev/fsl_pci.c | 12 +++++++-----
> > > 1 file changed, 7 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
> > > index 6455c1e..635d743 100644
> > > --- a/arch/powerpc/sysdev/fsl_pci.c
> > > +++ b/arch/powerpc/sysdev/fsl_pci.c
> > > @@ -69,11 +69,13 @@ static int fsl_pcie_check_link(struct pci_controller *hose)
> > >
> > > if (hose->indirect_type & PPC_INDIRECT_TYPE_FSL_CFG_REG_LINK) {
> > > if (hose->ops->read == fsl_indirect_read_config) {
> > > - struct pci_bus bus;
> > > - bus.number = hose->first_busno;
> > > - bus.sysdata = hose;
> > > - bus.ops = hose->ops;
> > > - indirect_read_config(&bus, 0, PCIE_LTSSM, 4, &val);
> > > + struct pci_bus *bus;
> > > + bus = kmalloc(sizeof(*bus), GFP_ATOMIC);
> > > + bus->number = hose->first_busno;
> >
> > Missing check for allocation failure.
>
> thanks.
>
> > Do we not have a real struct pci_bus we can use here? Or refactor
> > indirect_read_config() to take hose and bus number instead?
>
> indirect_read_config() can't be refactored because it is also used
> in the generic struct pci_ops. Unless you mean making an
> __indirect_read_config that the original would call,
Yes, that's what I mean.
> but that doesn't look that trivial given it calls pci_exclude_device with a
> struct pci_controller hose.
Check for excluded devices in indirect_read_config(), not
__indirect_read_config().
> > If putting a pci_bus struct on the stack is no longer OK, then
> > fake_pci_bus() should be fixed as well. I wonder if GCC is allocating
> > separate pci_bus structs on the stack for this one and the one that
> > early_read_config_dword() uses...
>
> fake_pci_bus()' version is static, so it's not on the stack.
>
> given that, maybe fsl_pcie_check_link()'s should be static too?
Oh. How would you ensure that it's only called once at a time? It
doesn't look like this is only called during early boot.
fsl_pcie_check_link() is called every time we do any config read through
the normal interface. This is also a concern for the call to
early_read_config_dword().
-Scott
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc/fsl_pci: Fix pci stack build bug with FRAME_WARN
2015-01-22 3:02 ` Scott Wood
@ 2015-01-23 0:20 ` Kim Phillips
2015-01-23 0:43 ` Scott Wood
0 siblings, 1 reply; 7+ messages in thread
From: Kim Phillips @ 2015-01-23 0:20 UTC (permalink / raw)
To: Scott Wood
Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Wang Dongsheng, Anton Blanchard, Himangi Saraogi, Aaron Sierra,
linux-kernel, linuxppc-dev
On Wed, 21 Jan 2015 21:02:27 -0600
Scott Wood <scottwood@freescale.com> wrote:
> On Wed, 2015-01-21 at 20:48 -0600, Kim Phillips wrote:
> > On Tue, 20 Jan 2015 18:31:32 -0600
> > Scott Wood <scottwood@freescale.com> wrote:
> >
> > > On Tue, 2015-01-20 at 14:03 -0600, Kim Phillips wrote:
> > > > Fix this:
> > > >
> > > > CC arch/powerpc/sysdev/fsl_pci.o
> > > > arch/powerpc/sysdev/fsl_pci.c: In function 'fsl_pcie_check_link':
> > > > arch/powerpc/sysdev/fsl_pci.c:91:1: error: the frame size of 1360 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> > > >
> > > > when configuring FRAME_WARN, by converting the allocation from the
> > > > stack to the heap. We use GFP_ATOMIC since this function can be
> > > > called with interrupts disabled.
> > > >
> > > > Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
> > > > ---
> > > > arch/powerpc/sysdev/fsl_pci.c | 12 +++++++-----
> > > > 1 file changed, 7 insertions(+), 5 deletions(-)
> > > >
> > > > diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
> > > > index 6455c1e..635d743 100644
> > > > --- a/arch/powerpc/sysdev/fsl_pci.c
> > > > +++ b/arch/powerpc/sysdev/fsl_pci.c
> > > > @@ -69,11 +69,13 @@ static int fsl_pcie_check_link(struct pci_controller *hose)
> > > >
> > > > if (hose->indirect_type & PPC_INDIRECT_TYPE_FSL_CFG_REG_LINK) {
> > > > if (hose->ops->read == fsl_indirect_read_config) {
> > > > - struct pci_bus bus;
> > > > - bus.number = hose->first_busno;
> > > > - bus.sysdata = hose;
> > > > - bus.ops = hose->ops;
> > > > - indirect_read_config(&bus, 0, PCIE_LTSSM, 4, &val);
> > > > + struct pci_bus *bus;
> > > > + bus = kmalloc(sizeof(*bus), GFP_ATOMIC);
> > > > + bus->number = hose->first_busno;
> > >
> > > Missing check for allocation failure.
> >
> > thanks.
> >
> > > Do we not have a real struct pci_bus we can use here? Or refactor
> > > indirect_read_config() to take hose and bus number instead?
> >
> > indirect_read_config() can't be refactored because it is also used
> > in the generic struct pci_ops. Unless you mean making an
> > __indirect_read_config that the original would call,
>
> Yes, that's what I mean.
>
> > but that doesn't look that trivial given it calls pci_exclude_device with a
> > struct pci_controller hose.
>
> Check for excluded devices in indirect_read_config(), not
> __indirect_read_config().
turns out it wasn't an issue; see below for a v2.
> > > If putting a pci_bus struct on the stack is no longer OK, then
> > > fake_pci_bus() should be fixed as well. I wonder if GCC is allocating
> > > separate pci_bus structs on the stack for this one and the one that
> > > early_read_config_dword() uses...
> >
> > fake_pci_bus()' version is static, so it's not on the stack.
> >
> > given that, maybe fsl_pcie_check_link()'s should be static too?
>
> Oh. How would you ensure that it's only called once at a time? It
> doesn't look like this is only called during early boot.
> fsl_pcie_check_link() is called every time we do any config read through
> the normal interface. This is also a concern for the call to
> early_read_config_dword().
I really don't know how that works: that code has been there since
before linux was maintained in git.
Below is the v2.
Thanks,
Kim.
>From aac5aa245949ea3dadae9ea913d67c456f558a0c Mon Sep 17 00:00:00 2001
From: Kim Phillips <kim.phillips@freescale.com>
Date: Tue, 20 Jan 2015 14:03:49 -0600
Subject: [PATCH v2] powerpc/fsl_pci: Fix pci stack build bug with FRAME_WARN
Fix this:
CC arch/powerpc/sysdev/fsl_pci.o
arch/powerpc/sysdev/fsl_pci.c: In function 'fsl_pcie_check_link':
arch/powerpc/sysdev/fsl_pci.c:91:1: error: the frame size of 1360 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
when configuring FRAME_WARN, by refactoring indirect_read_config()
to take hose and bus number instead of the 1344-byte struct pci_bus.
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
---
v2: refactor indirect_read_config() instead of kmalloc'ing a struct
pci_bus.
arch/powerpc/include/asm/pci-bridge.h | 4 ++++
arch/powerpc/sysdev/fsl_pci.c | 11 ++++-------
arch/powerpc/sysdev/indirect_pci.c | 25 +++++++++++++++++--------
3 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 725247b..546d036 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -119,6 +119,10 @@ extern void setup_indirect_pci(struct pci_controller* hose,
extern int indirect_read_config(struct pci_bus *bus, unsigned int devfn,
int offset, int len, u32 *val);
+extern int __indirect_read_config(struct pci_controller *hose,
+ unsigned char bus_number, unsigned int devfn,
+ int offset, int len, u32 *val);
+
extern int indirect_write_config(struct pci_bus *bus, unsigned int devfn,
int offset, int len, u32 val);
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 6455c1e..7cc215e 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -68,13 +68,10 @@ static int fsl_pcie_check_link(struct pci_controller *hose)
u32 val = 0;
if (hose->indirect_type & PPC_INDIRECT_TYPE_FSL_CFG_REG_LINK) {
- if (hose->ops->read == fsl_indirect_read_config) {
- struct pci_bus bus;
- bus.number = hose->first_busno;
- bus.sysdata = hose;
- bus.ops = hose->ops;
- indirect_read_config(&bus, 0, PCIE_LTSSM, 4, &val);
- } else
+ if (hose->ops->read == fsl_indirect_read_config)
+ __indirect_read_config(hose, hose->first_busno, 0,
+ PCIE_LTSSM, 4, &val);
+ else
early_read_config_dword(hose, 0, 0, PCIE_LTSSM, &val);
if (val < PCIE_LTSSM_L0)
return 1;
diff --git a/arch/powerpc/sysdev/indirect_pci.c b/arch/powerpc/sysdev/indirect_pci.c
index 1f6c570..692de9d 100644
--- a/arch/powerpc/sysdev/indirect_pci.c
+++ b/arch/powerpc/sysdev/indirect_pci.c
@@ -20,31 +20,31 @@
#include <asm/pci-bridge.h>
#include <asm/machdep.h>
-int indirect_read_config(struct pci_bus *bus, unsigned int devfn,
- int offset, int len, u32 *val)
+int __indirect_read_config(struct pci_controller *hose,
+ unsigned char bus_number, unsigned int devfn,
+ int offset, int len, u32 *val)
{
- struct pci_controller *hose = pci_bus_to_host(bus);
volatile void __iomem *cfg_data;
u8 cfg_type = 0;
u32 bus_no, reg;
if (hose->indirect_type & PPC_INDIRECT_TYPE_NO_PCIE_LINK) {
- if (bus->number != hose->first_busno)
+ if (bus_number != hose->first_busno)
return PCIBIOS_DEVICE_NOT_FOUND;
if (devfn != 0)
return PCIBIOS_DEVICE_NOT_FOUND;
}
if (ppc_md.pci_exclude_device)
- if (ppc_md.pci_exclude_device(hose, bus->number, devfn))
+ if (ppc_md.pci_exclude_device(hose, bus_number, devfn))
return PCIBIOS_DEVICE_NOT_FOUND;
if (hose->indirect_type & PPC_INDIRECT_TYPE_SET_CFG_TYPE)
- if (bus->number != hose->first_busno)
+ if (bus_number != hose->first_busno)
cfg_type = 1;
- bus_no = (bus->number == hose->first_busno) ?
- hose->self_busno : bus->number;
+ bus_no = (bus_number == hose->first_busno) ?
+ hose->self_busno : bus_number;
if (hose->indirect_type & PPC_INDIRECT_TYPE_EXT_REG)
reg = ((offset & 0xf00) << 16) | (offset & 0xfc);
@@ -77,6 +77,15 @@ int indirect_read_config(struct pci_bus *bus, unsigned int devfn,
return PCIBIOS_SUCCESSFUL;
}
+int indirect_read_config(struct pci_bus *bus, unsigned int devfn,
+ int offset, int len, u32 *val)
+{
+ struct pci_controller *hose = pci_bus_to_host(bus);
+
+ return __indirect_read_config(hose, bus->number, devfn, offset, len,
+ val);
+}
+
int indirect_write_config(struct pci_bus *bus, unsigned int devfn,
int offset, int len, u32 val)
{
--
2.2.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc/fsl_pci: Fix pci stack build bug with FRAME_WARN
2015-01-23 0:20 ` Kim Phillips
@ 2015-01-23 0:43 ` Scott Wood
2015-01-23 1:05 ` [PATCH v2] " Kim Phillips
0 siblings, 1 reply; 7+ messages in thread
From: Scott Wood @ 2015-01-23 0:43 UTC (permalink / raw)
To: Kim Phillips
Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Wang Dongsheng, Anton Blanchard, Himangi Saraogi, Aaron Sierra,
linux-kernel, linuxppc-dev
On Thu, 2015-01-22 at 18:20 -0600, Kim Phillips wrote:
> On Wed, 21 Jan 2015 21:02:27 -0600
> Scott Wood <scottwood@freescale.com> wrote:
>
> > On Wed, 2015-01-21 at 20:48 -0600, Kim Phillips wrote:
> > > fake_pci_bus()' version is static, so it's not on the stack.
> > >
> > > given that, maybe fsl_pcie_check_link()'s should be static too?
> >
> > Oh. How would you ensure that it's only called once at a time? It
> > doesn't look like this is only called during early boot.
> > fsl_pcie_check_link() is called every time we do any config read through
> > the normal interface. This is also a concern for the call to
> > early_read_config_dword().
>
> I really don't know how that works: that code has been there since
> before linux was maintained in git.
Regardless, now that it's been noticed we should figure it out.
fsl_pcie_check_link() is using the early_*() functions in a context that
is not early and thus appears to be breaking the assumption that
fake_pci_bus() makes.
fsl_pcie_check_link() is fairly recent, FWIW.
> Below is the v2.
Please send as a standalone patch so I don't have to edit all the
discussion out of the commit message.
-Scott
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] powerpc/fsl_pci: Fix pci stack build bug with FRAME_WARN
2015-01-23 0:43 ` Scott Wood
@ 2015-01-23 1:05 ` Kim Phillips
0 siblings, 0 replies; 7+ messages in thread
From: Kim Phillips @ 2015-01-23 1:05 UTC (permalink / raw)
To: Scott Wood
Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Wang Dongsheng, Anton Blanchard, Himangi Saraogi, Aaron Sierra,
linux-kernel, linuxppc-dev
Fix this:
CC arch/powerpc/sysdev/fsl_pci.o
arch/powerpc/sysdev/fsl_pci.c: In function 'fsl_pcie_check_link':
arch/powerpc/sysdev/fsl_pci.c:91:1: error: the frame size of 1360 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
when configuring FRAME_WARN, by refactoring indirect_read_config()
to take hose and bus number instead of the 1344-byte struct pci_bus.
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
---
v2: refactor indirect_read_config() instead of kmalloc'ing a struct
pci_bus.
Scott, I will look deeper into fake_pci_bus() later.
arch/powerpc/include/asm/pci-bridge.h | 4 ++++
arch/powerpc/sysdev/fsl_pci.c | 11 ++++-------
arch/powerpc/sysdev/indirect_pci.c | 25 +++++++++++++++++--------
3 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 725247b..546d036 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -119,6 +119,10 @@ extern void setup_indirect_pci(struct pci_controller* hose,
extern int indirect_read_config(struct pci_bus *bus, unsigned int devfn,
int offset, int len, u32 *val);
+extern int __indirect_read_config(struct pci_controller *hose,
+ unsigned char bus_number, unsigned int devfn,
+ int offset, int len, u32 *val);
+
extern int indirect_write_config(struct pci_bus *bus, unsigned int devfn,
int offset, int len, u32 val);
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 6455c1e..7cc215e 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -68,13 +68,10 @@ static int fsl_pcie_check_link(struct pci_controller *hose)
u32 val = 0;
if (hose->indirect_type & PPC_INDIRECT_TYPE_FSL_CFG_REG_LINK) {
- if (hose->ops->read == fsl_indirect_read_config) {
- struct pci_bus bus;
- bus.number = hose->first_busno;
- bus.sysdata = hose;
- bus.ops = hose->ops;
- indirect_read_config(&bus, 0, PCIE_LTSSM, 4, &val);
- } else
+ if (hose->ops->read == fsl_indirect_read_config)
+ __indirect_read_config(hose, hose->first_busno, 0,
+ PCIE_LTSSM, 4, &val);
+ else
early_read_config_dword(hose, 0, 0, PCIE_LTSSM, &val);
if (val < PCIE_LTSSM_L0)
return 1;
diff --git a/arch/powerpc/sysdev/indirect_pci.c b/arch/powerpc/sysdev/indirect_pci.c
index 1f6c570..692de9d 100644
--- a/arch/powerpc/sysdev/indirect_pci.c
+++ b/arch/powerpc/sysdev/indirect_pci.c
@@ -20,31 +20,31 @@
#include <asm/pci-bridge.h>
#include <asm/machdep.h>
-int indirect_read_config(struct pci_bus *bus, unsigned int devfn,
- int offset, int len, u32 *val)
+int __indirect_read_config(struct pci_controller *hose,
+ unsigned char bus_number, unsigned int devfn,
+ int offset, int len, u32 *val)
{
- struct pci_controller *hose = pci_bus_to_host(bus);
volatile void __iomem *cfg_data;
u8 cfg_type = 0;
u32 bus_no, reg;
if (hose->indirect_type & PPC_INDIRECT_TYPE_NO_PCIE_LINK) {
- if (bus->number != hose->first_busno)
+ if (bus_number != hose->first_busno)
return PCIBIOS_DEVICE_NOT_FOUND;
if (devfn != 0)
return PCIBIOS_DEVICE_NOT_FOUND;
}
if (ppc_md.pci_exclude_device)
- if (ppc_md.pci_exclude_device(hose, bus->number, devfn))
+ if (ppc_md.pci_exclude_device(hose, bus_number, devfn))
return PCIBIOS_DEVICE_NOT_FOUND;
if (hose->indirect_type & PPC_INDIRECT_TYPE_SET_CFG_TYPE)
- if (bus->number != hose->first_busno)
+ if (bus_number != hose->first_busno)
cfg_type = 1;
- bus_no = (bus->number == hose->first_busno) ?
- hose->self_busno : bus->number;
+ bus_no = (bus_number == hose->first_busno) ?
+ hose->self_busno : bus_number;
if (hose->indirect_type & PPC_INDIRECT_TYPE_EXT_REG)
reg = ((offset & 0xf00) << 16) | (offset & 0xfc);
@@ -77,6 +77,15 @@ int indirect_read_config(struct pci_bus *bus, unsigned int devfn,
return PCIBIOS_SUCCESSFUL;
}
+int indirect_read_config(struct pci_bus *bus, unsigned int devfn,
+ int offset, int len, u32 *val)
+{
+ struct pci_controller *hose = pci_bus_to_host(bus);
+
+ return __indirect_read_config(hose, bus->number, devfn, offset, len,
+ val);
+}
+
int indirect_write_config(struct pci_bus *bus, unsigned int devfn,
int offset, int len, u32 val)
{
--
2.2.2
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-01-23 1:10 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-20 20:03 [PATCH] powerpc/fsl_pci: Fix pci stack build bug with FRAME_WARN Kim Phillips
2015-01-21 0:31 ` Scott Wood
2015-01-22 2:48 ` Kim Phillips
2015-01-22 3:02 ` Scott Wood
2015-01-23 0:20 ` Kim Phillips
2015-01-23 0:43 ` Scott Wood
2015-01-23 1:05 ` [PATCH v2] " Kim Phillips
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).