]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
x86/pvh: Set phys_base when calling xen_prepare_pvh()
authorJason Andryuk <jason.andryuk@amd.com>
Fri, 23 Aug 2024 19:36:28 +0000 (15:36 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 12:52:44 +0000 (13:52 +0100)
[ Upstream commit b464b461d27d564125db760938643374864c1b1f ]

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 <jason.andryuk@amd.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Message-ID: <20240823193630.2583107-4-jason.andryuk@amd.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Stable-dep-of: e8fbc0d9cab6 ("x86/pvh: Call C code via the kernel virtual mapping")
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/platform/pvh/head.S

index f7235ef87bc32b790be894e3214bf6bd289b4d34..3621293cd1cc20cd9675fb47beebad68a9ae9585 100644 (file)
@@ -101,7 +101,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