From 8fea4a102ccd57e8c79d76d13f92d7516ec7b50f Mon Sep 17 00:00:00 2001 From: Nicola Corna Date: Fri, 19 Aug 2022 19:34:01 +0000 Subject: [PATCH] x86/64: enable IOMMU support Enable IOMMU support for Intel and AMD x86 platforms. With this, when the vfio module is present, physical PCI devices can be passed to VMs, for example with `qemu-system-x86_64 -device vfio-pci,host=05:00.0 ...`. IOMMU support increases the kernel size by a small amount (~370KB, from 5239840 B to 5611200 B, a ~7% increase in size). Signed-off-by: Nicola Corna --- target/linux/x86/64/config-5.10 | 19 +++++++++++++++++++ target/linux/x86/64/config-5.15 | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/target/linux/x86/64/config-5.10 b/target/linux/x86/64/config-5.10 index 472cf07669..f91b3fe76f 100644 --- a/target/linux/x86/64/config-5.10 +++ b/target/linux/x86/64/config-5.10 @@ -38,6 +38,8 @@ CONFIG_AGP=y CONFIG_AGP_INTEL=y # CONFIG_AGP_SIS is not set # CONFIG_AGP_VIA is not set +CONFIG_AMD_IOMMU=y +# CONFIG_AMD_IOMMU_V2 is not set CONFIG_ARCH_CPUIDLE_HALTPOLL=y CONFIG_ARCH_DMA_ADDR_T_64BIT=y CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC=y @@ -221,6 +223,7 @@ CONFIG_HW_RANDOM_VIRTIO=y CONFIG_HYPERV=y CONFIG_HYPERVISOR_GUEST=y CONFIG_HYPERV_BALLOON=y +CONFIG_HYPERV_IOMMU=y CONFIG_HYPERV_KEYBOARD=y CONFIG_HYPERV_NET=y CONFIG_HYPERV_STORAGE=y @@ -240,6 +243,11 @@ CONFIG_INPUT_XEN_KBDDEV_FRONTEND=y CONFIG_INTEL_GTT=y CONFIG_INTEL_IDLE=y # CONFIG_INTEL_IDXD is not set +CONFIG_INTEL_IOMMU=y +# CONFIG_INTEL_IOMMU_DEFAULT_ON is not set +CONFIG_INTEL_IOMMU_FLOPPY_WA=y +# CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON is not set +# CONFIG_INTEL_IOMMU_SVM is not set # CONFIG_INTEL_IPS is not set # CONFIG_INTEL_MEI_HDCP is not set # CONFIG_INTEL_MENLOW is not set @@ -249,12 +257,22 @@ CONFIG_INTEL_SOC_DTS_IOSF_CORE=y CONFIG_INTEL_SOC_DTS_THERMAL=y # CONFIG_INTEL_SPEED_SELECT_INTERFACE is not set # CONFIG_INTEL_TURBO_MAX_3 is not set +# CONFIG_INTEL_TXT is not set # CONFIG_INTEL_UNCORE_FREQ_CONTROL is not set CONFIG_INTERVAL_TREE=y +CONFIG_IOASID=y +CONFIG_IOMMU_API=y # CONFIG_IOMMU_DEBUG is not set +# CONFIG_IOMMU_DEBUGFS is not set +# CONFIG_IOMMU_DEFAULT_PASSTHROUGH is not set +CONFIG_IOMMU_DMA=y CONFIG_IOMMU_HELPER=y +CONFIG_IOMMU_IOVA=y +CONFIG_IOMMU_SUPPORT=y CONFIG_IOSF_MBI=y # CONFIG_IOSF_MBI_DEBUG is not set +CONFIG_IRQ_MSI_IOMMU=y +CONFIG_IRQ_REMAP=y # CONFIG_ISCSI_IBFT is not set CONFIG_ISO9660_FS=y CONFIG_KALLSYMS_ABSOLUTE_PERCPU=y @@ -401,6 +419,7 @@ CONFIG_THERMAL_WRITABLE_TRIPS=y # CONFIG_TOSHIBA_BT_RFKILL is not set CONFIG_TREE_RCU=y CONFIG_TREE_SRCU=y +# CONFIG_UACCE is not set # CONFIG_UCLAMP_TASK is not set CONFIG_UCS2_STRING=y # CONFIG_UNWINDER_ORC is not set diff --git a/target/linux/x86/64/config-5.15 b/target/linux/x86/64/config-5.15 index ec9a73c9e2..7068b3b66c 100644 --- a/target/linux/x86/64/config-5.15 +++ b/target/linux/x86/64/config-5.15 @@ -41,6 +41,8 @@ CONFIG_AGP=y CONFIG_AGP_INTEL=y # CONFIG_AGP_SIS is not set # CONFIG_AGP_VIA is not set +CONFIG_AMD_IOMMU=y +# CONFIG_AMD_IOMMU_V2 is not set # CONFIG_AMD_PMC is not set # CONFIG_AMD_PTDMA is not set # CONFIG_AMD_SFH_HID is not set @@ -234,6 +236,7 @@ CONFIG_HW_RANDOM_VIRTIO=y CONFIG_HYPERV=y CONFIG_HYPERVISOR_GUEST=y CONFIG_HYPERV_BALLOON=y +CONFIG_HYPERV_IOMMU=y CONFIG_HYPERV_KEYBOARD=y CONFIG_HYPERV_NET=y CONFIG_HYPERV_STORAGE=y @@ -255,6 +258,11 @@ CONFIG_INPUT_XEN_KBDDEV_FRONTEND=y CONFIG_INTEL_GTT=y CONFIG_INTEL_IDLE=y # CONFIG_INTEL_IDXD_COMPAT is not set +CONFIG_INTEL_IOMMU=y +# CONFIG_INTEL_IOMMU_DEFAULT_ON is not set +CONFIG_INTEL_IOMMU_FLOPPY_WA=y +# CONFIG_INTEL_IOMMU_SCALABLE_MODE_DEFAULT_ON is not set +# CONFIG_INTEL_IOMMU_SVM is not set # CONFIG_INTEL_IPS is not set # CONFIG_INTEL_MEI_HDCP is not set # CONFIG_INTEL_MENLOW is not set @@ -265,12 +273,22 @@ CONFIG_INTEL_SOC_DTS_IOSF_CORE=y CONFIG_INTEL_SOC_DTS_THERMAL=y # CONFIG_INTEL_SPEED_SELECT_INTERFACE is not set # CONFIG_INTEL_TURBO_MAX_3 is not set +# CONFIG_INTEL_TXT is not set # CONFIG_INTEL_UNCORE_FREQ_CONTROL is not set CONFIG_INTERVAL_TREE=y +CONFIG_IOASID=y +CONFIG_IOMMU_API=y # CONFIG_IOMMU_DEBUG is not set +# CONFIG_IOMMU_DEBUGFS is not set +# CONFIG_IOMMU_DEFAULT_PASSTHROUGH is not set +CONFIG_IOMMU_DMA=y CONFIG_IOMMU_HELPER=y +CONFIG_IOMMU_IOVA=y +CONFIG_IOMMU_SUPPORT=y CONFIG_IOSF_MBI=y # CONFIG_IOSF_MBI_DEBUG is not set +CONFIG_IRQ_MSI_IOMMU=y +CONFIG_IRQ_REMAP=y # CONFIG_ISCSI_IBFT is not set CONFIG_ISO9660_FS=y CONFIG_KALLSYMS_ABSOLUTE_PERCPU=y @@ -422,6 +440,7 @@ CONFIG_THERMAL_WRITABLE_TRIPS=y # CONFIG_TOSHIBA_BT_RFKILL is not set CONFIG_TREE_RCU=y CONFIG_TREE_SRCU=y +# CONFIG_UACCE is not set # CONFIG_UCLAMP_TASK is not set CONFIG_UCS2_STRING=y # CONFIG_UNWINDER_ORC is not set