On Wed, 26 Jul 2023 at 14:46, Sergey Kambalin <[email protected]> wrote: > > Signed-off-by: Sergey Kambalin <[email protected]> > --- > hw/arm/bcm2838_pcie.c | 232 +++++++++++++++++++++++++++++++++- > include/hw/arm/bcm2838_pcie.h | 23 ++++ > 2 files changed, 253 insertions(+), 2 deletions(-)
> + /* > + * The MemoryRegions io_mmio and io_ioport that we pass to > + * pci_register_root_bus() are not the same as the MemoryRegions > + * io_mmio_window and io_ioport_window that we expose as SysBus MRs. > + * The difference is in the behavior of accesses to addresses where no > PCI > + * device has been mapped. > + * > + * io_mmio and io_ioport are the underlying PCI view of the PCI address > + * space, and when a PCI device does a bus master access to a bad address > + * this is reported back to it as a transaction failure. > + * > + * io_mmio_window and io_ioport_window implement "unmapped addresses > read as > + * -1 and ignore writes"; this is a traditional x86 PC behavior, which is > + * not mandated properly by the PCI spec but expected by the majority of > + * PCI-using guest software, including Linux. > + * > + * We implement it in the PCIe host controller, by providing the *_window > + * MRs, which are containers with io ops that implement the 'background' > + * behavior and which hold the real PCI MRs as sub-regions. > + */ This comment has been copied from gpex.c, which is an implementation of a "generic" PCIE controller. Since it's generic, QEMU gets to decide its behaviour, and since we started with one behaviour and then changed to a different one we need to provide the property so that old versioned machine types get the old behaviour. For the raspi4 PCIe controller, we don't get to decide -- the hardware will behave in a particular way for accesses to addresses where no PCI device has been mapped, and we need to follow that. You should find out whether accesses to unmapped addresses should cause PCI transaction failures, or read-as-minus-one, and implement only that behaviour. You don't need to provide a property selecting between the two. thanks -- PMM
