hw/i386: make IOMMUs configurable via default-configs/
PATCH v2 1/1 hw/i386: make IOMMUs configurable via default-configs/
Allow distributions to disable the Intel and/or AMD IOMMU devices.
---
v1->v2: don't include x86-iommu.o unconditionally
default-configs/i386-softmmu.mak | 2 ++ default-configs/x86_64-softmmu.mak | 2 ++ hw/i386/Makefile.objs | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-)
default-configs/i386-softmmu.mak +2 -0
@@ -63,3 +63,5 @@ CONFIG_PXB=y CONFIG_ACPI_VMGENID=y CONFIG_FW_CFG_DMA=y CONFIG_I2C=y +CONFIG_VTD=y +CONFIG_AMD_IOMMU=y
default-configs/x86_64-softmmu.mak +2 -0
@@ -63,3 +63,5 @@ CONFIG_PXB=y CONFIG_ACPI_VMGENID=y CONFIG_FW_CFG_DMA=y CONFIG_I2C=y +CONFIG_VTD=y +CONFIG_AMD_IOMMU=y
hw/i386/Makefile.objs +2 -2
@@ -2,8 +2,8 @@ obj-$(CONFIG_KVM) += kvm/ obj-y += multiboot.o obj-y += pc.o pc_piix.o pc_q35.o obj-y += pc_sysfw.o -obj-y += x86-iommu.o intel_iommu.o -obj-y += amd_iommu.o +obj-$(CONFIG_VTD) += x86-iommu.o intel_iommu.o +obj-$(CONFIG_AMD_IOMMU) += x86-iommu.o amd_iommu.o obj-$(CONFIG_XEN) += ../xenpv/ xen/ obj-$(CONFIG_VMPORT) += vmport.o obj-$(CONFIG_VMMOUSE) += vmmouse.o
Signature · 1 line
2.14.3
Quoted 36 lines · Paolo Bonzini
Allow distributions to disable the Intel and/or AMD IOMMU devices.
Signed-off-by Paolo Bonzini <[email protected]>---
v1->v2: don't include x86-iommu.o unconditionallydefault-configs/i386-softmmu.mak | 2 ++ default-configs/x86_64-softmmu.mak | 2 ++ hw/i386/Makefile.objs | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-)default-configs/i386-softmmu.mak +2
-0@@ -63,3 +63,5 @@ CONFIG_PXB=y CONFIG_ACPI_VMGENID=y CONFIG_FW_CFG_DMA=y CONFIG_I2C=y +CONFIG_VTD=y +CONFIG_AMD_IOMMU=ydefault-configs/x86_64-softmmu.mak +2
-0@@ -63,3 +63,5 @@ CONFIG_PXB=y CONFIG_ACPI_VMGENID=y CONFIG_FW_CFG_DMA=y CONFIG_I2C=y +CONFIG_VTD=y +CONFIG_AMD_IOMMU=yhw/i386/Makefile.objs +0
-0
hw/i386/Makefile.objs obj-$(CONFIG_KVM) += kvm/ · line 6
Quoted 7 lines
hw/i386/Makefile.objs +2
-2@@ -2,8 +2,8 @@ obj-$(CONFIG_KVM) += kvm/ obj-y += multiboot.o obj-y += pc.o pc_piix.o pc_q35.o obj-y += pc_sysfw.o -obj-y += x86-iommu.o intel_iommu.o -obj-y += amd_iommu.o +obj-$(CONFIG_VTD) += x86-iommu.o intel_iommu.o +obj-$(CONFIG_AMD_IOMMU) += x86-iommu.o amd_iommu.o
The linker likely does not care if x86-iommu.o is included twice, but wouldn't it be clearer to use this instead:
obj-$(call lor,$(CONFIG_VTD),$(CONFIG_AMD_IOMMU)) += x86-iommu.o
?
Thomas
Quoted 3 lines · Thomas Huth
hw/i386/Makefile.objs obj-$(CONFIG_KVM) += kvm/ · line 6
Quoted 2 lines
hw/i386/Makefile.objs +2
-0+obj-$(CONFIG_VTD) += x86-iommu.o intel_iommu.o +obj-$(CONFIG_AMD_IOMMU) += x86-iommu.o amd_iommu.oThe linker likely does not care if x86-iommu.o is included twice
The linker actually cares, but rules.mak drops the duplicate:
commit e2a99ad3e174ab4c9d2320dcecd779230409829f
Author: Stefan Hajnoczi <[email protected]>
Date: Thu Aug 25 09:18:52 2011 +0100
build: sort objects to remove duplicates for link
Avoid duplicate object files during the link. There are legitimate cases where a link command-line would include duplicate object files because two independent subsystems both depend on common infrastructure.
Use GNU make's $(sort) function to remove duplicate object files from the link command-line.
Quoted 3 lines
, but wouldn't it be clearer to use this instead:
obj-$(call lor,$(CONFIG_VTD),$(CONFIG_AMD_IOMMU)) += x86-iommu.o
Possibly, but it doesn't scale too well when we add a third IOMMU. The right solution would be something like "select" in Kconfig. Let me know what you prefer for x86-iommu.c between obj-y and specifying the file twice, and I'll do it.
Paolo
Thomas Huth
Reviewed-byQuoted 5 lines · Paolo Bonzini
Quoted 3 lines · Thomas Huth
hw/i386/Makefile.objs obj-$(CONFIG_KVM) += kvm/ · line 6
Quoted 2 lines
hw/i386/Makefile.objs +2
-0+obj-$(CONFIG_VTD) += x86-iommu.o intel_iommu.o +obj-$(CONFIG_AMD_IOMMU) += x86-iommu.o amd_iommu.oThe linker likely does not care if x86-iommu.o is included twice
Quoted 7 lines
The linker actually cares, but rules.mak drops the duplicate:
commit
e2a99ad3e174ab4c9d2320dcecd779230409829f
Author: Stefan Hajnoczi <[email protected]>
Date: Thu Aug 25 09:18:52 2011 +0100build: sort objects to remove duplicates for link
Ah, nice, I wasn't aware of that trick. The current patch looks fine to me in this case:
Quoted 3 lines · Paolo Bonzini
Allow distributions to disable the Intel and/or AMD IOMMU devices.
Signed-off-by Paolo Bonzini <[email protected]>
Quoted 44 lines
---
v1->v2: don't include x86-iommu.o unconditionallydefault-configs/i386-softmmu.mak | 2 ++ default-configs/x86_64-softmmu.mak | 2 ++ hw/i386/Makefile.objs | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-)default-configs/i386-softmmu.mak +2
-0@@ -63,3 +63,5 @@ CONFIG_PXB=y CONFIG_ACPI_VMGENID=y CONFIG_FW_CFG_DMA=y CONFIG_I2C=y +CONFIG_VTD=y +CONFIG_AMD_IOMMU=ydefault-configs/x86_64-softmmu.mak +2
-0@@ -63,3 +63,5 @@ CONFIG_PXB=y CONFIG_ACPI_VMGENID=y CONFIG_FW_CFG_DMA=y CONFIG_I2C=y +CONFIG_VTD=y +CONFIG_AMD_IOMMU=yhw/i386/Makefile.objs +2
-2@@ -2,8 +2,8 @@ obj-$(CONFIG_KVM) += kvm/ obj-y += multiboot.o obj-y += pc.o pc_piix.o pc_q35.o obj-y += pc_sysfw.o -obj-y += x86-iommu.o intel_iommu.o -obj-y += amd_iommu.o +obj-$(CONFIG_VTD) += x86-iommu.o intel_iommu.o +obj-$(CONFIG_AMD_IOMMU) += x86-iommu.o amd_iommu.o obj-$(CONFIG_XEN) += ../xenpv/ xen/ obj-$(CONFIG_VMPORT) += vmport.o obj-$(CONFIG_VMMOUSE) += vmmouse.o