AMD IOMMU: emulate multiple devices
Hello all,
This patch tries to solve a problem whereby real AMD IOMMUs exhibit both PCI and Platform device properties. AMD IOMMU properties that conflict with conventional PCI devices' features include the fact that its not a BusMaster device, reserves MMIO region without a BAR register.
There is some already ongoing work on Intel IOMMU Interrupt remapping with implements an IOMMU base class, as a platform device(which means the moment I inherit from this class my device loses it's PCI properties). I am therefore forced to find a way to combine both PCI and platform features(which I had previously avoided) into AMD IOMMU.
This patch implements a dummy PCI device which serves to 'steal' PCI config space while the rest of the device remains a platform device. The platform device maintains a reference to the PCI and hence the relevant PCI config space. Please ignore details in this patch and review the design. Also, some of the changes here are not related to the above issue.
Looking forward to your comments!
David Kiarie (1):
Allow AMD IOMMU to have both SysBusDevice and PCIDevice properties.
hw/acpi/aml-build.c | 2 +- hw/i386/amd_iommu.c | 1471 +++++++++++++++++++++++++++++++++++++++++++ hw/i386/amd_iommu.h | 348 ++++++++++ hw/i386/kvm/pci-assign.c | 2 +- hw/i386/pc_q35.c | 1 + include/hw/acpi/acpi-defs.h | 13 + include/hw/acpi/aml-build.h | 1 + include/hw/pci/pci.h | 10 +- qemu-options.hx | 7 +- util/qemu-config.c | 8 +- 10 files changed, 1853 insertions(+), 10 deletions(-) create mode 100644 hw/i386/amd_iommu.c create mode 100644 hw/i386/amd_iommu.h
Signature · 1 line
2.1.4
RFC 1/1 Allow AMD IOMMU to have both SysBusDevice and PCIDevice properties.
--- hw/acpi/aml-build.c | 2 +- hw/i386/amd_iommu.c | 1471 +++++++++++++++++++++++++++++++++++++++++++ hw/i386/amd_iommu.h | 348 ++++++++++ hw/i386/kvm/pci-assign.c | 2 +- hw/i386/pc_q35.c | 1 + include/hw/acpi/acpi-defs.h | 13 + include/hw/acpi/aml-build.h | 1 + include/hw/pci/pci.h | 10 +- qemu-options.hx | 7 +- util/qemu-config.c | 8 +- 10 files changed, 1853 insertions(+), 10 deletions(-) create mode 100644 hw/i386/amd_iommu.c create mode 100644 hw/i386/amd_iommu.h
hw/acpi/aml-build.c +1 -1
@@ -227,7 +227,7 @@ static void build_extop_package(GArray *package, uint8_t op)build_prepend_byte (package,0x5B );/* ExtOpPrefix */ } -static void build_append_int_noprefix (GArray *table,uint64_t value,int size) +void build_append_int_noprefix (GArray *table,uint64_t value,int size) {int i;
hw/i386/amd_iommu.c new file +1471 -0
1,471 lines not on this page · raw message
hw/i386/amd_iommu.h new file +348 -0
348 lines not on this page · raw message
hw/i386/kvm/pci-assign.c +1 -1
@@ -1479,7 +1479,7 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev, Error **errp)* error bits, leave the rest. */ status =pci_get_long (pci_dev->config + pos +PCI_X_STATUS ); status &= ~(PCI_X_STATUS_BUS |PCI_X_STATUS_DEVFN ); - status |=pci_requester_id (pci_dev); + status |=pci_get_bdf (pci_dev); status &= ~(PCI_X_STATUS_SPL_DISC |PCI_X_STATUS_UNX_SPL |PCI_X_STATUS_SPL_ERR );pci_set_long (pci_dev->config + pos +PCI_X_STATUS , status);
hw/i386/pc_q35.c +1 -0
@@ -281,6 +281,7 @@ static void pc_q35_machine_options(MachineClass *m) m->default_machine_opts ="firmware=bios-256k.bin" ; m->default_display ="std" ; m->no_floppy =1 ; + m->has_dynamic_sysbus = true; }static void pc_q35_2_6_machine_options (MachineClass *m)
include/hw/acpi/acpi-defs.h +13 -0
@@ -598,4 +598,17 @@ typedef struct AcpiDmarHardwareUnit AcpiDmarHardwareUnit;/* Masks for Flags field above */ #define ACPI_DMAR_INCLUDE_PCI_ALL 1 +/* IVRS constants */ +#define AMD_IOMMU_HOST_ADDRESS_WIDTH 40UL + +/* flags in the IVHD headers */ +#define IVHD_HT_TUNEN (1UL << 0)/* recommended setting for HtTunEn */ +#define IVHD_IOTLBSUP (1UL << 4)/* remote IOTLB support */ +#define IVHD_PREFSUP (1UL << 6)/* page prefetch support */ +#define IVHD_PPRSUP (1UL << 7)/* peripheral page service support */ + +#define IVHD_EFR_HATS 48/* host address translation size */ +#define IVHD_EFR_GATS 48/* guest address translation size */ +#define IVHD_EFR_GTSUP (1UL << 2)/* guest translation support */ +#endif
include/hw/acpi/aml-build.h +1 -0
@@ -362,6 +362,7 @@ Aml *aml_derefof(Aml *arg);Aml *aml_sizeof (Aml *arg);Aml *aml_concatenate (Aml *source1,Aml *source2,Aml *target); +void build_append_int_noprefix (GArray *table,uint64_t value,int size); void build_header(GArray *linker, GArray *table_data, AcpiTableHeader *h, const char *sig, int len, uint8_t rev,
include/hw/pci/pci.h +6 -4
@@ -11,10 +11,11 @@#include "hw/pci/pcie.h" /* PCI bus */ - +#define PCI_DEVID (bus, devfn) ((((uint16_t)(bus)) << 8) | (devfn))#define PCI_DEVFN (slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07))#define PCI_SLOT (devfn) (((devfn) >> 3) & 0x1f)#define PCI_FUNC (devfn) ((devfn) & 0x07) +#define PCI_BUILD_BDF (bus, devfn) ((bus << 8) | (devfn))#define PCI_SLOT_MAX 32#define PCI_FUNC_MAX 8
@@ -328,7 +329,6 @@ int pci_add_capability(PCIDevice *pdev, uint8_t cap_id,int pci_add_capability2 (PCIDevice *pdev,uint8_t cap_id,uint8_t offset,uint8_t size,Error **errp); -void pci_del_capability (PCIDevice *pci_dev,uint8_t cap_id,uint8_t cap_size);uint8_t pci_find_capability (PCIDevice *pci_dev,uint8_t cap_id);
@@ -692,11 +692,13 @@ static inline uint32_t pci_config_size(const PCIDevice *d)return pci_is_express (d) ?PCIE_CONFIG_SPACE_SIZE :PCI_CONFIG_SPACE_SIZE ; } -static inline uint16_t pci_requester_id (PCIDevice *dev) +static inline uint16_t pci_get_bdf (PCIDevice *dev) { -return (pci_bus_num (dev->bus) <<8 ) | dev->devfn; +return PCI_BUILD_BDF (pci_bus_num (dev->bus), dev->devfn); } +uint16_t pci_requester_id (PCIDevice *dev); +/* DMA access functions */ static inline AddressSpace *pci_get_address_space (PCIDevice *dev) {
qemu-options.hx +5 -2
@@ -38,7 +38,8 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ " kvm_shadow_mem=size of KVM shadow MMU\n" " dump-guest-core=on|off include guest memory in a core dump (default=on)\n" " mem-merge=on|off controls memory merge support (default: on)\n" - " iommu=on|off controls emulated Intel IOMMU (VT-d) support (default=off)\n" + " iommu=on|off controls emulated IOMMU support(default: off)\n" + " x-iommu-type=amd|intel overrides emulated IOMMU to AMD IOMMU (default: intel)\n" " igd-passthru=on|off controls IGD GFX passthrough support (default=off)\n" " aes-key-wrap=on|off controls support for AES key wrapping (default=on)\n" " dea-key-wrap=on|off controls support for DEA key wrapping (default=on)\n"
@@ -74,7 +75,9 @@ Enables or disables memory merge support. This feature, when supported by the host, de-duplicates identical memory pages among VMs instances (enabled by default). @item iommu=on|off -Enables or disables emulated Intel IOMMU (VT-d) support. The default is off. +Enables and disables IOMMU emulation. The default is off. +@item x-iommu-type=on|off +Overrides emulated IOMMU from AMD IOMMU. By default Intel IOMMU is emulated. @item aes-key-wrap=on|off Enables or disables AES key wrapping support on s390-ccw hosts. This feature controls whether AES wrapping keys will be created to allow
util/qemu-config.c +6 -2
@@ -213,8 +213,12 @@ static QemuOptsList machine_opts = { .help = "firmware image", },{ .name = "iommu", - .type = QEMU_OPT_BOOL, - .help = "Set on/off to enable/disable Intel IOMMU (VT-d)", + .type = QEMU_OPT_BOOL, + .help = "Set on/off to enable iommu", + },{ + .name = "x-iommu-type", + .type = QEMU_OPT_STRING, + .help = "Overrides emulated IOMMU from Intel to AMD", },{ .name = "suppress-vmdesc", .type = QEMU_OPT_BOOL,
Signature · 1 line
2.1.4
Re: [Qemu-devel] [RFC] Allow AMD IOMMU to have both SysBusDevice and PCIDevice properties.
Hi,
I didn't review the amd_iommu.c code, but there seems to be some unrelated changes in the patch:
Quoted 21 lines · David Kiarie
Signed-off-by David Kiarie <[email protected]>--- hw/acpi/aml-build.c | 2 +- hw/i386/amd_iommu.c | 1471 +++++++++++++++++++++++++++++++++++++++++++ hw/i386/amd_iommu.h | 348 ++++++++++ hw/i386/kvm/pci-assign.c | 2 +- hw/i386/pc_q35.c | 1 + include/hw/acpi/acpi-defs.h | 13 + include/hw/acpi/aml-build.h | 1 + include/hw/pci/pci.h | 10 +- qemu-options.hx | 7 +- util/qemu-config.c | 8 +- 10 files changed, 1853 insertions(+), 10 deletions(-) create mode 100644 hw/i386/amd_iommu.c create mode 100644 hw/i386/amd_iommu.hhw/acpi/aml-build.c +0
-0
hw/acpi/aml-build.c static void build_extop_package(GArray *package, uint8_t op) · line 230
Quoted 5 lines
hw/acpi/aml-build.c +1
-1@@ -227,7 +227,7 @@ static void build_extop_package(GArray *package, uint8_t op)build_prepend_byte (package,0x5B );/* ExtOpPrefix */ } -static void build_append_int_noprefix (GArray *table,uint64_t value,int size) +void build_append_int_noprefix (GArray *table,uint64_t value,int size)
Why this change?
Quoted 3 lines
hw/acpi/aml-build.c +0
-0{int i;
[...]
hw/i386/pc_q35.c static void pc_q35_machine_options(MachineClass *m) · line 284
Quoted 9 lines
hw/i386/pc_q35.c +1
-0@@ -281,6 +281,7 @@ static void pc_q35_machine_options(MachineClass *m) m->default_machine_opts ="firmware=bios-256k.bin" ; m->default_display ="std" ; m->no_floppy =1 ; + m->has_dynamic_sysbus = true;
Why is this needed? Is it possible to do this change before adding the iommu code? Can this be done in a separate patch that documents why it should be changed and why it is safe to set it to true?
Quoted 2 lines
hw/i386/pc_q35.c +0
-0}
[...]
Quoted 5 lines
include/hw/pci/pci.h +0
-0
include/hw/pci/pci.h line 18
Quoted 9 lines
include/hw/pci/pci.h +2
-1@@ -11,10 +11,11 @@#include "hw/pci/pcie.h" /* PCI bus */ - +#define PCI_DEVID (bus, devfn) ((((uint16_t)(bus)) << 8) | (devfn))#define PCI_DEVFN (slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07))#define PCI_SLOT (devfn) (((devfn) >> 3) & 0x1f)#define PCI_FUNC (devfn) ((devfn) & 0x07) +#define PCI_BUILD_BDF (bus, devfn) ((bus << 8) | (devfn))
Missing parenthesis around (bus).
include/hw/pci/pci.h int pci_add_capability(PCIDevice *pdev, uint8_t cap_id, · line 331
Quoted 8 lines
include/hw/pci/pci.h +0
-1#define PCI_SLOT_MAX 32#define PCI_FUNC_MAX 8@@ -328,7 +329,6 @@ int pci_add_capability(PCIDevice *pdev, uint8_t cap_id,int pci_add_capability2 (PCIDevice *pdev,uint8_t cap_id,uint8_t offset,uint8_t size,Error **errp); -
Unrelated whitespace change.
Quoted 6 lines
include/hw/pci/pci.h +0
-0void pci_del_capability (PCIDevice *pci_dev,uint8_t cap_id,uint8_t cap_size);uint8_t pci_find_capability (PCIDevice *pci_dev,uint8_t cap_id);@@ -692,11 +692,13 @@ static inline uint32_t pci_config_size(const PCIDevice *d)return pci_is_express (d) ?PCIE_CONFIG_SPACE_SIZE :PCI_CONFIG_SPACE_SIZE ; }
include/hw/pci/pci.h static inline uint32_t pci_config_size(const PCIDevice *d) · line 701
Quoted 10 lines
include/hw/pci/pci.h +4
-2-static inline uint16_t pci_requester_id (PCIDevice *dev) +static inline uint16_t pci_get_bdf (PCIDevice *dev) { -return (pci_bus_num (dev->bus) <<8 ) | dev->devfn; +return PCI_BUILD_BDF (pci_bus_num (dev->bus), dev->devfn); } +uint16_t pci_requester_id (PCIDevice *dev); +
Why is pci_requester_id() being kept? Where's its implementation?
pci_requester_id() is still being used at:
hw/pci/msi.c: attrs.requester_id = pci_requester_id(dev); hw/pci/pcie_aer.c: err.source_id = pci_requester_id(dev);
Quoted 8 lines
include/hw/pci/pci.h +0
-0/* DMA access functions */ static inline AddressSpace *pci_get_address_space (PCIDevice *dev) {qemu-options.hx +0
-0
qemu-options.hx DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ · line 42
Quoted 6 lines
qemu-options.hx +2
-1@@ -38,7 +38,8 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ " kvm_shadow_mem=size of KVM shadow MMU\n" " dump-guest-core=on|off include guest memory in a core dump (default=on)\n" " mem-merge=on|off controls memory merge support (default: on)\n" - " iommu=on|off controls emulated Intel IOMMU (VT-d) support (default=off)\n" + " iommu=on|off controls emulated IOMMU support(default: off)\n" + " x-iommu-type=amd|intel overrides emulated IOMMU to AMD IOMMU (default: intel)\n"
Where is the new x-iommu-type option being used?
Quoted 36 lines
qemu-options.hx +3
-1" igd-passthru=on|off controls IGD GFX passthrough support (default=off)\n" " aes-key-wrap=on|off controls support for AES key wrapping (default=on)\n" " dea-key-wrap=on|off controls support for DEA key wrapping (default=on)\n"@@ -74,7 +75,9 @@ Enables or disables memory merge support. This feature, when supported by the host, de-duplicates identical memory pages among VMs instances (enabled by default). @item iommu=on|off -Enables or disables emulated Intel IOMMU (VT-d) support. The default is off. +Enables and disables IOMMU emulation. The default is off. +@item x-iommu-type=on|off +Overrides emulated IOMMU from AMD IOMMU. By default Intel IOMMU is emulated. @item aes-key-wrap=on|off Enables or disables AES key wrapping support on s390-ccw hosts. This feature controls whether AES wrapping keys will be created to allowutil/qemu-config.c +6
-2@@ -213,8 +213,12 @@ static QemuOptsList machine_opts = { .help = "firmware image", },{ .name = "iommu", - .type = QEMU_OPT_BOOL, - .help = "Set on/off to enable/disable Intel IOMMU (VT-d)", + .type = QEMU_OPT_BOOL, + .help = "Set on/off to enable iommu", + },{ + .name = "x-iommu-type", + .type = QEMU_OPT_STRING, + .help = "Overrides emulated IOMMU from Intel to AMD", },{ .name = "suppress-vmdesc", .type = QEMU_OPT_BOOL,Signature · 1 line
2.1.4
Signature · 1 line
Eduardo
Re: [Qemu-devel] [RFC] Allow AMD IOMMU to have both SysBusDevice and PCIDevice properties.
Quoted 1 line · Eduardo Habkost
Hi,
Hello,
Quoted 3 lines
I didn't review the
amd_iommu.ccode, but there seems to be some unrelated changes in the patch:
Thanks for looking at this but I actually wanted someone to look at the amd_iommu.c. I mentioned in annotation that there are some unrelated changes because this work is based on code that has not been merged yet. I specifically sent this to have a review in amd_iommu.c not the details but the design. I have patchset that implements AMD IOMMU (translation only) which is implemented as a PCI device. It is however not possible to work on interrupt remapping without converting AMD IOMMU from a PCI device to a SysBusDevice. This device(AMD IOMMU), the one on this patch unlike in previous patches, creates to devices ; a PCI device and a SySBusDev which am not sure is acceptable.
Quoted 162 lines · David Kiarie
Quoted 21 lines
Signed-off-by David Kiarie <[email protected]>--- hw/acpi/aml-build.c | 2 +- hw/i386/amd_iommu.c | 1471 +++++++++++++++++++++++++++++++++++++++++++ hw/i386/amd_iommu.h | 348 ++++++++++ hw/i386/kvm/pci-assign.c | 2 +- hw/i386/pc_q35.c | 1 + include/hw/acpi/acpi-defs.h | 13 + include/hw/acpi/aml-build.h | 1 + include/hw/pci/pci.h | 10 +- qemu-options.hx | 7 +- util/qemu-config.c | 8 +- 10 files changed, 1853 insertions(+), 10 deletions(-) create mode 100644 hw/i386/amd_iommu.c create mode 100644 hw/i386/amd_iommu.hhw/acpi/aml-build.c +0
-0hw/acpi/aml-build.c static void build_extop_package(GArray *package, uint8_t op) · line 230
Quoted 5 lines
hw/acpi/aml-build.c +1
-1@@ -227,7 +227,7 @@ static void build_extop_package(GArray *package, uint8_t op)build_prepend_byte (package,0x5B );/* ExtOpPrefix */ } -static void build_append_int_noprefix (GArray *table,uint64_t value,int size) +void build_append_int_noprefix (GArray *table,uint64_t value,int size)Why this change?
Quoted 3 lines
hw/acpi/aml-build.c +0
-0{int i;[...]
hw/i386/pc_q35.c static void pc_q35_machine_options(MachineClass *m) · line 284
Quoted 9 lines
hw/i386/pc_q35.c +1
-0@@ -281,6 +281,7 @@ static void pc_q35_machine_options(MachineClass *m) m->default_machine_opts ="firmware=bios-256k.bin" ; m->default_display ="std" ; m->no_floppy =1 ; + m->has_dynamic_sysbus = true;Why is this needed? Is it possible to do this change before adding the iommu code? Can this be done in a separate patch that documents why it should be changed and why it is safe to set it to true?
Quoted 2 lines
hw/i386/pc_q35.c +0
-0}[...]
Quoted 5 lines
include/hw/pci/pci.h +0
-0include/hw/pci/pci.h line 18
Quoted 9 lines
include/hw/pci/pci.h +2
-1@@ -11,10 +11,11 @@#include "hw/pci/pcie.h" /* PCI bus */ - +#define PCI_DEVID (bus, devfn) ((((uint16_t)(bus)) << 8) | (devfn))#define PCI_DEVFN (slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07))#define PCI_SLOT (devfn) (((devfn) >> 3) & 0x1f)#define PCI_FUNC (devfn) ((devfn) & 0x07) +#define PCI_BUILD_BDF (bus, devfn) ((bus << 8) | (devfn))Missing parenthesis around (bus).
include/hw/pci/pci.h int pci_add_capability(PCIDevice *pdev, uint8_t cap_id, · line 331
Quoted 8 lines
include/hw/pci/pci.h +0
-1#define PCI_SLOT_MAX 32#define PCI_FUNC_MAX 8@@ -328,7 +329,6 @@ int pci_add_capability(PCIDevice *pdev, uint8_t cap_id,int pci_add_capability2 (PCIDevice *pdev,uint8_t cap_id,uint8_t offset,uint8_t size,Error **errp); -Unrelated whitespace change.
Quoted 6 lines
include/hw/pci/pci.h +0
-0void pci_del_capability (PCIDevice *pci_dev,uint8_t cap_id,uint8_t cap_size);uint8_t pci_find_capability (PCIDevice *pci_dev,uint8_t cap_id);@@ -692,11 +692,13 @@ static inline uint32_t pci_config_size(const PCIDevice *d)return pci_is_express (d) ?PCIE_CONFIG_SPACE_SIZE :PCI_CONFIG_SPACE_SIZE ; }include/hw/pci/pci.h static inline uint32_t pci_config_size(const PCIDevice *d) · line 701
Quoted 10 lines
include/hw/pci/pci.h +4
-2-static inline uint16_t pci_requester_id (PCIDevice *dev) +static inline uint16_t pci_get_bdf (PCIDevice *dev) { -return (pci_bus_num (dev->bus) <<8 ) | dev->devfn; +return PCI_BUILD_BDF (pci_bus_num (dev->bus), dev->devfn); } +uint16_t pci_requester_id (PCIDevice *dev); +Why is
pci_requester_id()being kept? Where's its implementation?
pci_requester_id()is still being used at:hw/pci/msi.c: attrs.requester_id = pci_requester_id(dev); hw/pci/pcie_aer.c: err.source_id = pci_requester_id(dev);Quoted 8 lines
include/hw/pci/pci.h +0
-0/* DMA access functions */ static inline AddressSpace *pci_get_address_space (PCIDevice *dev) {qemu-options.hx +0
-0qemu-options.hx DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ · line 42
Quoted 6 lines
qemu-options.hx +2
-1@@ -38,7 +38,8 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ " kvm_shadow_mem=size of KVM shadow MMU\n" " dump-guest-core=on|off include guest memory in a core dump (default=on)\n" " mem-merge=on|off controls memory merge support (default: on)\n" - " iommu=on|off controls emulated Intel IOMMU (VT-d) support (default=off)\n" + " iommu=on|off controls emulated IOMMU support(default: off)\n" + " x-iommu-type=amd|intel overrides emulated IOMMU to AMD IOMMU (default: intel)\n"Where is the new x-iommu-type option being used?
Quoted 34 lines
qemu-options.hx +3
-1" igd-passthru=on|off controls IGD GFX passthrough support (default=off)\n" " aes-key-wrap=on|off controls support for AES key wrapping (default=on)\n" " dea-key-wrap=on|off controls support for DEA key wrapping (default=on)\n"@@ -74,7 +75,9 @@ Enables or disables memory merge support. This feature, when supported by the host, de-duplicates identical memory pages among VMs instances (enabled by default). @item iommu=on|off -Enables or disables emulated Intel IOMMU (VT-d) support. The default is off. +Enables and disables IOMMU emulation. The default is off. +@item x-iommu-type=on|off +Overrides emulated IOMMU from AMD IOMMU. By default Intel IOMMU is emulated. @item aes-key-wrap=on|off Enables or disables AES key wrapping support on s390-ccw hosts. This feature controls whether AES wrapping keys will be created to allowutil/qemu-config.c +6
-3@@ -213,8 +213,12 @@ static QemuOptsList machine_opts = { .help = "firmware image", },{ .name = "iommu", - .type = QEMU_OPT_BOOL, - .help = "Set on/off to enable/disable Intel IOMMU (VT-d)", + .type = QEMU_OPT_BOOL, + .help = "Set on/off to enable iommu", + },{ + .name = "x-iommu-type", + .type = QEMU_OPT_STRING, + .help = "Overrides emulated IOMMU from Intel to AMD", },{ .name = "suppress-vmdesc", .type = QEMU_OPT_BOOL, --Quoted 2 lines
2.1.4
--
Eduardo
Re: [Qemu-devel] [RFC] Allow AMD IOMMU to have both SysBusDevice and PCIDevice properties.
Quoted 9 lines · David Kiarie
Quoted 1 line · Eduardo Habkost
Hi,
Hello,
Quoted 3 lines
I didn't review the
amd_iommu.ccode, but there seems to be some unrelated changes in the patch:
Quoted 10 lines
Thanks for looking at this but I actually wanted someone to look at the
amd_iommu.c. I mentioned in annotation that there are some unrelated changes because this work is based on code that has not been merged yet. I specifically sent this to have a review inamd_iommu.cnot the details but the design. I have patchset that implements AMD IOMMU (translation only) which is implemented as a PCI device. It is however not possible to work on interrupt remapping without converting AMD IOMMU from a PCI device to a SysBusDevice. This device(AMD IOMMU), the one on this patch unlike in previous patches, creates to devices ; a PCI device and a SySBusDev which am not sure is acceptable.
I would suggest that you generate another patch, only contains the changes you made related to adding the PCI device for AMD IOMMU, explain bits about what this work is based on (e.g., IMHO it could be based on your v11 AMD patchset and several other patches like Intel IOMMU IR, just mention them in the cover letter), then mark it as a RFC.
-- peterx
Re: [Qemu-devel] [RFC] Allow AMD IOMMU to have both SysBusDevice and PCIDevice properties.
In reply to Eduardo HabkostQuoted 2 lines · Eduardo Habkost
Hi,
[...]
Quoted 17 lines
[...]
hw/i386/pc_q35.c static void pc_q35_machine_options(MachineClass *m) · line 284
Quoted 9 lines
hw/i386/pc_q35.c +1
-0@@ -281,6 +281,7 @@ static void pc_q35_machine_options(MachineClass *m) m->default_machine_opts ="firmware=bios-256k.bin" ; m->default_display ="std" ; m->no_floppy =1 ; + m->has_dynamic_sysbus = true;Why is this needed? Is it possible to do this change before adding the iommu code? Can this be done in a separate patch that documents why it should be changed and why it is safe to set it to true?
Quoted 1 line
Hi Eduardo,
I also have this change as part of '[PATCH v2 0/3] enable iommu with -device'.
Please see:
https://www.mail-archive.com/[email protected]/msg374644.html
Thanks,
Marcel
Re: [Qemu-devel] [RFC] Allow AMD IOMMU to have both SysBusDevice and PCIDevice properties.
Quoted 27 lines · Marcel Apfelbaum
Quoted 3 lines · Eduardo Habkost
Hi,
[...]
Quoted 19 lines
[...]
hw/i386/pc_q35.c static void pc_q35_machine_options(MachineClass *m) · line 284
Quoted 10 lines
hw/i386/pc_q35.c +1
-0@@ -281,6 +281,7 @@ static void pc_q35_machine_options(MachineClass *m) m->default_machine_opts ="firmware=bios-256k.bin" ; m->default_display ="std" ; m->no_floppy =1 ; + m->has_dynamic_sysbus = true;Why is this needed? Is it possible to do this change before adding the iommu code? Can this be done in a separate patch that documents why it should be changed and why it is safe to set it to true?
Quoted 1 line
Quoted 7 lines
Hi Eduardo,
I also have this change as part of '[PATCH v2 0/3] enable iommu with -device'.
Please see:
https://www.mail-archive.com/[email protected]/msg374644.html
This change is actually yours. My code is depends on your code.
Quoted 4 lines
Thanks,
Marcel