public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
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 v4 0/4] More skey instr. emulation test
Date: Wed,  8 Jun 2022 19:45:33 +0200	[thread overview]
Message-ID: <20220608174536.1700357-1-scgl@linux.ibm.com> (raw)

Add test cases similar to those testing the effect of storage keys on
instructions emulated by KVM, but test instructions emulated by user
space/qemu instead.
Test that DIAG 308 is not subject to key protection.
Additionally, check the transaction exception identification on
protection exceptions.

This series is based on v2 of s390x: Rework TEID decoding and usage .
https://lore.kernel.org/kvm/20220608133303.1532166-1-scgl@linux.ibm.com/

v3 -> v4
 * rebase on newest TEID decoding series
 * pick up r-b's (Thanks Claudio)
 * add check for protection code validity in case of basic SOP

v2 -> v3
 * move sclp patch and part of TEID test to series
       s390x: Rework TEID decoding and usage
 * make use of reworked TEID union in skey TEID test
 * get rid of pointer to array for diag 308 test
 * use lowcore symbol and mem_all
 * don't reset intparm when expecting exception in msch test

v1 -> v2
 * don't mixup sclp fix with new bits for the TEID patch
 * address feedback
       * cosmetic changes, i.e. shortening identifiers
       * remove unconditional report_info
 * add DIAG 308 test

Janis Schoetterl-Glausch (3):
  s390x: Test TEID values in storage key test
  s390x: Test effect of storage keys on some more instructions
  s390x: Test effect of storage keys on diag 308

 s390x/skey.c        | 381 +++++++++++++++++++++++++++++++++++++++++++-
 s390x/unittests.cfg |   1 +
 2 files changed, 376 insertions(+), 6 deletions(-)

Range-diff against v3:
1:  073ffb3c ! 1:  fbfd7e3b s390x: Test TEID values in storage key test
    @@ s390x/skey.c: static void test_test_protection(void)
     +{
     +	union teid teid;
     +	int access_code;
    ++	bool dat;
     +
     +	check_pgm_int_code(PGM_INT_CODE_PROTECTION);
     +	report_prefix_push("TEID");
     +	teid.val = lowcore.trans_exc_id;
     +	switch (get_supp_on_prot_facility()) {
     +	case SOP_NONE:
    ++		break;
     +	case SOP_BASIC:
    ++		dat = extract_psw_mask() & PSW_MASK_DAT;
    ++		report(!teid.sop_teid_predictable || !dat || !teid.sop_acc_list,
    ++		       "valid protection code");
     +		break;
     +	case SOP_ENHANCED_1:
    -+		report(!teid.esop1_acc_list_or_dat, "valid protection code");
    ++		report(!teid.sop_teid_predictable, "valid protection code");
     +		break;
     +	case SOP_ENHANCED_2:
     +		switch (teid_esop2_prot_code(teid)) {
    @@ s390x/skey.c: static void test_set_prefix(void)
      
     @@ s390x/skey.c: static void test_set_prefix(void)
      	install_page(root, virt_to_pte_phys(root, pagebuf), 0);
    - 	set_prefix_key_1((uint32_t *)&mem_all[2048]);
    + 	set_prefix_key_1(OPAQUE_PTR(2048));
      	install_page(root, 0, 0);
     -	check_pgm_int_code(PGM_INT_CODE_PROTECTION);
     +	check_key_prot_exc(ACC_FETCH, PROT_FETCH_STORE);
2:  9f300b87 ! 2:  868bb863 s390x: Test effect of storage keys on some more instructions
    @@ Commit message
         fetch protection override.
     
         Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
    +    Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
     
      ## s390x/skey.c ##
     @@
    @@ s390x/skey.c: static void test_set_prefix(void)
     +		set_storage_key(pagebuf, 0x28, 0);
     +		expect_pgm_int();
     +		install_page(root, virt_to_pte_phys(root, pagebuf), 0);
    -+		modify_subchannel_key_1(test_device_sid, (struct schib *)&mem_all[2048]);
    ++		modify_subchannel_key_1(test_device_sid, OPAQUE_PTR(2048));
     +		install_page(root, 0, 0);
     +		check_key_prot_exc(ACC_FETCH, PROT_FETCH_STORE);
     +		cc = stsch(test_device_sid, schib);
3:  c4ca0619 ! 3:  d49934c0 s390x: Test effect of storage keys on diag 308
    @@ Commit message
         Test that key-controlled protection does not apply to diag 308.
     
         Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
    +    Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
     
      ## s390x/skey.c ##
     @@ s390x/skey.c: static void test_store_cpu_address(void)

base-commit: 2eed0bf1096077144cc3a0dd9974689487f9511a
prerequisite-patch-id: aa682f50e4eba0e9b6cacd245d568f5bcca05e0f
prerequisite-patch-id: 79a88ac3faff3ae2ef214bf4a90de7463e2fdc8a
prerequisite-patch-id: bebbc71ca3cc8d085e36a049466dba5a420c9c75
prerequisite-patch-id: d38a4fc7bc1fa6e352502f294cb9413f0b738b99
prerequisite-patch-id: 181e4127db838f3a98fd2b27ea4f23c53da908d7
-- 
2.33.1


             reply	other threads:[~2022-06-08 17:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-08 17:45 Janis Schoetterl-Glausch [this message]
2022-06-08 17:45 ` [kvm-unit-tests PATCH v4 1/3] s390x: Test TEID values in storage key test Janis Schoetterl-Glausch
2022-06-08 17:45 ` [kvm-unit-tests PATCH v4 2/3] s390x: Test effect of storage keys on some more instructions Janis Schoetterl-Glausch
2022-06-08 17:45 ` [kvm-unit-tests PATCH v4 3/3] s390x: Test effect of storage keys on diag 308 Janis Schoetterl-Glausch

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=20220608174536.1700357-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