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

[Xen-devel] [PATCH] x86/hvm: don't pass through port 0x80 in a few special cases



In a recent commit (99f85a28a78e96d28907fe036e1671a218fee597), KVM
disabled the passthrough of this port due to known problems on certain
HP laptops (see http://lkml.indiana.edu/hypermail/linux/kernel/0712.3/0872.html 
and http://lkml.indiana.edu/hypermail/linux/kernel/0801.0/2388.html).

For Xen, don't do this globally, but rather based on a DMI black list.

It may be worth considering to add a platform hypercall instead, so
that the knowledge Dom0 already may have can be utilized in Xen - and
in particular to not have the need to keep the list of affected systems
in sync with Linux'.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

--- 2009-06-10.orig/xen/arch/x86/hvm/hvm.c      2009-06-10 11:22:25.000000000 
+0200
+++ 2009-06-10/xen/arch/x86/hvm/hvm.c   2009-06-10 13:54:49.000000000 +0200
@@ -33,6 +33,7 @@
 #include <xen/guest_access.h>
 #include <xen/event.h>
 #include <xen/paging.h>
+#include <xen/dmi.h>
 #include <asm/shadow.h>
 #include <asm/hap.h>
 #include <asm/current.h>
@@ -69,6 +70,77 @@ struct hvm_function_table hvm_funcs __re
 unsigned long __attribute__ ((__section__ (".bss.page_aligned")))
     hvm_io_bitmap[3*PAGE_SIZE/BYTES_PER_LONG];
 
+static int hvm_port80_allowed = -1;
+boolean_param("hvm_port80", hvm_port80_allowed);
+
+static int __init dmi_hvm_deny_port80(/*const*/ struct dmi_system_id *id)
+{
+    printk(XENLOG_WARNING "%s: port 0x80 access %s allowed for HVM guests\n",
+           id->ident, hvm_port80_allowed > 0 ? "forcibly" : "not");
+
+    if ( hvm_port80_allowed < 0 )
+        hvm_port80_allowed = 0;
+
+    return 0;
+}
+
+static int __init check_port80(void)
+{
+    /*
+     * Quirk table for systems that misbehave (lock up, etc.) if port
+     * 0x80 is used:
+     */
+    static struct dmi_system_id __initdata hvm_no_port80_dmi_table[] =
+    {
+        {
+            .callback = dmi_hvm_deny_port80,
+            .ident    = "Compaq Presario V6000",
+            .matches  = {
+                DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
+                DMI_MATCH(DMI_BOARD_NAME,   "30B7")
+            }
+        },
+        {
+            .callback = dmi_hvm_deny_port80,
+            .ident    = "HP Pavilion dv9000z",
+            .matches  = {
+                DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
+                DMI_MATCH(DMI_BOARD_NAME,   "30B9")
+            }
+        },
+        {
+            .callback = dmi_hvm_deny_port80,
+            .ident    = "HP Pavilion dv6000",
+            .matches  = {
+                DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
+                DMI_MATCH(DMI_BOARD_NAME,   "30B8")
+            }
+        },
+        {
+            .callback = dmi_hvm_deny_port80,
+            .ident    = "HP Pavilion tx1000",
+            .matches  = {
+                DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
+                DMI_MATCH(DMI_BOARD_NAME,   "30BF")
+            }
+        },
+        {
+            .callback = dmi_hvm_deny_port80,
+            .ident    = "Presario F700",
+            .matches  = {
+                DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
+                DMI_MATCH(DMI_BOARD_NAME,   "30D3")
+            }
+        },
+        { }
+    };
+
+    dmi_check_system(hvm_no_port80_dmi_table);
+
+    return 0;
+}
+__initcall(check_port80);
+
 void hvm_enable(struct hvm_function_table *fns)
 {
     BUG_ON(hvm_enabled);
@@ -79,7 +151,8 @@ void hvm_enable(struct hvm_function_tabl
      * often used for I/O delays, but the vmexits simply slow things down).
      */
     memset(hvm_io_bitmap, ~0, sizeof(hvm_io_bitmap));
-    __clear_bit(0x80, hvm_io_bitmap);
+    if ( hvm_port80_allowed )
+        __clear_bit(0x80, hvm_io_bitmap);
     __clear_bit(0xed, hvm_io_bitmap);
 
     hvm_funcs   = *fns;




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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