summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorMarcel Apfelbaum <marcel@redhat.com>2015-02-04 17:43:48 +0200
committerMichael S. Tsirkin <mst@redhat.com>2015-03-11 18:10:43 +0100
commit8caff63699a9bd6b82556bd527ff023c443ada2d (patch)
tree22b67cc3c74be83fedd1a450317474d2ebd775eb /hw
parent5820945946b1e221905aa898f2cd97ed825acd47 (diff)
downloadqemu-8caff63699a9bd6b82556bd527ff023c443ada2d.tar.gz
machine: replace qemu opts with iommu property
Fixes a QEMU crash when passing iommu parameter in command line. Running x86_64-softmmu/qemu-system-x86_64 -machine pc,iommu=on -enable-kvm leads to crash: qemu-system-x86_64: qemu/util/qemu-option.c:387: qemu_opt_get_bool_helper: Assertion `opt->desc && opt->desc->type == QEMU_OPT_BOOL' failed. Aborted (core dumped) This happens because commit e79d5a6 ("machine: remove qemu_machine_opts global list") removed the global option descriptions and moved them to MachineState's QOM properties. Fix this by querying machine properties through designated wrappers. Signed-off-by: Marcel Apfelbaum <marcel@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/core/machine.c5
-rw-r--r--hw/pci-host/q35.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/hw/core/machine.c b/hw/core/machine.c
index fbd91be575..096eb1030f 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -403,6 +403,11 @@ bool machine_usb(MachineState *machine)
return machine->usb;
}
+bool machine_iommu(MachineState *machine)
+{
+ return machine->iommu;
+}
+
static const TypeInfo machine_info = {
.name = TYPE_MACHINE,
.parent = TYPE_OBJECT,
diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index df60e61d4f..c8827cc000 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -415,7 +415,7 @@ static void mch_realize(PCIDevice *d, Error **errp)
PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE, PAM_EXPAN_SIZE);
}
/* Intel IOMMU (VT-d) */
- if (qemu_opt_get_bool(qemu_get_machine_opts(), "iommu", false)) {
+ if (machine_iommu(current_machine)) {
mch_init_dmar(mch);
}
}