1 /******************************************************************************
2  * x86/hvm/quirks.c
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms and conditions of the GNU General Public License,
6  * version 2, as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
11  * more details.
12  *
13  * You should have received a copy of the GNU General Public License along with
14  * this program; If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #include <xen/types.h>
18 #include <xen/init.h>
19 #include <xen/lib.h>
20 #include <xen/dmi.h>
21 #include <xen/bitmap.h>
22 #include <asm/hvm/support.h>
23 
24 s8 __read_mostly hvm_port80_allowed = -1;
25 boolean_param("hvm_port80", hvm_port80_allowed);
26 
dmi_hvm_deny_port80(struct dmi_system_id * id)27 static int __init dmi_hvm_deny_port80(/*const*/ struct dmi_system_id *id)
28 {
29     printk(XENLOG_WARNING "%s: port 0x80 access %s allowed for HVM guests\n",
30            id->ident, hvm_port80_allowed > 0 ? "forcibly" : "not");
31 
32     if ( hvm_port80_allowed < 0 )
33         hvm_port80_allowed = 0;
34 
35     return 0;
36 }
37 
check_port80(void)38 static int __init check_port80(void)
39 {
40     /*
41      * Quirk table for systems that misbehave (lock up, etc.) if port
42      * 0x80 is used:
43      */
44     static struct dmi_system_id __initdata hvm_no_port80_dmi_table[] =
45     {
46         {
47             .callback = dmi_hvm_deny_port80,
48             .ident    = "Compaq Presario V6000",
49             .matches  = {
50                 DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
51                 DMI_MATCH(DMI_BOARD_NAME,   "30B7")
52             }
53         },
54         {
55             .callback = dmi_hvm_deny_port80,
56             .ident    = "HP Pavilion dv9000z",
57             .matches  = {
58                 DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
59                 DMI_MATCH(DMI_BOARD_NAME,   "30B9")
60             }
61         },
62         {
63             .callback = dmi_hvm_deny_port80,
64             .ident    = "HP Pavilion dv6000",
65             .matches  = {
66                 DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
67                 DMI_MATCH(DMI_BOARD_NAME,   "30B8")
68             }
69         },
70         {
71             .callback = dmi_hvm_deny_port80,
72             .ident    = "HP Pavilion tx1000",
73             .matches  = {
74                 DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
75                 DMI_MATCH(DMI_BOARD_NAME,   "30BF")
76             }
77         },
78         {
79             .callback = dmi_hvm_deny_port80,
80             .ident    = "Presario F700",
81             .matches  = {
82                 DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
83                 DMI_MATCH(DMI_BOARD_NAME,   "30D3")
84             }
85         },
86         { }
87     };
88 
89     dmi_check_system(hvm_no_port80_dmi_table);
90 
91     if ( !hvm_port80_allowed )
92         __set_bit(0x80, hvm_io_bitmap);
93 
94     return 0;
95 }
96 __initcall(check_port80);
97