Skip to content

Commit faa5bdb

Browse files
committed
Drop txt_os_mle_data::boot_params_addr
Signed-off-by: Sergii Dmytruk <[email protected]>
1 parent a02f20a commit faa5bdb

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

xen/arch/x86/boot/slaunch_early.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ void __stdcall slaunch_early_tests(uint32_t load_base_addr,
6868
{
6969
void *txt_heap;
7070
struct txt_os_mle_data *os_mle;
71+
struct slr_table *slrt;
7172
struct txt_os_sinit_data *os_sinit;
73+
struct slr_entry_intel_info *intel_info;
7274
uint32_t size = tgt_end_addr - tgt_base_addr;
7375

7476
if ( !is_intel_cpu() )
@@ -77,7 +79,6 @@ void __stdcall slaunch_early_tests(uint32_t load_base_addr,
7779
* Not an Intel CPU. Currently the only other option is AMD with SKINIT
7880
* and secure-kernel-loader (SKL).
7981
*/
80-
struct slr_table *slrt;
8182
struct slr_entry_amd_info *amd_info;
8283
const struct skinit_sl_header *sl_header = (void *)slaunch_param;
8384

@@ -104,9 +105,18 @@ void __stdcall slaunch_early_tests(uint32_t load_base_addr,
104105
os_mle = txt_os_mle_data_start(txt_heap);
105106
os_sinit = txt_os_sinit_data_start(txt_heap);
106107

107-
txt_verify_pmr_ranges(os_mle, os_sinit, load_base_addr, tgt_base_addr,
108-
size);
109-
110-
result->mbi_pa = os_mle->boot_params_addr;
111108
result->slrt_pa = os_mle->slrt;
109+
result->mbi_pa = 0;
110+
111+
slrt = (struct slr_table *)result->slrt_pa;
112+
113+
intel_info = (struct slr_entry_intel_info *)
114+
slr_next_entry_by_tag (slrt, NULL, SLR_ENTRY_INTEL_INFO);
115+
if ( intel_info == NULL || intel_info->hdr.size != sizeof(*intel_info) )
116+
return;
117+
118+
result->mbi_pa = intel_info->boot_params_base;
119+
120+
txt_verify_pmr_ranges(os_mle, os_sinit, intel_info,
121+
load_base_addr, tgt_base_addr, size);
112122
}

xen/arch/x86/efi/efi-boot.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ void __init noreturn start_xen_from_efi(void)
258258
struct txt_os_sinit_data *os_sinit =
259259
txt_os_sinit_data_start(txt_heap);
260260

261-
txt_verify_pmr_ranges(os_mle, os_sinit, xen_phys_start,
261+
txt_verify_pmr_ranges(os_mle, os_sinit, intel_info, xen_phys_start,
262262
__XEN_VIRT_START, image_size);
263263
}
264264
}

xen/arch/x86/include/asm/intel_txt.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
extern char txt_ap_entry[];
8888
extern uint32_t trampoline_gdt[];
8989

90+
#include <xen/slr_table.h>
9091
#include <xen/types.h>
9192

9293
/* We need to differentiate between pre- and post paging enabled. */
@@ -130,7 +131,6 @@ static inline void txt_reset(uint32_t error)
130131
struct txt_os_mle_data {
131132
uint32_t version;
132133
uint32_t reserved;
133-
uint64_t boot_params_addr;
134134
uint64_t slrt;
135135
uint64_t txt_info;
136136
uint32_t ap_wake_block;
@@ -348,6 +348,7 @@ static inline void *txt_init(void)
348348

349349
static inline void txt_verify_pmr_ranges(struct txt_os_mle_data *os_mle,
350350
struct txt_os_sinit_data *os_sinit,
351+
struct slr_entry_intel_info *info,
351352
uint32_t load_base_addr,
352353
uint64_t tgt_base_addr,
353354
uint32_t xen_size)
@@ -393,8 +394,8 @@ static inline void txt_verify_pmr_ranges(struct txt_os_mle_data *os_mle,
393394
txt_reset(SLAUNCH_ERROR_LO_PMR_MLE);
394395

395396
/* Check if MBI is covered by PMR. MBI starts with 'uint32_t total_size'. */
396-
if ( !is_in_pmr(os_sinit, os_mle->boot_params_addr,
397-
*(uint32_t *)(uintptr_t)os_mle->boot_params_addr,
397+
if ( !is_in_pmr(os_sinit, info->boot_params_base,
398+
*(uint32_t *)(uintptr_t)info->boot_params_base,
398399
check_high_pmr) )
399400
txt_reset(SLAUNCH_ERROR_BUFFER_BEYOND_PMR);
400401

0 commit comments

Comments
 (0)