From: Claudio Imbrenda <imbrenda@linux.ibm.com>
To: pbonzini@redhat.com
Cc: kvm@vger.kernel.org, thuth@redhat.com, frankja@linux.ibm.com
Subject: [kvm-unit-tests GIT PULL 09/12] s390x: skey.c: rework the interrupt handler
Date: Thu, 21 Jul 2022 16:06:58 +0200 [thread overview]
Message-ID: <20220721140701.146135-10-imbrenda@linux.ibm.com> (raw)
In-Reply-To: <20220721140701.146135-1-imbrenda@linux.ibm.com>
The skey test currently uses a cleanup function to work around the
issues that arise when the lowcore is not mapped, since the interrupt
handler needs to access it.
Instead of a cleanup function, simply disable DAT for the interrupt
handler for the tests that remap page 0. This is needed in preparation
of and upcoming patch that will cause the interrupt handler to read
from lowcore before calling the cleanup function.
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Acked-by: Janosch Frank <frankja@linux.ibm.com>
---
s390x/skey.c | 33 ++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/s390x/skey.c b/s390x/skey.c
index 7e85f97d..1167e4d3 100644
--- a/s390x/skey.c
+++ b/s390x/skey.c
@@ -451,19 +451,6 @@ static void set_prefix_key_1(uint32_t *prefix_ptr)
);
}
-/*
- * We remapped page 0, making the lowcore inaccessible, which breaks the normal
- * handler and breaks skipping the faulting instruction.
- * Just disable dynamic address translation to make things work.
- */
-static void dat_fixup_pgm_int(void)
-{
- uint64_t psw_mask = extract_psw_mask();
-
- psw_mask &= ~PSW_MASK_DAT;
- load_psw_mask(psw_mask);
-}
-
#define PREFIX_AREA_SIZE (PAGE_SIZE * 2)
static char lowcore_tmp[PREFIX_AREA_SIZE] __attribute__((aligned(PREFIX_AREA_SIZE)));
@@ -519,7 +506,13 @@ static void test_set_prefix(void)
report(get_prefix() == old_prefix, "did not set prefix");
report_prefix_pop();
- register_pgm_cleanup_func(dat_fixup_pgm_int);
+ /*
+ * Page 0 will be remapped, making the lowcore inaccessible, which
+ * breaks the normal handler and breaks skipping the faulting
+ * instruction. Disable dynamic address translation for the
+ * interrupt handler to make things work.
+ */
+ lowcore.pgm_new_psw.mask &= ~PSW_MASK_DAT;
report_prefix_push("remapped page, fetch protection");
set_prefix(old_prefix);
@@ -557,7 +550,7 @@ static void test_set_prefix(void)
report_prefix_pop();
ctl_clear_bit(0, CTL0_FETCH_PROTECTION_OVERRIDE);
- register_pgm_cleanup_func(NULL);
+ lowcore.pgm_new_psw.mask |= PSW_MASK_DAT;
report_prefix_pop();
set_storage_key(pagebuf, 0x00, 0);
report_prefix_pop();
@@ -664,7 +657,13 @@ static void test_msch(void)
report_fail("could not reset SCHIB");
}
- register_pgm_cleanup_func(dat_fixup_pgm_int);
+ /*
+ * Page 0 will be remapped, making the lowcore inaccessible, which
+ * breaks the normal handler and breaks skipping the faulting
+ * instruction. Disable dynamic address translation for the
+ * interrupt handler to make things work.
+ */
+ lowcore.pgm_new_psw.mask &= ~PSW_MASK_DAT;
schib->pmcw.intparm = 0;
if (!msch(test_device_sid, schib)) {
@@ -720,7 +719,7 @@ static void test_msch(void)
}
ctl_clear_bit(0, CTL0_FETCH_PROTECTION_OVERRIDE);
- register_pgm_cleanup_func(NULL);
+ lowcore.pgm_new_psw.mask |= PSW_MASK_DAT;
report_prefix_pop();
set_storage_key(schib, 0x00, 0);
report_prefix_pop();
--
2.36.1
next prev parent reply other threads:[~2022-07-21 14:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-21 14:06 [kvm-unit-tests GIT PULL 00/12] s390x: improve error reporting, more storage key tests Claudio Imbrenda
2022-07-21 14:06 ` [kvm-unit-tests GIT PULL 01/12] s390x: Fix sclp facility bit numbers Claudio Imbrenda
2022-07-21 14:06 ` [kvm-unit-tests GIT PULL 02/12] s390x: lib: SOP facility query function Claudio Imbrenda
2022-07-21 14:06 ` [kvm-unit-tests GIT PULL 03/12] s390x: Rework TEID decoding and usage Claudio Imbrenda
2022-07-21 14:06 ` [kvm-unit-tests GIT PULL 04/12] s390x: Test TEID values in storage key test Claudio Imbrenda
2022-07-21 14:06 ` [kvm-unit-tests GIT PULL 05/12] s390x: Test effect of storage keys on some more instructions Claudio Imbrenda
2022-07-21 14:06 ` [kvm-unit-tests GIT PULL 06/12] s390x: Test effect of storage keys on diag 308 Claudio Imbrenda
2022-07-21 14:06 ` [kvm-unit-tests GIT PULL 07/12] s390x/intercept: Test invalid prefix argument to SET PREFIX Claudio Imbrenda
2022-07-21 14:06 ` [kvm-unit-tests GIT PULL 08/12] lib: s390x: add functions to set and clear PSW bits Claudio Imbrenda
2022-07-21 14:06 ` Claudio Imbrenda [this message]
2022-07-21 14:06 ` [kvm-unit-tests GIT PULL 10/12] lib: s390x: better smp interrupt checks Claudio Imbrenda
2022-07-21 14:07 ` [kvm-unit-tests GIT PULL 11/12] s390x: intercept: fence one test when using TCG Claudio Imbrenda
2022-07-21 14:07 ` [kvm-unit-tests GIT PULL 12/12] s390x: intercept: make sure all output lines are unique Claudio Imbrenda
2022-07-21 14:42 ` [kvm-unit-tests GIT PULL 00/12] s390x: improve error reporting, more storage key tests Paolo Bonzini
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=20220721140701.146135-10-imbrenda@linux.ibm.com \
--to=imbrenda@linux.ibm.com \
--cc=frankja@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.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