linux-s390.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Janosch Frank <frankja@linux.ibm.com>
To: kvm@vger.kernel.org
Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com,
	david@redhat.com, thuth@redhat.com, seiden@linux.ibm.com
Subject: [kvm-unit-tests PATCH v2 09/10] s390x: mvpg-sie: Use snippet helpers
Date: Tue,  7 Dec 2021 16:00:04 +0000	[thread overview]
Message-ID: <20211207160005.1586-10-frankja@linux.ibm.com> (raw)
In-Reply-To: <20211207160005.1586-1-frankja@linux.ibm.com>

Time to use our shiny new snippet helpers.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
 s390x/mvpg-sie.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/s390x/mvpg-sie.c b/s390x/mvpg-sie.c
index d526069d..8ae9a52a 100644
--- a/s390x/mvpg-sie.c
+++ b/s390x/mvpg-sie.c
@@ -21,17 +21,12 @@
 #include <sie.h>
 #include <snippet.h>
 
-static u8 *guest;
 static struct vm vm;
 
 static uint8_t *src;
 static uint8_t *dst;
 static uint8_t *cmp;
 
-extern const char SNIPPET_NAME_START(c, mvpg_snippet)[];
-extern const char SNIPPET_NAME_END(c, mvpg_snippet)[];
-int binary_size;
-
 static void test_mvpg_pei(void)
 {
 	uint64_t **pei_dst = (uint64_t **)((uintptr_t) vm.sblk + 0xc0);
@@ -78,9 +73,6 @@ static void test_mvpg_pei(void)
 
 static void test_mvpg(void)
 {
-	int binary_size = SNIPPET_LEN(c, mvpg_snippet);
-
-	memcpy(guest, SNIPPET_NAME_START(c, mvpg_snippet), binary_size);
 	memset(src, 0x42, PAGE_SIZE);
 	memset(dst, 0x43, PAGE_SIZE);
 	sie(&vm);
@@ -89,20 +81,20 @@ 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)[];
+
 	setup_vm();
 
-	/* Allocate 1MB as guest memory */
-	guest = alloc_pages(8);
+	snippet_setup_guest(&vm, false);
+	snippet_init(&vm, SNIPPET_NAME_START(c, mvpg_snippet),
+		     SNIPPET_LEN(c, mvpg_snippet), SNIPPET_OFF_C);
 
-	sie_guest_create(&vm, (uint64_t)guest, HPAGE_SIZE);
-
-	vm.sblk->gpsw = snippet_psw;
-	vm.sblk->ictl = ICTL_OPEREXC | ICTL_PINT;
 	/* Enable MVPG interpretation as we want to test KVM and not ourselves */
 	vm.sblk->eca = ECA_MVPGI;
 
-	src = guest + PAGE_SIZE * 6;
-	dst = guest + PAGE_SIZE * 5;
+	src = (uint8_t *) vm.sblk->mso + PAGE_SIZE * 6;
+	dst = (uint8_t *) vm.sblk->mso + PAGE_SIZE * 5;
 	cmp = alloc_page();
 	memset(cmp, 0, PAGE_SIZE);
 }
-- 
2.32.0


  parent reply	other threads:[~2021-12-07 16:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-07 15:59 [kvm-unit-tests PATCH v2 00/10] s390x: sie: Add PV snippet support Janosch Frank
2021-12-07 15:59 ` [kvm-unit-tests PATCH v2 01/10] lib: s390x: sie: Add sca allocation and freeing Janosch Frank
2021-12-07 15:59 ` [kvm-unit-tests PATCH v2 02/10] s390x: sie: Add PV fields to SIE control block Janosch Frank
2021-12-07 15:59 ` [kvm-unit-tests PATCH v2 03/10] s390x: sie: Add UV information into VM struct Janosch Frank
2021-12-07 15:59 ` [kvm-unit-tests PATCH v2 04/10] s390x: uv: Add more UV call functions Janosch Frank
2021-12-07 16:00 ` [kvm-unit-tests PATCH v2 05/10] s390x: lib: Extend UV library with PV guest management Janosch Frank
2021-12-07 16:00 ` [kvm-unit-tests PATCH v2 06/10] lib: s390: sie: Add PV guest register handling Janosch Frank
2021-12-07 16:00 ` [kvm-unit-tests PATCH v2 07/10] s390x: snippets: Add PV support Janosch Frank
2021-12-08 12:57   ` Claudio Imbrenda
2021-12-07 16:00 ` [kvm-unit-tests PATCH v2 08/10] lib: s390x: Introduce snippet helpers Janosch Frank
2021-12-08 11:46   ` Claudio Imbrenda
2021-12-08 13:56     ` Janosch Frank
2021-12-07 16:00 ` Janosch Frank [this message]
2021-12-08 11:19   ` [kvm-unit-tests PATCH v2 09/10] s390x: mvpg-sie: Use " Claudio Imbrenda
2021-12-07 16:00 ` [kvm-unit-tests PATCH v2 10/10] s390x: sie: Add PV diag test Janosch Frank
2021-12-08 12:55   ` Claudio Imbrenda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211207160005.1586-10-frankja@linux.ibm.com \
    --to=frankja@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=seiden@linux.ibm.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).