linux-stable/arch/arm/mach-cns3xxx
Arnd Bergmann 498a92d425 ARM: cns3xxx: pci: avoid potential stack overflow
The cns3xxx_pcie_hw_init function uses excessive kernel
stack space because of a hack that puts a fake struct
pci_sys_data and struct pci_bus on the stack in order to
call the generic pci_bus_read_config accessors, which causes
a warning in ARM allmodconfig builds:

arch/arm/mach-cns3xxx/pcie.c:266:1: warning: the frame size of 1080 bytes is larger than 1024 bytes

I've spent a few hours trying to find out what exactly this
code is wants to achieve here. The obvious part is setting
up the host_regs using config space accessors, and this can
simply be changed to use direct MMIO accesses, as I do
in this patch.

The second part is how the driver sets up the Max_Read_Request_Size
value for the first device/function on bus 1, i.e. the device
plugged directly into the PCIe root port.
For all I can tell, this is in fact incomplete, as it does not
perform the same setting on devices attached to a PCIe switch,
or multi-function devices.
The solution for this part fortunately is even easier: if we
just set the global pcie_bus_config variable to PCIE_BUS_PEER2PEER,
all PCIe devices in the system are limited to 128 byte MPS, which
in turn limits the MRRS to 128 bytes for all devices, and we
no longer even need to touch any devices.

With those two changes in place, we no longer need the fake
pci_sys_data/pci_bus structures for faking config space writes,
and the stack usage goes down as well.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Krzysztof Halasa <khalasa@piap.pl>
2015-10-08 16:32:48 +02:00
..
cns3xxx.h ARM: arm-soc multiplatform updates for 3.10 2013-05-02 09:38:16 -07:00
cns3420vb.c ARM: cns3xxx: fix allmodconfig panic in pci driver 2014-09-04 23:39:57 +02:00
core.c ARM: appropriate __init annotation for const data 2015-07-28 13:55:27 +02:00
core.h ARM: cns3xxx: fix allmodconfig panic in pci driver 2014-09-04 23:39:57 +02:00
devices.c ARM: cns3xxx: make mach header files local 2013-03-14 17:34:55 +01:00
devices.h ARM: cns3xxx: Add support for AHCI controllers 2010-06-08 17:37:09 +04:00
Kconfig ARM: use menuconfig for sub-arch menus 2014-06-17 17:09:48 +02:00
Makefile ARM: cns3xxx: initial DT support 2013-03-14 22:30:21 +01:00
Makefile.boot ARM: 7022/1: allow to detect conflicting zreladdrs 2011-10-17 09:12:40 +01:00
pcie.c ARM: cns3xxx: pci: avoid potential stack overflow 2015-10-08 16:32:48 +02:00
pm.c ARM: cns3xxx: don't export static symbol 2015-03-13 11:02:15 +01:00
pm.h ARM: cns3xxx: make mach header files local 2013-03-14 17:34:55 +01:00