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

[xen staging-4.18] x86/spec-ctrl: Widen the {xen,last,default}_spec_ctrl fields



commit 40a679548008aec65b729bf829f76390a028fe90
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Mar 26 22:43:18 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Apr 9 16:45:01 2024 +0100

    x86/spec-ctrl: Widen the {xen,last,default}_spec_ctrl fields
    
    Right now, they're all bytes, but MSR_SPEC_CTRL has been steadily gaining 
new
    features.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    (cherry picked from commit 45dac88e78e8a2d9d8738eef884fe6730faf9e67)
---
 xen/arch/x86/hvm/svm/entry.S             | 10 +++++-----
 xen/arch/x86/hvm/vmx/entry.S             |  2 +-
 xen/arch/x86/include/asm/current.h       |  4 ++--
 xen/arch/x86/include/asm/spec_ctrl.h     |  2 +-
 xen/arch/x86/include/asm/spec_ctrl_asm.h |  6 +++---
 xen/arch/x86/spec_ctrl.c                 |  2 +-
 6 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/entry.S b/xen/arch/x86/hvm/svm/entry.S
index 9f15d9fb70..5f318629b4 100644
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -61,14 +61,14 @@ __UNLIKELY_END(nsvm_hap)
         /* SPEC_CTRL_EXIT_TO_SVM       Req: b=curr %rsp=regs/cpuinfo, Clob: 
acd */
         .macro svm_vmentry_spec_ctrl
             mov    VCPU_arch_msrs(%rbx), %rax
-            movzbl CPUINFO_last_spec_ctrl(%rsp), %edx
+            mov    CPUINFO_last_spec_ctrl(%rsp), %edx
             mov    VCPUMSR_spec_ctrl_raw(%rax), %eax
             cmp    %edx, %eax
             je     1f /* Skip write if value is correct. */
             mov    $MSR_SPEC_CTRL, %ecx
             xor    %edx, %edx
             wrmsr
-            mov    %al, CPUINFO_last_spec_ctrl(%rsp)
+            mov    %eax, CPUINFO_last_spec_ctrl(%rsp)
 1:          /* No Spectre v1 concerns.  Execution will hit VMRUN imminently. */
         .endm
         ALTERNATIVE "", svm_vmentry_spec_ctrl, X86_FEATURE_SC_MSR_HVM
@@ -128,14 +128,14 @@ __UNLIKELY_END(nsvm_hap)
          * safe to use.  The guest's setting resides in the VMCB.
          */
         .macro svm_vmexit_spec_ctrl
-            movzbl CPUINFO_xen_spec_ctrl(%rsp), %eax
-            movzbl CPUINFO_last_spec_ctrl(%rsp), %edx
+            mov    CPUINFO_xen_spec_ctrl(%rsp), %eax
+            mov    CPUINFO_last_spec_ctrl(%rsp), %edx
             cmp    %edx, %eax
             je     1f /* Skip write if value is correct. */
             mov    $MSR_SPEC_CTRL, %ecx
             xor    %edx, %edx
             wrmsr
-            mov    %al, CPUINFO_last_spec_ctrl(%rsp)
+            mov    %eax, CPUINFO_last_spec_ctrl(%rsp)
 1:
         .endm
         ALTERNATIVE "", svm_vmexit_spec_ctrl, X86_FEATURE_SC_MSR_HVM
diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S
index f52b3f0893..96b3d22080 100644
--- a/xen/arch/x86/hvm/vmx/entry.S
+++ b/xen/arch/x86/hvm/vmx/entry.S
@@ -52,7 +52,7 @@ ENTRY(vmx_asm_vmexit_handler)
          */
         .macro restore_spec_ctrl
             mov    $MSR_SPEC_CTRL, %ecx
-            movzbl CPUINFO_xen_spec_ctrl(%rsp), %eax
+            mov    CPUINFO_xen_spec_ctrl(%rsp), %eax
             xor    %edx, %edx
             wrmsr
         .endm
diff --git a/xen/arch/x86/include/asm/current.h 
b/xen/arch/x86/include/asm/current.h
index 9cc8d8e3d4..ba82b413e2 100644
--- a/xen/arch/x86/include/asm/current.h
+++ b/xen/arch/x86/include/asm/current.h
@@ -55,8 +55,8 @@ struct cpu_info {
 
     /* See asm/spec_ctrl_asm.h for usage. */
     unsigned int shadow_spec_ctrl;
-    uint8_t      xen_spec_ctrl;
-    uint8_t      last_spec_ctrl;
+    unsigned int xen_spec_ctrl;
+    unsigned int last_spec_ctrl;
     uint8_t      scf; /* SCF_* */
 
     /*
diff --git a/xen/arch/x86/include/asm/spec_ctrl.h 
b/xen/arch/x86/include/asm/spec_ctrl.h
index ee3119e128..95dd081f30 100644
--- a/xen/arch/x86/include/asm/spec_ctrl.h
+++ b/xen/arch/x86/include/asm/spec_ctrl.h
@@ -81,7 +81,7 @@ extern int8_t opt_eager_fpu;
 extern int8_t opt_l1d_flush;
 
 extern bool bsp_delay_spec_ctrl;
-extern uint8_t default_xen_spec_ctrl;
+extern unsigned int default_xen_spec_ctrl;
 extern uint8_t default_scf;
 
 extern int8_t opt_xpti_hwdom, opt_xpti_domu;
diff --git a/xen/arch/x86/include/asm/spec_ctrl_asm.h 
b/xen/arch/x86/include/asm/spec_ctrl_asm.h
index e380c0579b..f697d17616 100644
--- a/xen/arch/x86/include/asm/spec_ctrl_asm.h
+++ b/xen/arch/x86/include/asm/spec_ctrl_asm.h
@@ -205,10 +205,10 @@
         setnz %al
         not %eax
         and %al, STACK_CPUINFO_FIELD(scf)(%r14)
-        movzbl STACK_CPUINFO_FIELD(xen_spec_ctrl)(%r14), %eax
+        mov STACK_CPUINFO_FIELD(xen_spec_ctrl)(%r14), %eax
     .else
         andb $~SCF_use_shadow, CPUINFO_scf(%rsp)
-        movzbl CPUINFO_xen_spec_ctrl(%rsp), %eax
+        mov  CPUINFO_xen_spec_ctrl(%rsp), %eax
     .endif
 
     wrmsr
@@ -406,7 +406,7 @@
 
     /* Load Xen's intended value. */
     mov $MSR_SPEC_CTRL, %ecx
-    movzbl STACK_CPUINFO_FIELD(xen_spec_ctrl)(%r14), %eax
+    mov STACK_CPUINFO_FIELD(xen_spec_ctrl)(%r14), %eax
     wrmsr
 
 .L\@_skip_msr_spec_ctrl:
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index b59f2f5425..0e53589f0e 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -56,7 +56,7 @@ static bool __initdata opt_branch_harden =
 static bool __initdata opt_lock_harden;
 
 bool __initdata bsp_delay_spec_ctrl;
-uint8_t __ro_after_init default_xen_spec_ctrl;
+unsigned int __ro_after_init default_xen_spec_ctrl;
 uint8_t __ro_after_init default_scf;
 
 paddr_t __ro_after_init l1tf_addr_mask, __ro_after_init l1tf_safe_maddr;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18



 


Rackspace

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