All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] VT-d/DMAR: accept DRHD with non-discoverable PCI devices
@ 2019-03-20 20:22 Igor Druzhinin
  2019-03-21 13:17 ` Andrew Cooper
  2019-03-21 16:55 ` Pasi Kärkkäinen
  0 siblings, 2 replies; 5+ messages in thread
From: Igor Druzhinin @ 2019-03-20 20:22 UTC (permalink / raw)
  To: xen-devel
  Cc: Igor Druzhinin, kevin.tian, sstabellini, wei.liu2, konrad.wilk,
	George.Dunlap, andrew.cooper3, julien.grall, jbeulich

Since commit dcf41790 ("x86/mmcfg/drhd: Move acpi_mmcfg_init() call
before calling acpi_parse_dmar()") PCI segment 0 is now known early
which made the sanity check on DRHD definition structure to work.
This, in turn, caused a regression on some machines (in particular,
HP PowerEdge R740 with I/O AT DMA disabled) where IOMMU was explicitly
disabled due to some internal PCI devices being non-discoverable but
present in DMAR.

While this is indeed a BIOS mistake it seems to be not that critical
to disable the whole IOMMU. Instead, extend the scope of
"workaround_bios_bug" option and make it enabled by default. This is
consistent with our documentation and actually what a user might expect
from an option with that name. It also doesn't seem safe to simply ignore
DRHD without initialization so remove this case. But leave the original
DMAR check in place to still allow error reporting.

Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
---
 docs/misc/xen-command-line.pandoc  |  2 +-
 xen/drivers/passthrough/iommu.c    |  2 +-
 xen/drivers/passthrough/vtd/dmar.c | 25 ++++++-------------------
 3 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index b0b6300..9413354 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -1261,7 +1261,7 @@ The following options are specific to Intel VT-d hardware:
     similar to Linux's `intel_iommu=igfx_off` option.  If specifying `no-igfx`
     fixes anything, please report the problem.
 
-*   The `workaround_bios_bug` boolean is disabled by default.  It can be used
+*   The `workaround_bios_bug` boolean is enabled by default.  It can be used
     to ignore errors when parsing the ACPI tables, and finding a listed PCI
     device which doesn't appear to exist in the system.
 
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
index 5ecaa10..de3a9eb 100644
--- a/xen/drivers/passthrough/iommu.c
+++ b/xen/drivers/passthrough/iommu.c
@@ -30,7 +30,7 @@ bool_t __initdata iommu_enable = 1;
 bool_t __read_mostly iommu_enabled;
 bool_t __read_mostly force_iommu;
 bool_t __read_mostly iommu_verbose;
-bool_t __read_mostly iommu_workaround_bios_bug;
+bool_t __read_mostly iommu_workaround_bios_bug = 1;
 bool_t __read_mostly iommu_igfx = 1;
 bool_t __read_mostly iommu_snoop = 1;
 bool_t __read_mostly iommu_qinval = 1;
diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c
index ac10602..9526ee7 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -553,26 +553,13 @@ acpi_parse_one_drhd(struct acpi_dmar_header *header)
             }
         }
 
-        if ( invalid_cnt )
+        if ( invalid_cnt && !iommu_workaround_bios_bug )
         {
-            if ( iommu_workaround_bios_bug &&
-                 invalid_cnt == dmaru->scope.devices_cnt )
-            {
-                printk(XENLOG_WARNING VTDPREFIX
-                       "  Workaround BIOS bug: ignoring DRHD (no devices in its scope are PCI discoverable)\n");
-
-                scope_devices_free(&dmaru->scope);
-                iommu_free(dmaru);
-                xfree(dmaru);
-            }
-            else
-            {
-                printk(XENLOG_WARNING VTDPREFIX
-                       "  DRHD is invalid (some devices in its scope are not PCI discoverable)\n");
-                printk(XENLOG_WARNING VTDPREFIX
-                       "  Try \"iommu=force\" or \"iommu=workaround_bios_bug\" if you really want VT-d\n");
-                ret = -EINVAL;
-            }
+            printk(XENLOG_WARNING VTDPREFIX
+                   "  DRHD is invalid (some devices in its scope are not PCI discoverable)\n");
+            printk(XENLOG_WARNING VTDPREFIX
+                   "  Try \"iommu=force\" or \"iommu=workaround_bios_bug\" if you really want VT-d\n");
+            ret = -EINVAL;
         }
         else
             acpi_register_drhd_unit(dmaru);
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-21 18:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-20 20:22 [PATCH] VT-d/DMAR: accept DRHD with non-discoverable PCI devices Igor Druzhinin
2019-03-21 13:17 ` Andrew Cooper
2019-03-21 13:50   ` Juergen Gross
2019-03-21 18:04   ` Igor Druzhinin
2019-03-21 16:55 ` Pasi Kärkkäinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.