[PATCH v3 02/14] x86/vmx: Skip vmx_pf_exception_test_fep early if FEP is not available

Yosry Ahmed
2025-11-10T23:27:06Z

The check to skip the test is currently performed in the guest code.
There a few TEST_ASSERTs that happen before the guest is run, which
internally call report_passed(). The latter increases the number of
passed tests.

Hence, when vmx_pf_exception_test_fep is run, report_summary() does not
return a "skip" error code because the total number of tests is larger
than the number of skipped tests.

Skip early if FEP is not available, before any assertions, such that
report_summary() finds exactly 1 skipped test and returns the
appropriate error code.

Signed-off-by: Yosry Ahmed <yosry.ahmed@linux.dev>
---
x86/vmx_tests.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 0b3cfe50c6142..4f214ebdbe1d9 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -10644,7 +10644,10 @@ static void vmx_pf_exception_test(void)

static void vmx_pf_exception_forced_emulation_test(void)
{
- __vmx_pf_exception_test(NULL, NULL, vmx_pf_exception_forced_emulation_test_guest);
+ if (is_fep_available)
+ __vmx_pf_exception_test(NULL, NULL, vmx_pf_exception_forced_emulation_test_guest);
+ else
+ report_skip("Forced emulation prefix (FEP) not available\n");
}

static void invalidate_tlb_no_vpid(void *data)
--
2.51.2.1041.gc1ab5b90ca-goog