Skip to content

Commit 4fb387d

Browse files
committed
security/intel/txt/common.c: avoid clearing memory if SMX is absent
When CPU doesn't support SMX, a DRTM is not possible, yet any reboot seems to be treated as DRTM reset. Discard TXT error and secret bits as irrelevant to avoid unnecessarily clearing DRAM on reboots as that makes reboot significantly longer. This applies to platforms which have CONFIG_INTEL_TXT for CBnT, have a TXT-enabled chipset, but don't have a CPU with TXT support. Change-Id: If937419d4186c7421c3eb52daf0cc299993b5068 Upstream-Status: Pending Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
1 parent 1e0659e commit 4fb387d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/security/intel/txt/common.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,13 @@ bool intel_txt_memory_has_secrets(void)
140140
if (!CONFIG(INTEL_TXT))
141141
return false;
142142

143-
ret = (read8p(TXT_ESTS) & TXT_ESTS_WAKE_ERROR_STS) ||
144-
(read64p(TXT_E2STS) & TXT_E2STS_SECRET_STS);
143+
if (!(cpuid_ecx(1) & CPUID_SMX)) {
144+
printk(BIOS_CRIT, "TXT-STS: assuming no secrets as CPU doesn't support SMX\n");
145+
ret = false;
146+
} else {
147+
ret = (read8p(TXT_ESTS) & TXT_ESTS_WAKE_ERROR_STS) ||
148+
(read64p(TXT_E2STS) & TXT_E2STS_SECRET_STS);
149+
}
145150

146151
if (ret)
147152
printk(BIOS_CRIT, "TXT-STS: Secrets in memory!\n");

0 commit comments

Comments
 (0)