[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-s390
Subject:    [kvm-unit-tests PATCH v3 01/10] s390x: topology: Introduce enums for polarization & cpu type
From:       Nina Schoetterl-Glausch <nsg () linux ! ibm ! com>
Date:       2023-10-30 16:03:40
Message-ID: 20231030160349.458764-2-nsg () linux ! ibm ! com
[Download RAW message or body]

Thereby get rid of magic values.

Reviewed-by: Nico Boehr <nrb@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
---
 lib/s390x/stsi.h | 11 +++++++++++
 s390x/topology.c |  6 ++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/lib/s390x/stsi.h b/lib/s390x/stsi.h
index 1351a6f3..2f6182c1 100644
--- a/lib/s390x/stsi.h
+++ b/lib/s390x/stsi.h
@@ -41,6 +41,17 @@ struct topology_core {
 	uint64_t mask;
 };
 
+enum topology_polarization {
+	POLARIZATION_HORIZONTAL = 0,
+	POLARIZATION_VERTICAL_LOW = 1,
+	POLARIZATION_VERTICAL_MEDIUM = 2,
+	POLARIZATION_VERTICAL_HIGH = 3,
+};
+
+enum cpu_type {
+	CPU_TYPE_IFL = 3,
+};
+
 #define CONTAINER_TLE_RES_BITS 0x00ffffffffffff00UL
 struct topology_container {
 	uint8_t nl;
diff --git a/s390x/topology.c b/s390x/topology.c
index 69558236..6ab8c8d4 100644
--- a/s390x/topology.c
+++ b/s390x/topology.c
@@ -261,7 +261,7 @@ static uint8_t *check_tle(void *tc)
 	report(!(*(uint64_t *)tc & CPUS_TLE_RES_BITS), "reserved bits %016lx",
 	       *(uint64_t *)tc & CPUS_TLE_RES_BITS);
 
-	report(cpus->type == 0x03, "type IFL");
+	report(cpus->type == CPU_TYPE_IFL, "type IFL");
 
 	report_info("origin: %d", cpus->origin);
 	report_info("mask: %016lx", cpus->mask);
@@ -275,7 +275,9 @@ static uint8_t *check_tle(void *tc)
 	if (!cpus->d)
 		report_skip("Not dedicated");
 	else
-		report(cpus->pp == 3 || cpus->pp == 0, "Dedicated CPUs are either vertically \
polarized or have high entitlement"); +		report(cpus->pp == \
POLARIZATION_VERTICAL_HIGH || +		       cpus->pp == POLARIZATION_HORIZONTAL,
+		       "Dedicated CPUs are either vertically polarized or have high entitlement");
 
 	return tc + sizeof(*cpus);
 }
-- 
2.41.0


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic