diff options
author | Andreas Färber <afaerber@suse.de> | 2013-01-30 12:48:24 +0000 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2013-02-01 02:02:20 +0100 |
commit | f94667336ecf6566e090a895a37bc06da435d686 (patch) | |
tree | a79088f7bd0e6fc08dfcec334ae3dc4172c4b2bd | |
parent | 07cc7d128111958e1079632129b1633cb2a435ec (diff) | |
download | qemu-f94667336ecf6566e090a895a37bc06da435d686.zip qemu-f94667336ecf6566e090a895a37bc06da435d686.tar.gz qemu-f94667336ecf6566e090a895a37bc06da435d686.tar.bz2 |
target-s390x: Clean up cpu_inject_*() signatures
Despite cautioning that S390CPU is needed for upcoming CPUState
refactorings, commit 5d69c547d947798cba92d836d06f6e017ba2b19d (s390:
I/O interrupt and machine check injection.) added functions
cpu_inject_io() and cpu_inject_crw_mchk() with CPUS390XState argument,
claiming consistency with cpu_inject_ext().
This complicates making cpu_interrupt() take a CPUState even more and it
required to pass &cpu->env from some S390CPU-aware call sites already,
creating inconsistency elsewhere. Address that.
This also eliminates the need for CPUS390XState in s390_virtio_irq().
Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
-rw-r--r-- | hw/s390x/s390-virtio-bus.c | 4 | ||||
-rw-r--r-- | target-s390x/cpu.h | 15 | ||||
-rw-r--r-- | target-s390x/helper.c | 6 | ||||
-rw-r--r-- | target-s390x/interrupt.c | 2 |
4 files changed, 16 insertions, 11 deletions
diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c index 32f63b0..d467781 100644 --- a/hw/s390x/s390-virtio-bus.c +++ b/hw/s390x/s390-virtio-bus.c @@ -113,12 +113,10 @@ VirtIOS390Bus *s390_virtio_bus_init(ram_addr_t *ram_size) static void s390_virtio_irq(S390CPU *cpu, int config_change, uint64_t token) { - CPUS390XState *env = &cpu->env; - if (kvm_enabled()) { kvm_s390_virtio_irq(cpu, config_change, token); } else { - cpu_inject_ext(env, VIRTIO_EXT_CODE, config_change, token); + cpu_inject_ext(cpu, VIRTIO_EXT_CODE, config_change, token); } } diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h index 9be4a47..41b2d92 100644 --- a/target-s390x/cpu.h +++ b/target-s390x/cpu.h @@ -975,9 +975,11 @@ static inline uint64_t time2tod(uint64_t ns) { return (ns << 9) / 125; } -static inline void cpu_inject_ext(CPUS390XState *env, uint32_t code, uint32_t param, +static inline void cpu_inject_ext(S390CPU *cpu, uint32_t code, uint32_t param, uint64_t param64) { + CPUS390XState *env = &cpu->env; + if (env->ext_index == MAX_EXT_QUEUE - 1) { /* ugh - can't queue anymore. Let's drop. */ return; @@ -994,10 +996,11 @@ static inline void cpu_inject_ext(CPUS390XState *env, uint32_t code, uint32_t pa cpu_interrupt(env, CPU_INTERRUPT_HARD); } -static inline void cpu_inject_io(CPUS390XState *env, uint16_t subchannel_id, +static inline void cpu_inject_io(S390CPU *cpu, uint16_t subchannel_id, uint16_t subchannel_number, uint32_t io_int_parm, uint32_t io_int_word) { + CPUS390XState *env = &cpu->env; int isc = ffs(io_int_word << 2) - 1; if (env->io_index[isc] == MAX_IO_QUEUE - 1) { @@ -1017,8 +1020,10 @@ static inline void cpu_inject_io(CPUS390XState *env, uint16_t subchannel_id, cpu_interrupt(env, CPU_INTERRUPT_HARD); } -static inline void cpu_inject_crw_mchk(CPUS390XState *env) +static inline void cpu_inject_crw_mchk(S390CPU *cpu) { + CPUS390XState *env = &cpu->env; + if (env->mchk_index == MAX_MCHK_QUEUE - 1) { /* ugh - can't queue anymore. Let's drop. */ return; @@ -1090,7 +1095,7 @@ static inline void s390_io_interrupt(S390CPU *cpu, kvm_s390_io_interrupt(cpu, subchannel_id, subchannel_nr, io_int_parm, io_int_word); } else { - cpu_inject_io(&cpu->env, subchannel_id, subchannel_nr, io_int_parm, + cpu_inject_io(cpu, subchannel_id, subchannel_nr, io_int_parm, io_int_word); } } @@ -1100,7 +1105,7 @@ static inline void s390_crw_mchk(S390CPU *cpu) if (kvm_enabled()) { kvm_s390_crw_mchk(cpu); } else { - cpu_inject_crw_mchk(&cpu->env); + cpu_inject_crw_mchk(cpu); } } diff --git a/target-s390x/helper.c b/target-s390x/helper.c index e62c93e..a5ce56b 100644 --- a/target-s390x/helper.c +++ b/target-s390x/helper.c @@ -737,6 +737,8 @@ static void do_mchk_interrupt(CPUS390XState *env) void do_interrupt(CPUS390XState *env) { + S390CPU *cpu = s390_env_get_cpu(env); + qemu_log_mask(CPU_LOG_INT, "%s: %d at pc=%" PRIx64 "\n", __func__, env->exception_index, env->psw.addr); @@ -755,12 +757,12 @@ void do_interrupt(CPUS390XState *env) /* code is already in env */ env->exception_index = EXCP_EXT; } else if (env->pending_int & INTERRUPT_TOD) { - cpu_inject_ext(env, 0x1004, 0, 0); + cpu_inject_ext(cpu, 0x1004, 0, 0); env->exception_index = EXCP_EXT; env->pending_int &= ~INTERRUPT_EXT; env->pending_int &= ~INTERRUPT_TOD; } else if (env->pending_int & INTERRUPT_CPUTIMER) { - cpu_inject_ext(env, 0x1005, 0, 0); + cpu_inject_ext(cpu, 0x1005, 0, 0); env->exception_index = EXCP_EXT; env->pending_int &= ~INTERRUPT_EXT; env->pending_int &= ~INTERRUPT_TOD; diff --git a/target-s390x/interrupt.c b/target-s390x/interrupt.c index e51519d..6d6580d 100644 --- a/target-s390x/interrupt.c +++ b/target-s390x/interrupt.c @@ -24,7 +24,7 @@ void s390_sclp_extint(uint32_t parm) #endif } else { env->psw.addr += 4; - cpu_inject_ext(env, EXT_SERVICE, parm, 0); + cpu_inject_ext(dummy_cpu, EXT_SERVICE, parm, 0); } } #endif |