]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.32.10/staging-hv-match-on-dmi-values-to-know-if-we-should-run.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.10 / staging-hv-match-on-dmi-values-to-know-if-we-should-run.patch
CommitLineData
99eec250
GKH
1From c22090facd354749cfe99a46e903449c7ac07788 Mon Sep 17 00:00:00 2001
2From: Greg Kroah-Hartman <gregkh@suse.de>
3Date: Thu, 25 Feb 2010 16:43:15 -0800
4Subject: Staging: hv: match on DMI values to know if we should run.
5
6From: Greg Kroah-Hartman <gregkh@suse.de>
7
8commit c22090facd354749cfe99a46e903449c7ac07788 upstream.
9
10The HV core mucks around with specific irqs and other low-level stuff
11and takes forever to determine that it really shouldn't be running on a
12machine. So instead, trigger off of the DMI system information and
13error out much sooner. This also allows the module loading tools to
14recognize that this code should be loaded on this type of system.
15
16Cc: Haiyang Zhang <haiyangz@microsoft.com>
17Cc: Hank Janssen <hjanssen@microsoft.com>
18Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
19
20---
21 drivers/staging/hv/vmbus_drv.c | 21 +++++++++++++++++----
22 1 file changed, 17 insertions(+), 4 deletions(-)
23
24--- a/drivers/staging/hv/vmbus_drv.c
25+++ b/drivers/staging/hv/vmbus_drv.c
26@@ -25,6 +25,7 @@
27 #include <linux/interrupt.h>
28 #include <linux/sysctl.h>
29 #include <linux/pci.h>
30+#include <linux/dmi.h>
31 #include "osd.h"
32 #include "logging.h"
33 #include "vmbus.h"
34@@ -947,6 +948,19 @@ static irqreturn_t vmbus_isr(int irq, vo
35 }
36 }
37
38+static struct dmi_system_id __initdata microsoft_hv_dmi_table[] = {
39+ {
40+ .ident = "Hyper-V",
41+ .matches = {
42+ DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
43+ DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
44+ DMI_MATCH(DMI_BOARD_NAME, "Virtual Machine"),
45+ },
46+ },
47+ { },
48+};
49+MODULE_DEVICE_TABLE(dmi, microsoft_hv_dmi_table);
50+
51 static int __init vmbus_init(void)
52 {
53 int ret = 0;
54@@ -958,6 +972,9 @@ static int __init vmbus_init(void)
55 vmbus_loglevel, HIWORD(vmbus_loglevel), LOWORD(vmbus_loglevel));
56 /* Todo: it is used for loglevel, to be ported to new kernel. */
57
58+ if (!dmi_check_system(microsoft_hv_dmi_table))
59+ return -ENODEV;
60+
61 ret = vmbus_bus_init(VmbusInitialize);
62
63 DPRINT_EXIT(VMBUS_DRV);
64@@ -979,10 +996,6 @@ static void __exit vmbus_exit(void)
65 * needed by distro tools to determine if the hyperv drivers should be
66 * installed and/or configured. We don't do anything else with the table, but
67 * it needs to be present.
68- *
69- * We might consider triggering off of DMI table info as well, as that does
70- * decribe the virtual machine being run on, but not all configuration tools
71- * seem to be able to handle DMI device ids properly.
72 */
73 const static struct pci_device_id microsoft_hv_pci_table[] = {
74 { PCI_DEVICE(0x1414, 0x5353) }, /* VGA compatible controller */