On Fri, 8 May 2026 at 19:37, Tushar Dave <[email protected]> wrote: > > This RFC introduces a mechanism to specify Guest Physical Addresses > (GPAs) for PCI BARs, allowing explicit placement of guest MMIO BAR > addresses to match host physical addresses for assigned devices. > > On some platforms, P2P DMA is performed between devices within the same > IOMMU group. The PCI fabric ACS is configured to permit direct P2P > without going through the host bridge in order to achieve the required > performance. > > To support this multi-device IOMMU group P2P scenario in virtualization, > the VM may need to use the same MMIO BAR addresses as the host physical > address layout.
This feels like something's wrong in the design. A VM doesn't necessarily have the same memory layout as the host: the VM hardware is all about making that possible. > Why QEMU programs PCI resources rather than EDK2: > > To support fixed BAR placement, QEMU performs PCI bus enumeration and > resource assignment prior to firmware execution. EDK2 already provides > a PCD-controlled mechanism (PcdPciDisableBusEnumeration) that allows > the platform to skip PCI enumeration and resource allocation. This > series leverages that mechanism so that, when enabled, firmware runs in > a discovery-only mode and preserves the configuration established by > QEMU. I'm definitely not enthusiastic about having QEMU do PCI bus enumeration. This isn't the way the hardware does it, and it's a lot of code that's duplicating what the guest already has (there's over a thousand lines of code in this patchset). > We use the virt machine in this series as the concrete example > consuming the fixed-BAR model. Other machines may require their own > machine-specific mechanism (such as pcie-mmio-window) if they want to > adopt the same approach. > > Example usage: > > -machine > virt,...,pcie-mmio-window=0x400000000000:0x400000000000,pci-pre-enum=on \ > -device vfio-pci,host=0009:06:00.0,id=dev0 \ > -set device.dev0.fixed-bars=bar2@0x6b8000000000,bar4@0x6c8000000000 ...and you end up with enormous command lines like this full of magic numbers relating to address space layout. I think it would be better to find a way of doing this that doesn't have the "VM address space layout has to match the host layout" restriction. -- PMM -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#121926): https://edk2.groups.io/g/devel/message/121926 Mute This Topic: https://groups.io/mt/119221703/21656 Group Owner: [email protected] Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
