From: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
To: Claudio Imbrenda <imbrenda@linux.ibm.com>,
Janosch Frank <frankja@linux.ibm.com>,
Thomas Huth <thuth@redhat.com>
Cc: Nina Schoetterl-Glausch <nsg@linux.ibm.com>,
David Hildenbrand <david@redhat.com>,
kvm@vger.kernel.org, linux-s390@vger.kernel.org
Subject: [kvm-unit-tests PATCH v5 0/3] s390x: Add misaligned instruction tests
Date: Tue, 4 Apr 2023 10:54:50 +0200 [thread overview]
Message-ID: <20230404085454.2709061-1-nsg@linux.ibm.com> (raw)
Instructions on s390 must be halfword aligned.
Add two tests for that.
v4 -> v5:
* fix miscompile due to missing barrier (thanks Thomas & Janosch)
* fix issues with clang (thanks Thomas)
v3 -> v4:
* zero whole register with xgr (thanks Janosch)
* pick up tags (thanks Janosch)
v2 -> v3:
* pick up R-b (thanks Janosch)
* use br instead of bcr (thanks Claudio)
* use text section instead of rodata for ex target (thanks Claudio)
* fix label position (thanks Claudio)
v1 -> v2:
* rebase
* use PSW macros
* simplify odd psw test (thanks Claudio)
* rename some identifiers
* pick up R-b (thanks Claudio)
Nina Schoetterl-Glausch (3):
s390x/spec_ex: Use PSW macro
s390x/spec_ex: Add test introducing odd address into PSW
s390x/spec_ex: Add test of EXECUTE with odd target address
s390x/spec_ex.c | 85 +++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 76 insertions(+), 9 deletions(-)
Range-diff against v4:
1: c00f8aa2 = 1: cdfa2083 s390x/spec_ex: Use PSW macro
2: d9e3f6e0 ! 2: 5bf32702 s390x/spec_ex: Add test introducing odd address into PSW
@@ s390x/spec_ex.c: static int psw_bit_12_is_1(void)
return check_invalid_psw();
}
-+extern char misaligned_code[];
++extern char misaligned_code_pre[];
+asm ( ".balign 2\n"
++"misaligned_code_pre:\n"
+" . = . + 1\n"
-+"misaligned_code:\n"
+" larl %r0,0\n"
+" br %r1\n"
+);
+
+static int psw_odd_address(void)
+{
-+ struct psw odd = PSW_WITH_CUR_MASK((uint64_t)&misaligned_code);
++ struct psw odd = PSW_WITH_CUR_MASK(((uint64_t)&misaligned_code_pre) + 1);
+ uint64_t executed_addr;
+
+ expect_invalid_psw(odd);
@@ s390x/spec_ex.c: static int psw_bit_12_is_1(void)
+ : [fixup_addr] "=&T" (fixup_psw.addr),
+ [executed_addr] "=d" (executed_addr)
+ : [odd_psw] "Q" (odd)
-+ : "cc", "%r0", "%r1"
++ : "cc", "%r0", "%r1", "memory" /* Compiler barrier like in load_psw */
+ );
+
+ if (!executed_addr) {
3: 7ea75611 ! 3: 14af5979 s390x/spec_ex: Add test of EXECUTE with odd target address
@@ s390x/spec_ex.c: static int short_psw_bit_12_is_0(void)
+
+ asm volatile ( ".pushsection .text.ex_odd\n"
+ " .balign 2\n"
-+ "pre_odd_ex_target:\n"
++ "pre_odd_ex_target%=:\n"
+ " . = . + 1\n"
+ " lr %[to],%[from]\n"
+ " .popsection\n"
+
-+ " larl %[pre_target_addr],pre_odd_ex_target\n"
++ " larl %[pre_target_addr],pre_odd_ex_target%=\n"
+ " ex 0,1(%[pre_target_addr])\n"
+ : [pre_target_addr] "=&a" (pre_target_addr),
+ [to] "+d" (to)
base-commit: 5b5d27da2973b20ec29b18df4d749fb2190458af
--
2.37.2
next reply other threads:[~2023-04-04 8:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-04 8:54 Nina Schoetterl-Glausch [this message]
2023-04-04 8:54 ` [kvm-unit-tests PATCH v5 1/3] s390x/spec_ex: Use PSW macro Nina Schoetterl-Glausch
2023-04-04 9:38 ` Nico Boehr
2023-04-04 8:54 ` [kvm-unit-tests PATCH v5 2/3] s390x/spec_ex: Add test introducing odd address into PSW Nina Schoetterl-Glausch
2023-04-04 9:59 ` Nico Boehr
2023-04-04 8:54 ` [kvm-unit-tests PATCH v5 3/3] s390x/spec_ex: Add test of EXECUTE with odd target address Nina Schoetterl-Glausch
2023-04-04 10:00 ` Nico Boehr
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=20230404085454.2709061-1-nsg@linux.ibm.com \
--to=nsg@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