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 <xen/param.h>
23 #include <asm/hvm/support.h>
24
25 s8 __read_mostly hvm_port80_allowed = -1;
26 boolean_param("hvm_port80", hvm_port80_allowed);
27
dmi_hvm_deny_port80(const struct dmi_system_id * id)28 static int __init dmi_hvm_deny_port80(const struct dmi_system_id *id)
29 {
30 printk(XENLOG_WARNING "%s: port 0x80 access %s allowed for HVM guests\n",
31 id->ident, hvm_port80_allowed > 0 ? "forcibly" : "not");
32
33 if ( hvm_port80_allowed < 0 )
34 hvm_port80_allowed = 0;
35
36 return 0;
37 }
38
check_port80(void)39 static int __init check_port80(void)
40 {
41 /*
42 * Quirk table for systems that misbehave (lock up, etc.) if port
43 * 0x80 is used:
44 */
45 static const struct dmi_system_id __initconstrel hvm_no_port80_dmi_table[] =
46 {
47 {
48 .callback = dmi_hvm_deny_port80,
49 .ident = "Compaq Presario V6000",
50 .matches = {
51 DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
52 DMI_MATCH(DMI_BOARD_NAME, "30B7")
53 }
54 },
55 {
56 .callback = dmi_hvm_deny_port80,
57 .ident = "HP Pavilion dv9000z",
58 .matches = {
59 DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
60 DMI_MATCH(DMI_BOARD_NAME, "30B9")
61 }
62 },
63 {
64 .callback = dmi_hvm_deny_port80,
65 .ident = "HP Pavilion dv6000",
66 .matches = {
67 DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
68 DMI_MATCH(DMI_BOARD_NAME, "30B8")
69 }
70 },
71 {
72 .callback = dmi_hvm_deny_port80,
73 .ident = "HP Pavilion tx1000",
74 .matches = {
75 DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
76 DMI_MATCH(DMI_BOARD_NAME, "30BF")
77 }
78 },
79 {
80 .callback = dmi_hvm_deny_port80,
81 .ident = "Presario F700",
82 .matches = {
83 DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
84 DMI_MATCH(DMI_BOARD_NAME, "30D3")
85 }
86 },
87 { }
88 };
89
90 dmi_check_system(hvm_no_port80_dmi_table);
91
92 if ( !hvm_port80_allowed )
93 __set_bit(0x80, hvm_io_bitmap);
94
95 return 0;
96 }
97 __initcall(check_port80);
98