From: Jens Freimann <jfrei@linux.vnet.ibm.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>,
Alexander Graf <agraf@suse.de>,
Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: David Hildenbrand <dahi@linux.vnet.ibm.com>,
Jens Freimann <jfrei@linux.vnet.ibm.com>,
qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 08/10] s390x: add function to deliver restart irqs
Date: Tue, 24 Feb 2015 14:15:29 +0100 [thread overview]
Message-ID: <1424783731-43426-9-git-send-email-jfrei@linux.vnet.ibm.com> (raw)
In-Reply-To: <1424783731-43426-1-git-send-email-jfrei@linux.vnet.ibm.com>
From: David Hildenbrand <dahi@linux.vnet.ibm.com>
This patch adds a helper function to deliver restart irqs. To be able to be used
by kvm, the psw load/store methods have to perform special cc-code handling only
when running with tcg.
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
---
target-s390x/cpu.h | 4 +++-
target-s390x/helper.c | 35 ++++++++++++++++++++++++++++-------
2 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index 988d4a0..162cbb6 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -355,6 +355,8 @@ void *s390_cpu_physical_memory_map(CPUS390XState *env, hwaddr addr, hwaddr *len,
int is_write);
void s390_cpu_physical_memory_unmap(CPUS390XState *env, void *addr, hwaddr len,
int is_write);
+void do_restart_interrupt(CPUS390XState *env);
+
static inline hwaddr decode_basedisp_s(CPUS390XState *env, uint32_t ipb)
{
hwaddr addr = 0;
@@ -666,7 +668,7 @@ typedef struct LowCore
PSW mcck_old_psw; /* 0x160 */
PSW io_old_psw; /* 0x170 */
uint8_t pad7[0x1a0-0x180]; /* 0x180 */
- PSW restart_psw; /* 0x1a0 */
+ PSW restart_new_psw; /* 0x1a0 */
PSW external_new_psw; /* 0x1b0 */
PSW svc_new_psw; /* 0x1c0 */
PSW program_new_psw; /* 0x1d0 */
diff --git a/target-s390x/helper.c b/target-s390x/helper.c
index 5958343..cb84779 100644
--- a/target-s390x/helper.c
+++ b/target-s390x/helper.c
@@ -506,7 +506,9 @@ void load_psw(CPUS390XState *env, uint64_t mask, uint64_t addr)
{
env->psw.addr = addr;
env->psw.mask = mask;
- env->cc_op = (mask >> 44) & 3;
+ if (tcg_enabled()) {
+ env->cc_op = (mask >> 44) & 3;
+ }
if (mask & PSW_MASK_WAIT) {
S390CPU *cpu = s390_env_get_cpu(env);
@@ -520,14 +522,16 @@ void load_psw(CPUS390XState *env, uint64_t mask, uint64_t addr)
static uint64_t get_psw_mask(CPUS390XState *env)
{
- uint64_t r;
+ uint64_t r = env->psw.mask;
- env->cc_op = calc_cc(env, env->cc_op, env->cc_src, env->cc_dst, env->cc_vr);
+ if (tcg_enabled()) {
+ env->cc_op = calc_cc(env, env->cc_op, env->cc_src, env->cc_dst,
+ env->cc_vr);
- r = env->psw.mask;
- r &= ~PSW_MASK_CC;
- assert(!(env->cc_op & ~3));
- r |= (uint64_t)env->cc_op << 44;
+ r &= ~PSW_MASK_CC;
+ assert(!(env->cc_op & ~3));
+ r |= (uint64_t)env->cc_op << 44;
+ }
return r;
}
@@ -577,6 +581,23 @@ void s390_cpu_physical_memory_unmap(CPUS390XState *env, void *addr, hwaddr len,
cpu_physical_memory_unmap(addr, len, is_write, len);
}
+void do_restart_interrupt(CPUS390XState *env)
+{
+ uint64_t mask, addr;
+ LowCore *lowcore;
+
+ lowcore = cpu_map_lowcore(env);
+
+ lowcore->restart_old_psw.mask = cpu_to_be64(get_psw_mask(env));
+ lowcore->restart_old_psw.addr = cpu_to_be64(env->psw.addr);
+ mask = be64_to_cpu(lowcore->restart_new_psw.mask);
+ addr = be64_to_cpu(lowcore->restart_new_psw.addr);
+
+ cpu_unmap_lowcore(lowcore);
+
+ load_psw(env, mask, addr);
+}
+
static void do_svc_interrupt(CPUS390XState *env)
{
uint64_t mask, addr;
--
2.1.4
next prev parent reply other threads:[~2015-02-24 13:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-24 13:15 [Qemu-devel] [PATCH 00/10] s390x: move sigp handling to user space Jens Freimann
2015-02-24 13:15 ` [Qemu-devel] [PATCH 01/10] s390x: introduce defines for SIGP condition codes Jens Freimann
2015-02-24 13:15 ` [Qemu-devel] [PATCH 02/10] s390x/kvm: more details for SIGP handler with one destination vcpu Jens Freimann
2015-02-24 13:15 ` [Qemu-devel] [PATCH 03/10] s390x/kvm: pass the SIGP instruction parameter to the SIGP handler Jens Freimann
2015-02-24 13:15 ` [Qemu-devel] [PATCH 04/10] s390x/kvm: helper to set the SIGP status in SigpInfo Jens Freimann
2015-02-24 13:15 ` [Qemu-devel] [PATCH 05/10] s390x/kvm: trace all SIGP orders Jens Freimann
2015-02-24 13:15 ` [Qemu-devel] [PATCH 06/10] s390x/kvm: implement handling of new " Jens Freimann
2015-02-24 13:15 ` [Qemu-devel] [PATCH 07/10] s390x/kvm: SIGP START is only applicable when STOPPED Jens Freimann
2015-02-24 13:15 ` Jens Freimann [this message]
2015-02-24 13:15 ` [Qemu-devel] [PATCH 09/10] s390x/kvm: deliver SIGP RESTART directly if stopped Jens Freimann
2015-02-24 13:15 ` [Qemu-devel] [PATCH 10/10] s390x/kvm: enable the new SIGP handling in user space Jens Freimann
2015-03-03 14:02 ` [Qemu-devel] [PATCH 00/10] s390x: move sigp handling to " Christian Borntraeger
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=1424783731-43426-9-git-send-email-jfrei@linux.vnet.ibm.com \
--to=jfrei@linux.vnet.ibm.com \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=dahi@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).