Message ID | 20220406123312.12986-1-varad.gautam@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [kvm-unit-tests] x86: efi: Fix pagetable creation | expand |
On 4/6/22 14:33, Varad Gautam wrote: > setup_page_table() ends up filling invalid page table entries > at ptl2 due to improper typecasting. This sometimes leads to > unhandled pagefaults when writing to APIC registers. Fix it. > > Fixes: e6f65fa464 ("x86 UEFI: Set up page tables") > Signed-off-by: Varad Gautam <varad.gautam@suse.com> > --- > lib/x86/setup.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/x86/setup.c b/lib/x86/setup.c > index bbd3468..7bc7c93 100644 > --- a/lib/x86/setup.c > +++ b/lib/x86/setup.c > @@ -258,7 +258,7 @@ static void setup_page_table(void) > curr_pt = (pgd_t *)&ptl2; > flags |= PT_ACCESSED_MASK | PT_DIRTY_MASK | PT_PAGE_SIZE_MASK | PT_GLOBAL_MASK; > for (i = 0; i < 4 * 512; i++) { > - curr_pt[i] = ((phys_addr_t)(i << 21)) | flags; > + curr_pt[i] = ((phys_addr_t) i << 21) | flags; > } > > if (amd_sev_es_enabled()) { Applied, thanks. Paolo
diff --git a/lib/x86/setup.c b/lib/x86/setup.c index bbd3468..7bc7c93 100644 --- a/lib/x86/setup.c +++ b/lib/x86/setup.c @@ -258,7 +258,7 @@ static void setup_page_table(void) curr_pt = (pgd_t *)&ptl2; flags |= PT_ACCESSED_MASK | PT_DIRTY_MASK | PT_PAGE_SIZE_MASK | PT_GLOBAL_MASK; for (i = 0; i < 4 * 512; i++) { - curr_pt[i] = ((phys_addr_t)(i << 21)) | flags; + curr_pt[i] = ((phys_addr_t) i << 21) | flags; } if (amd_sev_es_enabled()) {
setup_page_table() ends up filling invalid page table entries at ptl2 due to improper typecasting. This sometimes leads to unhandled pagefaults when writing to APIC registers. Fix it. Fixes: e6f65fa464 ("x86 UEFI: Set up page tables") Signed-off-by: Varad Gautam <varad.gautam@suse.com> --- lib/x86/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)