From: Tuomas Tynkkynen Date: Mon, 14 May 2018 15:47:50 +0000 (+0300) Subject: PCI: dm: Ignore 64-bit memory regions if CONFIG_SYS_PCI_64BIT not set X-Git-Tag: v2018.07-rc1~60 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=52ba907328ec069ff1cec6cbe659f1714c68ed33;p=u-boot PCI: dm: Ignore 64-bit memory regions if CONFIG_SYS_PCI_64BIT not set Currently, qemu_arm_defconfig and qemu_arm64_defconfig only work with the 'highmem=off' parameter passed to QEMU's virt machine. The reason is that when 'highmem' is not disabled, QEMU appends 64-bit a memory resource to the PCI controller's regions property in DT in addition to the 32-bit PCI memory window in low memory. And the current DT parsing code picks the last (thus the 64-bit one) memory resource, whose address eventually gets silently truncated to 32 bits because CONFIG_SYS_PCI_64BIT is not set, which obviously causes PCI to break. Avoid this problem by ignoring memory regions whose addresses are above the 32-bit boundary when CONFIG_SYS_PCI_64BIT is not set. Signed-off-by: Tuomas Tynkkynen Reviewed-by: Simon Glass --- diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index 49be1ebdd7..1cd1e409e3 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -860,6 +860,13 @@ static int decode_regions(struct pci_controller *hose, ofnode parent_node, } else { continue; } + + if (!IS_ENABLED(CONFIG_SYS_PCI_64BIT) && + type == PCI_REGION_MEM && upper_32_bits(pci_addr)) { + debug(" - beyond the 32-bit boundary, ignoring\n"); + continue; + } + pos = -1; for (i = 0; i < hose->region_count; i++) { if (hose->regions[i].flags == type)