hw/pci, hw/arm/virt: fixed PCI BAR placement
v2 cover hw/pci, hw/arm/virt: fixed PCI BAR placement
This patch series 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 between devices in the same IOMMU group is required for the desired data path and performance. The PCI fabric ACS is configured to permit direct P2P without routing traffic through the host bridge.
To support this multi-device IOMMU group P2P scenario in virtualization, the VM may need to preserve the host PCI BAR addresses in the guest.
A new fixed-bar-N property on a PCI endpoint device specifies the required guest address for BAR N (N = 0 through 5):
-device some-device,fixed-bar-0=<addr>[,fixed-bar-1=<addr>]...
Once any fixed-bar-N property is set on a device, every memory BAR on that device must have a fixed address. Under a PCIe root port, fixed BAR placement is all-or-nothing within that root port's subtree. If one endpoint below the root port has a fixed BAR, every other endpoint with a memory BAR below that same root port must also have all of its memory BARs fixed.
QEMU validates the configuration when the machine is done initializing. Each address must be aligned to its BAR size, fall within the appropriate PCIe MMIO aperture, and not overlap any other fixed BAR. QEMU aborts on any validation failure. QEMU performs neither PCI enumeration nor BAR allocation; the validated configuration is exported to firmware through the "etc/fixed-bars" fw_cfg blob, which carries each PCI function's vendor/device identification, firmware device path, and, for fixed devices, the configured address, size, and type of each BAR. The blob format is documented in docs/specs/pci-fixed-bars.rst.
The fixed-bar-N property and its validation are generic and apply to any PCI device. A machine type opts in by setting the new pci_fixed_bar_supported MachineClass flag. Machine types that leave it unset reject fixed-bar-N. This series enables it on the virt machine only, by setting the flag and wiring up the fw_cfg export. Other machine types would need equivalent wiring to expose the same mechanism to firmware.
On the firmware side, the existing IncompatiblePciDeviceSupportDxe driver is extended to consume this blob. During device discovery, its CheckDevice() implementation returns ACPI address descriptors with _MIF|_MAF set for the fixed BARs found in the blob. PciBusDxe's resource allocator already supports fixed BARs, including sizing and pinning the bridge windows above them. It now treats a BAR as fixed when the descriptor carries _MIF|_MAF, and programs the fixed address into the BAR register.
Fixed BAR placement requires the guest to preserve the PCI resource configuration established by firmware. This is requested through the PCI boot configuration preservation mechanism using ACPI _DSM function 5. Fixed BAR configuration is rejected when firmware is not loaded or ACPI is disabled.
Example 1: VFIO passthrough device with fixed BARs and the PCIe MMIO aperture adjusted to accommodate the fixed addresses.
-machine virt,...,highmem-mmio-base=4T,highmem-mmio-size=4T
-device pcie-root-port,id=pcie.port1,bus=pcie.1,chassis=1,io-reserve=0
-device x3130-upstream,id=upstream1,bus=pcie.port1
-device xio3130-downstream,id=downstream1_1,bus=upstream1,chassis=1,slot=2
-device vfio-pci-nohotplug,host=0018:06:00.0,bus=downstream1_1,id=dev0,\
fixed-bar-0=0x48000000000,fixed-bar-2=0x50000000000,fixed-bar-4=0x58000000000Example 2: VFIO and emulated devices under the same root port with fixed BARs and the PCIe MMIO aperture adjusted using highmem-mmio-base.
-machine virt,...,highmem-mmio-base=64T,highmem-mmio-size=64T
-device pxb-pcie,id=pcie.1,bus_nr=1,bus=pcie.0
-device pcie-root-port,id=pcie.port1,bus=pcie.1,chassis=1,io-reserve=0
-device x3130-upstream,id=upstream1,bus=pcie.port1
-device xio3130-downstream,id=downstream1_1,bus=upstream1,chassis=1,slot=1
-device vfio-pci-nohotplug,host=0018:06:00.0,bus=downstream1_1,rombar=0,id=dev0,iommufd=iommufd0,\
fixed-bar-0=0x6b4000000000,fixed-bar-2=0x6b8000000000,fixed-bar-4=0x6c0000000000
-device xio3130-downstream,id=downstream1_2,bus=upstream1,chassis=1,slot=2
-device vfio-pci,host=0012:03:00.1,bus=downstream1_2,id=nic1,iommufd=iommufd0,fixed-bar-0=0x6c8000000000
-device xio3130-downstream,id=downstream1_3,bus=upstream1,chassis=1,slot=3
-device e1000,netdev=net0,bus=downstream1_3,id=nic_emu,fixed-bar-0=0x20000000Limitations:
* I/O BARs and the expansion ROM BAR are not covered by fixed-bar-N.
* SR-IOV VF BARs are not covered.
Testing:
The series was tested on the AArch64 virt machine with a range of PCIe configurations, including emulated and VFIO passthrough devices, PCIe switches, single and multiple fixed-BAR endpoints behind a shared root port, devices attached directly to the host bridge, and endpoints behind nested bridges. All rejection paths were also exercised, with the corresponding error messages verified. These included unsupported machine types, hot-plugged devices, non-existent BARs, I/O BARs, unaligned, overlapping, or out-of-aperture BARs, incomplete BAR configurations, highmem-mmio=off, missing firmware, and highmem-mmio-base values that cause address-space overflow.
Changes since v1:
* Add a pci_fixed_bar_supported MachineClass flag; fixed-bar-N is rejected on machine types that do not set it. virt sets it.
* Keep the fixed BAR claims in FixedBarsInfo instead of a static array, and report validation failures through Error ** to the machine code instead of calling exit(1).
* Allow a 64-bit non-prefetchable BAR in either aperture when the device is attached to the host bridge; behind a PCI bridge it must lie below 4 GiB. A 64-bit prefetchable BAR must still lie in the 64-bit aperture.
* Treat the high PCIe MMIO aperture as absent with highmem-mmio=off, and reject fixed BAR configuration unless firmware is loaded and ACPI is enabled.
* Check highmem-mmio-base + highmem-mmio-size against the PA space without overflow, and document highmem-mmio-base in docs/system/arm/virt.rst.
* Document the etc/fixed-bars format in docs/specs/pci-fixed-bars.rst, and note that the firmware device path is carried for future matching.
* Move pci-fixed-bar.h to include/hw/pci/.
v1:
https://lore.kernel.org/qemu-arm/[email protected]/
A git branch with this series applied is available at:
https://github.com/tdavenvidia/upstream-qemu/tree/Upstream-fixed-bar-Oct-29-V2
The related EDK2 change is available at:
https://github.com/tianocore/edk2/pull/13183
Tushar Dave (5):
hw/pci: introduce PCI fixed BAR properties hw/pci: add validation for fixed BAR configuration hw/pci: add fixed BAR fw_cfg blob export hw/arm/virt: export fixed BAR metadata via fw_cfg hw/arm/virt: add highmem-mmio-base property
docs/specs/index.rst | 1 + docs/specs/pci-fixed-bars.rst | 75 +++++++ docs/system/arm/virt.rst | 4 + hw/arm/virt.c | 82 ++++++- hw/pci/meson.build | 2 + hw/pci/pci-fixed-bar-blob.c | 308 +++++++++++++++++++++++++++ hw/pci/pci-fixed-bar-validate.c | 365 ++++++++++++++++++++++++++++++++ hw/pci/pci-fixed-bar-validate.h | 22 ++ hw/pci/pci.c | 71 +++++++ include/hw/core/boards.h | 3 + include/hw/pci/pci-fixed-bar.h | 63 ++++++ include/hw/pci/pci_device.h | 7 + 12 files changed, 1002 insertions(+), 1 deletion(-) create mode 100644 docs/specs/pci-fixed-bars.rst create mode 100644 hw/pci/pci-fixed-bar-blob.c create mode 100644 hw/pci/pci-fixed-bar-validate.c create mode 100644 hw/pci/pci-fixed-bar-validate.h create mode 100644 include/hw/pci/pci-fixed-bar.h
Signature · 1 line
2.34.1
PATCH v2 1/5 hw/pci: introduce PCI fixed BAR properties
Add fixed-bar-N properties to PCIDevice to allow the guest address of an individual PCI BAR to be explicitly specified. The properties are available for PCI BARs 0 through 5 and accept QEMU size values, for example fixed-bar-0=0x40000000 or fixed-bar-0=64G.
e.g.
-device some-device,fixed-bar-0=<addr>[,fixed-bar-1=<addr>]...
During realize, validate that each specified BAR exists and is a memory BAR, and reject fixed BAR configuration for hot-plugged devices.
The fixed BAR properties are only supported on machine types that implement fixed BAR placement. Add the pci_fixed_bar_supported MachineClass flag to advertise this support, and reject fixed BAR properties on machine types that do not set it.
--- hw/pci/pci.c | 71 +++++++++++++++++++++++++++++++++++++ include/hw/core/boards.h | 3 ++ include/hw/pci/pci_device.h | 7 ++++ 3 files changed, 81 insertions(+)
hw/pci/pci.c +71 -0
@@ -89,6 +89,18 @@ static const Property pci_props[] = {DEFINE_PROP_STRING ("romfile" , PCIDevice, romfile),DEFINE_PROP_UINT32 ("romsize" , PCIDevice, romsize,UINT32_MAX ),DEFINE_PROP_INT32 ("rombar" , PCIDevice, rom_bar,-1 ), +DEFINE_PROP_SIZE ("fixed-bar-0" , PCIDevice, fixed_bar_addr[0 ], +PCI_BAR_UNMAPPED ), +DEFINE_PROP_SIZE ("fixed-bar-1" , PCIDevice, fixed_bar_addr[1 ], +PCI_BAR_UNMAPPED ), +DEFINE_PROP_SIZE ("fixed-bar-2" , PCIDevice, fixed_bar_addr[2 ], +PCI_BAR_UNMAPPED ), +DEFINE_PROP_SIZE ("fixed-bar-3" , PCIDevice, fixed_bar_addr[3 ], +PCI_BAR_UNMAPPED ), +DEFINE_PROP_SIZE ("fixed-bar-4" , PCIDevice, fixed_bar_addr[4 ], +PCI_BAR_UNMAPPED ), +DEFINE_PROP_SIZE ("fixed-bar-5" , PCIDevice, fixed_bar_addr[5 ], +PCI_BAR_UNMAPPED ),DEFINE_PROP_BIT ("multifunction" , PCIDevice, cap_present,QEMU_PCI_CAP_MULTIFUNCTION_BITNR , false), DEFINE_PROP_BIT("x-pcie-lnksta-dllla", PCIDevice, cap_present,
@@ -228,6 +240,58 @@ static void pci_bus_unrealize(BusState *qbus)vmstate_unregister (NULL , &vmstate_pcibus, bus); } +static bool pci_dev_has_fixed_bar (PCIDevice *pci_dev) +{ +int i; + +for (i =0 ; i <PCI_NUM_REGIONS -1 ; i++) { +if (pci_dev->fixed_bar_addr[i] !=PCI_BAR_UNMAPPED ) { +return true; + } + } +return false; +} + +static void pci_check_fixed_bars (PCIDevice *pci_dev,Error **errp) +{ +PCIIORegion *r; +int i; + +if (!pci_dev_has_fixed_bar (pci_dev)) { +return ; + } + +if (!MACHINE_GET_CLASS (qdev_get_machine ())->pci_fixed_bar_supported) { +error_setg (errp,"fixed BAR placement is not supported by this " +"machine type" ); +return ; + } + +if (DEVICE (pci_dev)->hotplugged) { +error_setg (errp,"fixed BAR placement is not supported on " +"hot-plugged devices" ); +return ; + } + +for (i =0 ; i <PCI_NUM_REGIONS -1 ; i++) { +if (pci_dev->fixed_bar_addr[i] ==PCI_BAR_UNMAPPED ) { +continue ; + } + + r = &pci_dev->io_regions[i]; +if (!r->size) { +error_setg (errp,"fixed-bar-%d: bar%d does not exist on %s" , + i, i, pci_dev->name); +return ; + } +if (r->type &PCI_BASE_ADDRESS_SPACE_IO ) { +error_setg (errp,"fixed-bar-%d: bar%d on %s is an I/O BAR, " +"not a memory BAR" , i, i, pci_dev->name); +return ; + } + } +} +static int pcibus_num (PCIBus *bus) {if (pci_bus_is_root (bus)) {
@@ -2399,6 +2463,13 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp) is_default_rom = true; } +pci_check_fixed_bars (pci_dev, &local_err); +if (local_err) { +error_propagate (errp, local_err); +pci_qdev_unrealize (DEVICE (pci_dev)); +return ; + } +pci_add_option_rom (pci_dev, is_default_rom, &local_err);if (local_err) {error_propagate (errp, local_err);
include/hw/core/boards.h +3 -0
@@ -242,6 +242,8 @@ typedef struct {* is not needed. * @numa_mem_supported: * true if '--numa node.mem' option is supported and false otherwise +* @pci_fixed_bar_supported: +* true if the machine supports fixed PCI BAR placement and false otherwise * @hotplug_allowed: * If the hook is provided, then it'll be called for each device * hotplug to check whether the device hotplug is allowed. Return
@@ -317,6 +319,7 @@ struct MachineClass {bool ignore_boot_device_suffixes;bool nvdimm_supported;bool numa_mem_supported; +bool pci_fixed_bar_supported;bool auto_enable_numa;bool cpu_cluster_has_numa_boundary;SMPCompatProps smp_props;
include/hw/pci/pci_device.h +7 -0
@@ -187,6 +187,13 @@ struct PCIDevice {uint32_t max_bounce_buffer_size;char *sriov_pf; + +/* +* fixed_bar_addr[N] holds the guest address configured via the +* fixed-bar-N property for memory BAR N. PCI_BAR_UNMAPPED means +* the BAR's address is not fixed. +*/ +uint64_t fixed_bar_addr[PCI_NUM_REGIONS -1 ]; };static inline int pci_intx (PCIDevice *pci_dev)
Signature · 1 line
2.34.1
PATCH v2 2/5 hw/pci: add validation for fixed BAR configuration
In reply to Tushar DaveValidate the fixed BAR configuration specified through the fixed-bar-N properties on PCI endpoint devices.
Configuring any fixed-bar-N property on an endpoint device requires every memory BAR on that device to have a fixed address. Validate that each assigned address:
- is aligned to its BAR size;
- is within the appropriate PCIe MMIO aperture; and
- does not overlap any other fixed BAR.
A 32-bit BAR must lie in the 32-bit aperture. A prefetchable 64-bit BAR must lie in the 64-bit aperture so that all prefetchable BARs can be accommodated in a single 64-bit prefetchable bridge window. A non-prefetchable 64-bit BAR may lie in either aperture when attached directly to the host bridge, but must lie below 4GiB when placed behind a PCI bridge.
Under a PCIe topology with a root port, fixed BAR placement is all-or-nothing within that root port's subtree. If any one endpoint device below the root port has a fixed BAR, every other endpoint device below that same root port with a memory BAR must have all of its memory BARs fixed too.
Endpoint devices with no root port in their ancestry, such as those attached directly to the host bridge, are not required to match their sibling devices. One such device may use fixed-bar-N for all of its memory BARs while another sibling device on the same host bridge uses none at all. Per-device completeness still applies regardless of ancestry. Once any fixed-bar-N property is set on a device, every memory BAR on that device must be fixed.
Report a validation failure through the Error ** argument and leave it to the caller to decide how to handle it.
--- hw/pci/meson.build | 1 + hw/pci/pci-fixed-bar-validate.c | 365 ++++++++++++++++++++++++++++++++ hw/pci/pci-fixed-bar-validate.h | 22 ++ 3 files changed, 388 insertions(+) create mode 100644 hw/pci/pci-fixed-bar-validate.c create mode 100644 hw/pci/pci-fixed-bar-validate.h
hw/pci/meson.build +1 -0
@@ -19,6 +19,7 @@ endif pci_ss.add(files('pcie.c', 'pcie_aer.c')) pci_ss.add(files('pcie_doe.c')) system_ss.add(when: 'CONFIG_PCI_EXPRESS', if_true: files('pcie_port.c', 'pcie_host.c')) +system_ss.add(when: 'CONFIG_PCI_EXPRESS', if_true: files('pci-fixed-bar-validate.c')) system_ss.add_all(when: 'CONFIG_PCI', if_true: pci_ss) stub_ss.add(files('pci-stub.c'))
hw/pci/pci-fixed-bar-validate.c new file +365 -0
365 lines not on this page · raw message
hw/pci/pci-fixed-bar-validate.h new file +22 -0
@@ -0,0 +1,22 @@ +/* +* Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved +* +* Written by Tushar Dave +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#ifndef HW_PCI_FIXED_BAR_VALIDATE_H +#define HW_PCI_FIXED_BAR_VALIDATE_H + +typedef struct { +bool any_fixed; +uint64_t mmio32_base; +uint64_t mmio32_limit; +uint64_t mmio64_base; +uint64_t mmio64_limit; +GArray *claims; +}FixedBarsInfo ; + +bool fixed_bars_validate (FixedBarsInfo *info,Error **errp); + +#endif /* HW_PCI_FIXED_BAR_VALIDATE_H */
Signature · 1 line
2.34.1
PATCH v2 3/5 hw/pci: add fixed BAR fw_cfg blob export
In reply to Tushar DaveIntroduce a fixed BAR fw_cfg blob exporter that serializes PCI device and BAR information into the "etc/fixed-bars" fw_cfg file.
The blob contains an entry for every PCI function with memory BARs. Each entry carries the device's vendor and device ID, whether it has a fixed BAR configuration, and its firmware device path. Fixed BAR entries also include the configured BAR address, size, and type information for each BAR.
Document the format in docs/specs/pci-fixed-bars.rst.
--- docs/specs/index.rst | 1 + docs/specs/pci-fixed-bars.rst | 75 ++++++++ hw/pci/meson.build | 1 + hw/pci/pci-fixed-bar-blob.c | 308 +++++++++++++++++++++++++++++++++ include/hw/pci/pci-fixed-bar.h | 63 +++++++ 5 files changed, 448 insertions(+) create mode 100644 docs/specs/pci-fixed-bars.rst create mode 100644 hw/pci/pci-fixed-bar-blob.c create mode 100644 include/hw/pci/pci-fixed-bar.h
docs/specs/index.rst +1 -0
@@ -11,6 +11,7 @@ guest hardware that is specific to QEMU. pci-ids pci-serial pci-testdev + pci-fixed-bars ppc-xive ppc-spapr-xive ppc-spapr-numa
docs/specs/pci-fixed-bars.rst new file +75 -0
75 lines not on this page · raw message
hw/pci/meson.build +1 -0
@@ -20,6 +20,7 @@ pci_ss.add(files('pcie.c', 'pcie_aer.c')) pci_ss.add(files('pcie_doe.c')) system_ss.add(when: 'CONFIG_PCI_EXPRESS', if_true: files('pcie_port.c', 'pcie_host.c')) system_ss.add(when: 'CONFIG_PCI_EXPRESS', if_true: files('pci-fixed-bar-validate.c')) +system_ss.add(when: 'CONFIG_PCI_EXPRESS', if_true: files('pci-fixed-bar-blob.c')) system_ss.add_all(when: 'CONFIG_PCI', if_true: pci_ss) stub_ss.add(files('pci-stub.c'))
hw/pci/pci-fixed-bar-blob.c new file +308 -0
308 lines not on this page · raw message
include/hw/pci/pci-fixed-bar.h new file +63 -0
63 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v2 3/5] hw/pci: add fixed BAR fw_cfg blob export
Quoted 23 lines · Tushar Dave
Introduce a fixed BAR
fw_cfgblob exporter that serializes PCI device and BAR information into the "etc/fixed-bars"fw_cfgfile.The blob contains an entry for every PCI function with memory BARs. Each entry carries the device's vendor and device ID, whether it has a fixed BAR configuration, and its firmware device path. Fixed BAR entries also include the configured BAR address, size, and type information for each BAR.
Document the format in
docs/specs/pci-fixed-bars.rst.Signed-off-by Tushar Dave <[email protected]>--- docs/specs/index.rst | 1 + docs/specs/pci-fixed-bars.rst | 75 ++++++++ hw/pci/meson.build | 1 + hw/pci/pci-fixed-bar-blob.c | 308 +++++++++++++++++++++++++++++++++ include/hw/pci/pci-fixed-bar.h | 63 +++++++ 5 files changed, 448 insertions(+) create mode 100644 docs/specs/pci-fixed-bars.rst create mode 100644 hw/pci/pci-fixed-bar-blob.c create mode 100644 include/hw/pci/pci-fixed-bar.h
...
Quoted 5 lines
hw/pci/pci-fixed-bar-blob.c new file +0
-0
...
Quoted 7 lines
+/*
+ * EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL's CheckDevice interface
+ * (UEFI PI Spec 1.2 Vol 5) only passes VendorId/DeviceId/RevisionId/
+ * SubsystemVendorId/SubsystemDeviceId, no BDF — so in EDK2 we can't
+ * match a blob entry to a specific device directly using BDF. To work
+ * around that, we prepare the blob entries in the same order PciBusDxe
+ * discovers devices, so matching by VID:DID inherently works.
This sounds rather fragile.
Could you elaborate on what order this is, and why it is reasonable to rely on that approach being stable?
Re: [PATCH v2 3/5] hw/pci: add fixed BAR fw_cfg blob export
Quoted 41 lines · Ard Biesheuvel
Quoted 23 lines · Tushar Dave
Introduce a fixed BAR
fw_cfgblob exporter that serializes PCI device and BAR information into the "etc/fixed-bars"fw_cfgfile.The blob contains an entry for every PCI function with memory BARs. Each entry carries the device's vendor and device ID, whether it has a fixed BAR configuration, and its firmware device path. Fixed BAR entries also include the configured BAR address, size, and type information for each BAR.
Document the format in
docs/specs/pci-fixed-bars.rst.Signed-off-by Tushar Dave <[email protected]>--- docs/specs/index.rst | 1 + docs/specs/pci-fixed-bars.rst | 75 ++++++++ hw/pci/meson.build | 1 + hw/pci/pci-fixed-bar-blob.c | 308 +++++++++++++++++++++++++++++++++ include/hw/pci/pci-fixed-bar.h | 63 +++++++ 5 files changed, 448 insertions(+) create mode 100644 docs/specs/pci-fixed-bars.rst create mode 100644 hw/pci/pci-fixed-bar-blob.c create mode 100644 include/hw/pci/pci-fixed-bar.h...
Quoted 5 lines
hw/pci/pci-fixed-bar-blob.c new file +0
-0...
Quoted 7 lines
+/*
+ * EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL's CheckDevice interface
+ * (UEFI PI Spec 1.2 Vol 5) only passes VendorId/DeviceId/RevisionId/
+ * SubsystemVendorId/SubsystemDeviceId, no BDF — so in EDK2 we can't
+ * match a blob entry to a specific device directly using BDF. To work
+ * around that, we prepare the blob entries in the same order PciBusDxe
+ * discovers devices, so matching by VID:DID inherently works.
Quoted 6 lines
This sounds rather fragile.
Could you elaborate on what order this is, and why it is reasonable to rely on that approach being stable?
Also, bus numbers can be changed by guest, and I don't get why would you want to report devices without a fixed bar.
Re: [PATCH v2 3/5] hw/pci: add fixed BAR fw_cfg blob export
Quoted 44 lines · Michael S. Tsirkin
Quoted 43 lines · Ard Biesheuvel
Quoted 23 lines · Tushar Dave
Introduce a fixed BAR
fw_cfgblob exporter that serializes PCI device and BAR information into the "etc/fixed-bars"fw_cfgfile.The blob contains an entry for every PCI function with memory BARs. Each entry carries the device's vendor and device ID, whether it has a fixed BAR configuration, and its firmware device path. Fixed BAR entries also include the configured BAR address, size, and type information for each BAR.
Document the format in
docs/specs/pci-fixed-bars.rst.Signed-off-by Tushar Dave <[email protected]>--- docs/specs/index.rst | 1 + docs/specs/pci-fixed-bars.rst | 75 ++++++++ hw/pci/meson.build | 1 + hw/pci/pci-fixed-bar-blob.c | 308 +++++++++++++++++++++++++++++++++ include/hw/pci/pci-fixed-bar.h | 63 +++++++ 5 files changed, 448 insertions(+) create mode 100644 docs/specs/pci-fixed-bars.rst create mode 100644 hw/pci/pci-fixed-bar-blob.c create mode 100644 include/hw/pci/pci-fixed-bar.h...
Quoted 5 lines
hw/pci/pci-fixed-bar-blob.c new file +0
-0...
Quoted 7 lines
+/*
+ * EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL's CheckDevice interface
+ * (UEFI PI Spec 1.2 Vol 5) only passes VendorId/DeviceId/RevisionId/
+ * SubsystemVendorId/SubsystemDeviceId, no BDF — so in EDK2 we can't
+ * match a blob entry to a specific device directly using BDF. To work
+ * around that, we prepare the blob entries in the same order PciBusDxe
+ * discovers devices, so matching by VID:DID inherently works.This sounds rather fragile.
Quoted 7 lines
Quoted 4 lines
Could you elaborate on what order this is, and why it is reasonable to rely on that approach being stable?
Also, bus numbers can be changed by guest, and I don't get why would you want to report devices without a fixed bar.
The bus number is not needed in the blob. It is included only for debugging and is not used for any functionality. The firmware matches blob entries by vendor/device ID and discovery order, as described in my earlier reply to Ard. I can drop 'rp_bus' from the blob.
Devices without fixed BARs are kept in the blob to preserve discovery order for matching. For example, if two identical NICs are present and only the second has a fixed BAR, including only the second NIC's entry would cause its fixed BAR address to be assigned to the first NIC, which is discovered first. Including both entries ensures the first NIC is skipped (each blob entry carries a flag indicating whether the device has fixed BARs) and the second NIC gets its own fixed BAR address.
-Tushar
Re: [PATCH v2 3/5] hw/pci: add fixed BAR fw_cfg blob export
In reply to Ard BiesheuvelQuoted 41 lines · Ard Biesheuvel
Quoted 23 lines · Tushar Dave
Introduce a fixed BAR
fw_cfgblob exporter that serializes PCI device and BAR information into the "etc/fixed-bars"fw_cfgfile.The blob contains an entry for every PCI function with memory BARs. Each entry carries the device's vendor and device ID, whether it has a fixed BAR configuration, and its firmware device path. Fixed BAR entries also include the configured BAR address, size, and type information for each BAR.
Document the format in
docs/specs/pci-fixed-bars.rst.Signed-off-by Tushar Dave <[email protected]>--- docs/specs/index.rst | 1 + docs/specs/pci-fixed-bars.rst | 75 ++++++++ hw/pci/meson.build | 1 + hw/pci/pci-fixed-bar-blob.c | 308 +++++++++++++++++++++++++++++++++ include/hw/pci/pci-fixed-bar.h | 63 +++++++ 5 files changed, 448 insertions(+) create mode 100644 docs/specs/pci-fixed-bars.rst create mode 100644 hw/pci/pci-fixed-bar-blob.c create mode 100644 include/hw/pci/pci-fixed-bar.h...
Quoted 5 lines
hw/pci/pci-fixed-bar-blob.c new file +0
-0...
Quoted 7 lines
+/*
+ * EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL's CheckDevice interface
+ * (UEFI PI Spec 1.2 Vol 5) only passes VendorId/DeviceId/RevisionId/
+ * SubsystemVendorId/SubsystemDeviceId, no BDF — so in EDK2 we can't
+ * match a blob entry to a specific device directly using BDF. To work
+ * around that, we prepare the blob entries in the same order PciBusDxe
+ * discovers devices, so matching by VID:DID inherently works.
Quoted 4 lines
This sounds rather fragile.
Could you elaborate on what order this is, and why it is reasonable to rely on that approach being stable?
PciBusDxe discovers devices using the conventional PCI enumeration
order: devices and functions in ascending order on each bus, visiting a bridge's secondary bus immediately after discovering the bridge (depth-first), and root bridges one after another. CheckDevice() is called for every function discovered, including bridges. QEMU exports the entries in the same order. For each VendorId/DeviceId pair, IncompatiblePciDeviceSupportDxe maintains a counter, and each CheckDevice() call for a matching device consumes the next corresponding entry from the blob. Accordingly, the blob contains an entry for every function with a memory BAR, whether fixed or not, to keep the matching simple and in sync.
I think relying on this order is reasonable because it is determined by the PCI topology configured on the QEMU command line. Since devices with fixed BARs cannot be hot-plugged, they are always present at boot, and the resulting discovery order remains stable across boots of a given VM.
-Tushar
PATCH v2 4/5 hw/arm/virt: export fixed BAR metadata via fw_cfg
In reply to Tushar DaveExport fixed BAR metadata through the "etc/fixed-bars" fw_cfg file and set pci_fixed_bar_supported to allow the fixed-bar-N properties on the virt machine.
Fixed BAR placement requires the guest to preserve the PCI resource configuration established by firmware, preventing the fixed BAR addresses from being reassigned during guest boot. ACPI provides this through the PCI boot configuration preservation mechanism (_DSM function 5).
Reject fixed BAR configuration if firmware is not loaded or ACPI is disabled, since PCI boot configuration preservation cannot otherwise be guaranteed.
--- hw/arm/virt.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
hw/arm/virt.c +19 -0
@@ -94,6 +94,7 @@#include "hw/cxl/cxl_host.h" #include "qemu/guest-random.h" #include "hw/watchdog/sbsa_gwdt.h" +#include "hw/pci/pci-fixed-bar.h" static GlobalProperty arm_virt_compat_defaults[] = { {TYPE_VIRTIO_IOMMU_PCI ,"aw-bits" ,"48" },
@@ -2435,6 +2436,23 @@ void virt_machine_done(Notifier *notifier, void *data) vms->memmap[VIRT_PLATFORM_BUS ].size, vms->irqmap[VIRT_PLATFORM_BUS]); } +if (fixed_bars_write_blob (vms->fw_cfg, + vms->memmap[VIRT_PCIE_MMIO ].base, + vms->memmap[VIRT_PCIE_MMIO ].size, + vms->memmap[VIRT_HIGH_PCIE_MMIO ].base, + vms->highmem_mmio ? + vms->memmap[VIRT_HIGH_PCIE_MMIO ].size :0 , + &error_fatal)) { +if (!(vms->bootinfo.firmware_loaded &&virt_is_acpi_enabled (vms))) { +error_report ("fixed-bar: fixed BAR placement requires firmware " +"and ACPI to preserve the PCI boot configuration, " +"otherwise these BAR assignments could be " +"reassigned later with no protection" ); +exit (1 ); + } + vms->pci_preserve_config = true; + } +if (arm_load_dtb (info->dtb_start, info, info->dtb_limit, as, ms, cpu) <0 ) {exit (1 ); }
@@ -4192,6 +4210,7 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data) hc->unplug_request = virt_machine_device_unplug_request_cb; hc->unplug = virt_machine_device_unplug_cb; mc->nvdimm_supported = true; + mc->pci_fixed_bar_supported = true; mc->smp_props.clusters_supported = true;/* Supported caches */
Signature · 1 line
2.34.1
PATCH v2 5/5 hw/arm/virt: add highmem-mmio-base property
In reply to Tushar DaveAdd a highmem-mmio-base property to override the base of the virt machine's high PCIe MMIO window, alongside the existing highmem-mmio-size:
-machine virt,highmem-mmio-base=<addr>,highmem-mmio-size=<size>
Some PCI devices require MMIO resources to be placed within a specific address range that cannot be satisfied by the default placement. The configured base is validated to be non-zero, aligned to highmem-mmio-size, non-overlapping with the existing high memory layout, and within the configured physical address space.
Document the property in docs/system/arm/virt.rst.
--- docs/system/arm/virt.rst | 4 +++ hw/arm/virt.c | 63 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 66 insertions(+), 1 deletion(-)
docs/system/arm/virt.rst +4 -0
@@ -152,6 +152,10 @@ highmem-mmio-size Set the high memory region size for PCI MMIO. Must be a power of 2 and greater than or equal to the default size (512G). +highmem-mmio-base + Set the high memory region base for PCI MMIO. Must be non-zero and + aligned to ``highmem-mmio-size``. + gic-version Specify the version of the Generic Interrupt Controller (GIC) to provide. Valid values are:
hw/arm/virt.c +62 -1
88 lines not on this page · raw message
Signature · 1 line
2.34.1
Quoted 3 lines · Tushar Dave
This patch series 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.
Quoted 3 lines · Tushar Dave
This patch series 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.
My understanding is that all this does it pass a property to the firmware asking it to set the bar to a given value?
There are two standard ways to do this:
- EA capability in pci config space
- fixed BAR _DSM in ACPI
If none of these are appropriate, pls document why.
Quoted 147 lines
On some platforms, P2P DMA between devices in the same IOMMU group is required for the desired data path and performance. The PCI fabric ACS is configured to permit direct P2P without routing traffic through the host bridge.
To support this multi-device IOMMU group P2P scenario in virtualization, the VM may need to preserve the host PCI BAR addresses in the guest.
A new fixed-bar-N property on a PCI endpoint device specifies the required guest address for BAR N (N = 0 through 5):
-device some-device,fixed-bar-0=<addr>[,fixed-bar-1=<addr>]...Once any fixed-bar-N property is set on a device, every memory BAR on that device must have a fixed address. Under a PCIe root port, fixed BAR placement is all-or-nothing within that root port's subtree. If one endpoint below the root port has a fixed BAR, every other endpoint with a memory BAR below that same root port must also have all of its memory BARs fixed.
QEMU validates the configuration when the machine is done initializing. Each address must be aligned to its BAR size, fall within the appropriate PCIe MMIO aperture, and not overlap any other fixed BAR. QEMU aborts on any validation failure. QEMU performs neither PCI enumeration nor BAR allocation; the validated configuration is exported to firmware through the "etc/fixed-bars"
fw_cfgblob, which carries each PCI function's vendor/device identification, firmware device path, and, for fixed devices, the configured address, size, and type of each BAR. The blob format is documented indocs/specs/pci-fixed-bars.rst.The fixed-bar-N property and its validation are generic and apply to any PCI device. A machine type opts in by setting the new
pci_fixed_bar_supportedMachineClass flag. Machine types that leave it unset reject fixed-bar-N. This series enables it on the virt machine only, by setting the flag and wiring up thefw_cfgexport. Other machine types would need equivalent wiring to expose the same mechanism to firmware.On the firmware side, the existing IncompatiblePciDeviceSupportDxe driver is extended to consume this blob. During device discovery, its
CheckDevice()implementation returns ACPI address descriptors with _MIF|_MAF set for the fixed BARs found in the blob. PciBusDxe's resource allocator already supports fixed BARs, including sizing and pinning the bridge windows above them. It now treats a BAR as fixed when the descriptor carries _MIF|_MAF, and programs the fixed address into the BAR register.Fixed BAR placement requires the guest to preserve the PCI resource configuration established by firmware. This is requested through the PCI boot configuration preservation mechanism using ACPI
_DSMfunction 5. Fixed BAR configuration is rejected when firmware is not loaded or ACPI is disabled.Example 1: VFIO passthrough device with fixed BARs and the PCIe MMIO aperture adjusted to accommodate the fixed addresses.
-machine virt,...,highmem-mmio-base=4T,highmem-mmio-size=4T -device pcie-root-port,id=pcie.port1,bus=pcie.1,chassis=1,io-reserve=0 -device x3130-upstream,id=upstream1,bus=pcie.port1 -device xio3130-downstream,id=downstream1_1,bus=upstream1,chassis=1,slot=2 -device vfio-pci-nohotplug,host=0018:06:00.0,bus=downstream1_1,id=dev0,\ fixed-bar-0=0x48000000000,fixed-bar-2=0x50000000000,fixed-bar-4=0x58000000000Example 2: VFIO and emulated devices under the same root port with fixed BARs and the PCIe MMIO aperture adjusted using highmem-mmio-base.
-machine virt,...,highmem-mmio-base=64T,highmem-mmio-size=64T -device pxb-pcie,id=pcie.1,bus_nr=1,bus=pcie.0 -device pcie-root-port,id=pcie.port1,bus=pcie.1,chassis=1,io-reserve=0 -device x3130-upstream,id=upstream1,bus=pcie.port1 -device xio3130-downstream,id=downstream1_1,bus=upstream1,chassis=1,slot=1 -device vfio-pci-nohotplug,host=0018:06:00.0,bus=downstream1_1,rombar=0,id=dev0,iommufd=iommufd0,\ fixed-bar-0=0x6b4000000000,fixed-bar-2=0x6b8000000000,fixed-bar-4=0x6c0000000000 -device xio3130-downstream,id=downstream1_2,bus=upstream1,chassis=1,slot=2 -device vfio-pci,host=0012:03:00.1,bus=downstream1_2,id=nic1,iommufd=iommufd0,fixed-bar-0=0x6c8000000000 -device xio3130-downstream,id=downstream1_3,bus=upstream1,chassis=1,slot=3 -device e1000,netdev=net0,bus=downstream1_3,id=nic_emu,fixed-bar-0=0x20000000Limitations:
* I/O BARs and the expansion ROM BAR are not covered by fixed-bar-N.
* SR-IOV VF BARs are not covered.Testing:
The series was tested on the AArch64 virt machine with a range of PCIe configurations, including emulated and VFIO passthrough devices, PCIe switches, single and multiple fixed-BAR endpoints behind a shared root port, devices attached directly to the host bridge, and endpoints behind nested bridges. All rejection paths were also exercised, with the corresponding error messages verified. These included unsupported machine types, hot-plugged devices, non-existent BARs, I/O BARs, unaligned, overlapping, or out-of-aperture BARs, incomplete BAR configurations, highmem-mmio=off, missing firmware, and highmem-mmio-base values that cause address-space overflow.
Changes since v1:
* Add a
pci_fixed_bar_supportedMachineClass flag; fixed-bar-N is rejected on machine types that do not set it. virt sets it.
* Keep the fixed BAR claims in FixedBarsInfo instead of a static array, and report validation failures through Error ** to the machine code instead of calling exit(1).
* Allow a 64-bit non-prefetchable BAR in either aperture when the device is attached to the host bridge; behind a PCI bridge it must lie below 4 GiB. A 64-bit prefetchable BAR must still lie in the 64-bit aperture.
* Treat the high PCIe MMIO aperture as absent with highmem-mmio=off, and reject fixed BAR configuration unless firmware is loaded and ACPI is enabled.
* Check highmem-mmio-base + highmem-mmio-size against the PA space without overflow, and document highmem-mmio-base indocs/system/arm/virt.rst.
* Document the etc/fixed-bars format indocs/specs/pci-fixed-bars.rst, and note that the firmware device path is carried for future matching.
* Movepci-fixed-bar.htoinclude/hw/pci/.v1:
https://lore.kernel.org/qemu-arm/[email protected]/A git branch with this series applied is available at:
https://github.com/tdavenvidia/upstream-qemu/tree/Upstream-fixed-bar-Oct-29-V2The related EDK2 change is available at:
https://github.com/tianocore/edk2/pull/13183Tushar Dave (5):
hw/pci: introduce PCI fixed BAR properties hw/pci: add validation for fixed BAR configuration hw/pci: add fixed BARfw_cfgblob export hw/arm/virt: export fixed BAR metadata viafw_cfghw/arm/virt: add highmem-mmio-base propertydocs/specs/index.rst | 1 + docs/specs/pci-fixed-bars.rst | 75 +++++++ docs/system/arm/virt.rst | 4 + hw/arm/virt.c | 82 ++++++- hw/pci/meson.build | 2 + hw/pci/pci-fixed-bar-blob.c | 308 +++++++++++++++++++++++++++ hw/pci/pci-fixed-bar-validate.c | 365 ++++++++++++++++++++++++++++++++ hw/pci/pci-fixed-bar-validate.h | 22 ++ hw/pci/pci.c | 71 +++++++ include/hw/core/boards.h | 3 + include/hw/pci/pci-fixed-bar.h | 63 ++++++ include/hw/pci/pci_device.h | 7 + 12 files changed, 1002 insertions(+), 1 deletion(-) create mode 100644 docs/specs/pci-fixed-bars.rst create mode 100644 hw/pci/pci-fixed-bar-blob.c create mode 100644 hw/pci/pci-fixed-bar-validate.c create mode 100644 hw/pci/pci-fixed-bar-validate.h create mode 100644 include/hw/pci/pci-fixed-bar.hSignature · 1 line
2.34.1
Quoted 11 lines · Michael S. Tsirkin
Quoted 3 lines · Tushar Dave
This patch series 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.
My understanding is that all this does it pass a property to the firmware asking it to set the bar to a given value?
There are two standard ways to do this:
- EA capability in pci config space
EA came up earlier in the discussions as well, but we set it aside because we thought it might need guest kernel changes, and besides, EDK2 had no EA support at the time.
I revisited EA now that EDK2 supports it (Ard's PR, merged
https://github.com/tianocore/edk2/pull/13186). With that in place, a Linux guest reports the BARs as "from Enhanced Allocation" without any kernel changes. (I have not tested older distro kernels though.)
The main change is in patch 3; no need for fw_cfg blob, each fixed BAR instead described by an EA capability in the device's PCI configuration space.
One limitation inherent to EA is that it is a conventional capability and must fit within the first 256 bytes of PCI configuration space. It requires 4 bytes for the capability header, plus 20 bytes for each 64-bit BAR and 12 bytes for each 32-bit BAR. A device that does not have sufficient space, or already has an EA capability, we cannot use EA for that device.
For a vfio-pci device, the EA capability is added after building the host device's capability chain, since it must fit within the available configuration space. vfio-pci gives a host capability whose size it does not know all the space up to the next one, so a last capability of that kind holds the rest of the standard configuration space. If the last capability is vendor-specific, its real length is known, so the unused tail can be reclaimed for the EA capability. If no free space is left, the device is rejected with an error.
No EDK2 changes are needed for this approach, so I can drop my EDK2 PR that extended the IncompatiblePciDeviceSupport protocol:
https://github.com/tianocore/edk2/pull/13183.
I will send QEMU fixed BAR v3 that uses EA.
Quoted 1 line
- fixed BAR
_DSMin ACPI
I am also not sure which fixed BAR _DSM in ACPI you meant. If you meant _DSM function 5, which tells the OS to preserve the PCI configuration, my series already uses it.
-Tushar
Quoted 154 lines
If none of these are appropriate, pls document why.
Quoted 147 lines
On some platforms, P2P DMA between devices in the same IOMMU group is required for the desired data path and performance. The PCI fabric ACS is configured to permit direct P2P without routing traffic through the host bridge.
To support this multi-device IOMMU group P2P scenario in virtualization, the VM may need to preserve the host PCI BAR addresses in the guest.
A new fixed-bar-N property on a PCI endpoint device specifies the required guest address for BAR N (N = 0 through 5):
-device some-device,fixed-bar-0=<addr>[,fixed-bar-1=<addr>]...Once any fixed-bar-N property is set on a device, every memory BAR on that device must have a fixed address. Under a PCIe root port, fixed BAR placement is all-or-nothing within that root port's subtree. If one endpoint below the root port has a fixed BAR, every other endpoint with a memory BAR below that same root port must also have all of its memory BARs fixed.
QEMU validates the configuration when the machine is done initializing. Each address must be aligned to its BAR size, fall within the appropriate PCIe MMIO aperture, and not overlap any other fixed BAR. QEMU aborts on any validation failure. QEMU performs neither PCI enumeration nor BAR allocation; the validated configuration is exported to firmware through the "etc/fixed-bars"
fw_cfgblob, which carries each PCI function's vendor/device identification, firmware device path, and, for fixed devices, the configured address, size, and type of each BAR. The blob format is documented indocs/specs/pci-fixed-bars.rst.The fixed-bar-N property and its validation are generic and apply to any PCI device. A machine type opts in by setting the new
pci_fixed_bar_supportedMachineClass flag. Machine types that leave it unset reject fixed-bar-N. This series enables it on the virt machine only, by setting the flag and wiring up thefw_cfgexport. Other machine types would need equivalent wiring to expose the same mechanism to firmware.On the firmware side, the existing IncompatiblePciDeviceSupportDxe driver is extended to consume this blob. During device discovery, its
CheckDevice()implementation returns ACPI address descriptors with _MIF|_MAF set for the fixed BARs found in the blob. PciBusDxe's resource allocator already supports fixed BARs, including sizing and pinning the bridge windows above them. It now treats a BAR as fixed when the descriptor carries _MIF|_MAF, and programs the fixed address into the BAR register.Fixed BAR placement requires the guest to preserve the PCI resource configuration established by firmware. This is requested through the PCI boot configuration preservation mechanism using ACPI
_DSMfunction 5. Fixed BAR configuration is rejected when firmware is not loaded or ACPI is disabled.Example 1: VFIO passthrough device with fixed BARs and the PCIe MMIO aperture adjusted to accommodate the fixed addresses.
-machine virt,...,highmem-mmio-base=4T,highmem-mmio-size=4T -device pcie-root-port,id=pcie.port1,bus=pcie.1,chassis=1,io-reserve=0 -device x3130-upstream,id=upstream1,bus=pcie.port1 -device xio3130-downstream,id=downstream1_1,bus=upstream1,chassis=1,slot=2 -device vfio-pci-nohotplug,host=0018:06:00.0,bus=downstream1_1,id=dev0,\ fixed-bar-0=0x48000000000,fixed-bar-2=0x50000000000,fixed-bar-4=0x58000000000Example 2: VFIO and emulated devices under the same root port with fixed BARs and the PCIe MMIO aperture adjusted using highmem-mmio-base.
-machine virt,...,highmem-mmio-base=64T,highmem-mmio-size=64T -device pxb-pcie,id=pcie.1,bus_nr=1,bus=pcie.0 -device pcie-root-port,id=pcie.port1,bus=pcie.1,chassis=1,io-reserve=0 -device x3130-upstream,id=upstream1,bus=pcie.port1 -device xio3130-downstream,id=downstream1_1,bus=upstream1,chassis=1,slot=1 -device vfio-pci-nohotplug,host=0018:06:00.0,bus=downstream1_1,rombar=0,id=dev0,iommufd=iommufd0,\ fixed-bar-0=0x6b4000000000,fixed-bar-2=0x6b8000000000,fixed-bar-4=0x6c0000000000 -device xio3130-downstream,id=downstream1_2,bus=upstream1,chassis=1,slot=2 -device vfio-pci,host=0012:03:00.1,bus=downstream1_2,id=nic1,iommufd=iommufd0,fixed-bar-0=0x6c8000000000 -device xio3130-downstream,id=downstream1_3,bus=upstream1,chassis=1,slot=3 -device e1000,netdev=net0,bus=downstream1_3,id=nic_emu,fixed-bar-0=0x20000000Limitations:
* I/O BARs and the expansion ROM BAR are not covered by fixed-bar-N.
* SR-IOV VF BARs are not covered.Testing:
The series was tested on the AArch64 virt machine with a range of PCIe configurations, including emulated and VFIO passthrough devices, PCIe switches, single and multiple fixed-BAR endpoints behind a shared root port, devices attached directly to the host bridge, and endpoints behind nested bridges. All rejection paths were also exercised, with the corresponding error messages verified. These included unsupported machine types, hot-plugged devices, non-existent BARs, I/O BARs, unaligned, overlapping, or out-of-aperture BARs, incomplete BAR configurations, highmem-mmio=off, missing firmware, and highmem-mmio-base values that cause address-space overflow.
Changes since v1:
* Add a
pci_fixed_bar_supportedMachineClass flag; fixed-bar-N is rejected on machine types that do not set it. virt sets it.
* Keep the fixed BAR claims in FixedBarsInfo instead of a static array, and report validation failures through Error ** to the machine code instead of calling exit(1).
* Allow a 64-bit non-prefetchable BAR in either aperture when the device is attached to the host bridge; behind a PCI bridge it must lie below 4 GiB. A 64-bit prefetchable BAR must still lie in the 64-bit aperture.
* Treat the high PCIe MMIO aperture as absent with highmem-mmio=off, and reject fixed BAR configuration unless firmware is loaded and ACPI is enabled.
* Check highmem-mmio-base + highmem-mmio-size against the PA space without overflow, and document highmem-mmio-base indocs/system/arm/virt.rst.
* Document the etc/fixed-bars format indocs/specs/pci-fixed-bars.rst, and note that the firmware device path is carried for future matching.
* Movepci-fixed-bar.htoinclude/hw/pci/.v1:
https://lore.kernel.org/qemu-arm/[email protected]/A git branch with this series applied is available at:
https://github.com/tdavenvidia/upstream-qemu/tree/Upstream-fixed-bar-Oct-29-V2The related EDK2 change is available at:
https://github.com/tianocore/edk2/pull/13183Tushar Dave (5):
hw/pci: introduce PCI fixed BAR properties hw/pci: add validation for fixed BAR configuration hw/pci: add fixed BARfw_cfgblob export hw/arm/virt: export fixed BAR metadata viafw_cfghw/arm/virt: add highmem-mmio-base propertydocs/specs/index.rst | 1 + docs/specs/pci-fixed-bars.rst | 75 +++++++ docs/system/arm/virt.rst | 4 + hw/arm/virt.c | 82 ++++++- hw/pci/meson.build | 2 + hw/pci/pci-fixed-bar-blob.c | 308 +++++++++++++++++++++++++++ hw/pci/pci-fixed-bar-validate.c | 365 ++++++++++++++++++++++++++++++++ hw/pci/pci-fixed-bar-validate.h | 22 ++ hw/pci/pci.c | 71 +++++++ include/hw/core/boards.h | 3 + include/hw/pci/pci-fixed-bar.h | 63 ++++++ include/hw/pci/pci_device.h | 7 + 12 files changed, 1002 insertions(+), 1 deletion(-) create mode 100644 docs/specs/pci-fixed-bars.rst create mode 100644 hw/pci/pci-fixed-bar-blob.c create mode 100644 hw/pci/pci-fixed-bar-validate.c create mode 100644 hw/pci/pci-fixed-bar-validate.h create mode 100644 include/hw/pci/pci-fixed-bar.hSignature · 1 line
2.34.1