All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] drop wrappers of SVM instructions
@ 2025-04-02 14:54 Alexander M. Merritt
  2025-04-02 14:54 ` [XEN PATCH 1/1] xen/x86: " Alexander M. Merritt
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander M. Merritt @ 2025-04-02 14:54 UTC (permalink / raw)
  To: xen-devel
  Cc: Alexander M. Merritt, Jan Beulich, Andrew Cooper,
	Roger Pau Monné

Part of cleanup following toolchain baseline upgrade.

As the new toolchain baseline knows the SVM instructions, this series drops
macros with SVM instructions, and updates SVM wrappers to use real instructions
rather than bytecode.

Resolves: xen-project/xen#204

Alexander M. Merritt (1):
  xen/x86: drop wrappers of SVM instructions

 xen/arch/x86/hvm/svm/svm.h           | 14 +++-----------
 xen/arch/x86/include/asm/asm-defns.h | 12 ------------
 2 files changed, 3 insertions(+), 23 deletions(-)

-- 
2.45.2



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

* [XEN PATCH 1/1] xen/x86: drop wrappers of SVM instructions
  2025-04-02 14:54 [PATCH 0/1] drop wrappers of SVM instructions Alexander M. Merritt
@ 2025-04-02 14:54 ` Alexander M. Merritt
  2025-04-02 14:56   ` Andrew Cooper
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander M. Merritt @ 2025-04-02 14:54 UTC (permalink / raw)
  To: xen-devel
  Cc: Alexander M. Merritt, Jan Beulich, Andrew Cooper,
	Roger Pau Monné

The new toolchain baseline knows the SVM instructions.

Resolves: xen-project/xen#204

Signed-off-by: Alexander M. Merritt <alexander@edera.dev>
---
 xen/arch/x86/hvm/svm/svm.h           | 14 +++-----------
 xen/arch/x86/include/asm/asm-defns.h | 12 ------------
 2 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/svm.h b/xen/arch/x86/hvm/svm/svm.h
index beeaaab4f7..5c5e91a1ac 100644
--- a/xen/arch/x86/hvm/svm/svm.h
+++ b/xen/arch/x86/hvm/svm/svm.h
@@ -23,25 +23,17 @@ void __update_guest_eip(struct cpu_user_regs *regs, unsigned int inst_len);
 
 static inline void svm_vmload_pa(paddr_t vmcb)
 {
-    asm volatile (
-        ".byte 0x0f,0x01,0xda" /* vmload */
-        : : "a" (vmcb) : "memory" );
+    asm volatile ( "vmload" : : "a" (vmcb) : "memory" );
 }
 
 static inline void svm_vmsave_pa(paddr_t vmcb)
 {
-    asm volatile (
-        ".byte 0x0f,0x01,0xdb" /* vmsave */
-        : : "a" (vmcb) : "memory" );
+    asm volatile ( "vmsave" : : "a" (vmcb) : "memory" );
 }
 
 static inline void svm_invlpga(unsigned long linear, uint32_t asid)
 {
-    asm volatile (
-        ".byte 0x0f,0x01,0xdf"
-        : /* output */
-        : /* input */
-        "a" (linear), "c" (asid) );
+    asm volatile ( "invlpga" : /* output */ : /* input */ "a" (linear), "c" (asid) );
 }
 
 /*
diff --git a/xen/arch/x86/include/asm/asm-defns.h b/xen/arch/x86/include/asm/asm-defns.h
index 32d6b44910..5a64b42495 100644
--- a/xen/arch/x86/include/asm/asm-defns.h
+++ b/xen/arch/x86/include/asm/asm-defns.h
@@ -10,18 +10,6 @@
 .endm
 #endif
 
-.macro vmrun
-    .byte 0x0f, 0x01, 0xd8
-.endm
-
-.macro stgi
-    .byte 0x0f, 0x01, 0xdc
-.endm
-
-.macro clgi
-    .byte 0x0f, 0x01, 0xdd
-.endm
-
 /*
  * Call a noreturn function.  This could be JMP, but CALL results in a more
  * helpful backtrace.  BUG is to catch functions which do decide to return...
-- 
2.45.2



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

* Re: [XEN PATCH 1/1] xen/x86: drop wrappers of SVM instructions
  2025-04-02 14:54 ` [XEN PATCH 1/1] xen/x86: " Alexander M. Merritt
@ 2025-04-02 14:56   ` Andrew Cooper
  2025-04-02 15:04     ` Alexander Merritt
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cooper @ 2025-04-02 14:56 UTC (permalink / raw)
  To: Alexander M. Merritt, xen-devel; +Cc: Jan Beulich, Roger Pau Monné

On 02/04/2025 3:54 pm, Alexander M. Merritt wrote:
> The new toolchain baseline knows the SVM instructions.
>
> Resolves: xen-project/xen#204
>
> Signed-off-by: Alexander M. Merritt <alexander@edera.dev>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>, with a couple of
notes.

> ---
>  xen/arch/x86/hvm/svm/svm.h           | 14 +++-----------
>  xen/arch/x86/include/asm/asm-defns.h | 12 ------------
>  2 files changed, 3 insertions(+), 23 deletions(-)
>
> diff --git a/xen/arch/x86/hvm/svm/svm.h b/xen/arch/x86/hvm/svm/svm.h
> index beeaaab4f7..5c5e91a1ac 100644
> --- a/xen/arch/x86/hvm/svm/svm.h
> +++ b/xen/arch/x86/hvm/svm/svm.h
> @@ -23,25 +23,17 @@ void __update_guest_eip(struct cpu_user_regs *regs, unsigned int inst_len);
>  
>  static inline void svm_vmload_pa(paddr_t vmcb)
>  {
> -    asm volatile (
> -        ".byte 0x0f,0x01,0xda" /* vmload */
> -        : : "a" (vmcb) : "memory" );
> +    asm volatile ( "vmload" : : "a" (vmcb) : "memory" );

We tend to prefer :: for empty sections.

>  }
>  
>  static inline void svm_vmsave_pa(paddr_t vmcb)
>  {
> -    asm volatile (
> -        ".byte 0x0f,0x01,0xdb" /* vmsave */
> -        : : "a" (vmcb) : "memory" );
> +    asm volatile ( "vmsave" : : "a" (vmcb) : "memory" );
>  }
>  
>  static inline void svm_invlpga(unsigned long linear, uint32_t asid)
>  {
> -    asm volatile (
> -        ".byte 0x0f,0x01,0xdf"
> -        : /* output */
> -        : /* input */
> -        "a" (linear), "c" (asid) );
> +    asm volatile ( "invlpga" : /* output */ : /* input */ "a" (linear), "c" (asid) );

And here, the output/input comments are useless and can be dropped.

I can fix both on commit if you're happy?

~Andrew


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

* Re: [XEN PATCH 1/1] xen/x86: drop wrappers of SVM instructions
  2025-04-02 14:56   ` Andrew Cooper
@ 2025-04-02 15:04     ` Alexander Merritt
  0 siblings, 0 replies; 4+ messages in thread
From: Alexander Merritt @ 2025-04-02 15:04 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: xen-devel, Jan Beulich, Roger Pau Monné

On 2025-04-02 10:56, Andrew Cooper wrote:
> On 02/04/2025 3:54 pm, Alexander M. Merritt wrote:

> I can fix both on commit if you're happy?
> 
> ~Andrew

Noted for future updates. Yes please go ahead.

-Alex


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

end of thread, other threads:[~2025-04-02 15:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-02 14:54 [PATCH 0/1] drop wrappers of SVM instructions Alexander M. Merritt
2025-04-02 14:54 ` [XEN PATCH 1/1] xen/x86: " Alexander M. Merritt
2025-04-02 14:56   ` Andrew Cooper
2025-04-02 15:04     ` Alexander Merritt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.