Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions arch/x86/kernel/slaunch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
18 changes: 2 additions & 16 deletions arch/x86/kernel/slmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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 */
Expand Down
1 change: 1 addition & 0 deletions include/linux/slaunch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down