diff options
author | Mario Limonciello <mario.limonciello@dell.com> | 2017-11-01 20:25:33 +0100 |
---|---|---|
committer | Darren Hart (VMware) <dvhart@infradead.org> | 2017-11-04 00:33:59 +0100 |
commit | da1f607ed6e6a904463396bb6a28bf96584c61cc (patch) | |
tree | 393d0d966e034f03f017f64f34c54441a4ddbfc5 /drivers/platform | |
parent | platform/x86: dell-smbios-wmi: Add new WMI dispatcher driver (diff) | |
download | linux-da1f607ed6e6a904463396bb6a28bf96584c61cc.tar.xz linux-da1f607ed6e6a904463396bb6a28bf96584c61cc.zip |
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>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/dell-smbios-smm.c | 33 | ||||
-rw-r--r-- | drivers/platform/x86/dell-smbios.h | 2 |
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) return 0; } +/* When enabled this indicates that SMM won't work */ +static bool test_wsmt_enabled(void) +{ + struct calling_interface_token *wsmt; + + /* if token doesn't exist, SMM will work */ + wsmt = dell_smbios_find_token(WSMT_EN_TOKEN); + if (!wsmt) + return false; + + /* If token exists, try to access over SMM but set a dummy return. + * - If WSMT disabled it will be overwritten by SMM + * - If WSMT enabled then dummy value will remain + */ + buffer->cmd_class = CLASS_TOKEN_READ; + buffer->cmd_select = SELECT_TOKEN_STD; + memset(buffer, 0, sizeof(struct calling_interface_buffer)); + buffer->input[0] = wsmt->location; + buffer->output[0] = 99; + dell_smbios_smm_call(buffer); + if (buffer->output[0] == 99) + return true; + + return false; +} + static int __init dell_smbios_smm_init(void) { int ret; @@ -115,6 +141,12 @@ static int __init dell_smbios_smm_init(void) dmi_walk(find_cmd_address, NULL); + if (test_wsmt_enabled()) { + pr_debug("Disabling due to WSMT enabled\n"); + ret = -ENODEV; + goto fail_wsmt; + } + platform_device = platform_device_alloc("dell-smbios", 1); if (!platform_device) { ret = -ENOMEM; @@ -138,6 +170,7 @@ fail_register: fail_platform_device_add: platform_device_put(platform_device); +fail_wsmt: fail_platform_device_alloc: free_page((unsigned long)buffer); 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 @@ #define KBD_LED_AUTO_100_TOKEN 0x02F6 #define GLOBAL_MIC_MUTE_ENABLE 0x0364 #define GLOBAL_MIC_MUTE_DISABLE 0x0365 +#define WSMT_EN_TOKEN 0x04EC +#define WSMT_DIS_TOKEN 0x04ED struct notifier_block; |