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

[xen staging] x86/trampoline: Change type of trampoline_phys to uint32_t



commit 9ef78a614d6397dc8a820a061874f840eea32c42
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Mon Nov 11 10:41:36 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Mon Nov 11 15:25:39 2024 +0000

    x86/trampoline: Change type of trampoline_phys to uint32_t
    
    As now documented, this variable holds a page aligned value less than 1M.
    
    However, head.S fills it using 4-byte stores, and reloc_trampoline() is
    compiled for both 32bit and 64bit, where unsigned long is a different size.
    
    This happens to work because of the range of the value, but switch to 
uint32_t
    to make it explicit.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/boot/reloc-trampoline.c  | 2 +-
 xen/arch/x86/efi/efi-boot.h           | 2 +-
 xen/arch/x86/include/asm/trampoline.h | 2 +-
 xen/arch/x86/smpboot.c                | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/boot/reloc-trampoline.c 
b/xen/arch/x86/boot/reloc-trampoline.c
index 0a74c1e75a..d5548eb08f 100644
--- a/xen/arch/x86/boot/reloc-trampoline.c
+++ b/xen/arch/x86/boot/reloc-trampoline.c
@@ -15,7 +15,7 @@ void reloc_trampoline64(void)
 #error Unknown architecture
 #endif
 {
-    unsigned long phys = trampoline_phys;
+    uint32_t phys = trampoline_phys;
     const int32_t *trampoline_ptr;
 
     /*
diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 3133985c88..7930b7c738 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -235,7 +235,7 @@ static void __init noreturn efi_arch_post_exit_boot(void)
     u64 cr4 = XEN_MINIMAL_CR4 & ~X86_CR4_PGE, efer;
 
     efi_arch_relocate_image(__XEN_VIRT_START - xen_phys_start);
-    memcpy((void *)trampoline_phys, trampoline_start, cfg.size);
+    memcpy(_p(trampoline_phys), trampoline_start, cfg.size);
 
     /*
      * We're in physical mode right now (i.e. identity map), so a regular
diff --git a/xen/arch/x86/include/asm/trampoline.h 
b/xen/arch/x86/include/asm/trampoline.h
index 838c2f0b6f..8c1e0b48c2 100644
--- a/xen/arch/x86/include/asm/trampoline.h
+++ b/xen/arch/x86/include/asm/trampoline.h
@@ -52,7 +52,7 @@ extern char trampoline_start[], trampoline_end[];
  * the 1M boundary (as the trampoline contains 16-bit code), and must be 4k
  * aligned (SIPI requirement for APs).
  */
-extern unsigned long trampoline_phys;
+extern uint32_t trampoline_phys;
 
 /*
  * Calculate the physical address of a symbol in the trampoline.
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 568a3abe1f..79a79c54c3 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -41,7 +41,7 @@
 #include <asm/trampoline.h>
 #include <asm/irq-vectors.h>
 
-unsigned long __read_mostly trampoline_phys;
+uint32_t __ro_after_init trampoline_phys;
 enum ap_boot_method __read_mostly ap_boot_method = AP_BOOT_NORMAL;
 
 /* representing HT siblings of each logical CPU */
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

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