* [kvm-unit-tests PATCH 0/2] lib: s390x: Add more snippet macros
@ 2026-09-01 14:20 Janosch Frank
2026-09-01 14:20 ` [kvm-unit-tests PATCH 1/2] lib: s390x: snippet: Add snippet declaration macro Janosch Frank
2026-09-01 14:20 ` [kvm-unit-tests PATCH 2/2] lib: s390x: snippet: Add setup macro Janosch Frank
0 siblings, 2 replies; 3+ messages in thread
From: Janosch Frank @ 2026-09-01 14:20 UTC (permalink / raw)
To: kvm; +Cc: linux-s390, imbrenda, borntraeger, nrb
I'm trying to make things easier for developers (and me) before adding
arm64 support. The upcoming code will add arch arguments to the
macrosso that we won't have to duplicate them.
Janosch Frank (2):
lib: s390x: snippet: Add snippet declaration macro
lib: s390x: snippet: Add setup macro
lib/s390x/snippet.h | 27 +++++++++++++++++
s390x/mvpg-sie.c | 3 +-
s390x/pv-diags.c | 33 ++++-----------------
s390x/pv-edat1.c | 12 ++------
s390x/pv-icptcode.c | 72 +++++++++------------------------------------
s390x/pv-ipl.c | 12 ++------
s390x/sie-dat.c | 3 +-
s390x/spec_ex-sie.c | 10 ++-----
s390x/stfle-sie.c | 7 ++---
9 files changed, 58 insertions(+), 121 deletions(-)
--
2.53.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [kvm-unit-tests PATCH 1/2] lib: s390x: snippet: Add snippet declaration macro
2026-09-01 14:20 [kvm-unit-tests PATCH 0/2] lib: s390x: Add more snippet macros Janosch Frank
@ 2026-09-01 14:20 ` Janosch Frank
2026-09-01 14:20 ` [kvm-unit-tests PATCH 2/2] lib: s390x: snippet: Add setup macro Janosch Frank
1 sibling, 0 replies; 3+ messages in thread
From: Janosch Frank @ 2026-09-01 14:20 UTC (permalink / raw)
To: kvm; +Cc: linux-s390, imbrenda, borntraeger, nrb
Improving readability.
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
lib/s390x/snippet.h | 9 +++++++++
s390x/mvpg-sie.c | 3 +--
s390x/pv-diags.c | 15 +++------------
s390x/pv-edat1.c | 5 +----
s390x/pv-icptcode.c | 30 ++++++------------------------
s390x/pv-ipl.c | 5 +----
s390x/sie-dat.c | 3 +--
s390x/spec_ex-sie.c | 3 +--
s390x/stfle-sie.c | 3 +--
9 files changed, 24 insertions(+), 52 deletions(-)
diff --git a/lib/s390x/snippet.h b/lib/s390x/snippet.h
index 83d74387..6f82a873 100644
--- a/lib/s390x/snippet.h
+++ b/lib/s390x/snippet.h
@@ -30,6 +30,15 @@
#define SNIPPET_HDR_LEN(type, file) \
((uintptr_t)SNIPPET_HDR_END(type, file) - (uintptr_t)SNIPPET_HDR_START(type, file))
+#define SNIPPET_DECLARE(type, file) \
+ extern const char SNIPPET_NAME_START(type, file)[]; \
+ extern const char SNIPPET_NAME_END(type, file)[]
+
+#define SNIPPET_DECLARE_PV(type, file) \
+ SNIPPET_DECLARE(type, file); \
+ extern const char SNIPPET_HDR_START(type, file)[]; \
+ extern const char SNIPPET_HDR_END(type, file)[]
+
/*
* Some of the UV memory needs to be allocated with >31 bit
* addresses which means we need a lot more memory than other
diff --git a/s390x/mvpg-sie.c b/s390x/mvpg-sie.c
index 21082c53..ec0737be 100644
--- a/s390x/mvpg-sie.c
+++ b/s390x/mvpg-sie.c
@@ -84,8 +84,7 @@ static void test_mvpg(void)
static void setup_guest(void)
{
- extern const char SNIPPET_NAME_START(c, mvpg_snippet)[];
- extern const char SNIPPET_NAME_END(c, mvpg_snippet)[];
+ SNIPPET_DECLARE(c, mvpg_snippet);
pgd_t *root;
setup_vm();
diff --git a/s390x/pv-diags.c b/s390x/pv-diags.c
index b6f08dd2..e7cc0e85 100644
--- a/s390x/pv-diags.c
+++ b/s390x/pv-diags.c
@@ -18,10 +18,7 @@ static struct vm vm;
static void test_diag_500(void)
{
- extern const char SNIPPET_NAME_START(asm, pv_diag_500)[];
- extern const char SNIPPET_NAME_END(asm, pv_diag_500)[];
- extern const char SNIPPET_HDR_START(asm, pv_diag_500)[];
- extern const char SNIPPET_HDR_END(asm, pv_diag_500)[];
+ SNIPPET_DECLARE_PV(asm, pv_diag_500);
int size_hdr = SNIPPET_HDR_LEN(asm, pv_diag_500);
int size_gbin = SNIPPET_LEN(asm, pv_diag_500);
@@ -69,10 +66,7 @@ static void test_diag_500(void)
static void test_diag_288(void)
{
- extern const char SNIPPET_NAME_START(asm, pv_diag_288)[];
- extern const char SNIPPET_NAME_END(asm, pv_diag_288)[];
- extern const char SNIPPET_HDR_START(asm, pv_diag_288)[];
- extern const char SNIPPET_HDR_END(asm, pv_diag_288)[];
+ SNIPPET_DECLARE_PV(asm, pv_diag_288);
int size_hdr = SNIPPET_HDR_LEN(asm, pv_diag_288);
int size_gbin = SNIPPET_LEN(asm, pv_diag_288);
@@ -110,10 +104,7 @@ static void test_diag_288(void)
static void test_diag_yield(void)
{
- extern const char SNIPPET_NAME_START(asm, pv_diag_yield)[];
- extern const char SNIPPET_NAME_END(asm, pv_diag_yield)[];
- extern const char SNIPPET_HDR_START(asm, pv_diag_yield)[];
- extern const char SNIPPET_HDR_END(asm, pv_diag_yield)[];
+ SNIPPET_DECLARE_PV(asm, pv_diag_yield);
int size_hdr = SNIPPET_HDR_LEN(asm, pv_diag_yield);
int size_gbin = SNIPPET_LEN(asm, pv_diag_yield);
diff --git a/s390x/pv-edat1.c b/s390x/pv-edat1.c
index ff762c75..05afbb41 100644
--- a/s390x/pv-edat1.c
+++ b/s390x/pv-edat1.c
@@ -36,10 +36,7 @@
static struct vm vm;
static pgd_t *root;
-extern const char SNIPPET_NAME_START(c, pv_memhog)[];
-extern const char SNIPPET_NAME_END(c, pv_memhog)[];
-extern const char SNIPPET_HDR_START(c, pv_memhog)[];
-extern const char SNIPPET_HDR_END(c, pv_memhog)[];
+SNIPPET_DECLARE_PV(c, pv_memhog);
static void init_snippet(struct vm *vm) {
const unsigned long size_hdr = SNIPPET_HDR_LEN(c, pv_memhog);
diff --git a/s390x/pv-icptcode.c b/s390x/pv-icptcode.c
index bdef3a05..35bfde56 100644
--- a/s390x/pv-icptcode.c
+++ b/s390x/pv-icptcode.c
@@ -33,10 +33,7 @@ static struct vm vm, vm2;
*/
static void test_validity_timing(void)
{
- extern const char SNIPPET_NAME_START(asm, pv_icpt_vir_timing)[];
- extern const char SNIPPET_NAME_END(asm, pv_icpt_vir_timing)[];
- extern const char SNIPPET_HDR_START(asm, pv_icpt_vir_timing)[];
- extern const char SNIPPET_HDR_END(asm, pv_icpt_vir_timing)[];
+ SNIPPET_DECLARE_PV(asm, pv_icpt_vir_timing);
int size_hdr = SNIPPET_HDR_LEN(asm, pv_icpt_vir_timing);
int size_gbin = SNIPPET_LEN(asm, pv_icpt_vir_timing);
uint64_t time_exit, time_entry, tmp;
@@ -82,10 +79,7 @@ static void run_loop(void)
static void test_validity_already_running(void)
{
- extern const char SNIPPET_NAME_START(asm, loop)[];
- extern const char SNIPPET_NAME_END(asm, loop)[];
- extern const char SNIPPET_HDR_START(asm, loop)[];
- extern const char SNIPPET_HDR_END(asm, loop)[];
+ SNIPPET_DECLARE_PV(asm, loop);
int size_hdr = SNIPPET_HDR_LEN(asm, loop);
int size_gbin = SNIPPET_LEN(asm, loop);
struct psw psw = {
@@ -131,10 +125,7 @@ out:
/* Tests if a vcpu handle from another configuration results in a validity intercept. */
static void test_validity_handle_not_in_config(void)
{
- extern const char SNIPPET_NAME_START(asm, icpt_loop)[];
- extern const char SNIPPET_NAME_END(asm, icpt_loop)[];
- extern const char SNIPPET_HDR_START(asm, icpt_loop)[];
- extern const char SNIPPET_HDR_END(asm, icpt_loop)[];
+ SNIPPET_DECLARE_PV(asm, icpt_loop);
int size_hdr = SNIPPET_HDR_LEN(asm, icpt_loop);
int size_gbin = SNIPPET_LEN(asm, icpt_loop);
@@ -173,10 +164,7 @@ static void test_validity_handle_not_in_config(void)
/* Tests if a wrong vm or vcpu handle results in a validity intercept. */
static void test_validity_seid(void)
{
- extern const char SNIPPET_NAME_START(asm, icpt_loop)[];
- extern const char SNIPPET_NAME_END(asm, icpt_loop)[];
- extern const char SNIPPET_HDR_START(asm, icpt_loop)[];
- extern const char SNIPPET_HDR_END(asm, icpt_loop)[];
+ SNIPPET_DECLARE_PV(asm, icpt_loop);
int size_hdr = SNIPPET_HDR_LEN(asm, icpt_loop);
int size_gbin = SNIPPET_LEN(asm, icpt_loop);
int fails = 0;
@@ -224,10 +212,7 @@ static void test_validity_seid(void)
*/
static void test_validity_asce(void)
{
- extern const char SNIPPET_NAME_START(asm, pv_icpt_112)[];
- extern const char SNIPPET_NAME_END(asm, pv_icpt_112)[];
- extern const char SNIPPET_HDR_START(asm, pv_icpt_112)[];
- extern const char SNIPPET_HDR_END(asm, pv_icpt_112)[];
+ SNIPPET_DECLARE_PV(asm, pv_icpt_112);
int size_hdr = SNIPPET_HDR_LEN(asm, pv_icpt_112);
int size_gbin = SNIPPET_LEN(asm, pv_icpt_112);
uint64_t asce_old, asce_new;
@@ -311,10 +296,7 @@ static void run_icpt_122_tests_prefix(unsigned long prefix)
static void test_icpt_112(void)
{
- extern const char SNIPPET_NAME_START(asm, pv_icpt_112)[];
- extern const char SNIPPET_NAME_END(asm, pv_icpt_112)[];
- extern const char SNIPPET_HDR_START(asm, pv_icpt_112)[];
- extern const char SNIPPET_HDR_END(asm, pv_icpt_112)[];
+ SNIPPET_DECLARE_PV(asm, pv_icpt_112);
int size_hdr = SNIPPET_HDR_LEN(asm, pv_icpt_112);
int size_gbin = SNIPPET_LEN(asm, pv_icpt_112);
diff --git a/s390x/pv-ipl.c b/s390x/pv-ipl.c
index 1219573f..af2cfbcf 100644
--- a/s390x/pv-ipl.c
+++ b/s390x/pv-ipl.c
@@ -19,10 +19,7 @@ static struct vm vm;
static void test_diag_308(int subcode)
{
- extern const char SNIPPET_NAME_START(asm, pv_diag_308)[];
- extern const char SNIPPET_NAME_END(asm, pv_diag_308)[];
- extern const char SNIPPET_HDR_START(asm, pv_diag_308)[];
- extern const char SNIPPET_HDR_END(asm, pv_diag_308)[];
+ SNIPPET_DECLARE_PV(asm, pv_diag_308);
int size_hdr = SNIPPET_HDR_LEN(asm, pv_diag_308);
int size_gbin = SNIPPET_LEN(asm, pv_diag_308);
uint16_t rc, rrc;
diff --git a/s390x/sie-dat.c b/s390x/sie-dat.c
index a5ff0872..46d20dab 100644
--- a/s390x/sie-dat.c
+++ b/s390x/sie-dat.c
@@ -63,8 +63,7 @@ static void test_sie_dat(void)
static void setup_guest(void)
{
- extern const char SNIPPET_NAME_START(c, sie_dat)[];
- extern const char SNIPPET_NAME_END(c, sie_dat)[];
+ SNIPPET_DECLARE(c, sie_dat);
uint64_t guest_max_addr;
pgd_t *root;
diff --git a/s390x/spec_ex-sie.c b/s390x/spec_ex-sie.c
index dd4ab77e..e79208df 100644
--- a/s390x/spec_ex-sie.c
+++ b/s390x/spec_ex-sie.c
@@ -21,8 +21,7 @@ static bool strict;
static void setup_guest(void)
{
- extern const char SNIPPET_NAME_START(c, spec_ex)[];
- extern const char SNIPPET_NAME_END(c, spec_ex)[];
+ SNIPPET_DECLARE(c, spec_ex);
setup_vm();
diff --git a/s390x/stfle-sie.c b/s390x/stfle-sie.c
index 3697e1ae..e3642078 100644
--- a/s390x/stfle-sie.c
+++ b/s390x/stfle-sie.c
@@ -20,8 +20,7 @@ static prng_state prng_s;
static void setup_guest(void)
{
- extern const char SNIPPET_NAME_START(c, stfle)[];
- extern const char SNIPPET_NAME_END(c, stfle)[];
+ SNIPPET_DECLARE(c, stfle);
setup_vm();
fac = alloc_pages_flags(0, AREA_DMA31);
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [kvm-unit-tests PATCH 2/2] lib: s390x: snippet: Add setup macro
2026-09-01 14:20 [kvm-unit-tests PATCH 0/2] lib: s390x: Add more snippet macros Janosch Frank
2026-09-01 14:20 ` [kvm-unit-tests PATCH 1/2] lib: s390x: snippet: Add snippet declaration macro Janosch Frank
@ 2026-09-01 14:20 ` Janosch Frank
1 sibling, 0 replies; 3+ messages in thread
From: Janosch Frank @ 2026-09-01 14:20 UTC (permalink / raw)
To: kvm; +Cc: linux-s390, imbrenda, borntraeger, nrb
SNIPPET_SETUP() takes care of guest setup and snippet initialization.
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
lib/s390x/snippet.h | 18 ++++++++++++++++++
s390x/pv-diags.c | 18 +++---------------
s390x/pv-edat1.c | 7 +------
s390x/pv-icptcode.c | 42 ++++++++----------------------------------
s390x/pv-ipl.c | 7 ++-----
s390x/spec_ex-sie.c | 7 +------
s390x/stfle-sie.c | 4 +---
7 files changed, 34 insertions(+), 69 deletions(-)
diff --git a/lib/s390x/snippet.h b/lib/s390x/snippet.h
index 6f82a873..0ff7ad7d 100644
--- a/lib/s390x/snippet.h
+++ b/lib/s390x/snippet.h
@@ -39,6 +39,24 @@
extern const char SNIPPET_HDR_START(type, file)[]; \
extern const char SNIPPET_HDR_END(type, file)[]
+#define SNIPPET_SETUP_PV(vm, type, file) \
+do { \
+ snippet_setup_guest(vm, true); \
+ snippet_pv_init(vm, \
+ SNIPPET_NAME_START(type, file), \
+ SNIPPET_HDR_START(type, file), \
+ SNIPPET_LEN(type, file), \
+ SNIPPET_HDR_LEN(type, file), \
+ 0); \
+} while (0)
+
+#define SNIPPET_SETUP(vm, type, file) \
+do { \
+ snippet_setup_guest(vm, false); \
+ snippet_init(vm, SNIPPET_NAME_START(type, file), \
+ SNIPPET_LEN(type, file), 0); \
+} while (0)
+
/*
* Some of the UV memory needs to be allocated with >31 bit
* addresses which means we need a lot more memory than other
diff --git a/s390x/pv-diags.c b/s390x/pv-diags.c
index e7cc0e85..a5f32954 100644
--- a/s390x/pv-diags.c
+++ b/s390x/pv-diags.c
@@ -19,14 +19,10 @@ static struct vm vm;
static void test_diag_500(void)
{
SNIPPET_DECLARE_PV(asm, pv_diag_500);
- int size_hdr = SNIPPET_HDR_LEN(asm, pv_diag_500);
- int size_gbin = SNIPPET_LEN(asm, pv_diag_500);
report_prefix_push("diag 0x500");
- snippet_pv_init(&vm, SNIPPET_NAME_START(asm, pv_diag_500),
- SNIPPET_HDR_START(asm, pv_diag_500),
- size_gbin, size_hdr, SNIPPET_UNPACK_OFF);
+ SNIPPET_SETUP_PV(&vm, asm, pv_diag_500);
sie(&vm);
report(sie_is_diag_icpt(&vm, 0x500), "intercept values");
@@ -67,14 +63,10 @@ static void test_diag_500(void)
static void test_diag_288(void)
{
SNIPPET_DECLARE_PV(asm, pv_diag_288);
- int size_hdr = SNIPPET_HDR_LEN(asm, pv_diag_288);
- int size_gbin = SNIPPET_LEN(asm, pv_diag_288);
report_prefix_push("diag 0x288");
- snippet_pv_init(&vm, SNIPPET_NAME_START(asm, pv_diag_288),
- SNIPPET_HDR_START(asm, pv_diag_288),
- size_gbin, size_hdr, SNIPPET_UNPACK_OFF);
+ SNIPPET_SETUP_PV(&vm, asm, pv_diag_288);
sie(&vm);
report(vm.sblk->icptcode == ICPT_PV_INSTR && vm.sblk->ipa == 0x8302 &&
@@ -105,14 +97,10 @@ static void test_diag_288(void)
static void test_diag_yield(void)
{
SNIPPET_DECLARE_PV(asm, pv_diag_yield);
- int size_hdr = SNIPPET_HDR_LEN(asm, pv_diag_yield);
- int size_gbin = SNIPPET_LEN(asm, pv_diag_yield);
report_prefix_push("diag yield");
- snippet_pv_init(&vm, SNIPPET_NAME_START(asm, pv_diag_yield),
- SNIPPET_HDR_START(asm, pv_diag_yield),
- size_gbin, size_hdr, SNIPPET_UNPACK_OFF);
+ SNIPPET_SETUP_PV(&vm, asm, pv_diag_yield);
/* 0x44 */
report_prefix_push("0x44");
diff --git a/s390x/pv-edat1.c b/s390x/pv-edat1.c
index 05afbb41..5dc1f42c 100644
--- a/s390x/pv-edat1.c
+++ b/s390x/pv-edat1.c
@@ -39,12 +39,7 @@ static pgd_t *root;
SNIPPET_DECLARE_PV(c, pv_memhog);
static void init_snippet(struct vm *vm) {
- const unsigned long size_hdr = SNIPPET_HDR_LEN(c, pv_memhog);
- const unsigned long size_gbin = SNIPPET_LEN(c, pv_memhog);
-
- snippet_pv_init(vm, SNIPPET_NAME_START(c, pv_memhog),
- SNIPPET_HDR_START(c, pv_memhog),
- size_gbin, size_hdr, SNIPPET_UNPACK_OFF);
+ SNIPPET_SETUP_PV(vm, c, pv_memhog);
}
static uint64_t tod_to_us(uint64_t tod)
diff --git a/s390x/pv-icptcode.c b/s390x/pv-icptcode.c
index 35bfde56..71baef2f 100644
--- a/s390x/pv-icptcode.c
+++ b/s390x/pv-icptcode.c
@@ -34,14 +34,11 @@ static struct vm vm, vm2;
static void test_validity_timing(void)
{
SNIPPET_DECLARE_PV(asm, pv_icpt_vir_timing);
- int size_hdr = SNIPPET_HDR_LEN(asm, pv_icpt_vir_timing);
- int size_gbin = SNIPPET_LEN(asm, pv_icpt_vir_timing);
uint64_t time_exit, time_entry, tmp;
report_prefix_push("manipulated cpu time");
- snippet_pv_init(&vm, SNIPPET_NAME_START(asm, pv_icpt_vir_timing),
- SNIPPET_HDR_START(asm, pv_icpt_vir_timing),
- size_gbin, size_hdr, SNIPPET_UNPACK_OFF);
+
+ SNIPPET_SETUP_PV(&vm, asm, pv_icpt_vir_timing);
sie(&vm);
report(sie_is_diag_icpt(&vm, 0x44), "spt done");
@@ -80,8 +77,6 @@ static void run_loop(void)
static void test_validity_already_running(void)
{
SNIPPET_DECLARE_PV(asm, loop);
- int size_hdr = SNIPPET_HDR_LEN(asm, loop);
- int size_gbin = SNIPPET_LEN(asm, loop);
struct psw psw = {
.mask = PSW_MASK_64,
.addr = (uint64_t)run_loop,
@@ -93,9 +88,7 @@ static void test_validity_already_running(void)
goto out;
}
- snippet_pv_init(&vm, SNIPPET_NAME_START(asm, loop),
- SNIPPET_HDR_START(asm, loop),
- size_gbin, size_hdr, SNIPPET_UNPACK_OFF);
+ SNIPPET_SETUP_PV(&vm, asm, loop);
smp_cpu_setup(1, psw);
sie_expect_validity(&vm);
@@ -126,20 +119,13 @@ out:
static void test_validity_handle_not_in_config(void)
{
SNIPPET_DECLARE_PV(asm, icpt_loop);
- int size_hdr = SNIPPET_HDR_LEN(asm, icpt_loop);
- int size_gbin = SNIPPET_LEN(asm, icpt_loop);
report_prefix_push("handle not in config");
/* Setup our primary vm */
- snippet_pv_init(&vm, SNIPPET_NAME_START(asm, icpt_loop),
- SNIPPET_HDR_START(asm, icpt_loop),
- size_gbin, size_hdr, SNIPPET_UNPACK_OFF);
+ SNIPPET_SETUP_PV(&vm, asm, icpt_loop);
/* Setup secondary vm */
- snippet_setup_guest(&vm2, true);
- snippet_pv_init(&vm2, SNIPPET_NAME_START(asm, icpt_loop),
- SNIPPET_HDR_START(asm, icpt_loop),
- size_gbin, size_hdr, SNIPPET_UNPACK_OFF);
+ SNIPPET_SETUP_PV(&vm2, asm, icpt_loop);
vm.sblk->pv_handle_cpu = vm2.sblk->pv_handle_cpu;
sie_expect_validity(&vm);
@@ -165,15 +151,11 @@ static void test_validity_handle_not_in_config(void)
static void test_validity_seid(void)
{
SNIPPET_DECLARE_PV(asm, icpt_loop);
- int size_hdr = SNIPPET_HDR_LEN(asm, icpt_loop);
- int size_gbin = SNIPPET_LEN(asm, icpt_loop);
int fails = 0;
int i;
report_prefix_push("handles");
- snippet_pv_init(&vm, SNIPPET_NAME_START(asm, icpt_loop),
- SNIPPET_HDR_START(asm, icpt_loop),
- size_gbin, size_hdr, SNIPPET_UNPACK_OFF);
+ SNIPPET_SETUP_PV(&vm, asm, icpt_loop);
for (i = 0; i < 64; i++) {
vm.sblk->pv_handle_config ^= 1UL << i;
@@ -213,15 +195,11 @@ static void test_validity_seid(void)
static void test_validity_asce(void)
{
SNIPPET_DECLARE_PV(asm, pv_icpt_112);
- int size_hdr = SNIPPET_HDR_LEN(asm, pv_icpt_112);
- int size_gbin = SNIPPET_LEN(asm, pv_icpt_112);
uint64_t asce_old, asce_new;
void *pgd_new, *pgd_old;
report_prefix_push("asce");
- snippet_pv_init(&vm, SNIPPET_NAME_START(asm, pv_icpt_112),
- SNIPPET_HDR_START(asm, pv_icpt_112),
- size_gbin, size_hdr, SNIPPET_UNPACK_OFF);
+ SNIPPET_SETUP_PV(&vm, asm, pv_icpt_112);
asce_old = vm.save_area.guest.asce;
pgd_new = memalign_pages_flags(PAGE_SIZE, PAGE_SIZE * 4, 0);
@@ -297,16 +275,12 @@ static void run_icpt_122_tests_prefix(unsigned long prefix)
static void test_icpt_112(void)
{
SNIPPET_DECLARE_PV(asm, pv_icpt_112);
- int size_hdr = SNIPPET_HDR_LEN(asm, pv_icpt_112);
- int size_gbin = SNIPPET_LEN(asm, pv_icpt_112);
unsigned long lc_off = 0;
report_prefix_push("prefix");
- snippet_pv_init(&vm, SNIPPET_NAME_START(asm, pv_icpt_112),
- SNIPPET_HDR_START(asm, pv_icpt_112),
- size_gbin, size_hdr, SNIPPET_UNPACK_OFF);
+ SNIPPET_SETUP_PV(&vm, asm, pv_icpt_112);
/* Setup of the guest's state for 0x0 prefix */
sie(&vm);
diff --git a/s390x/pv-ipl.c b/s390x/pv-ipl.c
index af2cfbcf..8affeb1c 100644
--- a/s390x/pv-ipl.c
+++ b/s390x/pv-ipl.c
@@ -20,15 +20,12 @@ static struct vm vm;
static void test_diag_308(int subcode)
{
SNIPPET_DECLARE_PV(asm, pv_diag_308);
- int size_hdr = SNIPPET_HDR_LEN(asm, pv_diag_308);
- int size_gbin = SNIPPET_LEN(asm, pv_diag_308);
uint16_t rc, rrc;
int cc;
report_prefix_pushf("subcode %d", subcode);
- snippet_pv_init(&vm, SNIPPET_NAME_START(asm, pv_diag_308),
- SNIPPET_HDR_START(asm, pv_diag_308),
- size_gbin, size_hdr, SNIPPET_UNPACK_OFF);
+
+ SNIPPET_SETUP_PV(&vm, asm, pv_diag_308);
/* First exit is a diag 0x500 */
sie(&vm);
diff --git a/s390x/spec_ex-sie.c b/s390x/spec_ex-sie.c
index e79208df..102f0345 100644
--- a/s390x/spec_ex-sie.c
+++ b/s390x/spec_ex-sie.c
@@ -22,12 +22,7 @@ static bool strict;
static void setup_guest(void)
{
SNIPPET_DECLARE(c, spec_ex);
-
- setup_vm();
-
- snippet_setup_guest(&vm, false);
- snippet_init(&vm, SNIPPET_NAME_START(c, spec_ex),
- SNIPPET_LEN(c, spec_ex), SNIPPET_UNPACK_OFF);
+ SNIPPET_SETUP(&vm, c, spec_ex);
}
static void test_spec_ex_sie(void)
diff --git a/s390x/stfle-sie.c b/s390x/stfle-sie.c
index e3642078..178c6815 100644
--- a/s390x/stfle-sie.c
+++ b/s390x/stfle-sie.c
@@ -25,9 +25,7 @@ static void setup_guest(void)
setup_vm();
fac = alloc_pages_flags(0, AREA_DMA31);
- snippet_setup_guest(&vm, false);
- snippet_init(&vm, SNIPPET_NAME_START(c, stfle),
- SNIPPET_LEN(c, stfle), SNIPPET_UNPACK_OFF);
+ SNIPPET_SETUP(&vm, c, stfle);
}
struct guest_stfle_res {
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-01 14:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-01 14:20 [kvm-unit-tests PATCH 0/2] lib: s390x: Add more snippet macros Janosch Frank
2026-09-01 14:20 ` [kvm-unit-tests PATCH 1/2] lib: s390x: snippet: Add snippet declaration macro Janosch Frank
2026-09-01 14:20 ` [kvm-unit-tests PATCH 2/2] lib: s390x: snippet: Add setup macro Janosch Frank
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox