Message ID | 20230222120023.3004624-6-burzalodowa@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | x86/hvm: {svm,vmx}.{c,h} cleanup | expand |
On 22.02.2023 13:00, Xenia Ragiadakou wrote: > Since GAS_VMX_OP is used only by vm{read,write}_safe, move its definition > just above those functions and undefine it after use. > > Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com> This can easily be done as part of the next patch, with less code churn overall. Jan
On 2/23/23 12:31, Jan Beulich wrote: > On 22.02.2023 13:00, Xenia Ragiadakou wrote: >> Since GAS_VMX_OP is used only by vm{read,write}_safe, move its definition >> just above those functions and undefine it after use. >> >> Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com> > > This can easily be done as part of the next patch, with less code churn > overall. Sure. I ve spotted a bug anyway in the next patch (I should not have deleted the #include <asm/hvm/vmx/vmcs.h>) so I will squeeze them in v3. > > Jan
diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmx.h b/xen/arch/x86/include/asm/hvm/vmx/vmx.h index c0ca6d10e3..1ba2937c23 100644 --- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h +++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h @@ -319,12 +319,6 @@ extern uint8_t posted_intr_vector; #define INVVPID_ALL_CONTEXT 2 #define INVVPID_SINGLE_CONTEXT_RETAINING_GLOBAL 3 -#ifdef HAVE_AS_VMX -# define GAS_VMX_OP(yes, no) yes -#else -# define GAS_VMX_OP(yes, no) no -#endif - static always_inline void __vmptrld(u64 addr) { asm volatile ( @@ -414,6 +408,12 @@ static always_inline void __vmwrite(unsigned long field, unsigned long value) ); } +#ifdef HAVE_AS_VMX +# define GAS_VMX_OP(yes, no) yes +#else +# define GAS_VMX_OP(yes, no) no +#endif + static inline enum vmx_insn_errno vmread_safe(unsigned long field, unsigned long *value) { @@ -460,6 +460,8 @@ static inline enum vmx_insn_errno vmwrite_safe(unsigned long field, return ret; } +#undef GAS_VMX_OP + static always_inline void __invept(unsigned long type, uint64_t eptp) { struct {
Since GAS_VMX_OP is used only by vm{read,write}_safe, move its definition just above those functions and undefine it after use. Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com> --- Changes in v2: - none xen/arch/x86/include/asm/hvm/vmx/vmx.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)