Skip to content

Commit 9af8f8e

Browse files
yosrym93sean-jc
authored andcommitted
x86/svm: Move report_svm_guest() to the top of svm_tests.c
Move the macro ahead of other tests that will start using it. Signed-off-by: Yosry Ahmed <yosry.ahmed@linux.dev> Link: https://patch.msgid.link/20251110232642.633672-8-yosry.ahmed@linux.dev Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent d7e64b5 commit 9af8f8e

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

x86/svm_tests.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,21 @@ u64 latclgi_max;
3737
u64 latclgi_min;
3838
u64 runs;
3939

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

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

0 commit comments

Comments
 (0)