6On Mon, Mar 22, 2021 at 9:13 PM Peter Maydell <peter.mayd...@linaro.org> wrote: > > Currently the gpex PCI controller implements no special behaviour for > guest accesses to areas of the PIO and MMIO where it has not mapped > any PCI devices, which means that for Arm you end up with a CPU > exception due to a data abort. > > Most host OSes expect "like an x86 PC" behaviour, where bad accesses > like this return -1 for reads and ignore writes. In the interests of > not being surprising, make host CPU accesses to these windows behave > as -1/discard where there's no mapped PCI device. > > Reported-by: Dmitry Vyukov <dvyu...@google.com> > Fixes: https://bugs.launchpad.net/qemu/+bug/1918917 > Signed-off-by: Peter Maydell <peter.mayd...@linaro.org> > --- > Not convinced that this is 6.0 material, because IMHO the > kernel shouldn't be doing this in the first place. > Do we need to have the property machinery so that old > virt-5.2 etc retain the previous behaviour ?
I think it would be sufficient to do this for the ioport window, which is what old-style ISA drivers access. I am not aware of any driver accessing hardcoded addresses in the mmio window, at least not without probing io ports first (the VGA text console would use both). I checked which SoCs the kernel supports that do require a special hook to avoid an abort and found these: arch/arm/mach-bcm/bcm_5301x.c: hook_fault_code(16 + 6, bcm5301x_abort_handler, SIGBUS, BUS_OBJERR, arch/arm/mach-cns3xxx/pcie.c: hook_fault_code(16 + 6, cns3xxx_pcie_abort_handler, SIGBUS, 0, arch/arm/mach-iop32x/pci.c: hook_fault_code(16+6, iop3xx_pci_abort, SIGBUS, 0, "imprecise external abort"); arch/arm/mach-ixp4xx/common-pci.c: hook_fault_code(16+6, abort_handler, SIGBUS, 0, drivers/pci/controller/dwc/pci-imx6.c: hook_fault_code(8, imx6q_pcie_abort_handler, SIGBUS, 0, drivers/pci/controller/dwc/pci-keystone.c: hook_fault_code(17, ks_pcie_fault, SIGBUS, 0, The first four (bcm5301x, cns3xxx, iop32x and ixp4xx) generate an 'imprecise external abort' (16+6), imx6q has a "precise external abort on non-linefetch" (8), and keystone in LPAE mode has an "asynchronous external abort". The only SoC among those that is emulated by qemu to my knowledge is the i.MX6q in the 'sabrelite' machine. It's possible that some of these are not caused by a PCI master abort but some other error condition on the PCI host though. I think most other PCI implementations either ignore the error or generate an I/O interrupt. Arnd