Skip to contentSkip to conversation

Minor cleanups when parsing the "iommu" option

PATCH Superseded Bandan Das 2 participants 5 messages Nov 12, 2015

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Bandan Das

author
#0 lore raw

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.

Bandan Das (2):
q35: Check propery to determine if iommu is set
i440fx: print a error message if user enable iommu

 hw/core/machine.c   | 7 -------
 hw/pci-host/piix.c  | 4 ++++
 hw/pci-host/q35.c   | 2 +-
 include/hw/boards.h | 1 -
 4 files changed, 5 insertions(+), 9 deletions(-)
Signature · 1 line
2.6.1
author
#1 lore raw

PATCH 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
index f4db340..acca00d 100644
@@ -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
index c81507d..1fb4707 100644
@@ -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
index 3e9a92c..24eb6f0 100644
@@ -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.6.1
author
#2 lore raw

PATCH 2/2 i440fx: print an error message if user tries to enable iommu

In reply to Bandan Das

There's no indication of any sort that i440fx doesn't support "iommu=on""

---
 hw/pci-host/piix.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/pci-host/piix.c +4 -0
index 7b2fbf9..f12593a 100644
@@ -301,6 +301,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)) {
+        fprintf(stderr, "i440fx doesn't support emulated iommu\n");
+    }
 }
 
 PCIBus *i440fx_init(const char *host_type, const char *pci_type,
Signature · 1 line
2.6.1
#3 lore raw

Re: [Qemu-devel] [PATCH 2/2] i440fx: print an error message if user tries to enable iommu

Quoted 13 lines · Bandan Das

There's no indication of any sort that i440fx doesn't support "iommu=on""

---
 hw/pci-host/piix.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/pci-host/piix.c +0 -0
index 7b2fbf9..f12593a 100644

hw/pci-host/piix.c static void i440fx_pcihost_realize(DeviceState *dev, Error **errp) · line 310

Quoted 10 lines
hw/pci-host/piix.c +4 -0
@@ -301,6 +301,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)) {
+        fprintf(stderr, "i440fx doesn't support emulated iommu\n");
+    }
 }
 
 PCIBus *i440fx_init(const char *host_type, const char *pci_type,

error_report(), please.

If this is just a warning, please prefix the message with "warning: ".

If it isn't, exit(1).

author
#4 lore raw

Re: [Qemu-devel] [PATCH 2/2] i440fx: print an error message if user tries to enable iommu

Quoted 24 lines · Markus Armbruster
Quoted 22 lines · Bandan Das

There's no indication of any sort that i440fx doesn't support "iommu=on""

---
 hw/pci-host/piix.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/pci-host/piix.c +4 -0
index 7b2fbf9..f12593a 100644
@@ -301,6 +301,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)) {
+        fprintf(stderr, "i440fx doesn't support emulated iommu\n");
+    }
 }
 
Quoted 5 lines

hw/pci-host/piix.c static void i440fx_pcihost_realize(DeviceState *dev, Error **errp) · line 310

Quoted 1 line
hw/pci-host/piix.c +0 -0
 PCIBus *i440fx_init(const char *host_type, const char *pci_type,

error_report(), please.

If this is just a warning, please prefix the message with "warning: ".

Sure will do. Yeah, it seems good enough just to print a message without exiting.

Quoted 1 line

If it isn't, exit(1).