[PATCH v3 07/14] x86/svm: Move report_svm_guest() to the top of svm_tests.c

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

Move the macro ahead of other tests that will start using it.

Signed-off-by: Yosry Ahmed <yosry.ahmed@linux.dev>
---
x86/svm_tests.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/x86/svm_tests.c b/x86/svm_tests.c
index feeb27d61435b..61ab63db462dc 100644
--- a/x86/svm_tests.c
+++ b/x86/svm_tests.c
@@ -37,6 +37,21 @@ u64 latclgi_max;
u64 latclgi_min;
u64 runs;

+/*
+ * Report failures from SVM guest code, and on failure, set the stage to -1 and
+ * do VMMCALL to terminate the test (host side must treat -1 as "finished").
+ * TODO: fix the tests that don't play nice with a straight report, e.g. the
+ * V_TPR test fails if report() is invoked.
+ */
+#define report_svm_guest(cond, test, fmt, args...) \
+do { \
+ if (!(cond)) { \
+ report_fail(fmt, ##args); \
+ set_test_stage(test, -1); \
+ vmmcall(); \
+ } \
+} while (0)
+
static void null_test(struct svm_test *test)
{
}
@@ -1074,21 +1089,6 @@ static bool lat_svm_insn_check(struct svm_test *test)
return true;
}

-/*
- * Report failures from SVM guest code, and on failure, set the stage to -1 and
- * do VMMCALL to terminate the test (host side must treat -1 as "finished").
- * TODO: fix the tests that don't play nice with a straight report, e.g. the
- * V_TPR test fails if report() is invoked.
- */
-#define report_svm_guest(cond, test, fmt, args...) \
-do { \
- if (!(cond)) { \
- report_fail(fmt, ##args); \
- set_test_stage(test, -1); \
- vmmcall(); \
- } \
-} while (0)
-
bool pending_event_ipi_fired;
bool pending_event_guest_run;

--
2.51.2.1041.gc1ab5b90ca-goog