[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 3/5] x86/pvh: Set phys_base when calling xen_prepare_pvh()
- To: Juergen Gross <jgross@xxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, "Ingo Molnar" <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, <x86@xxxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "Oleksandr Tyshchenko" <oleksandr_tyshchenko@xxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, Brian Gerst <brgerst@xxxxxxxxx>
- From: Jason Andryuk <jason.andryuk@xxxxxxx>
- Date: Wed, 14 Aug 2024 15:50:51 -0400
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=87Cir7MUe+90Zd8HQRFVV15Z21B672vcEXroWazgwgg=; b=ZeAeS989OLttb6QlmfBvI/WoYi0U1R6mMrb0fOEB8YcBjW9VEBVEQCYKkoLHZWT8sQuXa0fYbL4ECr/VZvUV0tM0KB7zCbVEoHpiCf+QDTkNW2qTThSl/Lpd4cOrHACEqE5my7Xq7hVFe+nrqpXIGTJAaTlnHet24eXHxvhq3y94N6uG/TYAG9aaJZ44t6AGbLZpKAE+m0lSgPc6+SXF5hb8NcmHaXLo1BXVHM/ZBBNJ1rPEbyxV05zOS+P4OI/2Cg9egO/JTQ0y+mk+25mD4UleVFCAVlZ9TQ6pUwvRNN8FvrcPbAEOCVcT64T091nzumwuApflbIz+eVYXpCAHIg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fZ6is2OKSqdYNpys3d1K7VBgqyyAY67MfnY0PjwU3IgcO4WJLdbjIcINGGBAJSc8IqdIGJowJ24vtXJguPj2kVP2WAKFMN8vxAe7sxw6C+kXz7R/ZrXIZnEBqg3NcVyqtOB47+iNfEpd3N87W7+WLdL+xsX+X1od1R1Nsci2USHrlRe/sv7ueRTVdJw0AaEfzfy48ZCRFLO+Xyf/w4Yfy5O0sPVbCz4ZTzlTwYOCUWa9cI6whQRYGUiwLBTxFi/i2pjiSPu6F0hYd4Sz+bP0kNcEgDh0ofdNYh4ei5x7jgxK60ptPAzk3ExzC4FgI1G7erLY8pjnYkIZq3GnbGPsmg==
- Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>, "Jason Andryuk" <jason.andryuk@xxxxxxx>
- Delivery-date: Wed, 14 Aug 2024 19:51:21 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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@xxxxxxx>
Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
---
v2:
Fix comment style
Add Juergen's R-b
s/LOAD_PHYSICAL_ADDR/_pa(pvh_start_xen)/ in case they differ
---
arch/x86/platform/pvh/head.S | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/arch/x86/platform/pvh/head.S b/arch/x86/platform/pvh/head.S
index ba4d0eab4436..14b4345d9bae 100644
--- a/arch/x86/platform/pvh/head.S
+++ b/arch/x86/platform/pvh/head.S
@@ -125,7 +125,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. */
lea pvh_bootparams(%rip), %rsi
--
2.34.1
|