aboutsummaryrefslogtreecommitdiff
path: root/target/s390x/interrupt.c
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2017-09-28 22:37:02 +0200
committerCornelia Huck <cohuck@redhat.com>2017-10-20 13:32:10 +0200
commitb1ab5f6068c059b1357209c1dbeaac772184977d (patch)
treee919bb321ea7e50b91ace07b7030d1fd58dac20e /target/s390x/interrupt.c
parenta6880d213b371cec59f780ed16a99f0b1e0df88d (diff)
s390x/tcg: implement STOP and RESET interrupts for TCG
Implement them like KVM implements/handles them. Both can only be triggered via SIGP instructions. RESET has (almost) the lowest priority if the CPU is running, and the highest if the CPU is STOPPED. This is handled in SIGP code already. On delivery, we only have to care about the "CPU running" scenario. STOP is defined to be delivered after all other interrupts have been delivered. Therefore it has the actual lowest priority. As both can wake up a CPU if sleeping, indicate them correctly to external code (e.g. cpu_has_work()). Signed-off-by: David Hildenbrand <david@redhat.com> Message-Id: <20170928203708.9376-25-david@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Diffstat (limited to 'target/s390x/interrupt.c')
-rw-r--r--target/s390x/interrupt.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/target/s390x/interrupt.c b/target/s390x/interrupt.c
index 462d45e95f..ce6177c141 100644
--- a/target/s390x/interrupt.c
+++ b/target/s390x/interrupt.c
@@ -109,22 +109,28 @@ int cpu_inject_external_call(S390CPU *cpu, uint16_t src_cpu_addr)
void cpu_inject_restart(S390CPU *cpu)
{
+ CPUS390XState *env = &cpu->env;
+
if (kvm_enabled()) {
kvm_s390_restart_interrupt(cpu);
return;
}
- /* FIXME TCG */
- g_assert_not_reached();
+
+ env->pending_int |= INTERRUPT_RESTART;
+ cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD);
}
void cpu_inject_stop(S390CPU *cpu)
{
+ CPUS390XState *env = &cpu->env;
+
if (kvm_enabled()) {
kvm_s390_stop_interrupt(cpu);
return;
}
- /* FIXME TCG */
- g_assert_not_reached();
+
+ env->pending_int |= INTERRUPT_STOP;
+ cpu_interrupt(CPU(cpu), CPU_INTERRUPT_HARD);
}
static void cpu_inject_io(S390CPU *cpu, uint16_t subchannel_id,
@@ -272,6 +278,20 @@ bool s390_cpu_has_io_int(S390CPU *cpu)
return env->pending_int & INTERRUPT_IO;
}
+
+bool s390_cpu_has_restart_int(S390CPU *cpu)
+{
+ CPUS390XState *env = &cpu->env;
+
+ return env->pending_int & INTERRUPT_RESTART;
+}
+
+bool s390_cpu_has_stop_int(S390CPU *cpu)
+{
+ CPUS390XState *env = &cpu->env;
+
+ return env->pending_int & INTERRUPT_STOP;
+}
#endif
bool s390_cpu_has_int(S390CPU *cpu)
@@ -282,7 +302,9 @@ bool s390_cpu_has_int(S390CPU *cpu)
}
return s390_cpu_has_mcck_int(cpu) ||
s390_cpu_has_ext_int(cpu) ||
- s390_cpu_has_io_int(cpu);
+ s390_cpu_has_io_int(cpu) ||
+ s390_cpu_has_restart_int(cpu) ||
+ s390_cpu_has_stop_int(cpu);
#else
return false;
#endif