summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Limonciello <mario.limonciello@dell.com>2017-11-01 15:25:33 -0400
committerDarren Hart (VMware) <dvhart@infradead.org>2017-11-03 19:33:59 -0400
commitda1f607ed6e6a904463396bb6a28bf96584c61cc (patch)
tree393d0d966e034f03f017f64f34c54441a4ddbfc5
parent1a258e670434f404a4500b65ba1afea2c2b29bba (diff)
platform/x86: dell-smbios-smm: test for WSMT
WSMT is as an attestation to the OS that the platform won't modify memory outside of pre-defined areas. If a platform has WSMT enabled in BIOS setup, SMM calls through dcdbas will fail. The only way to access platform data in these instances is through the WMI SMBIOS calling interface. Signed-off-by: Mario Limonciello <mario.limonciello@dell.com> Reviewed-by: Edward O'Callaghan <quasisec@google.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
-rw-r--r--drivers/platform/x86/dell-smbios-smm.c33
-rw-r--r--drivers/platform/x86/dell-smbios.h2
2 files changed, 35 insertions, 0 deletions
diff --git a/drivers/platform/x86/dell-smbios-smm.c b/drivers/platform/x86/dell-smbios-smm.c
index 53eabb14fb48..89f65c4651a0 100644
--- a/drivers/platform/x86/dell-smbios-smm.c
+++ b/drivers/platform/x86/dell-smbios-smm.c
@@ -102,6 +102,32 @@ int dell_smbios_smm_call(struct calling_interface_buffer *input)
102 return 0; 102 return 0;
103} 103}
104 104
105/* When enabled this indicates that SMM won't work */
106static bool test_wsmt_enabled(void)
107{
108 struct calling_interface_token *wsmt;
109
110 /* if token doesn't exist, SMM will work */
111 wsmt = dell_smbios_find_token(WSMT_EN_TOKEN);
112 if (!wsmt)
113 return false;
114
115 /* If token exists, try to access over SMM but set a dummy return.
116 * - If WSMT disabled it will be overwritten by SMM
117 * - If WSMT enabled then dummy value will remain
118 */
119 buffer->cmd_class = CLASS_TOKEN_READ;
120 buffer->cmd_select = SELECT_TOKEN_STD;
121 memset(buffer, 0, sizeof(struct calling_interface_buffer));
122 buffer->input[0] = wsmt->location;
123 buffer->output[0] = 99;
124 dell_smbios_smm_call(buffer);
125 if (buffer->output[0] == 99)
126 return true;
127
128 return false;
129}
130
105static int __init dell_smbios_smm_init(void) 131static int __init dell_smbios_smm_init(void)
106{ 132{
107 int ret; 133 int ret;
@@ -115,6 +141,12 @@ static int __init dell_smbios_smm_init(void)
115 141
116 dmi_walk(find_cmd_address, NULL); 142 dmi_walk(find_cmd_address, NULL);
117 143
144 if (test_wsmt_enabled()) {
145 pr_debug("Disabling due to WSMT enabled\n");
146 ret = -ENODEV;
147 goto fail_wsmt;
148 }
149
118 platform_device = platform_device_alloc("dell-smbios", 1); 150 platform_device = platform_device_alloc("dell-smbios", 1);
119 if (!platform_device) { 151 if (!platform_device) {
120 ret = -ENOMEM; 152 ret = -ENOMEM;
@@ -138,6 +170,7 @@ fail_register:
138fail_platform_device_add: 170fail_platform_device_add:
139 platform_device_put(platform_device); 171 platform_device_put(platform_device);
140 172
173fail_wsmt:
141fail_platform_device_alloc: 174fail_platform_device_alloc:
142 free_page((unsigned long)buffer); 175 free_page((unsigned long)buffer);
143 return ret; 176 return ret;
diff --git a/drivers/platform/x86/dell-smbios.h b/drivers/platform/x86/dell-smbios.h
index b3179f5b326b..07effdc7ae8b 100644
--- a/drivers/platform/x86/dell-smbios.h
+++ b/drivers/platform/x86/dell-smbios.h
@@ -44,6 +44,8 @@
44#define KBD_LED_AUTO_100_TOKEN 0x02F6 44#define KBD_LED_AUTO_100_TOKEN 0x02F6
45#define GLOBAL_MIC_MUTE_ENABLE 0x0364 45#define GLOBAL_MIC_MUTE_ENABLE 0x0364
46#define GLOBAL_MIC_MUTE_DISABLE 0x0365 46#define GLOBAL_MIC_MUTE_DISABLE 0x0365
47#define WSMT_EN_TOKEN 0x04EC
48#define WSMT_DIS_TOKEN 0x04ED
47 49
48struct notifier_block; 50struct notifier_block;
49 51