Minor cleanups when parsing the "iommu" option
v2 cover Minor cleanups when parsing the "iommu" option
Small cleanup changes. The first removes the helper function by directly checking the property and the second adds a error message if user tries to use "-machine iommu=on" with i440fx.
v2:
2/2: use error_report for the warning message
Bandan Das (2):
q35: Check propery to determine if iommu is set
i440fx: print an error message if user tries to enable iommu
hw/core/machine.c | 5 ----- hw/pci-host/piix.c | 5 +++++ hw/pci-host/q35.c | 2 +- include/hw/boards.h | 1 - 4 files changed, 6 insertions(+), 7 deletions(-)
Signature · 1 line
2.5.0
PATCH v2 1/2 q35: Check propery to determine if iommu is set
The helper function machine_iommu() isn't necesary. We can directly check for the property.
--- hw/core/machine.c | 5 ----- hw/pci-host/q35.c | 2 +- include/hw/boards.h | 1 - 3 files changed, 1 insertion(+), 7 deletions(-)
hw/core/machine.c +0 -5
@@ -462,11 +462,6 @@ bool machine_usb(MachineState *machine)return machine->usb; } -bool machine_iommu (MachineState *machine) -{ -return machine->iommu; -} -bool machine_kernel_irqchip_allowed (MachineState *machine) {return machine->kernel_irqchip_allowed;
hw/pci-host/q35.c +1 -1
@@ -506,7 +506,7 @@ static void mch_realize(PCIDevice *d, Error **errp) PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, PAM_EXPAN_SIZE); }/* Intel IOMMU (VT-d) */ -if (machine_iommu (current_machine)) { +if (object_property_get_bool (qdev_get_machine (),"iommu" ,NULL )) {mch_init_dmar (mch); } }
include/hw/boards.h +0 -1
@@ -33,7 +33,6 @@ MachineClass *find_default_machine(void);extern MachineState *current_machine;bool machine_usb (MachineState *machine); -bool machine_iommu (MachineState *machine);bool machine_kernel_irqchip_allowed (MachineState *machine);bool machine_kernel_irqchip_required (MachineState *machine);int machine_kvm_shadow_mem (MachineState *machine);
Signature · 1 line
2.5.0
PATCH v2 2/2 i440fx: print an error message if user tries to enable iommu
In reply to Bandan DasThere's no indication of any sort that i440fx doesn't support "iommu=on""
--- hw/pci-host/piix.c | 5 +++++ 1 file changed, 5 insertions(+)
hw/pci-host/piix.c +5 -0
@@ -34,6 +34,7 @@#include "sysemu/sysemu.h" #include "hw/i386/ioapic.h" #include "qapi/visitor.h" +#include "qemu/error-report.h" /* * I440FX chipset data sheet.
@@ -301,6 +302,10 @@ static void i440fx_pcihost_realize(DeviceState *dev, Error **errp)static void i440fx_realize (PCIDevice *dev,Error **errp) { dev->config[I440FX_SMRAM ] =0x02 ; + +if (object_property_get_bool (qdev_get_machine (),"iommu" ,NULL )) { +error_report ("warning: i440fx doesn't support emulated iommu\n" ); + } } PCIBus *i440fx_init(const char *host_type, const char *pci_type,
Signature · 1 line
2.5.0
Re: [Qemu-devel] [PATCH v2 2/2] i440fx: print an error message if user tries to enable iommu
Quoted 10 lines · Bandan Das
There's no indication of any sort that i440fx doesn't support "iommu=on""
Signed-off-by Bandan Das <[email protected]>--- hw/pci-host/piix.c | 5 +++++ 1 file changed, 5 insertions(+)
hw/pci-host/piix.c static void i440fx_pcihost_realize(DeviceState *dev, Error **errp) · line 307
Quoted 6 lines
hw/pci-host/piix.c +3
-0@@ -301,6 +302,10 @@ static void i440fx_pcihost_realize(DeviceState *dev, Error **errp)static void i440fx_realize (PCIDevice *dev,Error **errp) { dev->config[I440FX_SMRAM ] =0x02 ; + +if (object_property_get_bool (qdev_get_machine (),"iommu" ,NULL )) { +error_report ("warning: i440fx doesn't support emulated iommu\n" );
No trailing \n with error_report().
With that fixed (and perhaps maintainer can do it),
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCH v2 2/2] i440fx: print an error message if user tries to enable iommu
Quoted 20 lines · Eric Blake
Quoted 10 lines · Bandan Das
There's no indication of any sort that i440fx doesn't support "iommu=on""
Signed-off-by Bandan Das <[email protected]>--- hw/pci-host/piix.c | 5 +++++ 1 file changed, 5 insertions(+)hw/pci-host/piix.c static void i440fx_pcihost_realize(DeviceState *dev, Error **errp) · line 307
Quoted 6 lines
hw/pci-host/piix.c +3
-0@@ -301,6 +302,10 @@ static void i440fx_pcihost_realize(DeviceState *dev, Error **errp)static void i440fx_realize (PCIDevice *dev,Error **errp) { dev->config[I440FX_SMRAM ] =0x02 ; + +if (object_property_get_bool (qdev_get_machine (),"iommu" ,NULL )) { +error_report ("warning: i440fx doesn't support emulated iommu\n" );No trailing \n with
error_report().
Quoted 1 line
With that fixed (and perhaps maintainer can do it),
No problem, I sent out an updated version. Thanks for the review!
Bandan
Quoted 1 line
Reviewed-by Eric Blake <[email protected]>