From: Jason Andryuk <jason.andryuk@amd.com>
To: Juergen Gross <jgross@suse.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Thomas Gleixner <tglx@linutronix.de>,
"Ingo Molnar" <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>, <x86@kernel.org>,
"H. Peter Anvin" <hpa@zytor.com>,
Stefano Stabellini <sstabellini@kernel.org>,
"Oleksandr Tyshchenko" <oleksandr_tyshchenko@epam.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: <xen-devel@lists.xenproject.org>, <linux-kernel@vger.kernel.org>,
"Jason Andryuk" <jason.andryuk@amd.com>
Subject: [PATCH 3/5] x86/pvh: Set phys_base when calling xen_prepare_pvh()
Date: Wed, 10 Apr 2024 15:48:48 -0400 [thread overview]
Message-ID: <20240410194850.39994-4-jason.andryuk@amd.com> (raw)
In-Reply-To: <20240410194850.39994-1-jason.andryuk@amd.com>
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>
---
Instead of setting and clearing phys_base, a dedicated variable could be
used just for the hypercall page. Having phys_base set properly may
avoid further issues if the use of phys_base or __pa() grows.
---
arch/x86/platform/pvh/head.S | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/x86/platform/pvh/head.S b/arch/x86/platform/pvh/head.S
index bb1e582e32b1..c08d08d8cc92 100644
--- a/arch/x86/platform/pvh/head.S
+++ b/arch/x86/platform/pvh/head.S
@@ -125,7 +125,17 @@ SYM_CODE_START_LOCAL(pvh_start_xen)
xor %edx, %edx
wrmsr
+ /* Calculate load offset from LOAD_PHYSICAL_ADDR and store in
+ * phys_base. __pa() needs phys_base set to calculate the
+ * hypercall page in xen_pvh_init(). */
+ movq %rbp, %rbx
+ subq $LOAD_PHYSICAL_ADDR, %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. */
lea rva(pvh_bootparams)(%ebp), %rsi
--
2.44.0
next prev parent reply other threads:[~2024-04-10 19:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-10 19:48 [PATCH 0/5] x86/pvh: Make PVH entry relocatable Jason Andryuk
2024-04-10 19:48 ` [PATCH 1/5] xen: sync elfnote.h from xen tree Jason Andryuk
2024-05-10 8:09 ` Jürgen Groß
2024-04-10 19:48 ` [PATCH 2/5] x86/pvh: Make PVH entrypoint PIC for x86-64 Jason Andryuk
2024-04-10 21:00 ` Brian Gerst
2024-04-11 15:26 ` Jason Andryuk
2024-04-11 18:15 ` Brian Gerst
2024-04-10 19:48 ` Jason Andryuk [this message]
2024-05-23 11:14 ` [PATCH 3/5] x86/pvh: Set phys_base when calling xen_prepare_pvh() Jürgen Groß
2024-04-10 19:48 ` [PATCH 4/5] x86/kernel: Move page table macros to new header Jason Andryuk
2024-05-23 11:40 ` Juergen Gross
2024-05-23 13:59 ` Thomas Gleixner
2024-05-23 14:07 ` Borislav Petkov
2024-04-10 19:48 ` [PATCH 5/5] x86/pvh: Add 64bit relocation page tables Jason Andryuk
2024-05-23 12:11 ` Juergen Gross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240410194850.39994-4-jason.andryuk@amd.com \
--to=jason.andryuk@amd.com \
--cc=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oleksandr_tyshchenko@epam.com \
--cc=pbonzini@redhat.com \
--cc=sstabellini@kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox