Skip to content

Commit

Permalink
xen/arch/x86/e820.c: Read the MTRR caps and default type after restoring
Browse files Browse the repository at this point in the history
The MTRR capabilities and default type were read before the MTRRs were
restored in slaunch flow. The restoration itself updated the MTRR default
type MSR, so the mtrr_top_of_ram had invalid state in mtrr_cap and
mtrr_def variables. Move reading those MSRs after MTRRs are restored
in slaunch flow.

Signed-off-by: Michał Żygowski <[email protected]>
  • Loading branch information
miczyg1 committed Sep 15, 2024
1 parent 2dd7f6c commit f569612
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions xen/arch/x86/e820.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,12 +454,12 @@ static uint64_t __init mtrr_top_of_ram(void)
ASSERT(paddr_bits);
addr_mask = ((1ull << paddr_bits) - 1) & PAGE_MASK;

rdmsrl(MSR_MTRRcap, mtrr_cap);
rdmsrl(MSR_MTRRdefType, mtrr_def);

if ( slaunch_active && boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
txt_restore_mtrrs(e820_verbose);

rdmsrl(MSR_MTRRcap, mtrr_cap);
rdmsrl(MSR_MTRRdefType, mtrr_def);

if ( e820_verbose )
printk(" MTRR cap: %"PRIx64" type: %"PRIx64"\n", mtrr_cap, mtrr_def);

Expand Down

0 comments on commit f569612

Please sign in to comment.