Commit c22090fa authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Staging: hv: match on DMI values to know if we should run.

The HV core mucks around with specific irqs and other low-level stuff
and takes forever to determine that it really shouldn't be running on a
machine.  So instead, trigger off of the DMI system information and
error out much sooner.  This also allows the module loading tools to
recognize that this code should be loaded on this type of system.

Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Hank Janssen <hjanssen@microsoft.com>
Cc: stable <stable@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 9a775dbd
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/sysctl.h> #include <linux/sysctl.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/dmi.h>
#include "VersionInfo.h" #include "VersionInfo.h"
#include "osd.h" #include "osd.h"
#include "logging.h" #include "logging.h"
...@@ -948,6 +949,19 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id) ...@@ -948,6 +949,19 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id)
} }
} }
static struct dmi_system_id __initdata microsoft_hv_dmi_table[] = {
{
.ident = "Hyper-V",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
DMI_MATCH(DMI_BOARD_NAME, "Virtual Machine"),
},
},
{ },
};
MODULE_DEVICE_TABLE(dmi, microsoft_hv_dmi_table);
static int __init vmbus_init(void) static int __init vmbus_init(void)
{ {
int ret = 0; int ret = 0;
...@@ -959,6 +973,9 @@ static int __init vmbus_init(void) ...@@ -959,6 +973,9 @@ static int __init vmbus_init(void)
vmbus_loglevel, HIWORD(vmbus_loglevel), LOWORD(vmbus_loglevel)); vmbus_loglevel, HIWORD(vmbus_loglevel), LOWORD(vmbus_loglevel));
/* Todo: it is used for loglevel, to be ported to new kernel. */ /* Todo: it is used for loglevel, to be ported to new kernel. */
if (!dmi_check_system(microsoft_hv_dmi_table))
return -ENODEV;
ret = vmbus_bus_init(VmbusInitialize); ret = vmbus_bus_init(VmbusInitialize);
DPRINT_EXIT(VMBUS_DRV); DPRINT_EXIT(VMBUS_DRV);
...@@ -980,10 +997,6 @@ static void __exit vmbus_exit(void) ...@@ -980,10 +997,6 @@ static void __exit vmbus_exit(void)
* needed by distro tools to determine if the hyperv drivers should be * needed by distro tools to determine if the hyperv drivers should be
* installed and/or configured. We don't do anything else with the table, but * installed and/or configured. We don't do anything else with the table, but
* it needs to be present. * it needs to be present.
*
* We might consider triggering off of DMI table info as well, as that does
* decribe the virtual machine being run on, but not all configuration tools
* seem to be able to handle DMI device ids properly.
*/ */
const static struct pci_device_id microsoft_hv_pci_table[] = { const static struct pci_device_id microsoft_hv_pci_table[] = {
{ PCI_DEVICE(0x1414, 0x5353) }, /* VGA compatible controller */ { PCI_DEVICE(0x1414, 0x5353) }, /* VGA compatible controller */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment