From: Christoph Schlameuss <schlameuss@linux.ibm.com>
To: linux-s390@vger.kernel.org
Cc: "Janosch Frank" <frankja@linux.ibm.com>,
"Claudio Imbrenda" <imbrenda@linux.ibm.com>,
"Nico Böhr" <nrb@linux.ibm.com>,
"David Hildenbrand" <david@kernel.org>,
"Thomas Huth" <thuth@redhat.com>,
kvm@vger.kernel.org,
"Christoph Schlameuss" <schlameuss@linux.ibm.com>
Subject: [kvm-unit-tests PATCH v2 3/5] s390x: sclp: Rework sclp_facilities_setup() for simpler control flow
Date: Tue, 24 Mar 2026 16:28:07 +0100 [thread overview]
Message-ID: <20260324-vsie-stfle-fac-v2-3-5e52be2e4081@linux.ibm.com> (raw)
In-Reply-To: <20260324-vsie-stfle-fac-v2-0-5e52be2e4081@linux.ibm.com>
Reverse the order of operations to allow for early exits with increasing
cpu offsets when reading facility bits in the extended range.
Signed-off-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
---
lib/s390x/sclp.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
index 2f902e39e785ff4e139a39be2ffe11b5fa01edc0..d624872cba608fcbbd0c482a25f091fe19475a43 100644
--- a/lib/s390x/sclp.c
+++ b/lib/s390x/sclp.c
@@ -154,17 +154,6 @@ void sclp_facilities_setup(void)
assert(read_info);
cpu = sclp_get_cpu_entries();
- if (read_info->offset_cpu > 134)
- sclp_facilities.has_diag318 = read_info->byte_134_diag318;
- sclp_facilities.has_sop = sclp_feat_check(80, SCLP_FEAT_80_BIT_SOP);
- sclp_facilities.has_gsls = sclp_feat_check(85, SCLP_FEAT_85_BIT_GSLS);
- sclp_facilities.has_esop = sclp_feat_check(85, SCLP_FEAT_85_BIT_ESOP);
- sclp_facilities.has_kss = sclp_feat_check(98, SCLP_FEAT_98_BIT_KSS);
- sclp_facilities.has_cmma = sclp_feat_check(116, SCLP_FEAT_116_BIT_CMMA);
- sclp_facilities.has_64bscao = sclp_feat_check(116, SCLP_FEAT_116_BIT_64BSCAO);
- sclp_facilities.has_esca = sclp_feat_check(116, SCLP_FEAT_116_BIT_ESCA);
- sclp_facilities.has_ibs = sclp_feat_check(117, SCLP_FEAT_117_BIT_IBS);
- sclp_facilities.has_pfmfi = sclp_feat_check(117, SCLP_FEAT_117_BIT_PFMFI);
for (i = 0; i < read_info->entries_cpu; i++, cpu++) {
/*
@@ -184,6 +173,20 @@ void sclp_facilities_setup(void)
break;
}
}
+
+ sclp_facilities.has_sop = sclp_feat_check(80, SCLP_FEAT_80_BIT_SOP);
+ sclp_facilities.has_gsls = sclp_feat_check(85, SCLP_FEAT_85_BIT_GSLS);
+ sclp_facilities.has_esop = sclp_feat_check(85, SCLP_FEAT_85_BIT_ESOP);
+ sclp_facilities.has_kss = sclp_feat_check(98, SCLP_FEAT_98_BIT_KSS);
+ sclp_facilities.has_cmma = sclp_feat_check(116, SCLP_FEAT_116_BIT_CMMA);
+ sclp_facilities.has_64bscao = sclp_feat_check(116, SCLP_FEAT_116_BIT_64BSCAO);
+ sclp_facilities.has_esca = sclp_feat_check(116, SCLP_FEAT_116_BIT_ESCA);
+ sclp_facilities.has_ibs = sclp_feat_check(117, SCLP_FEAT_117_BIT_IBS);
+ sclp_facilities.has_pfmfi = sclp_feat_check(117, SCLP_FEAT_117_BIT_PFMFI);
+
+ if (read_info->offset_cpu <= 134)
+ return;
+ sclp_facilities.has_diag318 = read_info->byte_134_diag318;
}
/* Perform service call. Return 0 on success, non-zero otherwise. */
--
2.53.0
next prev parent reply other threads:[~2026-03-24 15:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 15:28 [kvm-unit-tests PATCH v2 0/5] s390x: Add test for STFLE interpretive execution (format-2) Christoph Schlameuss
2026-03-24 15:28 ` [kvm-unit-tests PATCH v2 1/5] s390x: snippets: Add reset_guest() to lib Christoph Schlameuss
2026-04-15 11:00 ` Nico Boehr
2026-03-24 15:28 ` [kvm-unit-tests PATCH v2 2/5] s390x: sclp: Remove unnecessary padding from struct sclp_facilities Christoph Schlameuss
2026-03-25 9:20 ` Janosch Frank
2026-04-15 11:10 ` Nico Boehr
2026-03-24 15:28 ` Christoph Schlameuss [this message]
2026-04-15 11:27 ` [kvm-unit-tests PATCH v2 3/5] s390x: sclp: Rework sclp_facilities_setup() for simpler control flow Nico Boehr
2026-04-17 15:28 ` Christoph Schlameuss
2026-03-24 15:28 ` [kvm-unit-tests PATCH v2 4/5] s390x: sclp: Add detection of alternate STFLE facilities Christoph Schlameuss
2026-04-15 11:34 ` Nico Boehr
2026-04-17 15:28 ` Christoph Schlameuss
2026-03-24 15:28 ` [kvm-unit-tests PATCH v2 5/5] s390x: Add test for STFLE interpretive execution (format-2) Christoph Schlameuss
2026-03-25 10:18 ` Janosch Frank
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=20260324-vsie-stfle-fac-v2-3-5e52be2e4081@linux.ibm.com \
--to=schlameuss@linux.ibm.com \
--cc=david@kernel.org \
--cc=frankja@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=nrb@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