]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/hyperv: Use savesegment() instead of inline asm() to save segment registers
authorUros Bizjak <ubizjak@gmail.com>
Fri, 21 Nov 2025 14:14:10 +0000 (15:14 +0100)
committerWei Liu <wei.liu@kernel.org>
Wed, 18 Feb 2026 06:42:57 +0000 (06:42 +0000)
Use standard savesegment() utility macro to save segment registers.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Acked-by: Wei Liu <wei.liu@kernel.org>
Tested-by: Michael Kelley <mhklinux@outlook.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
arch/x86/hyperv/ivm.c

index 651771534cae286920d3fb1b01837dbc53ba0a16..7365d8f43181ce9b7235b7a43f31f23a936893df 100644 (file)
@@ -25,6 +25,7 @@
 #include <asm/e820/api.h>
 #include <asm/desc.h>
 #include <asm/msr.h>
+#include <asm/segment.h>
 #include <uapi/asm/vmx.h>
 
 #ifdef CONFIG_AMD_MEM_ENCRYPT
@@ -315,16 +316,16 @@ int hv_snp_boot_ap(u32 apic_id, unsigned long start_ip, unsigned int cpu)
        vmsa->gdtr.base = gdtr.address;
        vmsa->gdtr.limit = gdtr.size;
 
-       asm volatile("movl %%es, %%eax;" : "=a" (vmsa->es.selector));
+       savesegment(es, vmsa->es.selector);
        hv_populate_vmcb_seg(vmsa->es, vmsa->gdtr.base);
 
-       asm volatile("movl %%cs, %%eax;" : "=a" (vmsa->cs.selector));
+       savesegment(cs, vmsa->cs.selector);
        hv_populate_vmcb_seg(vmsa->cs, vmsa->gdtr.base);
 
-       asm volatile("movl %%ss, %%eax;" : "=a" (vmsa->ss.selector));
+       savesegment(ss, vmsa->ss.selector);
        hv_populate_vmcb_seg(vmsa->ss, vmsa->gdtr.base);
 
-       asm volatile("movl %%ds, %%eax;" : "=a" (vmsa->ds.selector));
+       savesegment(ds, vmsa->ds.selector);
        hv_populate_vmcb_seg(vmsa->ds, vmsa->gdtr.base);
 
        vmsa->efer = native_read_msr(MSR_EFER);