Skip to contentSkip to conversation

hw/i386: Allow building machines without IOMMU

PATCH In review Philippe Mathieu-Daudé 2 participants 2 messages Dec 27, 2019 – Jan 6, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 hw/i386: Allow building machines without IOMMU

Commit 6c730e4af9 introduced a stub to build the MicroVM machine without Intel IOMMU suppport. However when configure with --without-default-devices, the build fails:

    LINK    x86_64-softmmu/qemu-system-x86_64

/usr/bin/ld: hw/i386/pc.o: in function `pc_machine_done':
hw/i386/pc.c:869: undefined reference to x86_iommu_ir_supported' /usr/bin/ld: hw/i386/acpi-build.o: in function acpi_build':
hw/i386/acpi-build.c:2844: undefined reference to x86_iommu_get_type' /usr/bin/ld: hw/i386/acpi-build.o: in function build_dmar_q35':
hw/i386/acpi-build.c:2478: undefined reference to x86_iommu_ir_supported' /usr/bin/ld: hw/i386/acpi-build.o: in function build_amd_iommu':
hw/i386/acpi-build.c:2665: undefined reference to x86_iommu_ir_supported' /usr/bin/ld: hw/i386/acpi-build.c:2700: undefined reference to x86_iommu_ir_supported'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:206: qemu-system-x86_64] Error 1

Since currently all PC machines can not be built without IOMMU, select X86_IOMMU in the PC config, and remove the stubs.

Fixes 6c730e4af9
Reported-by Travis-CI

---
v2: simplify, remove the stub.

---
 hw/i386/x86-iommu-stub.c | 34 ----------------------------------
 hw/i386/Kconfig          |  2 +-
 hw/i386/Makefile.objs    |  1 -
 3 files changed, 1 insertion(+), 36 deletions(-)
 delete mode 100644 hw/i386/x86-iommu-stub.c
hw/i386/x86-iommu-stub.c deleted +0 -34
deleted file mode 100644
index 03576cdccb..0000000000
@@ -1,34 +0,0 @@
-/*
- * Stubs for X86 IOMMU emulation
- *
- * Copyright (C) 2019 Red Hat, Inc.
- *
- * Author: Paolo Bonzini <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "qemu/osdep.h"
-#include "hw/i386/x86-iommu.h"
-
-void x86_iommu_iec_register_notifier(X86IOMMUState *iommu,
-                                     iec_notify_fn fn, void *data)
-{
-}
-
-X86IOMMUState *x86_iommu_get_default(void)
-{
-    return NULL;
-}
-
hw/i386/Kconfig +1 -1
index 91cf5843b4..e428322a2c 100644
@@ -35,6 +35,7 @@ config PC
     select ACPI_PCI
     select ACPI_VMGENID
     select VIRTIO_PMEM_SUPPORTED
+    select X86_IOMMU
 
 config PC_PCI
     bool
@@ -105,7 +106,6 @@ config MICROVM
 
 config X86_IOMMU
     bool
-    depends on PC
 
 config VTD
     bool
hw/i386/Makefile.objs +0 -1
index 8ce1b26533..6ebb6d0cf0 100644
@@ -7,7 +7,6 @@ obj-$(CONFIG_Q35) += pc_q35.o
 obj-$(CONFIG_MICROVM) += microvm.o
 obj-y += fw_cfg.o
 obj-$(CONFIG_X86_IOMMU) += x86-iommu.o
-obj-$(call lnot,$(CONFIG_X86_IOMMU)) += x86-iommu-stub.o
 obj-$(CONFIG_VTD) += intel_iommu.o
 obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o
 obj-$(CONFIG_XEN) += ../xenpv/ xen/
Signature · 1 line
2.21.0
Acked-by on v2 1/1
#1 lore raw
Quoted 17 lines · Philippe Mathieu-Daudé

Commit 6c730e4af9 introduced a stub to build the MicroVM machine without Intel IOMMU suppport. However when configure with --without-default-devices, the build fails:

    LINK    x86_64-softmmu/qemu-system-x86_64

/usr/bin/ld: hw/i386/pc.o: in function `pc_machine_done':
hw/i386/pc.c:869: undefined reference to x86_iommu_ir_supported' /usr/bin/ld: hw/i386/acpi-build.o: in function acpi_build':
hw/i386/acpi-build.c:2844: undefined reference to x86_iommu_get_type' /usr/bin/ld: hw/i386/acpi-build.o: in function build_dmar_q35':
hw/i386/acpi-build.c:2478: undefined reference to x86_iommu_ir_supported' /usr/bin/ld: hw/i386/acpi-build.o: in function build_amd_iommu':
hw/i386/acpi-build.c:2665: undefined reference to x86_iommu_ir_supported' /usr/bin/ld: hw/i386/acpi-build.c:2700: undefined reference to x86_iommu_ir_supported'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:206: qemu-system-x86_64] Error 1

Quoted 6 lines

Since currently all PC machines can not be built without IOMMU, select X86_IOMMU in the PC config, and remove the stubs.

Fixes 6c730e4af9
Reported-by Travis-CI

I'd rather Paolo applied this in his tree.

Quoted 83 lines

---
v2: simplify, remove the stub.

---
 hw/i386/x86-iommu-stub.c | 34 ----------------------------------
 hw/i386/Kconfig          |  2 +-
 hw/i386/Makefile.objs    |  1 -
 3 files changed, 1 insertion(+), 36 deletions(-)
 delete mode 100644 hw/i386/x86-iommu-stub.c
hw/i386/x86-iommu-stub.c deleted +0 -34
deleted file mode 100644
index 03576cdccb..0000000000
@@ -1,34 +0,0 @@
-/*
- * Stubs for X86 IOMMU emulation
- *
- * Copyright (C) 2019 Red Hat, Inc.
- *
- * Author: Paolo Bonzini <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "qemu/osdep.h"
-#include "hw/i386/x86-iommu.h"
-
-void x86_iommu_iec_register_notifier(X86IOMMUState *iommu,
-                                     iec_notify_fn fn, void *data)
-{
-}
-
-X86IOMMUState *x86_iommu_get_default(void)
-{
-    return NULL;
-}
-
hw/i386/Kconfig +1 -1
index 91cf5843b4..e428322a2c 100644
@@ -35,6 +35,7 @@ config PC
     select ACPI_PCI
     select ACPI_VMGENID
     select VIRTIO_PMEM_SUPPORTED
+    select X86_IOMMU
 
 config PC_PCI
     bool
@@ -105,7 +106,6 @@ config MICROVM
 
 config X86_IOMMU
     bool
-    depends on PC
 
 config VTD
     bool
hw/i386/Makefile.objs +0 -1
index 8ce1b26533..6ebb6d0cf0 100644
@@ -7,7 +7,6 @@ obj-$(CONFIG_Q35) += pc_q35.o
 obj-$(CONFIG_MICROVM) += microvm.o
 obj-y += fw_cfg.o
 obj-$(CONFIG_X86_IOMMU) += x86-iommu.o
-obj-$(call lnot,$(CONFIG_X86_IOMMU)) += x86-iommu-stub.o
 obj-$(CONFIG_VTD) += intel_iommu.o
 obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o
 obj-$(CONFIG_XEN) += ../xenpv/ xen/
Signature · 1 line
2.21.0