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 v2 2/3] s390x: lib: SOP facility query function
Date: Wed, 8 Jun 2022 15:33:02 +0200 [thread overview]
Message-ID: <20220608133303.1532166-3-scgl@linux.ibm.com> (raw)
In-Reply-To: <20220608133303.1532166-1-scgl@linux.ibm.com>
Add function returning which suppression-on-protection facility is
installed.
Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
lib/s390x/asm/facility.h | 21 +++++++++++++++++++++
lib/s390x/sclp.h | 4 ++++
lib/s390x/sclp.c | 2 ++
3 files changed, 27 insertions(+)
diff --git a/lib/s390x/asm/facility.h b/lib/s390x/asm/facility.h
index 49380203..a66fe56a 100644
--- a/lib/s390x/asm/facility.h
+++ b/lib/s390x/asm/facility.h
@@ -12,6 +12,7 @@
#include <asm/facility.h>
#include <asm/arch_def.h>
#include <bitops.h>
+#include <sclp.h>
#define NB_STFL_DOUBLEWORDS 32
extern uint64_t stfl_doublewords[];
@@ -42,4 +43,24 @@ static inline void setup_facilities(void)
stfle(stfl_doublewords, NB_STFL_DOUBLEWORDS);
}
+enum supp_on_prot_facility {
+ SOP_NONE,
+ SOP_BASIC,
+ SOP_ENHANCED_1,
+ SOP_ENHANCED_2,
+};
+
+static inline enum supp_on_prot_facility get_supp_on_prot_facility(void)
+{
+ if (sclp_facilities.has_esop) {
+ if (test_facility(131)) /* side-effect-access facility */
+ return SOP_ENHANCED_2;
+ else
+ return SOP_ENHANCED_1;
+ }
+ if (sclp_facilities.has_sop)
+ return SOP_BASIC;
+ return SOP_NONE;
+}
+
#endif
diff --git a/lib/s390x/sclp.h b/lib/s390x/sclp.h
index 3488f4d2..853529bf 100644
--- a/lib/s390x/sclp.h
+++ b/lib/s390x/sclp.h
@@ -123,7 +123,9 @@ struct sclp_facilities {
uint64_t has_cei : 1;
uint64_t has_diag318 : 1;
+ uint64_t has_sop : 1;
uint64_t has_gsls : 1;
+ uint64_t has_esop : 1;
uint64_t has_cmma : 1;
uint64_t has_64bscao : 1;
uint64_t has_esca : 1;
@@ -134,7 +136,9 @@ struct sclp_facilities {
};
/* bit number within a certain byte */
+#define SCLP_FEAT_80_BIT_SOP 2
#define SCLP_FEAT_85_BIT_GSLS 0
+#define SCLP_FEAT_85_BIT_ESOP 6
#define SCLP_FEAT_98_BIT_KSS 7
#define SCLP_FEAT_116_BIT_64BSCAO 0
#define SCLP_FEAT_116_BIT_CMMA 1
diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
index b8204c5f..e6017f64 100644
--- a/lib/s390x/sclp.c
+++ b/lib/s390x/sclp.c
@@ -152,7 +152,9 @@ void sclp_facilities_setup(void)
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);
--
2.33.1
next prev parent reply other threads:[~2022-06-08 13:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-08 13:33 [kvm-unit-tests PATCH v2 0/3] s390x: Rework TEID decoding and usage Janis Schoetterl-Glausch
2022-06-08 13:33 ` [kvm-unit-tests PATCH v2 1/3] s390x: Fix sclp facility bit numbers Janis Schoetterl-Glausch
2022-06-08 13:33 ` Janis Schoetterl-Glausch [this message]
2022-06-08 13:33 ` [kvm-unit-tests PATCH v2 3/3] s390x: Rework TEID decoding and usage Janis Schoetterl-Glausch
2022-06-08 14:03 ` Claudio Imbrenda
2022-06-08 15:55 ` Janis Schoetterl-Glausch
2022-06-08 16:40 ` Claudio Imbrenda
2022-06-10 9:31 ` Janosch Frank
2022-06-10 10:37 ` Janis Schoetterl-Glausch
2022-06-10 12:10 ` Janosch Frank
2022-06-13 12:40 ` 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=20220608133303.1532166-3-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.