From: Uros Bizjak Date: Fri, 21 Nov 2025 14:14:10 +0000 (+0100) Subject: x86/hyperv: Use savesegment() instead of inline asm() to save segment registers X-Git-Tag: v7.0-rc1~43^2~14 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=834ef6aa0996121184728279c4b81a3b70ee649b;p=thirdparty%2Fkernel%2Flinux.git x86/hyperv: Use savesegment() instead of inline asm() to save segment registers Use standard savesegment() utility macro to save segment registers. Signed-off-by: Uros Bizjak Acked-by: Wei Liu Tested-by: Michael Kelley Cc: K. Y. Srinivasan Cc: Haiyang Zhang Cc: Dexuan Cui Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: H. Peter Anvin Signed-off-by: Wei Liu --- diff --git a/arch/x86/hyperv/ivm.c b/arch/x86/hyperv/ivm.c index 651771534cae2..7365d8f43181c 100644 --- a/arch/x86/hyperv/ivm.c +++ b/arch/x86/hyperv/ivm.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #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);