From 41b84341f5520f682edb712b86b969e7968ac42f Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Fri, 19 Jun 2020 18:00:20 +0000 Subject: [PATCH] Use the correct address when creating pci resources When the PCI and CPU physical addresses are identical it doesn't matter which is used to create the resources, however on some systems, e.g. qemu armv7 virt, they are different. This leads to a panic as we try to map the wrong physical address into the kernel address space. Reported by: Jenkins via trasz Sponsored by: Innovate UK --- sys/dev/pci/pci_host_generic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c index b70711816016..330420fdb01d 100644 --- a/sys/dev/pci/pci_host_generic.c +++ b/sys/dev/pci/pci_host_generic.c @@ -143,15 +143,15 @@ pci_host_generic_core_attach(device_t dev) case FLAG_TYPE_PMEM: sc->has_pmem = true; error = rman_manage_region(&sc->pmem_rman, - phys_base, phys_base + size - 1); + pci_base, pci_base + size - 1); break; case FLAG_TYPE_MEM: error = rman_manage_region(&sc->mem_rman, - phys_base, phys_base + size - 1); + pci_base, pci_base + size - 1); break; case FLAG_TYPE_IO: error = rman_manage_region(&sc->io_rman, - phys_base, phys_base + size - 1); + pci_base, pci_base + size - 1); break; default: continue;