diff mbox series

[kvm-unit-tests,v1,1/2] s390x: spec_ex-sie: refactor to use snippet API

Message ID 20231103064132.11358-2-nrb@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x: Align SIE tests to 2GB | expand

Commit Message

Nico Boehr Nov. 3, 2023, 6:35 a.m. UTC
spec_ex-sie uses a snippet, but allocated the memory on its own without
obvious reason to do so.

Refactor the test to use snippet_init().

Signed-off-by: Nico Boehr <nrb@linux.ibm.com>
---
 s390x/spec_ex-sie.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Janosch Frank Nov. 3, 2023, 12:09 p.m. UTC | #1
On 11/3/23 07:35, Nico Boehr wrote:
> spec_ex-sie uses a snippet, but allocated the memory on its own without
> obvious reason to do so.
> 
> Refactor the test to use snippet_init().

Hmm, is the test pre-snippet?

Anyway:
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
diff mbox series

Patch

diff --git a/s390x/spec_ex-sie.c b/s390x/spec_ex-sie.c
index 5fa135b81c86..fe2f23ee3d84 100644
--- a/s390x/spec_ex-sie.c
+++ b/s390x/spec_ex-sie.c
@@ -17,19 +17,18 @@ 
 #include <hardware.h>
 
 static struct vm vm;
-extern const char SNIPPET_NAME_START(c, spec_ex)[];
-extern const char SNIPPET_NAME_END(c, spec_ex)[];
 static bool strict;
 
 static void setup_guest(void)
 {
-	char *guest;
-	int binary_size = SNIPPET_LEN(c, spec_ex);
+	extern const char SNIPPET_NAME_START(c, spec_ex)[];
+	extern const char SNIPPET_NAME_END(c, spec_ex)[];
 
 	setup_vm();
-	guest = alloc_pages(8);
-	memcpy(guest, SNIPPET_NAME_START(c, spec_ex), binary_size);
-	sie_guest_create(&vm, (uint64_t) guest, HPAGE_SIZE);
+
+	snippet_setup_guest(&vm, false);
+	snippet_init(&vm, SNIPPET_NAME_START(c, spec_ex),
+		     SNIPPET_LEN(c, spec_ex), SNIPPET_UNPACK_OFF);
 }
 
 static void reset_guest(void)