virtio-iommu: Add ACPI support
v3 cover virtio-iommu: Add ACPI support
Allow instantiating a virtio-iommu device on ACPI systems by adding a Virtual I/O Translation table (VIOT). Enable x86 support for VIOT.
Changes since v2 [1]:
* Use acpi_table_begin() and acpi_table_end().
This series now depends on "acpi: refactor error prone build_header() and packed structures usage in ACPI tables" [2]
* Dropped ACPI header definitions.
* Dropped doc patch, to be revisited later.
* Squashed patch 5.
* Added tests for q35 and virt machines: patch 6 temporarily enables blob updates (for bisectability), patch 7 adds the two test cases and patches 8-10 add the three reference tables.
There is an important caveat at the moment: when virtio-iommu is instantiated, device DMA faults until the guest configures the IOMMU. Firmware is therefore unable to access storage devices and load the bootloader and OS. Upcoming patches will align virtio-iommu with other vIOMMUs and let DMA bypass the IOMMU during boot. In the meantime there are several ways to circumvent the problem:
* Use plain old virtio-blk as storage, without enabling the 'iommu_platform' property. DMA from the device bypasses the IOMMU.
* Place the storage device behind a PCI bus that bypasses the IOMMU, using the new 'bypass_iommu' bridge property.
See docs/bypass-iommu.txt
* Use non-PCI storage devices, for example virtio-blk-device on the arm64 virt machine.
You can find a description of the VIOT table, which will be included in next ACPI version, here: https://jpbrucker.net/virtio-iommu/viot/viot-v9.pdf
[1] https://lore.kernel.org/qemu-devel/[email protected]/
[2] https://lore.kernel.org/qemu-devel/[email protected]/
Jean-Philippe Brucker (10):
hw/acpi: Add VIOT table
hw/arm/virt-acpi-build: Add VIOT table for virtio-iommu hw/arm/virt: Remove device tree restriction for virtio-iommu hw/arm/virt: Reject instantiation of multiple IOMMUs
pc: Allow instantiating a virtio-iommu device tests/acpi: allow updates of VIOT expected data files tests/acpi: add test cases for VIOT
tests/acpi: add expected VIOT blob for virt machine tests/acpi: add expected DSDT blob for VIOT test on q35 tests/acpi: add expected VIOT blob for q35 machine
hw/acpi/viot.h | 13 ++++ include/hw/i386/pc.h | 2 + hw/acpi/viot.c | 112 +++++++++++++++++++++++++++++++++ hw/arm/virt-acpi-build.c | 7 +++ hw/arm/virt.c | 15 +++-- hw/i386/acpi-build.c | 5 ++ hw/i386/pc.c | 28 ++++++++- hw/virtio/virtio-iommu-pci.c | 7 --- tests/qtest/bios-tables-test.c | 39 ++++++++++++ hw/acpi/Kconfig | 4 ++ hw/acpi/meson.build | 1 + hw/arm/Kconfig | 1 + hw/i386/Kconfig | 1 + tests/data/acpi/q35/DSDT.viot | Bin 0 -> 9415 bytes tests/data/acpi/q35/VIOT.viot | Bin 0 -> 112 bytes tests/data/acpi/virt/VIOT | Bin 0 -> 88 bytes 16 files changed, 219 insertions(+), 16 deletions(-) create mode 100644 hw/acpi/viot.h create mode 100644 hw/acpi/viot.c create mode 100644 tests/data/acpi/q35/DSDT.viot create mode 100644 tests/data/acpi/q35/VIOT.viot create mode 100644 tests/data/acpi/virt/VIOT
Signature · 1 line
2.33.0
PATCH v3 1/10 hw/acpi: Add VIOT table
Add a function that generates a Virtual I/O Translation table (VIOT), describing the topology of paravirtual IOMMUs. The table is created when instantiating a virtio-iommu device. It contains a virtio-iommu node and PCI Range nodes for endpoints managed by the IOMMU. By default, a single node describes all PCI devices. When passing the "default_bus_bypass_iommu" machine option and "bypass_iommu" PXB option, only buses that do not bypass the IOMMU are described by PCI Range nodes.
---
Sizes and types are hardcoded because it will now be the default style
https://lore.kernel.org/qemu-devel/[email protected]/
--- hw/acpi/viot.h | 13 +++++ hw/acpi/viot.c | 112 ++++++++++++++++++++++++++++++++++++++++++++ hw/acpi/Kconfig | 4 ++ hw/acpi/meson.build | 1 + 4 files changed, 130 insertions(+) create mode 100644 hw/acpi/viot.h create mode 100644 hw/acpi/viot.c
hw/acpi/viot.h new file +13 -0
@@ -0,0 +1,13 @@ +/* +* ACPI Virtual I/O Translation Table implementation +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#ifndef VIOT_H +#define VIOT_H + +void build_viot (GArray *table_data,BIOSLinker *linker, +uint16_t virtio_iommu_bdf,const char *oem_id, +const char *oem_table_id); + +#endif /* VIOT_H */
hw/acpi/viot.c new file +112 -0
112 lines not on this page · raw message
hw/acpi/Kconfig +4 -0
@@ -51,6 +51,10 @@ config ACPI_VMGENID default y depends on PC +config ACPI_VIOT + bool + depends on ACPI + config ACPI_HW_REDUCED bool select ACPI
hw/acpi/meson.build +1 -0
@@ -20,6 +20,7 @@ acpi_ss.add(when: 'CONFIG_ACPI_APEI', if_true: files('ghes.c'), if_false: files( acpi_ss.add(when: 'CONFIG_ACPI_PIIX4', if_true: files('piix4.c')) acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_true: files('pcihp.c')) acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_false: files('acpi-pci-hotplug-stub.c')) +acpi_ss.add(when: 'CONFIG_ACPI_VIOT', if_true: files('viot.c')) acpi_ss.add(when: 'CONFIG_ACPI_X86_ICH', if_true: files('ich9.c', 'tco.c')) acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c'), if_false: files('ipmi-stub.c')) acpi_ss.add(when: 'CONFIG_PC', if_false: files('acpi-x86-stub.c'))
Signature · 1 line
2.33.0
Re: [PATCH v3 01/10] hw/acpi: Add VIOT table
Hi Jean,
Quoted 56 lines · Jean-Philippe Brucker
Add a function that generates a Virtual I/O Translation table (VIOT), describing the topology of paravirtual IOMMUs. The table is created when instantiating a virtio-iommu device. It contains a virtio-iommu node and PCI Range nodes for endpoints managed by the IOMMU. By default, a single node describes all PCI devices. When passing the "
default_bus_bypass_iommu" machine option and "bypass_iommu" PXB option, only buses that do not bypass the IOMMU are described by PCI Range nodes.Signed-off-by Jean-Philippe Brucker <[email protected]>---
Sizes and types are hardcoded because it will now be the default style
https://lore.kernel.org/qemu-devel/[email protected]/--- hw/acpi/viot.h | 13 +++++ hw/acpi/viot.c | 112 ++++++++++++++++++++++++++++++++++++++++++++ hw/acpi/Kconfig | 4 ++ hw/acpi/meson.build | 1 + 4 files changed, 130 insertions(+) create mode 100644 hw/acpi/viot.h create mode 100644 hw/acpi/viot.chw/acpi/viot.h new file +13
-0@@ -0,0 +1,13 @@ +/* +* ACPI Virtual I/O Translation Table implementation +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#ifndef VIOT_H +#define VIOT_H + +void build_viot (GArray *table_data,BIOSLinker *linker, +uint16_t virtio_iommu_bdf,const char *oem_id, +const char *oem_table_id); + +#endif /* VIOT_H */ hw/acpi/viot.c new file +10
-0@@ -0,0 +1,112 @@ +/* +* ACPI Virtual I/O Translation table implementation +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#include "qemu/osdep.h" +#include "hw/acpi/acpi.h" +#include "hw/acpi/aml-build.h" +#include "hw/acpi/viot.h" +#include "hw/pci/pci.h"
hw/acpi/viot.c line 20
Quoted 10 lines
hw/acpi/viot.c new file +10
-0+#include "hw/pci/pci_host.h" + +struct viot_pci_ranges { +GArray *blob; +size_t count; +uint16_t output_node; +}; + +/* Build PCI range for a given PCI host bridge */ +static int viot_host_bridges (Object *obj,void *opaque)
nit: rename the function into something like build_pci_range_node() which actually indicates what it does
Quoted 45 lines
hw/acpi/viot.c new file +45
-0+{ +struct viot_pci_ranges *pci_ranges = opaque; +GArray *blob = pci_ranges->blob; + +if (object_dynamic_cast (obj,TYPE_PCI_HOST_BRIDGE )) { +PCIBus *bus =PCI_HOST_BRIDGE (obj)->bus; + +if (bus && !pci_bus_bypass_iommu (bus)) { +int min_bus, max_bus; + +pci_bus_range (bus, &min_bus, &max_bus); + +/* Type (PCI range) */ +build_append_int_noprefix (blob,1 ,1 ); +/* Reserved */ +build_append_int_noprefix (blob,0 ,1 ); +/* Length */ +build_append_int_noprefix (blob,24 ,2 ); +/* Endpoint start */ +build_append_int_noprefix (blob,PCI_BUILD_BDF (min_bus,0 ),4 ); +/* PCI Segment start */ +build_append_int_noprefix (blob,0 ,2 ); +/* PCI Segment end */ +build_append_int_noprefix (blob,0 ,2 ); +/* PCI BDF start */ +build_append_int_noprefix (blob,PCI_BUILD_BDF (min_bus,0 ),2 ); +/* PCI BDF end */ +build_append_int_noprefix (blob,PCI_BUILD_BDF (max_bus,0xff ),2 ); +/* Output node */ +build_append_int_noprefix (blob, pci_ranges->output_node,2 ); +/* Reserved */ +build_append_int_noprefix (blob,0 ,6 ); + + pci_ranges->count++; + } + } + +return 0 ; +} + +/* +* Generate a VIOT table with one PCI-based virtio-iommu that manages PCI +* endpoints. +*/ +void build_viot(GArray *table_data, BIOSLinker *linker,
hw/acpi/viot.c line 75
Quoted 10 lines
hw/acpi/viot.c new file +10
-0+ uint16_t virtio_iommu_bdf, const char *oem_id, + const char *oem_table_id) +{ + /* The virtio-iommu node follows the 48-bytes header */ + int viommu_off = 48; +AcpiTable table = { .sig ="VIOT" , .rev =0 , + .oem_id = oem_id, .oem_table_id = oem_table_id }; + struct viot_pci_ranges pci_ranges = { + .output_node = viommu_off, + .blob = g_array_new(false, true, 1),
nit add clear comment as in the other places?
.blob = g_array_new(false, /* clear */ true, 1),
Quoted 57 lines
hw/acpi/viot.c new file +37
-0+ }; + +/* Build the list of PCI ranges that this viommu manages */ +object_child_foreach_recursive (object_get_root (), viot_host_bridges, + &pci_ranges); + +/* ACPI table header */ +acpi_table_begin (&table, table_data); +/* Node count */ +build_append_int_noprefix (table_data, pci_ranges.count +1 ,2 ); +/* Node offset */ +build_append_int_noprefix (table_data, viommu_off,2 ); +/* Reserved */ +build_append_int_noprefix (table_data,0 ,8 ); + +/* Virtio-iommu node */ +/* Type (virtio-pci IOMMU) */ +build_append_int_noprefix (table_data,3 ,1 ); +/* Reserved */ +build_append_int_noprefix (table_data,0 ,1 ); +/* Length */ +build_append_int_noprefix (table_data,16 ,2 ); +/* PCI Segment */ +build_append_int_noprefix (table_data,0 ,2 ); +/* PCI BDF number */ +build_append_int_noprefix (table_data, virtio_iommu_bdf,2 ); +/* Reserved */ +build_append_int_noprefix (table_data,0 ,8 ); + +/* PCI ranges found above */ +g_array_append_vals (table_data, pci_ranges.blob->data, + pci_ranges.blob->len); +g_array_free (pci_ranges.blob, true); + +acpi_table_end (linker, &table); +} +hw/acpi/Kconfig +4
-0@@ -51,6 +51,10 @@ config ACPI_VMGENID default y depends on PC +config ACPI_VIOT + bool + depends on ACPI + config ACPI_HW_REDUCED bool select ACPIhw/acpi/meson.build +0
-0
hw/acpi/meson.build acpi_ss.add(when: 'CONFIG_ACPI_APEI', if_true: files('ghes.c'), if_false: files( · line 26
Quoted 7 lines
hw/acpi/meson.build +1
-0@@ -20,6 +20,7 @@ acpi_ss.add(when: 'CONFIG_ACPI_APEI', if_true: files('ghes.c'), if_false: files( acpi_ss.add(when: 'CONFIG_ACPI_PIIX4', if_true: files('piix4.c')) acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_true: files('pcihp.c')) acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_false: files('acpi-pci-hotplug-stub.c')) +acpi_ss.add(when: 'CONFIG_ACPI_VIOT', if_true: files('viot.c')) acpi_ss.add(when: 'CONFIG_ACPI_X86_ICH', if_true: files('ich9.c', 'tco.c')) acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c'), if_false: files('ipmi-stub.c')) acpi_ss.add(when: 'CONFIG_PC', if_false: files('acpi-x86-stub.c'))
Besides
Tested with default root bus and pxb-pci. Feel free to add
Thanks
Eric
Re: [PATCH v3 01/10] hw/acpi: Add VIOT table
In reply to Jean-Philippe BruckerQuoted 99 lines · On Tue, 14 Sep 2021 15:19:56 +0100 Jean-Philippe Brucker…
Add a function that generates a Virtual I/O Translation table (VIOT), describing the topology of paravirtual IOMMUs. The table is created when instantiating a virtio-iommu device. It contains a virtio-iommu node and PCI Range nodes for endpoints managed by the IOMMU. By default, a single node describes all PCI devices. When passing the "
default_bus_bypass_iommu" machine option and "bypass_iommu" PXB option, only buses that do not bypass the IOMMU are described by PCI Range nodes.Signed-off-by Jean-Philippe Brucker <[email protected]>---
Sizes and types are hardcoded because it will now be the default style
https://lore.kernel.org/qemu-devel/[email protected]/--- hw/acpi/viot.h | 13 +++++ hw/acpi/viot.c | 112 ++++++++++++++++++++++++++++++++++++++++++++ hw/acpi/Kconfig | 4 ++ hw/acpi/meson.build | 1 + 4 files changed, 130 insertions(+) create mode 100644 hw/acpi/viot.h create mode 100644 hw/acpi/viot.chw/acpi/viot.h new file +13
-0@@ -0,0 +1,13 @@ +/* +* ACPI Virtual I/O Translation Table implementation +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#ifndef VIOT_H +#define VIOT_H + +void build_viot (GArray *table_data,BIOSLinker *linker, +uint16_t virtio_iommu_bdf,const char *oem_id, +const char *oem_table_id); + +#endif /* VIOT_H */ hw/acpi/viot.c new file +53
-0@@ -0,0 +1,112 @@ +/* +* ACPI Virtual I/O Translation table implementation +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#include "qemu/osdep.h" +#include "hw/acpi/acpi.h" +#include "hw/acpi/aml-build.h" +#include "hw/acpi/viot.h" +#include "hw/pci/pci.h" +#include "hw/pci/pci_host.h" + +struct viot_pci_ranges { +GArray *blob; +size_t count; +uint16_t output_node; +}; + +/* Build PCI range for a given PCI host bridge */ +static int viot_host_bridges (Object *obj,void *opaque) +{ +struct viot_pci_ranges *pci_ranges = opaque; +GArray *blob = pci_ranges->blob; + +if (object_dynamic_cast (obj,TYPE_PCI_HOST_BRIDGE )) { +PCIBus *bus =PCI_HOST_BRIDGE (obj)->bus; + +if (bus && !pci_bus_bypass_iommu (bus)) { +int min_bus, max_bus; + +pci_bus_range (bus, &min_bus, &max_bus); + +/* Type (PCI range) */ +build_append_int_noprefix (blob,1 ,1 ); +/* Reserved */ +build_append_int_noprefix (blob,0 ,1 ); +/* Length */ +build_append_int_noprefix (blob,24 ,2 ); +/* Endpoint start */ +build_append_int_noprefix (blob,PCI_BUILD_BDF (min_bus,0 ),4 ); +/* PCI Segment start */ +build_append_int_noprefix (blob,0 ,2 ); +/* PCI Segment end */ +build_append_int_noprefix (blob,0 ,2 ); +/* PCI BDF start */ +build_append_int_noprefix (blob,PCI_BUILD_BDF (min_bus,0 ),2 ); +/* PCI BDF end */ +build_append_int_noprefix (blob,PCI_BUILD_BDF (max_bus,0xff ),2 ); +/* Output node */ +build_append_int_noprefix (blob, pci_ranges->output_node,2 ); +/* Reserved */ +build_append_int_noprefix (blob,0 ,6 ); +
hw/acpi/viot.c line 63
Quoted 10 lines
hw/acpi/viot.c new file +10
-0+ pci_ranges->count++; + } + } + +return 0 ; +} + +/* +* Generate a VIOT table with one PCI-based virtio-iommu that manages PCI +* endpoints.
We usually put a pointer to spec/revision and chapter in it that describes being implemented table, so reviewer would have a reference to compare code with. Otherwise I have no idea if implementation is correct or not.
ex: build_hmat_mpda
the same applies to viot_host_bridges
Quoted 76 lines
hw/acpi/viot.c new file +49
-0+*/ +void build_viot (GArray *table_data,BIOSLinker *linker, +uint16_t virtio_iommu_bdf,const char *oem_id, +const char *oem_table_id) +{ +/* The virtio-iommu node follows the 48-bytes header */ +int viommu_off =48 ; +AcpiTable table = { .sig ="VIOT" , .rev =0 , + .oem_id = oem_id, .oem_table_id = oem_table_id }; +struct viot_pci_ranges pci_ranges = { + .output_node = viommu_off, + .blob =g_array_new (false, true,1 ), + }; + +/* Build the list of PCI ranges that this viommu manages */ +object_child_foreach_recursive (object_get_root (), viot_host_bridges, + &pci_ranges); + +/* ACPI table header */ +acpi_table_begin (&table, table_data); +/* Node count */ +build_append_int_noprefix (table_data, pci_ranges.count +1 ,2 ); +/* Node offset */ +build_append_int_noprefix (table_data, viommu_off,2 ); +/* Reserved */ +build_append_int_noprefix (table_data,0 ,8 ); + +/* Virtio-iommu node */ +/* Type (virtio-pci IOMMU) */ +build_append_int_noprefix (table_data,3 ,1 ); +/* Reserved */ +build_append_int_noprefix (table_data,0 ,1 ); +/* Length */ +build_append_int_noprefix (table_data,16 ,2 ); +/* PCI Segment */ +build_append_int_noprefix (table_data,0 ,2 ); +/* PCI BDF number */ +build_append_int_noprefix (table_data, virtio_iommu_bdf,2 ); +/* Reserved */ +build_append_int_noprefix (table_data,0 ,8 ); + +/* PCI ranges found above */ +g_array_append_vals (table_data, pci_ranges.blob->data, + pci_ranges.blob->len); +g_array_free (pci_ranges.blob, true); + +acpi_table_end (linker, &table); +} +hw/acpi/Kconfig +4
-0@@ -51,6 +51,10 @@ config ACPI_VMGENID default y depends on PC +config ACPI_VIOT + bool + depends on ACPI + config ACPI_HW_REDUCED bool select ACPIhw/acpi/meson.build +1
-0@@ -20,6 +20,7 @@ acpi_ss.add(when: 'CONFIG_ACPI_APEI', if_true: files('ghes.c'), if_false: files( acpi_ss.add(when: 'CONFIG_ACPI_PIIX4', if_true: files('piix4.c')) acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_true: files('pcihp.c')) acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_false: files('acpi-pci-hotplug-stub.c')) +acpi_ss.add(when: 'CONFIG_ACPI_VIOT', if_true: files('viot.c')) acpi_ss.add(when: 'CONFIG_ACPI_X86_ICH', if_true: files('ich9.c', 'tco.c')) acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c'), if_false: files('ipmi-stub.c')) acpi_ss.add(when: 'CONFIG_PC', if_false: files('acpi-x86-stub.c'))
Re: [PATCH v3 01/10] hw/acpi: Add VIOT table
Quoted 8 lines · Igor Mammedov
Quoted 3 lines
+/*
+ * Generate a VIOT table with one PCI-based virtio-iommu that manages PCI
+ * endpoints.We usually put a pointer to spec/revision and chapter in it that describes being implemented table, so reviewer would have a reference to compare code with. Otherwise I have no idea if implementation is correct or not.
The 6.5 ACPI specification isn't out yet unfortunately, so I can't put any reference at the moment. I don't know when it will be published. The draft specification is here: https://jpbrucker.net/virtio-iommu/viot/viot-v9.pdf
But that's only temporary. I can make a note to add the pointers once the spec is out.
The acpica implementation could also be used for cross-reference:
https://github.com/acpica/acpica/commit/fc4e33319c1ee08f20f5c44853dd8426643f6dfd
Thanks,
Jean
Quoted 5 lines
ex:
build_hmat_mpdathe same applies to
viot_host_bridges
Re: [PATCH v3 01/10] hw/acpi: Add VIOT table
In reply to Jean-Philippe BruckerQuoted 115 lines · On Tue, 14 Sep 2021 15:19:56 +0100 Jean-Philippe Brucker…
Add a function that generates a Virtual I/O Translation table (VIOT), describing the topology of paravirtual IOMMUs. The table is created when instantiating a virtio-iommu device. It contains a virtio-iommu node and PCI Range nodes for endpoints managed by the IOMMU. By default, a single node describes all PCI devices. When passing the "
default_bus_bypass_iommu" machine option and "bypass_iommu" PXB option, only buses that do not bypass the IOMMU are described by PCI Range nodes.Signed-off-by Jean-Philippe Brucker <[email protected]>---
Sizes and types are hardcoded because it will now be the default style
https://lore.kernel.org/qemu-devel/[email protected]/--- hw/acpi/viot.h | 13 +++++ hw/acpi/viot.c | 112 ++++++++++++++++++++++++++++++++++++++++++++ hw/acpi/Kconfig | 4 ++ hw/acpi/meson.build | 1 + 4 files changed, 130 insertions(+) create mode 100644 hw/acpi/viot.h create mode 100644 hw/acpi/viot.chw/acpi/viot.h new file +13
-0@@ -0,0 +1,13 @@ +/* +* ACPI Virtual I/O Translation Table implementation +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#ifndef VIOT_H +#define VIOT_H + +void build_viot (GArray *table_data,BIOSLinker *linker, +uint16_t virtio_iommu_bdf,const char *oem_id, +const char *oem_table_id); + +#endif /* VIOT_H */ hw/acpi/viot.c new file +69
-0@@ -0,0 +1,112 @@ +/* +* ACPI Virtual I/O Translation table implementation +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ +#include "qemu/osdep.h" +#include "hw/acpi/acpi.h" +#include "hw/acpi/aml-build.h" +#include "hw/acpi/viot.h" +#include "hw/pci/pci.h" +#include "hw/pci/pci_host.h" + +struct viot_pci_ranges { +GArray *blob; +size_t count; +uint16_t output_node; +}; + +/* Build PCI range for a given PCI host bridge */ +static int viot_host_bridges (Object *obj,void *opaque) +{ +struct viot_pci_ranges *pci_ranges = opaque; +GArray *blob = pci_ranges->blob; + +if (object_dynamic_cast (obj,TYPE_PCI_HOST_BRIDGE )) { +PCIBus *bus =PCI_HOST_BRIDGE (obj)->bus; + +if (bus && !pci_bus_bypass_iommu (bus)) { +int min_bus, max_bus; + +pci_bus_range (bus, &min_bus, &max_bus); + +/* Type (PCI range) */ +build_append_int_noprefix (blob,1 ,1 ); +/* Reserved */ +build_append_int_noprefix (blob,0 ,1 ); +/* Length */ +build_append_int_noprefix (blob,24 ,2 ); +/* Endpoint start */ +build_append_int_noprefix (blob,PCI_BUILD_BDF (min_bus,0 ),4 ); +/* PCI Segment start */ +build_append_int_noprefix (blob,0 ,2 ); +/* PCI Segment end */ +build_append_int_noprefix (blob,0 ,2 ); +/* PCI BDF start */ +build_append_int_noprefix (blob,PCI_BUILD_BDF (min_bus,0 ),2 ); +/* PCI BDF end */ +build_append_int_noprefix (blob,PCI_BUILD_BDF (max_bus,0xff ),2 ); +/* Output node */ +build_append_int_noprefix (blob, pci_ranges->output_node,2 ); +/* Reserved */ +build_append_int_noprefix (blob,0 ,6 ); + + pci_ranges->count++; + } + } + +return 0 ; +} + +/* +* Generate a VIOT table with one PCI-based virtio-iommu that manages PCI +* endpoints. +*/ +void build_viot (GArray *table_data,BIOSLinker *linker, +uint16_t virtio_iommu_bdf,const char *oem_id, +const char *oem_table_id) +{ +/* The virtio-iommu node follows the 48-bytes header */
hw/acpi/viot.c line 79
Quoted 10 lines
hw/acpi/viot.c new file +10
-0+int viommu_off =48 ; +AcpiTable table = { .sig ="VIOT" , .rev =0 , + .oem_id = oem_id, .oem_table_id = oem_table_id }; +struct viot_pci_ranges pci_ranges = { + .output_node = viommu_off, + .blob =g_array_new (false, true,1 ), + }; + +/* Build the list of PCI ranges that this viommu manages */ + object_child_foreach_recursive(object_get_root(), viot_host_bridges,
I'd limit scope to machine and re-use one that caller already uses.
in arm case: virt_acpi_build(VirtMachineState *vms, ...
q35: acpi_build(..., MachineState *machine)
Quoted 60 lines
hw/acpi/viot.c new file +33
-0+ &pci_ranges); + +/* ACPI table header */ +acpi_table_begin (&table, table_data); +/* Node count */ +build_append_int_noprefix (table_data, pci_ranges.count +1 ,2 ); +/* Node offset */ +build_append_int_noprefix (table_data, viommu_off,2 ); +/* Reserved */ +build_append_int_noprefix (table_data,0 ,8 ); + +/* Virtio-iommu node */ +/* Type (virtio-pci IOMMU) */ +build_append_int_noprefix (table_data,3 ,1 ); +/* Reserved */ +build_append_int_noprefix (table_data,0 ,1 ); +/* Length */ +build_append_int_noprefix (table_data,16 ,2 ); +/* PCI Segment */ +build_append_int_noprefix (table_data,0 ,2 ); +/* PCI BDF number */ +build_append_int_noprefix (table_data, virtio_iommu_bdf,2 ); +/* Reserved */ +build_append_int_noprefix (table_data,0 ,8 ); + +/* PCI ranges found above */ +g_array_append_vals (table_data, pci_ranges.blob->data, + pci_ranges.blob->len); +g_array_free (pci_ranges.blob, true); + +acpi_table_end (linker, &table); +} +hw/acpi/Kconfig +4
-0@@ -51,6 +51,10 @@ config ACPI_VMGENID default y depends on PC +config ACPI_VIOT + bool + depends on ACPI + config ACPI_HW_REDUCED bool select ACPIhw/acpi/meson.build +1
-0@@ -20,6 +20,7 @@ acpi_ss.add(when: 'CONFIG_ACPI_APEI', if_true: files('ghes.c'), if_false: files( acpi_ss.add(when: 'CONFIG_ACPI_PIIX4', if_true: files('piix4.c')) acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_true: files('pcihp.c')) acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_false: files('acpi-pci-hotplug-stub.c')) +acpi_ss.add(when: 'CONFIG_ACPI_VIOT', if_true: files('viot.c')) acpi_ss.add(when: 'CONFIG_ACPI_X86_ICH', if_true: files('ich9.c', 'tco.c')) acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c'), if_false: files('ipmi-stub.c')) acpi_ss.add(when: 'CONFIG_PC', if_false: files('acpi-x86-stub.c'))
PATCH v3 2/10 hw/arm/virt-acpi-build: Add VIOT table for virtio-iommu
In reply to Jean-Philippe BruckerWhen a virtio-iommu is instantiated, describe it using the ACPI VIOT table.
--- hw/arm/virt-acpi-build.c | 7 +++++++ hw/arm/Kconfig | 1 + 2 files changed, 8 insertions(+)
hw/arm/virt-acpi-build.c +7 -0
@@ -55,6 +55,7 @@#include "kvm_arm.h" #include "migration/vmstate.h" #include "hw/acpi/ghes.h" +#include "hw/acpi/viot.h" #define ARM_SPI_BASE 32
@@ -928,6 +929,12 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables) }#endif +if (vms->iommu ==VIRT_IOMMU_VIRTIO ) { +acpi_add_table (table_offsets, tables_blob); +build_viot (tables_blob, tables->linker, vms->virtio_iommu_bdf, + vms->oem_id, vms->oem_table_id); + } +/* XSDT is pointed to by RSDP */ xsdt = tables_blob->len; build_xsdt(tables_blob, tables->linker, table_offsets, vms->oem_id,
hw/arm/Kconfig +1 -0
@@ -27,6 +27,7 @@ config ARM_VIRT select DIMM select ACPI_HW_REDUCED select ACPI_APEI + select ACPI_VIOT config CHEETAH bool
Signature · 1 line
2.33.0
PATCH v3 3/10 hw/arm/virt: Remove device tree restriction for virtio-iommu
In reply to Jean-Philippe Bruckervirtio-iommu is now supported with ACPI VIOT as well as device tree. Remove the restriction that prevents from instantiating a virtio-iommu device under ACPI.
--- hw/arm/virt.c | 10 ++-------- hw/virtio/virtio-iommu-pci.c | 7 ------- 2 files changed, 2 insertions(+), 15 deletions(-)
hw/arm/virt.c +2 -8
@@ -2547,16 +2547,10 @@ static HotplugHandler *virt_machine_get_hotplug_handler(MachineState *machine,MachineClass *mc =MACHINE_GET_CLASS (machine);if (device_is_dynamic_sysbus (mc, dev) || - (object_dynamic_cast (OBJECT (dev),TYPE_PC_DIMM ))) { +object_dynamic_cast (OBJECT (dev),TYPE_PC_DIMM ) || +object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_IOMMU_PCI )) {return HOTPLUG_HANDLER (machine); } -if (object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_IOMMU_PCI )) { -VirtMachineState *vms =VIRT_MACHINE (machine); - -if (!vms->bootinfo.firmware_loaded || !virt_is_acpi_enabled (vms)) { -return HOTPLUG_HANDLER (machine); - } - }return NULL ; }
hw/virtio/virtio-iommu-pci.c +0 -7
@@ -48,16 +48,9 @@ static void virtio_iommu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)VirtIOIOMMU *s =VIRTIO_IOMMU (vdev);if (!qdev_get_machine_hotplug_handler (DEVICE (vpci_dev))) { -MachineClass *mc =MACHINE_GET_CLASS (qdev_get_machine ()); - -error_setg (errp, -"%s machine fails to create iommu-map device tree bindings" , - mc->name);error_append_hint (errp,"Check your machine implements a hotplug handler " "for the virtio-iommu-pci device\n" ); -error_append_hint (errp,"Check the guest is booted without FW or with " -"-no-acpi\n" );return ; }for (int i =0 ; i < s->nb_reserved_regions; i++) {
Signature · 1 line
2.33.0
PATCH v3 4/10 hw/arm/virt: Reject instantiation of multiple IOMMUs
In reply to Jean-Philippe BruckerWe do not support instantiating multiple IOMMUs. Before adding a virtio-iommu, check that no other IOMMU is present. This will detect both "iommu=smmuv3" machine parameter and another virtio-iommu instance.
--- hw/arm/virt.c | 5 +++++ 1 file changed, 5 insertions(+)
hw/arm/virt.c +5 -0
@@ -2471,6 +2471,11 @@ static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev,if (object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_IOMMU_PCI )) {PCIDevice *pdev =PCI_DEVICE (dev); +if (vms->iommu !=VIRT_IOMMU_NONE ) { +error_setg (errp,"virt machine does not support multiple IOMMUs" ); +return ; + } + vms->iommu =VIRT_IOMMU_VIRTIO ; vms->virtio_iommu_bdf =pci_get_bdf (pdev);create_virtio_iommu_dt_bindings (vms);
Signature · 1 line
2.33.0
Re: [PATCH v3 04/10] hw/arm/virt: Reject instantiation of multiple IOMMUs
Hi Jean,
Quoted 7 lines · Jean-Philippe Brucker
We do not support instantiating multiple IOMMUs. Before adding a virtio-iommu, check that no other IOMMU is present. This will detect both "iommu=smmuv3" machine parameter and another virtio-iommu instance.
Fixes 70e89132c9 ("hw/arm/virt: Add the virtio-iommu device tree mappings")Reviewed-by Eric Auger <[email protected]>Signed-off-by Jean-Philippe Brucker <[email protected]>
Eric
Quoted 20 lines
--- hw/arm/virt.c | 5 +++++ 1 file changed, 5 insertions(+)hw/arm/virt.c +5
-0@@ -2471,6 +2471,11 @@ static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev,if (object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_IOMMU_PCI )) {PCIDevice *pdev =PCI_DEVICE (dev); +if (vms->iommu !=VIRT_IOMMU_NONE ) { +error_setg (errp,"virt machine does not support multiple IOMMUs" ); +return ; + } + vms->iommu =VIRT_IOMMU_VIRTIO ; vms->virtio_iommu_bdf =pci_get_bdf (pdev);create_virtio_iommu_dt_bindings (vms);
Re: [PATCH v3 04/10] hw/arm/virt: Reject instantiation of multiple IOMMUs
In reply to Jean-Philippe BruckerQuoted 16 lines · On Tue, 14 Sep 2021 15:19:59 +0100 Jean-Philippe Brucker…
We do not support instantiating multiple IOMMUs. Before adding a virtio-iommu, check that no other IOMMU is present. This will detect both "iommu=smmuv3" machine parameter and another virtio-iommu instance.
Fixes 70e89132c9 ("hw/arm/virt: Add the virtio-iommu device tree mappings")Reviewed-by Eric Auger <[email protected]>Signed-off-by Jean-Philippe Brucker <[email protected]>--- hw/arm/virt.c | 5 +++++ 1 file changed, 5 insertions(+)hw/arm/virt.c +0
-0
hw/arm/virt.c static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev, · line 2477
Quoted 7 lines
hw/arm/virt.c +4
-0@@ -2471,6 +2471,11 @@ static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev,if (object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_IOMMU_PCI )) {PCIDevice *pdev =PCI_DEVICE (dev); +if (vms->iommu !=VIRT_IOMMU_NONE ) { +error_setg (errp,"virt machine does not support multiple IOMMUs" ); +return ; + }
can you move check into 'pre_plug' callback?
(plug should not fail and just finish up whatever was verified/set by pre_plug, there are plans to remove errp argument from 'plug' callback)
Quoted 4 lines
hw/arm/virt.c +1
-0+ vms->iommu =VIRT_IOMMU_VIRTIO ; vms->virtio_iommu_bdf =pci_get_bdf (pdev);create_virtio_iommu_dt_bindings (vms);
PATCH v3 5/10 pc: Allow instantiating a virtio-iommu device
In reply to Jean-Philippe BruckerAllow instantiating a virtio-iommu device by adding an ACPI Virtual I/O Translation table (VIOT), which describes the relation between the virtio-iommu and the endpoints it manages.
Add a hotplug handler for virtio-iommu on x86 and set the necessary reserved region property. On x86, the [0xfee00000, 0xfeefffff] DMA region is reserved for MSIs. DMA transactions to this range either trigger IRQ remapping in the IOMMU or bypasses IOMMU translation.
Although virtio-iommu does not support IRQ remapping it must be informed of the reserved region so that it can forward DMA transactions targeting this region.
--- include/hw/i386/pc.h | 2 ++ hw/i386/acpi-build.c | 5 +++++ hw/i386/pc.c | 28 +++++++++++++++++++++++++++- hw/i386/Kconfig | 1 + 4 files changed, 35 insertions(+), 1 deletion(-)
include/hw/i386/pc.h +2 -0
@@ -45,6 +45,8 @@ typedef struct PCMachineState {bool pit_enabled;bool hpet_enabled;bool default_bus_bypass_iommu; +bool virtio_iommu; +uint16_t virtio_iommu_bdf;uint64_t max_fw_size;/* ACPI Memory hotplug IO base address */
hw/i386/acpi-build.c +5 -0
@@ -71,6 +71,7 @@#include "hw/acpi/ipmi.h" #include "hw/acpi/hmat.h" +#include "hw/acpi/viot.h" /* These are used to size the ACPI tables for -M pc-i440fx-1.7 and * -M pc-i440fx-2.0. Even if the actual amount of AML generated grows
@@ -2593,6 +2594,10 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)build_dmar_q35 (tables_blob, tables->linker, x86ms->oem_id, x86ms->oem_table_id); } + }else if (pcms->virtio_iommu) { +acpi_add_table (table_offsets, tables_blob); +build_viot (tables_blob, tables->linker, pcms->virtio_iommu_bdf, + x86ms->oem_id, x86ms->oem_table_id); }if (machine->nvdimms_state->is_enabled) { nvdimm_build_acpi(table_offsets, tables_blob, tables->linker,
hw/i386/pc.c +27 -1
@@ -83,6 +83,7 @@#include "hw/i386/intel_iommu.h" #include "hw/net/ne2000-isa.h" #include "standard-headers/asm-x86/bootparam.h" +#include "hw/virtio/virtio-iommu.h" #include "hw/virtio/virtio-pmem-pci.h" #include "hw/virtio/virtio-mem-pci.h" #include "hw/mem/memory-device.h"
@@ -798,6 +799,11 @@ void pc_machine_done(Notifier *notifier, void *data) "irqchip support.");exit (EXIT_FAILURE ); } + +if (pcms->virtio_iommu &&x86_iommu_get_default ()) { +error_report ("QEMU does not support multiple vIOMMUs for x86 yet." ); +exit (EXIT_FAILURE ); + } }void pc_guest_info_init (PCMachineState *pcms)
@@ -1368,6 +1374,14 @@ static void pc_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, }else if (object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_PMEM_PCI ) ||object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_MEM_PCI )) {pc_virtio_md_pci_pre_plug (hotplug_dev, dev, errp); + }else if (object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_IOMMU_PCI )) { +/* Declare the reserved MSI region */ +char *resv_prop_str =g_strdup_printf ("0xfee00000:0xfeefffff:%d" , +VIRTIO_IOMMU_RESV_MEM_T_MSI ); + +qdev_prop_set_uint32 (dev,"len-reserved-regions" ,1 ); +qdev_prop_set_string (dev,"reserved-regions[0]" , resv_prop_str); +g_free (resv_prop_str); } }
@@ -1381,6 +1395,17 @@ static void pc_machine_device_plug_cb(HotplugHandler *hotplug_dev, }else if (object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_PMEM_PCI ) ||object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_MEM_PCI )) {pc_virtio_md_pci_plug (hotplug_dev, dev, errp); + }else if (object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_IOMMU_PCI )) { +PCMachineState *pcms =PC_MACHINE (hotplug_dev); +PCIDevice *pdev =PCI_DEVICE (dev); + +if (pcms->virtio_iommu) { +error_setg (errp, +"QEMU does not support multiple vIOMMUs for x86 yet." ); +return ; + } + pcms->virtio_iommu = true; + pcms->virtio_iommu_bdf =pci_get_bdf (pdev); } }
@@ -1422,7 +1447,8 @@ static HotplugHandler *pc_get_hotplug_handler(MachineState *machine,if (object_dynamic_cast (OBJECT (dev),TYPE_PC_DIMM ) ||object_dynamic_cast (OBJECT (dev),TYPE_CPU ) ||object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_PMEM_PCI ) || -object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_MEM_PCI )) { +object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_MEM_PCI ) || +object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_IOMMU_PCI )) {return HOTPLUG_HANDLER (machine); }
hw/i386/Kconfig +1 -0
@@ -54,6 +54,7 @@ config PC_ACPI select ACPI_X86 select ACPI_CPU_HOTPLUG select ACPI_MEMORY_HOTPLUG + select ACPI_VIOT select SMBUS_EEPROM select PFLASH_CFI01 depends on ACPI_SMBUS
Signature · 1 line
2.33.0
Re: [PATCH v3 05/10] pc: Allow instantiating a virtio-iommu device
Quoted 70 lines · On Tue, 14 Sep 2021 15:20:00 +0100 Jean-Philippe Brucker…
Allow instantiating a virtio-iommu device by adding an ACPI Virtual I/O Translation table (VIOT), which describes the relation between the virtio-iommu and the endpoints it manages.
Add a hotplug handler for virtio-iommu on x86 and set the necessary reserved region property. On x86, the [
0xfee00000,0xfeefffff] DMA region is reserved for MSIs. DMA transactions to this range either trigger IRQ remapping in the IOMMU or bypasses IOMMU translation.Although virtio-iommu does not support IRQ remapping it must be informed of the reserved region so that it can forward DMA transactions targeting this region.
Signed-off-by Jean-Philippe Brucker <[email protected]>--- include/hw/i386/pc.h | 2 ++ hw/i386/acpi-build.c | 5 +++++ hw/i386/pc.c | 28 +++++++++++++++++++++++++++- hw/i386/Kconfig | 1 + 4 files changed, 35 insertions(+), 1 deletion(-)include/hw/i386/pc.h +2
-0@@ -45,6 +45,8 @@ typedef struct PCMachineState {bool pit_enabled;bool hpet_enabled;bool default_bus_bypass_iommu; +bool virtio_iommu; +uint16_t virtio_iommu_bdf;uint64_t max_fw_size;/* ACPI Memory hotplug IO base address */ hw/i386/acpi-build.c +5
-0@@ -71,6 +71,7 @@#include "hw/acpi/ipmi.h" #include "hw/acpi/hmat.h" +#include "hw/acpi/viot.h" /* These are used to size the ACPI tables for -M pc-i440fx-1.7 and * -M pc-i440fx-2.0. Even if the actual amount of AML generated grows @@ -2593,6 +2594,10 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)build_dmar_q35 (tables_blob, tables->linker, x86ms->oem_id, x86ms->oem_table_id); } + }else if (pcms->virtio_iommu) { +acpi_add_table (table_offsets, tables_blob); +build_viot (tables_blob, tables->linker, pcms->virtio_iommu_bdf, + x86ms->oem_id, x86ms->oem_table_id); }if (machine->nvdimms_state->is_enabled) { nvdimm_build_acpi(table_offsets, tables_blob, tables->linker,hw/i386/pc.c +1
-0@@ -83,6 +83,7 @@#include "hw/i386/intel_iommu.h" #include "hw/net/ne2000-isa.h" #include "standard-headers/asm-x86/bootparam.h" +#include "hw/virtio/virtio-iommu.h" #include "hw/virtio/virtio-pmem-pci.h" #include "hw/virtio/virtio-mem-pci.h" #include "hw/mem/memory-device.h"
hw/i386/pc.c void pc_machine_done(Notifier *notifier, void *data) · line 806
Quoted 8 lines
hw/i386/pc.c +5
-0@@ -798,6 +799,11 @@ void pc_machine_done(Notifier *notifier, void *data) "irqchip support.");exit (EXIT_FAILURE ); } + +if (pcms->virtio_iommu &&x86_iommu_get_default ()) { +error_report ("QEMU does not support multiple vIOMMUs for x86 yet." ); +exit (EXIT_FAILURE ); + }
previous patch does similar check, doesn't it? So is why it's not implement the same way?
hw/i386/pc.c static void pc_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, · line 1380
Quoted 11 lines
hw/i386/pc.c +4
-0}void pc_guest_info_init (PCMachineState *pcms)@@ -1368,6 +1374,14 @@ static void pc_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, }else if (object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_PMEM_PCI ) ||object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_MEM_PCI )) {pc_virtio_md_pci_pre_plug (hotplug_dev, dev, errp); + }else if (object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_IOMMU_PCI )) { +/* Declare the reserved MSI region */ +char *resv_prop_str =g_strdup_printf ("0xfee00000:0xfeefffff:%d" , +VIRTIO_IOMMU_RESV_MEM_T_MSI );
add a comment describing where these values come from, pls.
hw/i386/pc.c static void pc_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev, · line 1383
Quoted 3 lines
hw/i386/pc.c +3
-0+ +qdev_prop_set_uint32 (dev,"len-reserved-regions" ,1 ); +qdev_prop_set_string (dev,"reserved-regions[0]" , resv_prop_str);
why not use qom setters directly
(they have error argument and can gracefully error out, which is expected error handling in pre_plug)
and fix up similar (ab)use of setters in virt_machine_device_pre_plug_cb()
Quoted 7 lines
hw/i386/pc.c +1
-0+g_free (resv_prop_str); } }@@ -1381,6 +1395,17 @@ static void pc_machine_device_plug_cb(HotplugHandler *hotplug_dev, }else if (object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_PMEM_PCI ) ||object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_MEM_PCI )) {
hw/i386/pc.c static void pc_machine_device_plug_cb(HotplugHandler *hotplug_dev, · line 1406
Quoted 10 lines
hw/i386/pc.c +9
-0pc_virtio_md_pci_plug (hotplug_dev, dev, errp); + }else if (object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_IOMMU_PCI )) { +PCMachineState *pcms =PC_MACHINE (hotplug_dev); +PCIDevice *pdev =PCI_DEVICE (dev); + +if (pcms->virtio_iommu) { +error_setg (errp, +"QEMU does not support multiple vIOMMUs for x86 yet." ); +return ; + }
move to pre_plug please
Quoted 27 lines
hw/i386/pc.c +4
-1+ pcms->virtio_iommu = true; + pcms->virtio_iommu_bdf =pci_get_bdf (pdev); } }@@ -1422,7 +1447,8 @@ static HotplugHandler *pc_get_hotplug_handler(MachineState *machine,if (object_dynamic_cast (OBJECT (dev),TYPE_PC_DIMM ) ||object_dynamic_cast (OBJECT (dev),TYPE_CPU ) ||object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_PMEM_PCI ) || -object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_MEM_PCI )) { +object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_MEM_PCI ) || +object_dynamic_cast (OBJECT (dev),TYPE_VIRTIO_IOMMU_PCI )) {return HOTPLUG_HANDLER (machine); }hw/i386/Kconfig +1
-0@@ -54,6 +54,7 @@ config PC_ACPI select ACPI_X86 select ACPI_CPU_HOTPLUG select ACPI_MEMORY_HOTPLUG + select ACPI_VIOT select SMBUS_EEPROM select PFLASH_CFI01 depends on ACPI_SMBUS
Re: [PATCH v3 05/10] pc: Allow instantiating a virtio-iommu device
Quoted 7 lines · Igor Mammedov
hw/i386/pc.c void pc_machine_done(Notifier *notifier, void *data) · line 806
Quoted 4 lines
hw/i386/pc.c +4
-0+if (pcms->virtio_iommu &&x86_iommu_get_default ()) { +error_report ("QEMU does not support multiple vIOMMUs for x86 yet." ); +exit (EXIT_FAILURE ); + }previous patch does similar check, doesn't it?
So is why it's not implement the same way?
The existing check for Intel and AMD IOMMUs is in x86_iommu_set_default(), but virtio-iommu isn't an X86IOMMUState (because it already inherits virtio object, and because X86IOMMUState is used for IRQ remapping which isn't supported by virtio-iommu).
I'll move the check from X86IOMMUState into pre_plug to avoid the duplication.
Thanks,
Jean
PATCH v3 6/10 tests/acpi: allow updates of VIOT expected data files
In reply to Jean-Philippe BruckerCreate empty data files and allow updates for the upcoming VIOT tests.
--- tests/qtest/bios-tables-test-allowed-diff.h | 3 +++ tests/data/acpi/q35/DSDT.viot | 0 tests/data/acpi/q35/VIOT.viot | 0 tests/data/acpi/virt/VIOT | 0 4 files changed, 3 insertions(+) create mode 100644 tests/data/acpi/q35/DSDT.viot create mode 100644 tests/data/acpi/q35/VIOT.viot create mode 100644 tests/data/acpi/virt/VIOT
tests/qtest/bios-tables-test-allowed-diff.h +3 -0
@@ -1 +1,4 @@/* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/virt/VIOT" , +"tests/data/acpi/q35/DSDT.viot" , +"tests/data/acpi/q35/VIOT.viot",
tests/data/acpi/q35/DSDT.viot new file +0 -0
tests/data/acpi/q35/VIOT.viot new file +0 -0
tests/data/acpi/virt/VIOT new file +0 -0
Signature · 1 line
2.33.0
PATCH v3 7/10 tests/acpi: add test cases for VIOT
In reply to Jean-Philippe BruckerAdd two test cases for VIOT, one on the q35 machine and the other on virt. To test complex topologies the q35 test has two PCIe buses that bypass the IOMMU (and are therefore not described by VIOT), and two buses that are translated by virtio-iommu.
--- tests/qtest/bios-tables-test.c | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
tests/qtest/bios-tables-test.c +39 -0
@@ -1403,6 +1403,43 @@ static void test_acpi_virt_tcg(void)free_test_data (&data); } +static void test_acpi_q35_viot (void ) +{ +test_data data = { + .machine =MACHINE_Q35 , + .variant =".viot" , + .blkdev ="virtio-blk,bus=pcie.0" , + }; + +/* +* To keep things interesting, two buses bypass the IOMMU. +* VIOT should only describes the other two buses. +*/ +test_acpi_one ("-machine default_bus_bypass_iommu=on " +"-device virtio-iommu " +"-device pxb-pcie,bus_nr=0x10,id=pcie.100,bus=pcie.0 " +"-device pxb-pcie,bus_nr=0x20,id=pcie.200,bus=pcie.0,bypass_iommu=on " +"-device pxb-pcie,bus_nr=0x30,id=pcie.300,bus=pcie.0" , + &data); +free_test_data (&data); +} + +static void test_acpi_virt_viot (void ) +{ +test_data data = { + .machine ="virt" , + .uefi_fl1 ="pc-bios/edk2-aarch64-code.fd" , + .uefi_fl2 ="pc-bios/edk2-arm-vars.fd" , + .cd ="tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2" , + .ram_start =0x40000000ULL , + .scan_len =128ULL *1024 *1024 , + }; + +test_acpi_one ("-cpu cortex-a57 " +"-device virtio-iommu" , &data); +free_test_data (&data); +} +static void test_oem_fields (test_data *data) {int i;
@@ -1567,12 +1604,14 @@ int main(int argc, char *argv[])if (strcmp (arch,"x86_64" ) ==0 ) {qtest_add_func ("acpi/microvm/pcie" , test_acpi_microvm_pcie_tcg); } +qtest_add_func ("acpi/q35/viot" , test_acpi_q35_viot); }else if (strcmp (arch,"aarch64" ) ==0 ) {qtest_add_func ("acpi/virt" , test_acpi_virt_tcg);qtest_add_func ("acpi/virt/numamem" , test_acpi_virt_tcg_numamem);qtest_add_func ("acpi/virt/memhp" , test_acpi_virt_tcg_memhp);qtest_add_func ("acpi/virt/pxb" , test_acpi_virt_tcg_pxb);qtest_add_func ("acpi/virt/oem-fields" , test_acpi_oem_fields_virt); +qtest_add_func ("acpi/virt/viot" , test_acpi_virt_viot); } ret =g_test_run ();boot_sector_cleanup (disk);
Signature · 1 line
2.33.0
Re: [PATCH v3 07/10] tests/acpi: add test cases for VIOT
Quoted 15 lines · On Tue, 14 Sep 2021 15:20:02 +0100 Jean-Philippe Brucker…
Add two test cases for VIOT, one on the q35 machine and the other on virt. To test complex topologies the q35 test has two PCIe buses that bypass the IOMMU (and are therefore not described by VIOT), and two buses that are translated by virtio-iommu.
Signed-off-by Jean-Philippe Brucker <[email protected]>--- tests/qtest/bios-tables-test.c | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)tests/qtest/bios-tables-test.c +0
-0
tests/qtest/bios-tables-test.c static void test_acpi_virt_tcg(void) · line 1412
Quoted 10 lines
tests/qtest/bios-tables-test.c +6
-0@@ -1403,6 +1403,43 @@ static void test_acpi_virt_tcg(void)free_test_data (&data); } +static void test_acpi_q35_viot (void ) +{ +test_data data = { + .machine =MACHINE_Q35 , + .variant =".viot" , + .blkdev ="virtio-blk,bus=pcie.0" ,
why is this necessary?
Quoted 49 lines
tests/qtest/bios-tables-test.c +31
-0+ }; + +/* +* To keep things interesting, two buses bypass the IOMMU. +* VIOT should only describes the other two buses. +*/ +test_acpi_one ("-machine default_bus_bypass_iommu=on " +"-device virtio-iommu " +"-device pxb-pcie,bus_nr=0x10,id=pcie.100,bus=pcie.0 " +"-device pxb-pcie,bus_nr=0x20,id=pcie.200,bus=pcie.0,bypass_iommu=on " +"-device pxb-pcie,bus_nr=0x30,id=pcie.300,bus=pcie.0" , + &data); +free_test_data (&data); +} + +static void test_acpi_virt_viot (void ) +{ +test_data data = { + .machine ="virt" , + .uefi_fl1 ="pc-bios/edk2-aarch64-code.fd" , + .uefi_fl2 ="pc-bios/edk2-arm-vars.fd" , + .cd ="tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2" , + .ram_start =0x40000000ULL , + .scan_len =128ULL *1024 *1024 , + }; + +test_acpi_one ("-cpu cortex-a57 " +"-device virtio-iommu" , &data); +free_test_data (&data); +} +static void test_oem_fields (test_data *data) {int i;tests/qtest/bios-tables-test.c +2
-0@@ -1567,12 +1604,14 @@ int main(int argc, char *argv[])if (strcmp (arch,"x86_64" ) ==0 ) {qtest_add_func ("acpi/microvm/pcie" , test_acpi_microvm_pcie_tcg); } +qtest_add_func ("acpi/q35/viot" , test_acpi_q35_viot); }else if (strcmp (arch,"aarch64" ) ==0 ) {qtest_add_func ("acpi/virt" , test_acpi_virt_tcg);qtest_add_func ("acpi/virt/numamem" , test_acpi_virt_tcg_numamem);qtest_add_func ("acpi/virt/memhp" , test_acpi_virt_tcg_memhp);qtest_add_func ("acpi/virt/pxb" , test_acpi_virt_tcg_pxb);qtest_add_func ("acpi/virt/oem-fields" , test_acpi_oem_fields_virt); +qtest_add_func ("acpi/virt/viot" , test_acpi_virt_viot); } ret =g_test_run ();boot_sector_cleanup (disk);
Re: [PATCH v3 07/10] tests/acpi: add test cases for VIOT
Quoted 8 lines · Igor Mammedov
tests/qtest/bios-tables-test.c static void test_acpi_virt_tcg(void) · line 1411
Quoted 7 lines
tests/qtest/bios-tables-test.c +6
-0+static void test_acpi_q35_viot (void ) +{ +test_data data = { + .machine =MACHINE_Q35 , + .variant =".viot" , + .blkdev ="virtio-blk,bus=pcie.0" ,why is this necessary?
It isn't actually, I think an earlier version of the patch needed it. I'll remove this.
Thanks,
Jean
PATCH v3 8/10 tests/acpi: add expected VIOT blob for virt machine
In reply to Jean-Philippe BruckerThe VIOT blob contains the following:
[000h 0000 4] Signature : "VIOT" [Virtual I/O Translation Table] [004h 0004 4] Table Length : 00000058 [008h 0008 1] Revision : 00 [009h 0009 1] Checksum : 66 [00Ah 0010 6] Oem ID : "BOCHS " [010h 0016 8] Oem Table ID : "BXPC " [018h 0024 4] Oem Revision : 00000001 [01Ch 0028 4] Asl Compiler ID : "BXPC" [020h 0032 4] Asl Compiler Revision : 00000001
[024h 0036 2] Node count : 0002 [026h 0038 2] Node offset : 0030 [028h 0040 8] Reserved : 0000000000000000
[030h 0048 1] Type : 03 [VirtIO-PCI IOMMU] [031h 0049 1] Reserved : 00 [032h 0050 2] Length : 0010
[034h 0052 2] PCI Segment : 0000 [036h 0054 2] PCI BDF number : 0008 [038h 0056 8] Reserved : 0000000000000000
[040h 0064 1] Type : 01 [PCI Range] [041h 0065 1] Reserved : 00 [042h 0066 2] Length : 0018
[044h 0068 4] Endpoint start : 00000000 [048h 0072 2] PCI Segment start : 0000 [04Ah 0074 2] PCI Segment end : 0000 [04Ch 0076 2] PCI BDF start : 0000 [04Eh 0078 2] PCI BDF end : 00FF [050h 0080 2] Output node : 0030 [052h 0082 6] Reserved : 000000000000
--- tests/qtest/bios-tables-test-allowed-diff.h | 1 - tests/data/acpi/virt/VIOT | Bin 0 -> 88 bytes 2 files changed, 1 deletion(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -1
@@ -1,4 +1,3 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/virt/VIOT" ,"tests/data/acpi/q35/DSDT.viot" , "tests/data/acpi/q35/VIOT.viot",
tests/data/acpi/virt/VIOT binary +0 -0
Signature · 1 line
2.33.0
PATCH v3 9/10 tests/acpi: add expected DSDT blob for VIOT test on q35
In reply to Jean-Philippe BruckerThe VIOT test instantiates two virtio devices and PCIe expander bridges, so the DSDT has additional blocks:
+ Scope (\_SB)
+ {
+ Device (PC30)
+ {
+ Name (_UID, 0x30) // _UID: Unique ID
+ Name (_BBN, 0x30) // _BBN: BIOS Bus Number
+ Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID
+ Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID
+ Method (_OSC, 4, NotSerialized) // _OSC: Operating System Capabilities
+ {
+ CreateDWordField (Arg3, Zero, CDW1)
+ If ((Arg0 == ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */))
+ {
+ CreateDWordField (Arg3, 0x04, CDW2)
+ CreateDWordField (Arg3, 0x08, CDW3)
+ Local0 = CDW3 /* \_SB_.PC30._OSC.CDW3 */
+ Local0 &= 0x1F
+ If ((Arg1 != One))
+ {+ CDW1 |= 0x08
+ }
+
+ If ((CDW3 != Local0))
+ {
+ CDW1 |= 0x10
+ }
+
+ CDW3 = Local0
+ }
+ Else
+ {+ CDW1 |= 0x04
+ }
+
+ Return (Arg3)
+ }
+
+ Method (_PRT, 0, NotSerialized) // _PRT: PCI Routing Table
+ {
+ Local0 = Package (0x80){}
+ Local1 = Zero
+ While ((Local1 < 0x80))
+ {
+ Local2 = (Local1 >> 0x02)
+ Local3 = ((Local1 + Local2) & 0x03)
+ If ((Local3 == Zero))
+ {
+ Local4 = Package (0x04)
+ {
+ Zero,
+ Zero,
+ LNKD,
+ Zero+ }
+ }
+
+ If ((Local3 == One))
+ {
+ Local4 = Package (0x04)
+ {
+ Zero, + Zero, + LNKA, + Zero
+ }
+ }
+
+ If ((Local3 == 0x02))
+ {
+ Local4 = Package (0x04)
+ {
+ Zero, + Zero, + LNKB, + Zero
+ }
+ }
+
+ If ((Local3 == 0x03))
+ {
+ Local4 = Package (0x04)
+ {
+ Zero, + Zero, + LNKC, + Zero + } + } + + Local4 [Zero] = ((Local2 << 0x10) | 0xFFFF) + Local4 [One] = (Local1 & 0x03) + Local0 [Local1] = Local4 + Local1++
+ }
+
+ Return (Local0)
+ }
+
+ Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
+ {
+ WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
+ 0x0000, // Granularity + 0x0030, // Range Minimum + 0x0030, // Range Maximum + 0x0000, // Translation Offset + 0x0001, // Length + ,, )
+ })
+ }
+ }
+
+ Scope (\_SB)
+ {
+ Device (PC20)
+ {
+ Name (_UID, 0x20) // _UID: Unique ID
+ Name (_BBN, 0x20) // _BBN: BIOS Bus Number
+ Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID
+ Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID
+ Method (_OSC, 4, NotSerialized) // _OSC: Operating System Capabilities
+ {
+ CreateDWordField (Arg3, Zero, CDW1)
+ If ((Arg0 == ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */))
+ {
+ CreateDWordField (Arg3, 0x04, CDW2)
+ CreateDWordField (Arg3, 0x08, CDW3)
+ Local0 = CDW3 /* \_SB_.PC20._OSC.CDW3 */
+ Local0 &= 0x1F
+ If ((Arg1 != One))
+ {+ CDW1 |= 0x08
+ }
+
+ If ((CDW3 != Local0))
+ {
+ CDW1 |= 0x10
+ }
+
+ CDW3 = Local0
+ }
+ Else
+ {+ CDW1 |= 0x04
+ }
+
+ Return (Arg3)
+ }
+
+ Method (_PRT, 0, NotSerialized) // _PRT: PCI Routing Table
+ {
+ Local0 = Package (0x80){}
+ Local1 = Zero
+ While ((Local1 < 0x80))
+ {
+ Local2 = (Local1 >> 0x02)
+ Local3 = ((Local1 + Local2) & 0x03)
+ If ((Local3 == Zero))
+ {
+ Local4 = Package (0x04)
+ {
+ Zero,
+ Zero,
+ LNKD,
+ Zero+ }
+ }
+
+ If ((Local3 == One))
+ {
+ Local4 = Package (0x04)
+ {
+ Zero, + Zero, + LNKA, + Zero
+ }
+ }
+
+ If ((Local3 == 0x02))
+ {
+ Local4 = Package (0x04)
+ {
+ Zero, + Zero, + LNKB, + Zero
+ }
+ }
+
+ If ((Local3 == 0x03))
+ {
+ Local4 = Package (0x04)
+ {
+ Zero, + Zero, + LNKC, + Zero + } + } + + Local4 [Zero] = ((Local2 << 0x10) | 0xFFFF) + Local4 [One] = (Local1 & 0x03) + Local0 [Local1] = Local4 + Local1++
+ }
+
+ Return (Local0)
+ }
+
+ Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
+ {
+ WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
+ 0x0000, // Granularity + 0x0020, // Range Minimum + 0x0020, // Range Maximum + 0x0000, // Translation Offset + 0x0001, // Length + ,, )
+ })
+ }
+ }
+
+ Scope (\_SB)
+ {
+ Device (PC10)
+ {
+ Name (_UID, 0x10) // _UID: Unique ID
+ Name (_BBN, 0x10) // _BBN: BIOS Bus Number
+ Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */) // _HID: Hardware ID
+ Name (_CID, EisaId ("PNP0A03") /* PCI Bus */) // _CID: Compatible ID
+ Method (_OSC, 4, NotSerialized) // _OSC: Operating System Capabilities
+ {
+ CreateDWordField (Arg3, Zero, CDW1)
+ If ((Arg0 == ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */))
+ {
+ CreateDWordField (Arg3, 0x04, CDW2)
+ CreateDWordField (Arg3, 0x08, CDW3)
+ Local0 = CDW3 /* \_SB_.PC10._OSC.CDW3 */
+ Local0 &= 0x1F
+ If ((Arg1 != One))
+ {+ CDW1 |= 0x08
+ }
+
+ If ((CDW3 != Local0))
+ {
+ CDW1 |= 0x10
+ }
+
+ CDW3 = Local0
+ }
+ Else
+ {+ CDW1 |= 0x04
+ }
+
+ Return (Arg3)
+ }
+
+ Method (_PRT, 0, NotSerialized) // _PRT: PCI Routing Table
+ {
+ Local0 = Package (0x80){}
+ Local1 = Zero
+ While ((Local1 < 0x80))
+ {
+ Local2 = (Local1 >> 0x02)
+ Local3 = ((Local1 + Local2) & 0x03)
+ If ((Local3 == Zero))
+ {
+ Local4 = Package (0x04)
+ {
+ Zero,
+ Zero,
+ LNKD,
+ Zero+ }
+ }
+
+ If ((Local3 == One))
+ {
+ Local4 = Package (0x04)
+ {
+ Zero, + Zero, + LNKA, + Zero
+ }
+ }
+
+ If ((Local3 == 0x02))
+ {
+ Local4 = Package (0x04)
+ {
+ Zero, + Zero, + LNKB, + Zero
+ }
+ }
+
+ If ((Local3 == 0x03))
+ {
+ Local4 = Package (0x04)
+ {
+ Zero, + Zero, + LNKC, + Zero + } + } + + Local4 [Zero] = ((Local2 << 0x10) | 0xFFFF) + Local4 [One] = (Local1 & 0x03) + Local0 [Local1] = Local4 + Local1++
+ }
+
+ Return (Local0)
+ }
+
+ Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
+ {
+ WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
+ 0x0000, // Granularity + 0x0010, // Range Minimum + 0x0010, // Range Maximum + 0x0000, // Translation Offset + 0x0001, // Length + ,, )
+ })
+ }
+ }
+
Scope (\_SB.PCI0)
{
Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
{
WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
0x0000, // Granularity
0x0000, // Range Minimum
- 0x00FF, // Range Maximum
+ 0x000F, // Range Maximum
0x0000, // Translation Offset
- 0x0100, // Length
+ 0x0010, // Length
,, )[...]
+ Device (S10)
+ {
+ Name (_ADR, 0x00020000) // _ADR: Address
+ }
+
+ Device (S18)
+ {
+ Name (_ADR, 0x00030000) // _ADR: Address
+ }
+
+ Device (S20)
+ {
+ Name (_ADR, 0x00040000) // _ADR: Address
+ }
+
+ Device (S28)
+ {
+ Name (_ADR, 0x00050000) // _ADR: Address
+ }
+
+ Device (S30)
+ {
+ Name (_ADR, 0x00060000) // _ADR: Address
+ }
+
Method (PCNT, 0, NotSerialized)
{
}
}
}}
--- tests/qtest/bios-tables-test-allowed-diff.h | 1 - tests/data/acpi/q35/DSDT.viot | Bin 0 -> 9415 bytes 2 files changed, 1 deletion(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -1
@@ -1,3 +1,2 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/q35/DSDT.viot" , "tests/data/acpi/q35/VIOT.viot",
tests/data/acpi/q35/DSDT.viot binary +0 -0
Signature · 1 line
2.33.0
PATCH v3 10/10 tests/acpi: add expected VIOT blob for q35 machine
In reply to Jean-Philippe BruckerThe VIOT table generated for the q35 test is:
[000h 0000 4] Signature : "VIOT" [Virtual I/O Translation Table] [004h 0004 4] Table Length : 00000070 [008h 0008 1] Revision : 00 [009h 0009 1] Checksum : 3D [00Ah 0010 6] Oem ID : "BOCHS " [010h 0016 8] Oem Table ID : "BXPC " [018h 0024 4] Oem Revision : 00000001 [01Ch 0028 4] Asl Compiler ID : "BXPC" [020h 0032 4] Asl Compiler Revision : 00000001
[024h 0036 2] Node count : 0003 [026h 0038 2] Node offset : 0030 [028h 0040 8] Reserved : 0000000000000000
[030h 0048 1] Type : 03 [VirtIO-PCI IOMMU] [031h 0049 1] Reserved : 00 [032h 0050 2] Length : 0010
[034h 0052 2] PCI Segment : 0000 [036h 0054 2] PCI BDF number : 0010 [038h 0056 8] Reserved : 0000000000000000
[040h 0064 1] Type : 01 [PCI Range] [041h 0065 1] Reserved : 00 [042h 0066 2] Length : 0018
[044h 0068 4] Endpoint start : 00001000 [048h 0072 2] PCI Segment start : 0000 [04Ah 0074 2] PCI Segment end : 0000 [04Ch 0076 2] PCI BDF start : 1000 [04Eh 0078 2] PCI BDF end : 10FF [050h 0080 2] Output node : 0030 [052h 0082 6] Reserved : 000000000000
[058h 0088 1] Type : 01 [PCI Range] [059h 0089 1] Reserved : 00 [05Ah 0090 2] Length : 0018
[05Ch 0092 4] Endpoint start : 00003000 [060h 0096 2] PCI Segment start : 0000 [062h 0098 2] PCI Segment end : 0000 [064h 0100 2] PCI BDF start : 3000 [066h 0102 2] PCI BDF end : 30FF [068h 0104 2] Output node : 0030 [06Ah 0106 6] Reserved : 000000000000
--- tests/qtest/bios-tables-test-allowed-diff.h | 1 - tests/data/acpi/q35/VIOT.viot | Bin 0 -> 112 bytes 2 files changed, 1 deletion(-)
tests/qtest/bios-tables-test-allowed-diff.h +0 -1
@@ -1,2 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/q35/VIOT.viot",
tests/data/acpi/q35/VIOT.viot binary +0 -0
Signature · 1 line
2.33.0
Re: [PATCH v3 10/10] tests/acpi: add expected VIOT blob for q35 machine
Quoted 1 line · On Tue, 14 Sep 2021 15:20:05 +0100 Jean-Philippe Brucker…
The VIOT table generated for the q35 test is:
I'd squash this into previous patch
Quoted 69 lines
[000h 0000 4] Signature : "VIOT" [Virtual I/O Translation Table] [004h 0004 4] Table Length : 00000070 [008h 0008 1] Revision : 00 [009h 0009 1] Checksum : 3D [00Ah 0010 6] Oem ID : "BOCHS " [010h 0016 8] Oem Table ID : "BXPC " [018h 0024 4] Oem Revision : 00000001 [01Ch 0028 4] Asl Compiler ID : "BXPC" [020h 0032 4] Asl Compiler Revision : 00000001[024h 0036 2] Node count : 0003 [026h 0038 2] Node offset : 0030 [028h 0040 8] Reserved : 0000000000000000[030h 0048 1] Type : 03 [VirtIO-PCI IOMMU] [031h 0049 1] Reserved : 00 [032h 0050 2] Length : 0010[034h 0052 2] PCI Segment : 0000 [036h 0054 2] PCI BDF number : 0010 [038h 0056 8] Reserved : 0000000000000000[040h 0064 1] Type : 01 [PCI Range] [041h 0065 1] Reserved : 00 [042h 0066 2] Length : 0018[044h 0068 4] Endpoint start : 00001000 [048h 0072 2] PCI Segment start : 0000 [04Ah 0074 2] PCI Segment end : 0000 [04Ch 0076 2] PCI BDF start : 1000 [04Eh 0078 2] PCI BDF end : 10FF [050h 0080 2] Output node : 0030 [052h 0082 6] Reserved : 000000000000[058h 0088 1] Type : 01 [PCI Range] [059h 0089 1] Reserved : 00 [05Ah 0090 2] Length : 0018[05Ch 0092 4] Endpoint start : 00003000 [060h 0096 2] PCI Segment start : 0000 [062h 0098 2] PCI Segment end : 0000 [064h 0100 2] PCI BDF start : 3000 [066h 0102 2] PCI BDF end : 30FF [068h 0104 2] Output node : 0030 [06Ah 0106 6] Reserved : 000000000000Signed-off-by Jean-Philippe Brucker <[email protected]>--- tests/qtest/bios-tables-test-allowed-diff.h | 1 - tests/data/acpi/q35/VIOT.viot | Bin 0 -> 112 bytes 2 files changed, 1 deletion(-)tests/qtest/bios-tables-test-allowed-diff.h +0
-1@@ -1,2 +1 @@/* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/q35/VIOT.viot",tests/data/acpi/q35/VIOT.viot binary +0
-0zcmWIZ^baXu00LVle`k+i1*eDrX9XZ&1PX!JAex!M0Hgv8m>C3sGzdcgBZCBjEAU?c OrV=a;;~4xmfH48g0SW;C
literal 0
HcmV?d00001