Linux-HyperV List
 help / color / mirror / Atom feed
* [PATCH] x86/hyperv: use helpers to read control registers in hv_snp_boot_ap()
@ 2024-08-01 18:39 Yosry Ahmed
  2024-08-01 18:41 ` Yosry Ahmed
  0 siblings, 1 reply; 2+ messages in thread
From: Yosry Ahmed @ 2024-08-01 18:39 UTC (permalink / raw)
  To: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin, linux-hyperv, linux-kernel, Yosry Ahmed

Use native_read_cr*() helpers to read control registers into vmsa->cr*
instead of open-coded assembly.

No functional change intended, unless there was a purpose to specifying
rax.

Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
---
 arch/x86/hyperv/ivm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/hyperv/ivm.c b/arch/x86/hyperv/ivm.c
index b4a851d27c7cb..434507dd135c5 100644
--- a/arch/x86/hyperv/ivm.c
+++ b/arch/x86/hyperv/ivm.c
@@ -321,9 +321,9 @@ int hv_snp_boot_ap(u32 cpu, unsigned long start_ip)
 
 	vmsa->efer = native_read_msr(MSR_EFER);
 
-	asm volatile("movq %%cr4, %%rax;" : "=a" (vmsa->cr4));
-	asm volatile("movq %%cr3, %%rax;" : "=a" (vmsa->cr3));
-	asm volatile("movq %%cr0, %%rax;" : "=a" (vmsa->cr0));
+	vmsa->cr4 = native_read_cr4();
+	vmsa->cr3 = __native_read_cr3();
+	vmsa->cr3 = native_read_cr0();
 
 	vmsa->xcr0 = 1;
 	vmsa->g_pat = HV_AP_INIT_GPAT_DEFAULT;
-- 
2.46.0.rc2.264.g509ed76dc8-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86/hyperv: use helpers to read control registers in hv_snp_boot_ap()
  2024-08-01 18:39 [PATCH] x86/hyperv: use helpers to read control registers in hv_snp_boot_ap() Yosry Ahmed
@ 2024-08-01 18:41 ` Yosry Ahmed
  0 siblings, 0 replies; 2+ messages in thread
From: Yosry Ahmed @ 2024-08-01 18:41 UTC (permalink / raw)
  To: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin, linux-hyperv, linux-kernel

On Thu, Aug 1, 2024 at 11:40 AM Yosry Ahmed <yosryahmed@google.com> wrote:
>
> Use native_read_cr*() helpers to read control registers into vmsa->cr*
> instead of open-coded assembly.
>
> No functional change intended, unless there was a purpose to specifying
> rax.
>
> Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
> ---
>  arch/x86/hyperv/ivm.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/hyperv/ivm.c b/arch/x86/hyperv/ivm.c
> index b4a851d27c7cb..434507dd135c5 100644
> --- a/arch/x86/hyperv/ivm.c
> +++ b/arch/x86/hyperv/ivm.c
> @@ -321,9 +321,9 @@ int hv_snp_boot_ap(u32 cpu, unsigned long start_ip)
>
>         vmsa->efer = native_read_msr(MSR_EFER);
>
> -       asm volatile("movq %%cr4, %%rax;" : "=a" (vmsa->cr4));
> -       asm volatile("movq %%cr3, %%rax;" : "=a" (vmsa->cr3));
> -       asm volatile("movq %%cr0, %%rax;" : "=a" (vmsa->cr0));
> +       vmsa->cr4 = native_read_cr4();
> +       vmsa->cr3 = __native_read_cr3();
> +       vmsa->cr3 = native_read_cr0();

..and obviously this should be vmsa->cr0, forgot to regenerate the
patch after amending, apologies.

>
>         vmsa->xcr0 = 1;
>         vmsa->g_pat = HV_AP_INIT_GPAT_DEFAULT;
> --
> 2.46.0.rc2.264.g509ed76dc8-goog
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-01 18:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-01 18:39 [PATCH] x86/hyperv: use helpers to read control registers in hv_snp_boot_ap() Yosry Ahmed
2024-08-01 18:41 ` Yosry Ahmed

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox