VT-d: don't panic/warn on iommu=no-igfx
PATCH 1/1 VT-d: don't panic/warn on iommu=no-igfx
When operating on an Intel graphics device, iommu_enable_translation() panicked (force_iommu==1) or warned (force_iommu==0) about the BIOS if is_igd_vt_enabled_quirk() returned 0. That's good if the actual BIOS problem has been detected. But since commit 1463411, returning 0 could also happen if the user simply passed "iommu=no-igfx", in which case bailing out _without_ the panic/warning would be more appropriate.
The panic broke the combination "iommu=force,no-igfx", and also the case where "iommu=no-igfx" is passed but force_iommu=1 is set automatically by x2apic_bsp_setup().
Move the iommu_igfx check from is_igd_vt_enabled_quirk() into its only caller iommu_enable_translation(), and tweak the logic.
---
Notes:
Best viewed with "git show --ignore-space-change --function-context"
xen/drivers/passthrough/vtd/iommu.c | 18 ++++++++++++------ xen/drivers/passthrough/vtd/quirks.c | 3 --- 2 files changed, 12 insertions(+), 9 deletions(-)
xen/drivers/passthrough/vtd/iommu.c +12 -6
@@ -747,14 +747,20 @@ static void iommu_enable_translation(struct acpi_drhd_unit *drhd)unsigned long flags;struct iommu *iommu = drhd->iommu; -if (is_igd_drhd (drhd) && !is_igd_vt_enabled_quirk () ) +if (is_igd_drhd (drhd) ) { -if ( force_iommu ) -panic ("BIOS did not enable IGD for VT properly, crash Xen for security purpose" ); +if ( !iommu_igfx ) +return ; - printk(XENLOG_WARNING VTDPREFIX - "BIOS did not enable IGD for VT properly. Disabling IGD VT-d engine.\n"); -return ; +if ( !is_igd_vt_enabled_quirk () ) + { +if ( force_iommu ) +panic ("BIOS did not enable IGD for VT properly, crash Xen for security purpose" ); + + printk(XENLOG_WARNING VTDPREFIX + "BIOS did not enable IGD for VT properly. Disabling IGD VT-d engine.\n"); +return ; + } }/* apply platform specific errata workarounds */
xen/drivers/passthrough/vtd/quirks.c +0 -3
@@ -70,9 +70,6 @@ int is_igd_vt_enabled_quirk(void) {u16 ggc; -if ( !iommu_igfx ) -return 0 ; -if ( !IS_ILK (ioh_id) )return 1 ;
Signature · 7 lines
2.9.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 35 lines
From: Rusty Bird [mailto:[email protected]]
Sent: Thursday, July 27, 2017 7:54 PMWhen operating on an Intel graphics device,
iommu_enable_translation()panicked (force_iommu==1) or warned (force_iommu==0) about the BIOS ifis_igd_vt_enabled_quirk()returned 0. That's good if the actual BIOS problem has been detected. But since commit 1463411, returning 0 could also happen if the user simply passed "iommu=no-igfx", in which case bailing out _without_ the panic/warning would be more appropriate.The panic broke the combination "iommu=force,no-igfx", and also the case where "iommu=no-igfx" is passed but force_iommu=1 is set automatically by
x2apic_bsp_setup().Move the
iommu_igfxcheck fromis_igd_vt_enabled_quirk()into its only calleriommu_enable_translation(), and tweak the logic.Signed-off-by Rusty Bird <[email protected]>---
Notes:
Best viewed with "git show --ignore-space-change --function-context"xen/drivers/passthrough/vtd/iommu.c | 18 ++++++++++++------ xen/drivers/passthrough/vtd/quirks.c | 3 --- 2 files changed, 12 insertions(+), 9 deletions(-)xen/drivers/passthrough/vtd/iommu.c +0
-0@@ -747,14 +747,20 @@ static void iommu_enable_translation(struct acpi_drhd_unit *drhd)unsigned long flags;
xen/drivers/passthrough/vtd/iommu.c static void iommu_enable_translation(struct · line 755
Quoted 10 lines
xen/drivers/passthrough/vtd/iommu.c +3
-3struct iommu *iommu = drhd->iommu; -if (is_igd_drhd (drhd) && !is_igd_vt_enabled_quirk () ) +if (is_igd_drhd (drhd) ) { -if ( force_iommu ) -panic ("BIOS did not enable IGD for VT properly, crash Xen for security purpose"); + if ( !iommu_igfx ) + return;
A message might be also helpful here so user can confirm its boot option takes effect...
Quoted 35 lines
xen/drivers/passthrough/vtd/iommu.c +7
-3- printk(XENLOG_WARNING VTDPREFIX - "BIOS did not enable IGD for VT properly. Disabling IGD VT-d engine.\n"); - return; + if ( !is_igd_vt_enabled_quirk() ) + { + if ( force_iommu ) + panic("BIOS did not enable IGD for VT properly, crash Xen for security purpose"); + + printk(XENLOG_WARNING VTDPREFIX + "BIOS did not enable IGD for VT properly. Disabling IGD VT-dengine.\n");
xen/drivers/passthrough/vtd/iommu.c +2
-0+return ; + } }/* apply platform specific errata workarounds */ xen/drivers/passthrough/vtd/quirks.c +0
-4@@ -70,9 +70,6 @@ int is_igd_vt_enabled_quirk(void) {u16 ggc; -if ( !iommu_igfx ) -return 0 ; -if ( !IS_ILK (ioh_id) )return 1 ; --
Quoted 1 line
2.9.4
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Tian, Kevin:
Quoted 6 lines
Review
Quoted 3 lines
From: Rusty Bird [mailto:[email protected]]
(quoted diff) +2
-0+ if ( !iommu_igfx ) + return;A message might be also helpful here so user can confirm its boot option takes effect...
Done, see v2 patch. Thanks for the feedback!
Rusty
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel