android_kernel_motorola_sm6225/arch
Alexey Kardashevskiy 216462fa88 powerpc/pci/of: Fix OF flags parsing for 64bit BARs
[ Upstream commit df5be5be8735ef2ae80d5ae1f2453cd81a035c4b ]

When the firmware does PCI BAR resource allocation, it passes the assigned
addresses and flags (prefetch/64bit/...) via the "reg" property of
a PCI device device tree node so the kernel does not need to do
resource allocation.

The flags are stored in resource::flags - the lower byte stores
PCI_BASE_ADDRESS_SPACE/etc bits and the other bytes are IORESOURCE_IO/etc.
Some flags from PCI_BASE_ADDRESS_xxx and IORESOURCE_xxx are duplicated,
such as PCI_BASE_ADDRESS_MEM_PREFETCH/PCI_BASE_ADDRESS_MEM_TYPE_64/etc.
When parsing the "reg" property, we copy the prefetch flag but we skip
on PCI_BASE_ADDRESS_MEM_TYPE_64 which leaves the flags out of sync.

The missing IORESOURCE_MEM_64 flag comes into play under 2 conditions:
1. we remove PCI_PROBE_ONLY for pseries (by hacking pSeries_setup_arch()
or by passing "/chosen/linux,pci-probe-only");
2. we request resource alignment (by passing pci=resource_alignment=
via the kernel cmd line to request PAGE_SIZE alignment or defining
ppc_md.pcibios_default_alignment which returns anything but 0). Note that
the alignment requests are ignored if PCI_PROBE_ONLY is enabled.

With 1) and 2), the generic PCI code in the kernel unconditionally
decides to:
- reassign the BARs in pci_specified_resource_alignment() (works fine)
- write new BARs to the device - this fails for 64bit BARs as the generic
code looks at IORESOURCE_MEM_64 (not set) and writes only lower 32bits
of the BAR and leaves the upper 32bit unmodified which breaks BAR mapping
in the hypervisor.

This fixes the issue by copying the flag. This is useful if we want to
enforce certain BAR alignment per platform as handling subpage sized BARs
is proven to cause problems with hotplug (SLOF already aligns BARs to 64k).

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Sam Bobroff <sbobroff@linux.ibm.com>
Reviewed-by: Oliver O'Halloran <oohall@gmail.com>
Reviewed-by: Shawn Anastasio <shawn@anastas.io>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-07-31 07:27:01 +02:00
..
alpha alpha: Fix Eiger NR_IRQS to 128 2019-02-20 10:25:47 +01:00
arc ARC: hide unused function unw_hdr_alloc 2019-07-21 09:03:14 +02:00
arm ARM: dts: imx6ul: fix PWM[1-4] interrupts 2019-07-21 09:03:08 +02:00
arm64 arm64: tegra: Fix AGIC register range 2019-07-26 09:14:24 +02:00
c6x kbuild: rename LDFLAGS to KBUILD_LDFLAGS 2018-08-24 08:22:08 +09:00
h8300 h8300: use cc-cross-prefix instead of hardcoding h8300-unknown-linux- 2019-04-05 22:32:55 +02:00
hexagon hexagon: modify ffs() and fls() to return int 2018-09-10 19:42:15 -05:00
ia64 ia64: fix build errors by exporting paddr_to_nid() 2019-06-22 08:15:19 +02:00
m68k m68k: Add -ffreestanding to CFLAGS 2019-03-23 20:10:00 +01:00
microblaze mm: make the __PAGETABLE_PxD_FOLDED defines non-empty 2018-12-29 13:37:57 +01:00
mips MIPS: lb60: Fix pin mappings 2019-07-28 08:29:28 +02:00
nds32 nds32: Fix gcc 8.0 compiler option incompatible. 2019-02-12 19:46:57 +01:00
nios2 nios2: kconfig: remove duplicate DEBUG_STACK_USAGE symbol defintions 2018-08-27 09:47:20 +08:00
openrisc OpenRISC updates for 4.19 2018-08-23 14:09:37 -07:00
parisc parisc: Fix kernel panic due invalid values in IAOQ0 or IAOQ1 2019-07-26 09:14:29 +02:00
powerpc powerpc/pci/of: Fix OF flags parsing for 64bit BARs 2019-07-31 07:27:01 +02:00
riscv riscv: Fix udelay in RV32. 2019-07-14 08:11:09 +02:00
s390 s390: fix stfle zero padding 2019-07-21 09:03:14 +02:00
sh sh: sh7786: Add explicit I/O cast to sh7786_mm_sel() 2019-05-31 06:46:28 -07:00
sparc sparc: perf: fix updated event period in response to PERF_EVENT_IOC_PERIOD 2019-06-25 11:35:57 +08:00
um uml: fix a boot splat wrt use of cpu_all_mask 2019-06-15 11:54:05 +02:00
unicore32 mm: convert return type of handle_mm_fault() caller to vm_fault_t 2018-08-17 16:20:28 -07:00
x86 KVM: nVMX: Clear pending KVM_REQ_GET_VMCS12_PAGES when leaving nested 2019-07-28 08:29:30 +02:00
xtensa xtensa: Fix section mismatch between memblock_reserve and mem_reserve 2019-06-25 11:35:56 +08:00
.gitignore
Kconfig jump_label: move 'asm goto' support test to Kconfig 2019-06-04 08:02:34 +02:00