aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/cpu/vmware.c7
-rw-r--r--drivers/firmware/dmi_scan.c11
-rw-r--r--include/linux/dmi.h2
3 files changed, 19 insertions, 1 deletions
diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c
index a0905ecfe7d2..c034bda842d9 100644
--- a/arch/x86/kernel/cpu/vmware.c
+++ b/arch/x86/kernel/cpu/vmware.c
@@ -61,6 +61,11 @@ static unsigned long __vmware_get_tsc_khz(void)
61 return tsc_hz; 61 return tsc_hz;
62} 62}
63 63
64/*
65 * While checking the dmi string infomation, just checking the product
66 * serial key should be enough, as this will always have a VMware
67 * specific string when running under VMware hypervisor.
68 */
64int vmware_platform(void) 69int vmware_platform(void)
65{ 70{
66 if (cpu_has_hypervisor) { 71 if (cpu_has_hypervisor) {
@@ -74,7 +79,7 @@ int vmware_platform(void)
74 hyper_vendor_id[12] = '\0'; 79 hyper_vendor_id[12] = '\0';
75 if (!strcmp(hyper_vendor_id, "VMwareVMware")) 80 if (!strcmp(hyper_vendor_id, "VMwareVMware"))
76 return 1; 81 return 1;
77 } else if (dmi_available && dmi_name_in_vendors("VMware") && 82 } else if (dmi_available && dmi_name_in_serial("VMware") &&
78 __vmware_platform()) 83 __vmware_platform())
79 return 1; 84 return 1;
80 85
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 3e526b6d00cb..d66d41282907 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -467,6 +467,17 @@ const char *dmi_get_system_info(int field)
467} 467}
468EXPORT_SYMBOL(dmi_get_system_info); 468EXPORT_SYMBOL(dmi_get_system_info);
469 469
470/**
471 * dmi_name_in_serial - Check if string is in the DMI product serial
472 * information.
473 */
474int dmi_name_in_serial(const char *str)
475{
476 int f = DMI_PRODUCT_SERIAL;
477 if (dmi_ident[f] && strstr(dmi_ident[f], str))
478 return 1;
479 return 0;
480}
470 481
471/** 482/**
472 * dmi_name_in_vendors - Check if string is anywhere in the DMI vendor information. 483 * dmi_name_in_vendors - Check if string is anywhere in the DMI vendor information.
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index e5084eb5943a..2bfda178f274 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -44,6 +44,7 @@ extern const struct dmi_device * dmi_find_device(int type, const char *name,
44extern void dmi_scan_machine(void); 44extern void dmi_scan_machine(void);
45extern int dmi_get_year(int field); 45extern int dmi_get_year(int field);
46extern int dmi_name_in_vendors(const char *str); 46extern int dmi_name_in_vendors(const char *str);
47extern int dmi_name_in_serial(const char *str);
47extern int dmi_available; 48extern int dmi_available;
48extern int dmi_walk(void (*decode)(const struct dmi_header *)); 49extern int dmi_walk(void (*decode)(const struct dmi_header *));
49 50
@@ -56,6 +57,7 @@ static inline const struct dmi_device * dmi_find_device(int type, const char *na
56static inline void dmi_scan_machine(void) { return; } 57static inline void dmi_scan_machine(void) { return; }
57static inline int dmi_get_year(int year) { return 0; } 58static inline int dmi_get_year(int year) { return 0; }
58static inline int dmi_name_in_vendors(const char *s) { return 0; } 59static inline int dmi_name_in_vendors(const char *s) { return 0; }
60static inline int dmi_name_in_serial(const char *s) { return 0; }
59#define dmi_available 0 61#define dmi_available 0
60static inline int dmi_walk(void (*decode)(const struct dmi_header *)) 62static inline int dmi_walk(void (*decode)(const struct dmi_header *))
61 { return -1; } 63 { return -1; }