Skip to contentSkip to conversation

x86/vmx: Correct the declaration of vmx_asm_vmexit_handler()

PATCH In review Andrew Cooper 2 participants 3 messages Feb 23, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/vmx: Correct the declaration of vmx_asm_vmexit_handler()

Taking struct cpu_user_regs as a full object is bogus, and while what was probably meant was to take a struct cpu_user_regs pointer, that's still wrong.

This isn't a function; its an address stored in the VMCS that the CPU resumes from on VMExit, meaning that it doesn't conform to a normal C API/ABI.

Annotate it with nocall, and move the declaration into vmcs.c next to its sole user.

Fixes 9c3118a82523 ("bitkeeper revision 1.1159.1.483 (41c0c417XYObowWqbfqU0cdLx30C9w)")
                 `-> "Initial Intel VMX support"

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>
CC: Xenia Ragiadakou <[email protected]>
CC: Jun Nakajima <[email protected]>
CC: Kevin Tian <[email protected]>

---
 xen/arch/x86/hvm/vmx/vmcs.c            | 2 ++
 xen/arch/x86/include/asm/hvm/vmx/vmx.h | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)
xen/arch/x86/hvm/vmx/vmcs.c +2 -0
index e1c268789e7e..ed71ecfb6284 100644
@@ -1074,6 +1074,8 @@ static void pi_desc_init(struct vcpu *v)
     v->arch.hvm.vmx.pi_desc.ndst = APIC_INVALID_DEST;
 }
 
+void nocall vmx_asm_vmexit_handler(void);
+
 static int construct_vmcs(struct vcpu *v)
 {
     struct domain *d = v->domain;
xen/arch/x86/include/asm/hvm/vmx/vmx.h +0 -1
index 97d6b810ec55..f6308ed65601 100644
@@ -82,7 +82,6 @@ typedef enum {
 
 #define PI_xAPIC_NDST_MASK      0xFF00
 
-void vmx_asm_vmexit_handler(struct cpu_user_regs);
 void vmx_intr_assist(void);
 void noreturn cf_check vmx_do_resume(void);
 void cf_check vmx_vlapic_msr_changed(struct vcpu *v);
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Andrew Cooper

Taking struct cpu_user_regs as a full object is bogus, and while what was probably meant was to take a struct cpu_user_regs pointer, that's still wrong.

This isn't a function; its an address stored in the VMCS that the CPU resumes from on VMExit, meaning that it doesn't conform to a normal C API/ABI.

Quoted 7 lines

Annotate it with nocall, and move the declaration into vmcs.c next to its sole user.

Fixes 9c3118a82523 ("bitkeeper revision 1.1159.1.483 (41c0c417XYObowWqbfqU0cdLx30C9w)")
                 `-> "Initial Intel VMX support"

Since I had to look up what exactly "nocall" expands to, I'm wondering whether it really is still the case that Clang doesn't support the error attribute ...

Jan

#2 lore raw
Quoted 15 lines · Jan Beulich
Quoted 6 lines · Andrew Cooper

Taking struct cpu_user_regs as a full object is bogus, and while what was probably meant was to take a struct cpu_user_regs pointer, that's still wrong.

This isn't a function; its an address stored in the VMCS that the CPU resumes from on VMExit, meaning that it doesn't conform to a normal C API/ABI.

Quoted 7 lines

Annotate it with nocall, and move the declaration into vmcs.c next to its sole user.

Fixes 9c3118a82523 ("bitkeeper revision 1.1159.1.483 (41c0c417XYObowWqbfqU0cdLx30C9w)")
                 `-> "Initial Intel VMX support"
Quoted 5 lines

Since I had to look up what exactly "nocall" expands to, I'm wondering whether it really is still the case that Clang doesn't support the error attribute ...

Argh, should have looked at your next patch ...

Jan