Skip to contentSkip to conversation

xen/public: Delete duplicate VCGF constants

PATCH In review Andrew Cooper 2 participants 3 messages Mar 23

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/public: Delete duplicate VCGF constants

Having two spellings of the constants makes following the code unnecessarily difficult. Reduce it to one spelling.

This is an API change in the public headers, but one for the better.

No functional change.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>

---
 xen/arch/x86/domain.c                    | 2 +-
 xen/include/public/arch-x86/xen-x86_64.h | 1 -
 xen/include/public/arch-x86/xen.h        | 2 --
 3 files changed, 1 insertion(+), 4 deletions(-)
xen/arch/x86/domain.c +1 -1
index 4664264b2f5d..9ba2774762cc 100644
@@ -1246,7 +1246,7 @@ int arch_set_info_guest(
          is_pv_64bit_domain(d) )
         v->arch.flags &= ~TF_kernel_mode;
 
-    if ( flags & VGCF_I387_VALID )
+    if ( flags & VGCF_i387_valid )
         vcpu_setup_fpu(v, &c.nat->fpu_ctxt);
     else
         vcpu_reset_fpu(v);
xen/include/public/arch-x86/xen-x86_64.h +0 -1
index 75f121be0e14..9f33d80d3135 100644
@@ -103,7 +103,6 @@
 /* Guest exited in SYSCALL context? Return to guest with SYSRET? */
 #define _VGCF_in_syscall 8
 #define VGCF_in_syscall  (1<<_VGCF_in_syscall)
-#define VGCF_IN_SYSCALL  VGCF_in_syscall
 
 #ifndef __ASSEMBLER__
 
xen/include/public/arch-x86/xen.h +0 -2
index a7bf046ee006..4693e47d204c 100644
@@ -160,8 +160,6 @@ typedef uint64_t tsc_timestamp_t; /* RDTSC timestamp */
 struct vcpu_guest_context {
     /* FPU registers come first so they can be aligned for FXSAVE/FXRSTOR. */
     struct { char x[512]; } fpu_ctxt;       /* User-level FPU registers     */
-#define VGCF_I387_VALID                (1<<0)
-#define VGCF_IN_KERNEL                 (1<<2)
 #define _VGCF_i387_valid               0
 #define VGCF_i387_valid                (1<<_VGCF_i387_valid)
 #define _VGCF_in_kernel                2
Signature · 1 line
2.39.5
#2 lore raw
In reply to Andrew Cooper
Quoted 47 lines · Andrew Cooper

Having two spellings of the constants makes following the code unnecessarily difficult. Reduce it to one spelling.

This is an API change in the public headers, but one for the better.

No functional change.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>

---
 xen/arch/x86/domain.c                    | 2 +-
 xen/include/public/arch-x86/xen-x86_64.h | 1 -
 xen/include/public/arch-x86/xen.h        | 2 --
 3 files changed, 1 insertion(+), 4 deletions(-)
xen/arch/x86/domain.c +1 -1
index 4664264b2f5d..9ba2774762cc 100644
@@ -1246,7 +1246,7 @@ int arch_set_info_guest(
          is_pv_64bit_domain(d) )
         v->arch.flags &= ~TF_kernel_mode;
 
-    if ( flags & VGCF_I387_VALID )
+    if ( flags & VGCF_i387_valid )
         vcpu_setup_fpu(v, &c.nat->fpu_ctxt);
     else
         vcpu_reset_fpu(v);
xen/include/public/arch-x86/xen-x86_64.h +0 -1
index 75f121be0e14..9f33d80d3135 100644
@@ -103,7 +103,6 @@
 /* Guest exited in SYSCALL context? Return to guest with SYSRET? */
 #define _VGCF_in_syscall 8
 #define VGCF_in_syscall  (1<<_VGCF_in_syscall)
-#define VGCF_IN_SYSCALL  VGCF_in_syscall
 
 #ifndef __ASSEMBLER__
 
xen/include/public/arch-x86/xen.h +0 -0
index a7bf046ee006..4693e47d204c 100644

xen/include/public/arch-x86/xen.h typedef uint64_t tsc_timestamp_t; /* RDTSC timestamp */ · line 165

Quoted 8 lines
xen/include/public/arch-x86/xen.h +0 -2
@@ -160,8 +160,6 @@ typedef uint64_t tsc_timestamp_t; /* RDTSC timestamp */
 struct vcpu_guest_context {
     /* FPU registers come first so they can be aligned for FXSAVE/FXRSTOR. */
     struct { char x[512]; } fpu_ctxt;       /* User-level FPU registers     */
-#define VGCF_I387_VALID                (1<<0)
-#define VGCF_IN_KERNEL                 (1<<2)
 #define _VGCF_i387_valid               0
 #define VGCF_i387_valid                (1<<_VGCF_i387_valid)
 #define _VGCF_in_kernel                2

Juergen, as a heads up, Linux has one use this:

linux.git$ git grep -e VGCF_IN_SYSCALL -e VGCF_I387_VALID -e VGCF_IN_KERNEL arch/x86/include/asm/xen/interface.h:216:#define VGCF_I387_VALID                (1<<0) arch/x86/include/asm/xen/interface.h:217:#define VGCF_IN_KERNEL                 (1<<2) arch/x86/include/asm/xen/interface_64.h:78:#define VGCF_IN_SYSCALL  VGCF_in_syscall arch/x86/xen/smp_pv.c:247:      ctxt->flags = VGCF_IN_KERNEL;

That will be easy enough to fix up when re-sync-ing the header.

~Andrew