From: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
To: Thomas Huth <thuth@redhat.com>,
Janosch Frank <frankja@linux.ibm.com>,
Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: Janis Schoetterl-Glausch <scgl@linux.ibm.com>,
David Hildenbrand <david@redhat.com>,
kvm@vger.kernel.org, linux-s390@vger.kernel.org
Subject: [kvm-unit-tests PATCH v7 0/3] s390x: Test effect of storage keys on some instructions
Date: Mon, 2 May 2022 17:40:58 +0200 [thread overview]
Message-ID: <20220502154101.3663941-1-scgl@linux.ibm.com> (raw)
See range diff below for changes. Since I messed up the addressees
for the cover letter for the last version, the diff is against v5.
v6 -> v7:
* Add fetch-protection override test case to TPROT test
* Change reporting of TPROT test to be more in line with other tests
v5 -> v6:
* Disable skey test in GitLab CI, needs kernel 5.18
* Added comment to test_set_prefix
* Introduce names for tprot return values
...
v2 -> v3:
* fix asm for SET PREFIX zero key test: make input
* implement Thomas' suggestions:
https://lore.kernel.org/kvm/f050da01-4d50-5da5-7f08-6da30f5dbbbe@redhat.com/
v1 -> v2:
* use install_page instead of manual page table entry manipulation
* check that no store occurred if none is expected
* try to check that no fetch occurred if not expected, although in
practice a fetch would probably cause the test to crash
* reset storage key to 0 after test
Janis Schoetterl-Glausch (3):
s390x: Give name to return value of tprot()
s390x: Test effect of storage keys on some instructions
Disable s390x skey test in GitLab CI
lib/s390x/asm/arch_def.h | 31 +++--
lib/s390x/sclp.c | 6 +-
s390x/skey.c | 250 +++++++++++++++++++++++++++++++++++++++
s390x/tprot.c | 24 ++--
.gitlab-ci.yml | 2 +-
5 files changed, 286 insertions(+), 27 deletions(-)
Range-diff against v5:
-: -------- > 1: 6b11f01d s390x: Give name to return value of tprot()
1: 89e59626 ! 2: e3df88c6 s390x: Test effect of storage keys on some instructions
@@ s390x/skey.c: static void test_invalid_address(void)
+ report_prefix_push("TPROT");
+
+ set_storage_key(pagebuf, 0x10, 0);
-+ report(tprot(addr, 0) == 0, "access key 0 -> no protection");
-+ report(tprot(addr, 1) == 0, "access key matches -> no protection");
-+ report(tprot(addr, 2) == 1, "access key mismatches, no fetch protection -> store protection");
++ report(tprot(addr, 0) == TPROT_READ_WRITE, "zero key: no protection");
++ report(tprot(addr, 1) == TPROT_READ_WRITE, "matching key: no protection");
++
++ report_prefix_push("mismatching key");
++
++ report(tprot(addr, 2) == TPROT_READ, "no fetch protection: store protection");
++
+
+ set_storage_key(pagebuf, 0x18, 0);
-+ report(tprot(addr, 2) == 2, "access key mismatches, fetch protection -> fetch & store protection");
++ report(tprot(addr, 2) == TPROT_RW_PROTECTED,
++ "fetch protection: fetch & store protection");
++
++ report_prefix_push("fetch-protection override");
++ set_storage_key(0, 0x18, 0);
++ report(tprot(0, 2) == TPROT_RW_PROTECTED, "disabled: fetch & store protection");
++ ctl_set_bit(0, CTL0_FETCH_PROTECTION_OVERRIDE);
++ report(tprot(0, 2) == TPROT_READ, "enabled: store protection");
++ report(tprot(2048, 2) == TPROT_RW_PROTECTED, "invalid: fetch & store protection");
++ ctl_clear_bit(0, CTL0_FETCH_PROTECTION_OVERRIDE);
++ set_storage_key(0, 0x00, 0);
++ report_prefix_pop();
+
+ ctl_set_bit(0, CTL0_STORAGE_PROTECTION_OVERRIDE);
+ set_storage_key(pagebuf, 0x90, 0);
-+ report(tprot(addr, 2) == 0, "access key mismatches, storage protection override -> no protection");
++ report(tprot(addr, 2) == TPROT_READ_WRITE,
++ "storage-protection override: no protection");
+ ctl_clear_bit(0, CTL0_STORAGE_PROTECTION_OVERRIDE);
+
++ report_prefix_pop();
+ set_storage_key(pagebuf, 0x00, 0);
+ report_prefix_pop();
+}
@@ s390x/skey.c: static void test_invalid_address(void)
+#define PREFIX_AREA_SIZE (PAGE_SIZE * 2)
+static char lowcore_tmp[PREFIX_AREA_SIZE] __attribute__((aligned(PREFIX_AREA_SIZE)));
+
++/*
++ * Test accessibility of the operand to SET PREFIX given different configurations
++ * with regards to storage keys. That is, check the accessibility of the location
++ * holding the new prefix, not that of the new prefix area. The new prefix area
++ * is a valid lowcore, so that the test does not crash on failure.
++ */
+static void test_set_prefix(void)
+{
+ uint32_t *prefix_ptr = (uint32_t *)pagebuf;
-: -------- > 3: c3236718 Disable s390x skey test in GitLab CI
base-commit: 6a7a83ed106211fc0ee530a3a05f171f6a4c4e66
--
2.33.1
next reply other threads:[~2022-05-02 15:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-02 15:40 Janis Schoetterl-Glausch [this message]
2022-05-02 15:40 ` [kvm-unit-tests PATCH v7 1/3] s390x: Give name to return value of tprot() Janis Schoetterl-Glausch
2022-05-04 13:23 ` Thomas Huth
2022-05-02 15:41 ` [kvm-unit-tests PATCH v7 2/3] s390x: Test effect of storage keys on some instructions Janis Schoetterl-Glausch
2022-05-04 12:46 ` Janosch Frank
2022-05-04 13:29 ` Thomas Huth
2022-05-02 15:41 ` [kvm-unit-tests PATCH v7 3/3] Disable s390x skey test in GitLab CI Janis Schoetterl-Glausch
2022-05-05 13:16 ` [kvm-unit-tests PATCH v7 0/3] s390x: Test effect of storage keys on some instructions 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=20220502154101.3663941-1-scgl@linux.ibm.com \
--to=scgl@linux.ibm.com \
--cc=david@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--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