All of lore.kernel.org
 help / color / mirror / Atom feed
From: Janosch Frank <frankja@linux.ibm.com>
To: pbonzini@redhat.com
Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com,
	borntraeger@de.ibm.com, cohuck@redhat.com,
	linux-s390@vger.kernel.org, imbrenda@linux.ibm.com,
	thuth@redhat.com
Subject: [kvm-unit-tests GIT PULL 8/9] lib: s390x: sclp: Extend feature probing
Date: Wed, 26 May 2021 16:55:38 +0200	[thread overview]
Message-ID: <20210526145539.52008-9-frankja@linux.ibm.com> (raw)
In-Reply-To: <20210526145539.52008-1-frankja@linux.ibm.com>

Let's grab more of the feature bits from SCLP read info so we can use
them in the cpumodel tests.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: David Hildenbrand <david@redhat.com>
---
 lib/s390x/sclp.c | 20 ++++++++++++++++++++
 lib/s390x/sclp.h | 39 ++++++++++++++++++++++++++++++++++++---
 2 files changed, 56 insertions(+), 3 deletions(-)

diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c
index f11c2035..291924b0 100644
--- a/lib/s390x/sclp.c
+++ b/lib/s390x/sclp.c
@@ -129,6 +129,13 @@ CPUEntry *sclp_get_cpu_entries(void)
 	return (CPUEntry *)(_read_info + read_info->offset_cpu);
 }
 
+static bool sclp_feat_check(int byte, int bit)
+{
+	uint8_t *rib = (uint8_t *)read_info;
+
+	return !!(rib[byte] & (0x80 >> bit));
+}
+
 void sclp_facilities_setup(void)
 {
 	unsigned short cpu0_addr = stap();
@@ -140,6 +147,14 @@ 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_gsls = sclp_feat_check(85, SCLP_FEAT_85_BIT_GSLS);
+	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++) {
 		/*
 		 * The logic for only reading the facilities from the
@@ -150,6 +165,11 @@ void sclp_facilities_setup(void)
 		 */
 		if (cpu->address == cpu0_addr) {
 			sclp_facilities.has_sief2 = cpu->feat_sief2;
+			sclp_facilities.has_skeyi = cpu->feat_skeyi;
+			sclp_facilities.has_siif = cpu->feat_siif;
+			sclp_facilities.has_sigpif = cpu->feat_sigpif;
+			sclp_facilities.has_ib = cpu->feat_ib;
+			sclp_facilities.has_cei = cpu->feat_cei;
 			break;
 		}
 	}
diff --git a/lib/s390x/sclp.h b/lib/s390x/sclp.h
index 85231333..7abf1038 100644
--- a/lib/s390x/sclp.h
+++ b/lib/s390x/sclp.h
@@ -94,9 +94,19 @@ typedef struct CPUEntry {
 	uint8_t reserved0;
 	uint8_t : 4;
 	uint8_t feat_sief2 : 1;
+	uint8_t feat_skeyi : 1;
+	uint8_t : 2;
+	uint8_t : 2;
+	uint8_t feat_gpere : 1;
+	uint8_t feat_siif : 1;
+	uint8_t feat_sigpif : 1;
 	uint8_t : 3;
-	uint8_t features_res2 [SCCB_CPU_FEATURE_LEN - 1];
-	uint8_t reserved2[6];
+	uint8_t reserved2[3];
+	uint8_t : 2;
+	uint8_t feat_ib : 1;
+	uint8_t feat_cei : 1;
+	uint8_t : 4;
+	uint8_t reserved3[6];
 	uint8_t type;
 	uint8_t reserved1;
 } __attribute__((packed)) CPUEntry;
@@ -105,10 +115,33 @@ extern struct sclp_facilities sclp_facilities;
 
 struct sclp_facilities {
 	uint64_t has_sief2 : 1;
+	uint64_t has_skeyi : 1;
+	uint64_t has_gpere : 1;
+	uint64_t has_siif : 1;
+	uint64_t has_sigpif : 1;
+	uint64_t has_ib : 1;
+	uint64_t has_cei : 1;
+
 	uint64_t has_diag318 : 1;
-	uint64_t : 62;
+	uint64_t has_gsls : 1;
+	uint64_t has_cmma : 1;
+	uint64_t has_64bscao : 1;
+	uint64_t has_esca : 1;
+	uint64_t has_kss : 1;
+	uint64_t has_pfmfi : 1;
+	uint64_t has_ibs : 1;
+	uint64_t : 64 - 15;
 };
 
+/* bit number within a certain byte */
+#define SCLP_FEAT_85_BIT_GSLS		7
+#define SCLP_FEAT_98_BIT_KSS		0
+#define SCLP_FEAT_116_BIT_64BSCAO	7
+#define SCLP_FEAT_116_BIT_CMMA		6
+#define SCLP_FEAT_116_BIT_ESCA		3
+#define SCLP_FEAT_117_BIT_PFMFI		6
+#define SCLP_FEAT_117_BIT_IBS		5
+
 typedef struct ReadInfo {
 	SCCBHeader h;
 	uint16_t rnmax;
-- 
2.31.1


  parent reply	other threads:[~2021-05-26 14:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-26 14:55 [kvm-unit-tests GIT PULL 0/9] s390x update 2021-26-05 Janosch Frank
2021-05-26 14:55 ` [kvm-unit-tests GIT PULL 1/9] s390x: uv-guest: Add invalid share location test Janosch Frank
2021-05-26 14:55 ` [kvm-unit-tests GIT PULL 2/9] s390x: Add more Ultravisor command structure definitions Janosch Frank
2021-05-26 14:55 ` [kvm-unit-tests GIT PULL 3/9] s390x: uv: Add UV lib Janosch Frank
2021-05-26 14:55 ` [kvm-unit-tests GIT PULL 4/9] s390x: Test for share/unshare call support before using them Janosch Frank
2021-05-26 14:55 ` [kvm-unit-tests GIT PULL 5/9] s390x: uv-guest: Test invalid commands Janosch Frank
2021-05-26 14:55 ` [kvm-unit-tests GIT PULL 6/9] s390x: Add UV host test Janosch Frank
2021-05-26 14:55 ` [kvm-unit-tests GIT PULL 7/9] s390x: sclp: Only fetch read info byte 134 if cpu entries are above it Janosch Frank
2021-05-26 14:55 ` Janosch Frank [this message]
2021-05-26 14:55 ` [kvm-unit-tests GIT PULL 9/9] s390x: cpumodel: FMT2 and FMT4 SCLP test Janosch Frank
2021-05-26 16:33 ` [kvm-unit-tests GIT PULL 0/9] s390x update 2021-26-05 Paolo Bonzini

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=20210526145539.52008-9-frankja@linux.ibm.com \
    --to=frankja@linux.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pbonzini@redhat.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 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.