From: Janosch Frank <frankja@linux.ibm.com>
To: kvm@vger.kernel.org
Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com,
thuth@redhat.com, david@redhat.com, nsg@linux.ibm.com,
nrb@linux.ibm.com, akrowiak@linux.ibm.com, jjherne@linux.ibm.com
Subject: [kvm-unit-tests PATCH v4 7/7] s390x: ap: Add nq/dq len test
Date: Fri, 2 Feb 2024 14:59:13 +0000 [thread overview]
Message-ID: <20240202145913.34831-8-frankja@linux.ibm.com> (raw)
In-Reply-To: <20240202145913.34831-1-frankja@linux.ibm.com>
For years the nqap/dqap max length was 12KB but with a recent machine
extended message length support was introduced. The support is AP type
and generation specific, so it can vary from card to card which
complicates testing by a lot.
This test will use the APQN that all other tests use no matter if
there's extended length support or not. But if longer messages are
supported by the APQN we need to adapt our tests.
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
lib/s390x/ap.h | 3 +-
s390x/ap.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 105 insertions(+), 1 deletion(-)
diff --git a/lib/s390x/ap.h b/lib/s390x/ap.h
index eecb39be..792149ea 100644
--- a/lib/s390x/ap.h
+++ b/lib/s390x/ap.h
@@ -77,7 +77,8 @@ struct pqap_r2 {
uint8_t pad_1[3];
uint8_t at;
uint8_t nd;
- uint8_t pad_6;
+ uint8_t pad_6 : 4;
+ uint8_t ml : 4;
uint8_t pad_7 : 4;
uint8_t qd : 4;
} __attribute__((packed)) __attribute__((aligned(8)));
diff --git a/s390x/ap.c b/s390x/ap.c
index 0f2d03c2..edb4943b 100644
--- a/s390x/ap.c
+++ b/s390x/ap.c
@@ -257,6 +257,106 @@ static void test_pgms_dqap(void)
report_prefix_pop();
}
+/*
+ * For years the nqap/dqap max length was 12KB but with a recent
+ * machine extended message length support was introduced. The support
+ * is AP type and generation specific, so it can vary from card to
+ * card.
+ *
+ * This test will use the APQN that all other tests use no matter if
+ * there's extended length support or not. But if longer messages are
+ * supported by the APQN we need to adapt our tests.
+ */
+static void test_pgms_nqdq_len(void)
+{
+ struct ap_queue_status apqsw = {};
+ struct pqap_r2 r2 = {};
+ uint64_t len, mlen;
+ bool fail;
+ int i;
+
+ /* Extended message support is reported via tapq with T=1 */
+ ap_pqap_tapq(apn, qn, &apqsw, &r2, true);
+ /* < 3 means 3 because of backwards compatibility */
+ mlen = r2.ml ? r2.ml : 3;
+ /* Len is reported in pages */
+ mlen *= PAGE_SIZE;
+
+ report_prefix_push("nqap");
+ report_prefix_push("spec");
+
+ report_prefix_push("len + 1");
+ expect_pgm_int();
+ len = mlen + 1;
+ asm volatile (
+ "lg 5, 0(%[len])\n"
+ ".insn rre,0xb2ae0000,2,4\n"
+ : : [len] "a" (&len)
+ : "cc", "memory", "0", "1", "2", "3", "4", "5", "6", "7");
+ check_pgm_int_code(PGM_INT_CODE_SPECIFICATION);
+ report_prefix_pop();
+
+ report_prefix_push("len bits");
+ fail = false;
+ for (i = 12; i < 63; i++) {
+ len = BIT(i);
+ if (len < mlen)
+ continue;
+ expect_pgm_int();
+ asm volatile (
+ "lg 5, 0(%[len])\n"
+ ".insn rre,0xb2ae0000,2,4\n"
+ : : [len] "a" (&len)
+ : "cc", "memory", "0", "1", "2", "3", "4", "5", "6", "7");
+ if (clear_pgm_int() != PGM_INT_CODE_SPECIFICATION) {
+ report_fail("setting len to %lx did not result in a spec exception",
+ len);
+ fail = true;
+ }
+ }
+ report(!fail, "length pgms");
+ report_prefix_pop();
+ report_prefix_pop();
+ report_prefix_pop();
+
+ report_prefix_push("dqap");
+ report_prefix_push("spec");
+
+ report_prefix_push("len + 1");
+ expect_pgm_int();
+ len = mlen + 1;
+ asm volatile (
+ "lg 5, 0(%[len])\n"
+ ".insn rre,0xb2ae0000,2,4\n"
+ : : [len] "a" (&len)
+ : "cc", "memory", "0", "1", "2", "3", "4", "5", "6", "7");
+ check_pgm_int_code(PGM_INT_CODE_SPECIFICATION);
+ report_prefix_pop();
+
+ report_prefix_push("len bits");
+ fail = false;
+ for (i = 12; i < 63; i++) {
+ len = BIT(i);
+ if (len < mlen)
+ continue;
+ expect_pgm_int();
+ asm volatile (
+ "lg 5, 0(%[len])\n"
+ ".insn rre,0xb2ae0000,2,4\n"
+ : : [len] "a" (&len)
+ : "cc", "memory", "0", "1", "2", "3", "4", "5", "6", "7");
+ if (clear_pgm_int() != PGM_INT_CODE_SPECIFICATION) {
+ report_fail("setting len to %lx did not result in a spec exception",
+ len);
+ fail = true;
+ }
+ }
+ report(!fail, "length pgms");
+ report_prefix_pop();
+ report_prefix_pop();
+ report_prefix_pop();
+}
+
static void test_priv(void)
{
struct ap_config_info info = {};
@@ -446,6 +546,9 @@ int main(void)
}
apn = apns[0];
qn = qns[0];
+
+ test_pgms_nqdq_len();
+
report_prefix_push("pqap");
if (test_facility(65)) {
test_pqap_aqic();
--
2.40.1
prev parent reply other threads:[~2024-02-02 15:05 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-02 14:59 [kvm-unit-tests PATCH v4 0/7] s390x: Add base AP support Janosch Frank
2024-02-02 14:59 ` [kvm-unit-tests PATCH v4 1/7] lib: s390x: Add ap library Janosch Frank
2024-02-05 18:15 ` Anthony Krowiak
2024-02-06 8:48 ` Harald Freudenberger
2024-02-06 15:45 ` Anthony Krowiak
2024-02-06 13:42 ` Janosch Frank
2024-02-06 15:55 ` Anthony Krowiak
2024-02-07 8:06 ` Harald Freudenberger
2024-02-07 14:30 ` Anthony Krowiak
2024-02-02 14:59 ` [kvm-unit-tests PATCH v4 2/7] s390x: Add guest 2 AP test Janosch Frank
2024-02-20 16:38 ` Anthony Krowiak
2024-02-21 7:57 ` Janosch Frank
2024-02-02 14:59 ` [kvm-unit-tests PATCH v4 3/7] lib: s390x: ap: Add proper ap setup code Janosch Frank
2024-02-02 14:59 ` [kvm-unit-tests PATCH v4 4/7] s390x: ap: Add pqap aqic tests Janosch Frank
2024-02-02 14:59 ` [kvm-unit-tests PATCH v4 5/7] s390x: ap: Add reset tests Janosch Frank
2024-02-02 14:59 ` [kvm-unit-tests PATCH v4 6/7] lib: s390x: ap: Add tapq test facility bit Janosch Frank
2024-02-02 14:59 ` Janosch Frank [this message]
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=20240202145913.34831-8-frankja@linux.ibm.com \
--to=frankja@linux.ibm.com \
--cc=akrowiak@linux.ibm.com \
--cc=david@redhat.com \
--cc=imbrenda@linux.ibm.com \
--cc=jjherne@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=nrb@linux.ibm.com \
--cc=nsg@linux.ibm.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