From: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
To: Thomas Huth <thuth@redhat.com>,
Janosch Frank <frankja@linux.ibm.com>,
Claudio Imbrenda <imbrenda@linux.ibm.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 v1] s390x: spec_ex: Add test for misaligned load
Date: Wed, 1 Mar 2023 14:26:38 +0100 [thread overview]
Message-ID: <20230301132638.3336040-1-nsg@linux.ibm.com> (raw)
The operand of LOAD RELATIVE LONG must be word aligned, otherwise a
specification exception occurs. Test that this exception occurs.
Signed-off-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
---
Noticed while writing another test that TCG fails this requirement,
so thought it best do document this in the form of a test.
s390x/spec_ex.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/s390x/spec_ex.c b/s390x/spec_ex.c
index 42ecaed3..42e86070 100644
--- a/s390x/spec_ex.c
+++ b/s390x/spec_ex.c
@@ -136,7 +136,7 @@ static int short_psw_bit_12_is_0(void)
return 0;
}
-static int bad_alignment(void)
+static int bad_alignment_lqp(void)
{
uint32_t words[5] __attribute__((aligned(16)));
uint32_t (*bad_aligned)[4] = (uint32_t (*)[4])&words[1];
@@ -149,6 +149,22 @@ static int bad_alignment(void)
return 0;
}
+static int bad_alignment_lrl(void)
+{
+ uint64_t r;
+
+ asm volatile ( ".pushsection .rodata\n"
+ " .balign 4\n"
+ " . = . + 2\n"
+ "0: .fill 4\n"
+ " .popsection\n"
+
+ " lrl %0,0b\n"
+ : "=d" (r)
+ );
+ return 0;
+}
+
static int not_even(void)
{
uint64_t quad[2] __attribute__((aligned(16))) = {0};
@@ -176,7 +192,8 @@ struct spec_ex_trigger {
static const struct spec_ex_trigger spec_ex_triggers[] = {
{ "psw_bit_12_is_1", &psw_bit_12_is_1, false, &fixup_invalid_psw },
{ "short_psw_bit_12_is_0", &short_psw_bit_12_is_0, false, &fixup_invalid_psw },
- { "bad_alignment", &bad_alignment, true, NULL },
+ { "bad_alignment_lqp", &bad_alignment_lqp, true, NULL },
+ { "bad_alignment_lrl", &bad_alignment_lrl, true, NULL },
{ "not_even", ¬_even, true, NULL },
{ NULL, NULL, false, NULL },
};
base-commit: e3c5c3ef2524c58023073c0fadde2e8ae3c04ec6
--
2.36.1
next reply other threads:[~2023-03-01 13:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-01 13:26 Nina Schoetterl-Glausch [this message]
2023-03-06 10:59 ` [kvm-unit-tests PATCH v1] s390x: spec_ex: Add test for misaligned load Claudio Imbrenda
2023-03-06 11:31 ` Nina Schoetterl-Glausch
2023-03-20 12:22 ` Claudio Imbrenda
2023-03-22 14:55 ` Nico Boehr
2023-03-23 12:42 ` 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=20230301132638.3336040-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;
as well as URLs for NNTP newsgroup(s).