[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/20] s390x: add function to deliver restart irqs
From: |
Christian Borntraeger |
Subject: |
[Qemu-devel] [PULL 09/20] s390x: add function to deliver restart irqs |
Date: |
Tue, 10 Mar 2015 09:38:02 +0100 |
From: David Hildenbrand <address@hidden>
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 <address@hidden>
Signed-off-by: Jens Freimann <address@hidden>
Signed-off-by: David Hildenbrand <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Christian Borntraeger <address@hidden>
---
target-s390x/cpu.h | 5 ++++-
target-s390x/helper.c | 35 ++++++++++++++++++++++++++++-------
2 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index da0af94..56c0293 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -352,7 +352,10 @@ int s390_cpu_handle_mmu_fault(CPUState *cpu, vaddr
address, int rw,
#include "ioinst.h"
+
#ifndef CONFIG_USER_ONLY
+void do_restart_interrupt(CPUS390XState *env);
+
static inline hwaddr decode_basedisp_s(CPUS390XState *env, uint32_t ipb)
{
hwaddr addr = 0;
@@ -671,7 +674,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 e0fd8fc..f1060c2 100644
--- a/target-s390x/helper.c
+++ b/target-s390x/helper.c
@@ -183,7 +183,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);
@@ -197,14 +199,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;
}
@@ -229,6 +233,23 @@ static void cpu_unmap_lowcore(LowCore *lowcore)
cpu_physical_memory_unmap(lowcore, sizeof(LowCore), 1, sizeof(LowCore));
}
+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.3.0
- [Qemu-devel] [PULL 04/20] s390x/kvm: pass the SIGP instruction parameter to the SIGP handler, (continued)
- [Qemu-devel] [PULL 04/20] s390x/kvm: pass the SIGP instruction parameter to the SIGP handler, Christian Borntraeger, 2015/03/10
- [Qemu-devel] [PULL 10/20] s390x/kvm: deliver SIGP RESTART directly if stopped, Christian Borntraeger, 2015/03/10
- [Qemu-devel] [PULL 02/20] s390x: introduce defines for SIGP condition codes, Christian Borntraeger, 2015/03/10
- [Qemu-devel] [PULL 01/20] synchronize Linux headers to 4.0-rc3, Christian Borntraeger, 2015/03/10
- [Qemu-devel] [PULL 20/20] s390-ccw: rebuild BIOS, Christian Borntraeger, 2015/03/10
- [Qemu-devel] [PULL 11/20] s390x/kvm: enable the new SIGP handling in user space, Christian Borntraeger, 2015/03/10
- [Qemu-devel] [PULL 16/20] s390-ccw.img: Allow bigger ramdisk sizes or offsets, Christian Borntraeger, 2015/03/10
- [Qemu-devel] [PULL 17/20] s390-ccw.img: Reinitialize guessing on reboot, Christian Borntraeger, 2015/03/10
- [Qemu-devel] [PULL 18/20] elf-loader: Provide the possibility to relocate s390 ELF files, Christian Borntraeger, 2015/03/10
- [Qemu-devel] [PULL 03/20] s390x/kvm: more details for SIGP handler with one destination vcpu, Christian Borntraeger, 2015/03/10
- [Qemu-devel] [PULL 09/20] s390x: add function to deliver restart irqs,
Christian Borntraeger <=
- [Qemu-devel] [PULL 13/20] virtio-s390: Convert to realize(), Christian Borntraeger, 2015/03/10
- [Qemu-devel] [PULL 07/20] s390x/kvm: implement handling of new SIGP orders, Christian Borntraeger, 2015/03/10
- [Qemu-devel] [PULL 12/20] virtio-s390: s390_virtio_device_init() can't fail, simplify, Christian Borntraeger, 2015/03/10
- [Qemu-devel] [PULL 19/20] s390/bios: Make the s390-ccw.img relocatable, Christian Borntraeger, 2015/03/10
- [Qemu-devel] [PULL 14/20] virtio-ccw: Convert to realize(), Christian Borntraeger, 2015/03/10
- [Qemu-devel] [PULL 15/20] s390x/kvm: passing max memory size to accelerator, Christian Borntraeger, 2015/03/10
- Re: [Qemu-devel] [PULL 00/20] s390x/kvm: Features and fixes for 2.3, Peter Maydell, 2015/03/10