Extract the inline assembly hypercall from test_pv_ipi() into a new helper function, pv_ipi(), to facilitate code sharing. Assisted-by: Gemini:gemini-3.1-pro Signed-off-by: Jim Mattson --- x86/apic.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/x86/apic.c b/x86/apic.c index 65198ecfb3c1..eea0c8d8e0f9 100644 --- a/x86/apic.c +++ b/x86/apic.c @@ -638,6 +638,18 @@ static void test_apic_change_mode(void) #define KVM_HC_SEND_IPI 10 +static int pv_ipi(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3) +{ + int ret; + + if (is_intel()) + asm volatile("vmcall" : "=a"(ret) :"a"(KVM_HC_SEND_IPI), "b"(a0), "c"(a1), "d"(a2), "S"(a3)); + else + asm volatile("vmmcall" : "=a"(ret) :"a"(KVM_HC_SEND_IPI), "b"(a0), "c"(a1), "d"(a2), "S"(a3)); + + return ret; +} + static void test_pv_ipi(void) { int ret; @@ -651,10 +663,7 @@ static void test_pv_ipi(void) if (!test_device_enabled()) return; - if (is_intel()) - asm volatile("vmcall" : "=a"(ret) :"a"(KVM_HC_SEND_IPI), "b"(a0), "c"(a1), "d"(a2), "S"(a3)); - else - asm volatile("vmmcall" : "=a"(ret) :"a"(KVM_HC_SEND_IPI), "b"(a0), "c"(a1), "d"(a2), "S"(a3)); + ret = pv_ipi(a0, a1, a2, a3); report(!ret, "PV IPIs testing"); } -- 2.55.0.rc0.799.gd6f94ed593-goog