[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<SN6PR02MB4157A2BE3BF643B9E8CB2B0BD462A@SN6PR02MB4157.namprd02.prod.outlook.com>
Date: Tue, 10 Feb 2026 22:40:35 +0000
From: Michael Kelley <mhklinux@...look.com>
To: Uros Bizjak <ubizjak@...il.com>, "linux-hyperv@...r.kernel.org"
<linux-hyperv@...r.kernel.org>, "x86@...nel.org" <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Wei Liu
<wei.liu@...nel.org>
CC: "K. Y. Srinivasan" <kys@...rosoft.com>, Haiyang Zhang
<haiyangz@...rosoft.com>, Dexuan Cui <decui@...rosoft.com>, Thomas Gleixner
<tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, Borislav Petkov
<bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>, "H. Peter Anvin"
<hpa@...or.com>
Subject: RE: [PATCH v2 2/3] x86/hyperv: Use savesegment() instead of inline
asm() to save segment registers
From: Uros Bizjak <ubizjak@...il.com> Sent: Friday, November 21, 2025 6:14 AM
>
> Use standard savesegment() utility macro to save segment registers.
Patch 1 of this series was included in the tip tree. But this patch (Patch 2) and
Patch 3 have not been picked up anywhere.
Wei Liu -- could you pick these two up in the hyperv tree?
Michael
>
> Signed-off-by: Uros Bizjak <ubizjak@...il.com>
> Acked-by: Wei Liu <wei.liu@...nel.org>
> Tested-by: Michael Kelley <mhklinux@...look.com>
> Cc: "K. Y. Srinivasan" <kys@...rosoft.com>
> Cc: Haiyang Zhang <haiyangz@...rosoft.com>
> Cc: Dexuan Cui <decui@...rosoft.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: Borislav Petkov <bp@...en8.de>
> Cc: Dave Hansen <dave.hansen@...ux.intel.com>
> Cc: "H. Peter Anvin" <hpa@...or.com>
> ---
> arch/x86/hyperv/ivm.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/hyperv/ivm.c b/arch/x86/hyperv/ivm.c
> index 651771534cae..7365d8f43181 100644
> --- a/arch/x86/hyperv/ivm.c
> +++ b/arch/x86/hyperv/ivm.c
> @@ -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);
> --
> 2.51.1
Powered by blists - more mailing lists