iommu/vt-d: Small fixes for 5.2-rc1
cover iommu/vt-d: Small fixes for 5.2-rc1
Hi Joerg,
This includes two small fixes for virtual IOMMU running in qemu enviroment. On bare metal, we always have an dedicated IOMMU for Intel integrated graphic device. And some aspects of the driver was designed according to this. Unfortunately, in qemu environment, the virtual IOMMU has only a single include-all IOMMU engine, as the result some interfaces don't work as expected anymore. This includes two fixes for this.
Best regards,
Lu Baolu
Lu Baolu (2):
iommu/vt-d: Set intel_iommu_gfx_mapped correctly iommu/vt-d: Make kernel parameter igfx_off work with vIOMMU
drivers/iommu/intel-iommu.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/2 iommu/vt-d: Set intel_iommu_gfx_mapped correctly
The intel_iommu_gfx_mapped flag is exported by the Intel IOMMU driver to indicate whether an IOMMU is used for the graphic device. In a virtualized IOMMU environment (e.g. QEMU), an include-all IOMMU is used for graphic device. This flag is found to be clear even the IOMMU is used.
--- drivers/iommu/intel-iommu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/iommu/intel-iommu.c +4 -3
@@ -4068,9 +4068,7 @@ static void __init init_no_remapping_devices(void)/* This IOMMU has *only* gfx devices. Either bypass it or set the gfx_mapped flag, as appropriate */ -if (dmar_map_gfx) { - intel_iommu_gfx_mapped =1 ; - }else { +if (!dmar_map_gfx) { drhd->ignored =1 ;for_each_active_dev_scope (drhd->devices, drhd->devices_cnt, i, dev)
@@ -4909,6 +4907,9 @@ int __init intel_iommu_init(void) goto out_free_reserved_range; } +if (dmar_map_gfx) + intel_iommu_gfx_mapped =1 ; +init_no_remapping_devices (); ret =init_dmars ();
Signature · 1 line
2.17.1
PATCH 2/2 iommu/vt-d: Make kernel parameter igfx_off work with vIOMMU
In reply to Lu BaoluThe kernel parameter igfx_off is used by users to disable DMA remapping for the Intel integrated graphic device. It was designed for bare metal cases where a dedicated IOMMU is used for graphic. This doesn't apply to virtual IOMMU case where an include-all IOMMU is used. This makes the kernel parameter work with virtual IOMMU as well.
--- drivers/iommu/intel-iommu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/iommu/intel-iommu.c +4 -1
@@ -3415,9 +3415,12 @@ static int __init init_dmars(void) iommu_identity_mapping |=IDENTMAP_ALL ;#ifdef CONFIG_INTEL_IOMMU_BROKEN_GFX_WA - iommu_identity_mapping |=IDENTMAP_GFX ; + dmar_map_gfx =0 ;#endif +if (!dmar_map_gfx) + iommu_identity_mapping |=IDENTMAP_GFX ; +check_tylersburg_isoch ();if (iommu_identity_mapping) {
Signature · 1 line
2.17.1
Quoted 3 lines · Lu Baolu
Lu Baolu (2):
iommu/vt-d: Setintel_iommu_gfx_mappedcorrectly iommu/vt-d: Make kernel parameterigfx_offwork with vIOMMU
Applied both, thanks.