[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 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>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Wed, 10 Apr 2024 15:48:48 -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=arcselector9901; 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=6aGShkfhPfFFWeAFRLHJuhfTDAE6nHPfx+9E7Z29HTo=; b=cTSirRTDi7jJFDA8LmODI4Xd1BIGOC6Hu7ZEiR0pDcqfBatghRThIGRXZXf0LoNJn8fCZe7hTBXjDLT6yggwhShpdWPBNZNAsvYA1BhdOVpBiFwVYxdIc5OObNHQQP/nJbDnwd0kaFcWdYEF1LPTCzF+gtVkfYL8U/qk2IajIzUtaY2yFtjvEnT2Pdew0TJlSzwTEBobKR617XJWqSgNLV2+4Fiy1tXL/33Qv00Af5/ld082O5Zmq9hffUCd+XHXiUXFf4tcmGJOXOmhbWvjTGjhNSTS8tgA3gCu/EqtS/W3EM6BEyAnh5neTvid8G9BW2eqzWXvt58UZwovjhbk3Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ItA2HYzklBqNdbLijzteMpEt8IpC1bHrV/OcdtY2oblEm1SpOdFX2kfpKE6Hu1jbantAJam80Xu3nspDU9ppoUWhZ8Nf/8ADQVgR8G5m7DxoJEziRbrQzNVU9cQz//XdFnyasRG6MriP2K5yRtXXBRWP4rWEwNlmEAgcFFldWfFbPHw/MVCCSRCvc8xBI0SPgfLxLa3yKPn0jBo8cSc5utR64ggaIWce9nKv13Xn7tULaHL6dMvXCaEoPkmi0QNGLDw6itJGrc6sflhZFz1HQwO0fzpbfJLKZ7R7oGqGNH9RgKUPn5EEBtn/HU8GSt1QOpw4DXwv+jKVLHPFdCb3OQ==
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>, "Jason Andryuk" <jason.andryuk@xxxxxxx>
  • Delivery-date: Wed, 10 Apr 2024 19:49:09 +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>
---
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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.