From: Janosch Frank <frankja@linux.ibm.com>
To: kvm@vger.kernel.org
Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com,
thuth@redhat.com, david@redhat.com, nsg@linux.ibm.com,
nrb@linux.ibm.com
Subject: [kvm-unit-tests PATCH 4/5] lib: s390x: css: Dirty CC before css instructions
Date: Mon, 8 Jan 2024 13:29:20 +0000 [thread overview]
Message-ID: <20240108132921.255769-5-frankja@linux.ibm.com> (raw)
In-Reply-To: <20240108132921.255769-1-frankja@linux.ibm.com>
Dirtying the CC allows us to find missing CC changes when css
instructions are emulated.
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
lib/s390x/css.h | 18 ++++++++++++++----
s390x/mvpg.c | 6 ++++--
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/lib/s390x/css.h b/lib/s390x/css.h
index 0a19324b..47733d2d 100644
--- a/lib/s390x/css.h
+++ b/lib/s390x/css.h
@@ -6,6 +6,8 @@
* Author: Pierre Morel <pmorel@linux.ibm.com>
*/
+#include <asm/arch_def.h>
+
#ifndef _S390X_CSS_H_
#define _S390X_CSS_H_
@@ -147,14 +149,16 @@ static inline int ssch(unsigned long schid, struct orb *addr)
static inline int stsch(unsigned long schid, struct schib *addr)
{
register unsigned long reg1 asm ("1") = schid;
+ uint64_t spm_cc = 1 << SPM_CC_SHIFT;
int cc;
asm volatile(
+ " spm %[spm_cc]\n"
" stsch 0(%3)\n"
" ipm %0\n"
" srl %0,28"
: "=d" (cc), "=m" (*addr)
- : "d" (reg1), "a" (addr)
+ : "d" (reg1), "a" (addr), [spm_cc] "d" (spm_cc)
: "cc");
return cc;
}
@@ -177,14 +181,16 @@ static inline int msch(unsigned long schid, struct schib *addr)
static inline int tsch(unsigned long schid, struct irb *addr)
{
register unsigned long reg1 asm ("1") = schid;
+ uint64_t spm_cc = 2 << SPM_CC_SHIFT;
int cc;
asm volatile(
+ " spm %[spm_cc]\n"
" tsch 0(%3)\n"
" ipm %0\n"
" srl %0,28"
: "=d" (cc), "=m" (*addr)
- : "d" (reg1), "a" (addr)
+ : "d" (reg1), "a" (addr), [spm_cc] "d" (spm_cc)
: "cc");
return cc;
}
@@ -252,28 +258,32 @@ static inline int rsch(unsigned long schid)
static inline int rchp(unsigned long chpid)
{
register unsigned long reg1 asm("1") = chpid;
+ uint64_t spm_cc = 1 << SPM_CC_SHIFT;
int cc;
asm volatile(
+ " spm %[spm_cc]\n"
" rchp\n"
" ipm %0\n"
" srl %0,28"
: "=d" (cc)
- : "d" (reg1)
+ : "d" (reg1), [spm_cc] "d" (spm_cc)
: "cc");
return cc;
}
static inline int stcrw(uint32_t *crw)
{
+ uint64_t spm_cc = 1 << SPM_CC_SHIFT;
int cc;
asm volatile(
+ " spm %[spm_cc]\n"
" stcrw %[crw]\n"
" ipm %[cc]\n"
" srl %[cc],28"
: [cc] "=d" (cc)
- : [crw] "Q" (*crw)
+ : [crw] "Q" (*crw), [spm_cc] "d" (spm_cc)
: "cc", "memory");
return cc;
}
diff --git a/s390x/mvpg.c b/s390x/mvpg.c
index 296338d4..21e3ecc7 100644
--- a/s390x/mvpg.c
+++ b/s390x/mvpg.c
@@ -40,12 +40,14 @@ static uint8_t *fresh;
static inline int mvpg(unsigned long r0, void *dest, void *src)
{
register unsigned long reg0 asm ("0") = r0;
+ uint64_t spm_cc = 3 << SPM_CC_SHIFT;
int cc;
- asm volatile(" mvpg %1,%2\n"
+ asm volatile(" spm %[spm_cc]\n"
+ " mvpg %1,%2\n"
" ipm %0\n"
" srl %0,28"
- : "=&d" (cc) : "a" (dest), "a" (src), "d" (reg0)
+ : "=&d" (cc) : "a" (dest), "a" (src), "d" (reg0), [spm_cc] "d" (spm_cc)
: "memory", "cc");
return cc;
}
--
2.40.1
next prev parent reply other threads:[~2024-01-08 13:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-08 13:29 [kvm-unit-tests PATCH 0/5] s390x: Dirty cc before executing tested instructions Janosch Frank
2024-01-08 13:29 ` [kvm-unit-tests PATCH 1/5] lib: s390x: Add spm cc shift constant Janosch Frank
2024-01-08 13:29 ` [kvm-unit-tests PATCH 2/5] lib: s390x: sigp: Dirty CC before sigp execution Janosch Frank
2024-01-08 13:29 ` [kvm-unit-tests PATCH 3/5] lib: s390x: uv: Dirty CC before uvc execution Janosch Frank
2024-01-08 13:29 ` Janosch Frank [this message]
2024-01-08 13:29 ` [kvm-unit-tests PATCH 5/5] s390x: sclp: Dirty CC before sclp execution Janosch Frank
2024-01-16 13:02 ` [kvm-unit-tests PATCH 0/5] s390x: Dirty cc before executing tested instructions Nina Schoetterl-Glausch
2024-01-17 14:21 ` 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=20240108132921.255769-5-frankja@linux.ibm.com \
--to=frankja@linux.ibm.com \
--cc=david@redhat.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=nrb@linux.ibm.com \
--cc=nsg@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