[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH V2] Decouple SnadyBridge quirk form VTd timeout



Currently the quirk code for SandyBridge uses the VTd timeout value when
writing to an IGD register.  This is the wrong timeout to use and, at
1000 msec, is much too large.  Change this behavior by adding a new
boot paramter, snb_igd_timeout, that can specify the timeout to be used
when accessing the IGD registers in the quirk code.

For compatibility purposes, specifying the current boolean parameter,
snb_igd_quirk, will enable the quirk code with a timeout of 1000 msec.
Specifying the new parameter, snb_igd_timeout, with no value will
enable the quirk code with the theoretical maximum timeout of
670 msec.  Specifying a value for this parameter sets the timeout
to that number of msec.

Signed-off-by: Don Dugger <donald.d.dugger@xxxxxxxxx>

diff -r 9d485e2c8339 xen/drivers/passthrough/vtd/quirks.c
--- a/xen/drivers/passthrough/vtd/quirks.c      Mon Nov 10 12:03:36 2014 +0000
+++ b/xen/drivers/passthrough/vtd/quirks.c      Sun Nov 16 17:28:17 2014 -0700
@@ -50,6 +50,9 @@
 #define IS_ILK(id)    (id == 0x00408086 || id == 0x00448086 || id== 0x00628086 
|| id == 0x006A8086)
 #define IS_CPT(id)    (id == 0x01008086 || id == 0x01048086)
 
+#define SNB_IGD_TIMEOUT        MILLISECS(670)
+static u32 snb_igd_timeout = MILLISECS(1000);
+
 static u32 __read_mostly ioh_id;
 static u32 __initdata igd_id;
 bool_t __read_mostly rwbf_quirk;
@@ -158,6 +161,20 @@
  * Workaround is to prevent graphics get into RC6
  * state when doing VT-d IOTLB operations, do the VT-d
  * IOTLB operation, and then re-enable RC6 state.
+ *
+ * This code, enabled by the Xen command line parameter
+ * snb_igd_quirk, due to legacy issues, uses th VTd timeout
+ * of 1000 msec.  This timeout is too large so a second
+ * integer parameter, snb_igd_timeout, can be used to fine
+ * tune the IGD register access timeout.
+ *
+ * Specifying snb_igd_timeout with no value enables this
+ * quirk and sets the timeout to the theoretical maximum
+ * of 670 msec.  Setting this parameter with a value enables
+ * this quirk and sets the timeout to that value.
+ *
+ * If neither snb_igd_quirk nor snb_igd_timeout are specified
+ * then the quirk code is not enabled.
  */
 static void snb_vtd_ops_preamble(struct iommu* iommu)
 {
@@ -177,7 +194,7 @@
     start_time = NOW();
     while ( (*(volatile u32 *)(igd_reg_va + 0x22AC) & 0xF) != 0 )
     {
-        if ( NOW() > start_time + DMAR_OPERATION_TIMEOUT )
+        if ( NOW() > start_time + snb_igd_timeout )
         {
             dprintk(XENLOG_INFO VTDPREFIX,
                     "snb_vtd_ops_preamble: failed to disable idle 
handshake\n");
@@ -237,6 +254,18 @@
     }
 }
 
+static void __init parse_snb_timeout(const char *s)
+{
+
+       if (*s == '\0')
+               snb_igd_timeout = SNB_IGD_TIMEOUT;
+       else
+               snb_igd_timeout = MILLISECS(simple_strtoul(s, &s, 0));
+       snb_igd_quirk = 1;
+       return;
+}
+custom_param("snb_igd_timeout", parse_snb_timeout);
+
 /* 5500/5520/X58 Chipset Interrupt remapping errata, for stepping B-3.
  * Fixed in stepping C-2. */
 static void __init tylersburg_intremap_quirk(void)

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.