Browse Source

pc: stubify x86 iommu

Allow building microvm without x86-iommu.c.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini 5 years ago
parent
commit
6c730e4af9
3 changed files with 42 additions and 1 deletions
  1. 6 0
      hw/i386/Kconfig
  2. 2 1
      hw/i386/Makefile.objs
  3. 34 0
      hw/i386/x86-iommu-stub.c

+ 6 - 0
hw/i386/Kconfig

@@ -103,11 +103,17 @@ config MICROVM
     select MC146818RTC
     select MC146818RTC
     select VIRTIO_MMIO
     select VIRTIO_MMIO
 
 
+config X86_IOMMU
+    bool
+    depends on PC
+
 config VTD
 config VTD
     bool
     bool
+    select X86_IOMMU
 
 
 config AMD_IOMMU
 config AMD_IOMMU
     bool
     bool
+    select X86_IOMMU
 
 
 config VMPORT
 config VMPORT
     bool
     bool

+ 2 - 1
hw/i386/Makefile.objs

@@ -6,7 +6,8 @@ obj-$(CONFIG_I440FX) += pc_piix.o
 obj-$(CONFIG_Q35) += pc_q35.o
 obj-$(CONFIG_Q35) += pc_q35.o
 obj-$(CONFIG_MICROVM) += microvm.o
 obj-$(CONFIG_MICROVM) += microvm.o
 obj-y += fw_cfg.o
 obj-y += fw_cfg.o
-obj-y += x86-iommu.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_VTD) += intel_iommu.o
 obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o
 obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o
 obj-$(CONFIG_XEN) += ../xenpv/ xen/
 obj-$(CONFIG_XEN) += ../xenpv/ xen/

+ 34 - 0
hw/i386/x86-iommu-stub.c

@@ -0,0 +1,34 @@
+/*
+ * Stubs for X86 IOMMU emulation
+ *
+ * Copyright (C) 2019 Red Hat, Inc.
+ *
+ * Author: Paolo Bonzini <pbonzini@redhat.com>
+ *
+ * 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;
+}
+