From: Claudio Imbrenda <imbrenda@linux.ibm.com>
To: kvm@vger.kernel.org
Cc: linux-s390@vger.kernel.org, frankja@linux.ibm.com,
scgl@linux.ibm.com, borntraeger@de.ibm.com, pmorel@linux.ibm.com,
pasic@linux.ibm.com, nrb@linux.ibm.com, thuth@redhat.com,
david@redhat.com
Subject: [kvm-unit-tests PATCH v2 4/5] lib: s390x: functions for machine models
Date: Thu, 31 Mar 2022 18:04:18 +0200 [thread overview]
Message-ID: <20220331160419.333157-5-imbrenda@linux.ibm.com> (raw)
In-Reply-To: <20220331160419.333157-1-imbrenda@linux.ibm.com>
* move existing macros for machine models to hardware.h
* add machine_is_* functions
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
lib/s390x/asm/arch_def.h | 3 ---
lib/s390x/hardware.h | 10 ++++++++++
s390x/uv-host.c | 4 ++--
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
index 40626d72..8d860ccf 100644
--- a/lib/s390x/asm/arch_def.h
+++ b/lib/s390x/asm/arch_def.h
@@ -219,9 +219,6 @@ static inline unsigned short stap(void)
return cpu_address;
}
-#define MACHINE_Z15A 0x8561
-#define MACHINE_Z15B 0x8562
-
static inline uint16_t get_machine_id(void)
{
uint64_t cpuid;
diff --git a/lib/s390x/hardware.h b/lib/s390x/hardware.h
index e5910ea5..af20be18 100644
--- a/lib/s390x/hardware.h
+++ b/lib/s390x/hardware.h
@@ -13,6 +13,9 @@
#define _S390X_HARDWARE_H_
#include <asm/arch_def.h>
+#define MACHINE_Z15 0x8561
+#define MACHINE_Z15T02 0x8562
+
enum s390_host {
HOST_IS_UNKNOWN,
HOST_IS_LPAR,
@@ -37,4 +40,11 @@ static inline bool host_is_lpar(void)
return detect_host() == HOST_IS_LPAR;
}
+static inline bool machine_is_z15(void)
+{
+ uint16_t machine = get_machine_id();
+
+ return machine == MACHINE_Z15 || machine == MACHINE_Z15T02;
+}
+
#endif /* _S390X_HARDWARE_H_ */
diff --git a/s390x/uv-host.c b/s390x/uv-host.c
index de2e4850..d3018e3c 100644
--- a/s390x/uv-host.c
+++ b/s390x/uv-host.c
@@ -9,6 +9,7 @@
*/
#include <libcflat.h>
+#include <hardware.h>
#include <alloc.h>
#include <vmalloc.h>
#include <sclp.h>
@@ -111,7 +112,6 @@ static void test_config_destroy(void)
static void test_cpu_destroy(void)
{
int rc;
- uint16_t machineid = get_machine_id();
struct uv_cb_nodata uvcb = {
.header.len = sizeof(uvcb),
.header.cmd = UVC_CMD_DESTROY_SEC_CPU,
@@ -126,7 +126,7 @@ static void test_cpu_destroy(void)
"hdr invalid length");
uvcb.header.len += 8;
- if (machineid != MACHINE_Z15A && machineid != MACHINE_Z15B) {
+ if (!machine_is_z15()) {
uvcb.handle += 1;
rc = uv_call(0, (uint64_t)&uvcb);
report(rc == 1 && uvcb.header.rc == UVC_RC_INV_CHANDLE, "invalid handle");
--
2.34.1
next prev parent reply other threads:[~2022-03-31 16:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-31 16:04 [kvm-unit-tests PATCH v2 0/5] lib: s390x: Refactor and rename vm.[ch] Claudio Imbrenda
2022-03-31 16:04 ` [kvm-unit-tests PATCH v2 1/5] s390x: remove spurious includes Claudio Imbrenda
2022-03-31 16:04 ` [kvm-unit-tests PATCH v2 2/5] s390x: skey: remove check for old z/VM version Claudio Imbrenda
2022-04-01 8:09 ` Janosch Frank
2022-03-31 16:04 ` [kvm-unit-tests PATCH v2 3/5] lib: s390: rename and refactor vm.[ch] Claudio Imbrenda
2022-04-01 8:14 ` Janosch Frank
2022-03-31 16:04 ` Claudio Imbrenda [this message]
2022-04-01 8:10 ` [kvm-unit-tests PATCH v2 4/5] lib: s390x: functions for machine models Janosch Frank
2022-03-31 16:04 ` [kvm-unit-tests PATCH v2 5/5] lib: s390x: stidp wrapper and move get_machine_id Claudio Imbrenda
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=20220331160419.333157-5-imbrenda@linux.ibm.com \
--to=imbrenda@linux.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=david@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=nrb@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=pmorel@linux.ibm.com \
--cc=scgl@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