diff --git a/arch/x86/kernel/slaunch.c b/arch/x86/kernel/slaunch.c index c61445c079ff..a48fa9b77f0d 100644 --- a/arch/x86/kernel/slaunch.c +++ b/arch/x86/kernel/slaunch.c @@ -24,8 +24,7 @@ static u32 sl_flags __ro_after_init; static struct sl_ap_wake_info ap_wake_info __ro_after_init; -static u64 evtlog_addr __ro_after_init; -static u32 evtlog_size __ro_after_init; +static struct slr_entry_log_info sl_log_info __ro_after_init; static u64 vtd_pmr_lo_size __ro_after_init; /* This should be plenty of room */ @@ -49,6 +48,14 @@ struct sl_ap_wake_info *slaunch_get_ap_wake_info(void) return &ap_wake_info; } +/* + * Return the event log information from SLRT. + */ +struct slr_entry_log_info *slaunch_get_log_info(void) +{ + return &sl_log_info; +} + /* * On Intel platforms, TXT passes a safe copy of the DMAR ACPI table to the * DRTM. The DRTM is supposed to use this instead of the one found in the @@ -312,8 +319,8 @@ static void __init slaunch_txt_reserve(void __iomem *txt) * event log needs to be reserved. If it is in the TXT heap, it is * already reserved. */ - if (evtlog_addr < heap_base || evtlog_addr > (heap_base + heap_size)) - slaunch_txt_reserve_range(evtlog_addr, evtlog_size); + if (sl_log_info.addr < heap_base || sl_log_info.addr > (heap_base + heap_size)) + slaunch_txt_reserve_range(sl_log_info.addr, sl_log_info.size); for (i = 0; i < e820_table->nr_entries; i++) { base = e820_table->entries[i].addr; @@ -407,8 +414,7 @@ static void __init slaunch_fetch_values(void __iomem *txt) if (!log_info) slaunch_reset(txt, "SLRT missing logging info entry\n", SL_ERROR_SLRT_MISSING_ENTRY); - evtlog_addr = log_info->addr; - evtlog_size = log_info->size; + sl_log_info = *log_info; early_memunmap(slrt, size); diff --git a/arch/x86/kernel/slmodule.c b/arch/x86/kernel/slmodule.c index 407288c6c2d5..50b998b32f3b 100644 --- a/arch/x86/kernel/slmodule.c +++ b/arch/x86/kernel/slmodule.c @@ -247,7 +247,6 @@ static void slaunch_intel_evtlog(void __iomem *txt) { struct slr_entry_log_info *log_info; struct txt_os_mle_data *params; - struct slr_table *slrt; void *os_sinit_data; u64 base, size; @@ -261,28 +260,15 @@ static void slaunch_intel_evtlog(void __iomem *txt) params = (struct txt_os_mle_data *)txt_os_mle_data_start(txt_heap); - /* Get the SLRT and remap it */ - slrt = memremap(params->slrt, sizeof(*slrt), MEMREMAP_WB); - if (!slrt) - slaunch_reset(txt, "Error failed to memremap SLR Table\n", SL_ERROR_SLRT_MAP); - size = slrt->size; - memunmap(slrt); - - slrt = memremap(params->slrt, size, MEMREMAP_WB); - if (!slrt) - slaunch_reset(txt, "Error failed to memremap SLR Table\n", SL_ERROR_SLRT_MAP); - - log_info = slr_next_entry_by_tag(slrt, NULL, SLR_ENTRY_LOG_INFO); + log_info = slaunch_get_log_info(); if (!log_info) - slaunch_reset(txt, "Error failed to memremap SLR Table\n", SL_ERROR_SLRT_MISSING_ENTRY); + slaunch_reset(txt, "Error getting TPM event log info\n", SL_ERROR_SLRT_MISSING_ENTRY); sl_evtlog.size = log_info->size; sl_evtlog.addr = memremap(log_info->addr, log_info->size, MEMREMAP_WB); if (!sl_evtlog.addr) slaunch_reset(txt, "Error failed to memremap TPM event log\n", SL_ERROR_EVENTLOG_MAP); - memunmap(slrt); - /* Determine if this is TPM 1.2 or 2.0 event log */ if (memcmp(sl_evtlog.addr + sizeof(struct tcg_pcr_event), TCG_SPECID_SIG, sizeof(TCG_SPECID_SIG))) return; /* looks like it is not 2.0 */ diff --git a/include/linux/slaunch.h b/include/linux/slaunch.h index 330492fcdd8c..145a818c7ff1 100644 --- a/include/linux/slaunch.h +++ b/include/linux/slaunch.h @@ -204,6 +204,7 @@ void slaunch_setup(void); void slaunch_fixup_ap_wake_vector(void); u32 slaunch_get_flags(void); struct sl_ap_wake_info *slaunch_get_ap_wake_info(void); +struct slr_entry_log_info *slaunch_get_log_info(void); struct acpi_table_header *slaunch_get_dmar_table(struct acpi_table_header *dmar); void __noreturn slaunch_reset(void *ctx, const char *msg, u64 error); void slaunch_finalize(int do_sexit);