Skip to content

Commit

Permalink
x86/pvh: Set phys_base when calling xen_prepare_pvh()
Browse files Browse the repository at this point in the history
[ Upstream commit b464b46 ]

phys_base needs to be set for __pa() to work in xen_pvh_init() when
finding the hypercall page.  Set it before calling into
xen_prepare_pvh(), which calls xen_pvh_init().  Clear it afterward to
avoid __startup_64() adding to it and creating an incorrect value.

Signed-off-by: Jason Andryuk <[email protected]>
Reviewed-by: Juergen Gross <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Juergen Gross <[email protected]>
Stable-dep-of: e8fbc0d ("x86/pvh: Call C code via the kernel virtual mapping")
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
Jason Andryuk authored and gregkh committed Dec 9, 2024
1 parent aa6e32c commit f662b4a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions arch/x86/platform/pvh/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,20 @@ SYM_CODE_START_LOCAL(pvh_start_xen)
xor %edx, %edx
wrmsr

/*
* Calculate load offset and store in phys_base. __pa() needs
* phys_base set to calculate the hypercall page in xen_pvh_init().
*/
movq %rbp, %rbx
subq $_pa(pvh_start_xen), %rbx
movq %rbx, phys_base(%rip)
call xen_prepare_pvh
/*
* Clear phys_base. __startup_64 will *add* to its value,
* so reset to 0.
*/
xor %rbx, %rbx
movq %rbx, phys_base(%rip)

/* startup_64 expects boot_params in %rsi. */
mov $_pa(pvh_bootparams), %rsi
Expand Down

0 comments on commit f662b4a

Please sign in to comment.