[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[qemu-s390x] [PULL 14/46] s390x/kvm: generalize SIGP stop and restart in
From: |
Cornelia Huck |
Subject: |
[qemu-s390x] [PULL 14/46] s390x/kvm: generalize SIGP stop and restart interrupt injection |
Date: |
Fri, 20 Oct 2017 13:53:46 +0200 |
From: David Hildenbrand <address@hidden>
Preparation for factoring it out into !kvm code.
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: David Hildenbrand <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>
---
target/s390x/internal.h | 2 ++
target/s390x/interrupt.c | 20 ++++++++++++++++++++
target/s390x/kvm-stub.c | 8 ++++++++
target/s390x/kvm.c | 33 +++++++++++++++++++++------------
target/s390x/kvm_s390x.h | 2 ++
5 files changed, 53 insertions(+), 12 deletions(-)
diff --git a/target/s390x/internal.h b/target/s390x/internal.h
index 6e500d6bb7..0ac026d30f 100644
--- a/target/s390x/internal.h
+++ b/target/s390x/internal.h
@@ -369,6 +369,8 @@ bool s390_cpu_has_io_int(S390CPU *cpu);
bool s390_cpu_has_ext_int(S390CPU *cpu);
bool s390_cpu_has_mcck_int(S390CPU *cpu);
bool s390_cpu_has_int(S390CPU *cpu);
+void cpu_inject_restart(S390CPU *cpu);
+void cpu_inject_stop(S390CPU *cpu);
/* ioinst.c */
diff --git a/target/s390x/interrupt.c b/target/s390x/interrupt.c
index 83a0f194f8..462d45e95f 100644
--- a/target/s390x/interrupt.c
+++ b/target/s390x/interrupt.c
@@ -107,6 +107,26 @@ int cpu_inject_external_call(S390CPU *cpu, uint16_t
src_cpu_addr)
return 0;
}
+void cpu_inject_restart(S390CPU *cpu)
+{
+ if (kvm_enabled()) {
+ kvm_s390_restart_interrupt(cpu);
+ return;
+ }
+ /* FIXME TCG */
+ g_assert_not_reached();
+}
+
+void cpu_inject_stop(S390CPU *cpu)
+{
+ if (kvm_enabled()) {
+ kvm_s390_stop_interrupt(cpu);
+ return;
+ }
+ /* FIXME TCG */
+ g_assert_not_reached();
+}
+
static void cpu_inject_io(S390CPU *cpu, uint16_t subchannel_id,
uint16_t subchannel_number,
uint32_t io_int_parm, uint32_t io_int_word)
diff --git a/target/s390x/kvm-stub.c b/target/s390x/kvm-stub.c
index 43f02c2d69..b27ed2927a 100644
--- a/target/s390x/kvm-stub.c
+++ b/target/s390x/kvm-stub.c
@@ -119,3 +119,11 @@ int kvm_s390_set_mem_limit(uint64_t new_limit, uint64_t
*hw_limit)
void kvm_s390_crypto_reset(void)
{
}
+
+void kvm_s390_stop_interrupt(S390CPU *cpu)
+{
+}
+
+void kvm_s390_restart_interrupt(S390CPU *cpu)
+{
+}
diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
index 2e75bda31a..98fa1c59a9 100644
--- a/target/s390x/kvm.c
+++ b/target/s390x/kvm.c
@@ -1539,9 +1539,6 @@ static void sigp_stop(CPUState *cs, run_on_cpu_data arg)
{
S390CPU *cpu = S390_CPU(cs);
SigpInfo *si = arg.host_ptr;
- struct kvm_s390_irq irq = {
- .type = KVM_S390_SIGP_STOP,
- };
if (s390_cpu_get_state(cpu) != CPU_STATE_OPERATING) {
si->cc = SIGP_CC_ORDER_CODE_ACCEPTED;
@@ -1554,7 +1551,7 @@ static void sigp_stop(CPUState *cs, run_on_cpu_data arg)
} else {
/* execute the stop function */
cpu->env.sigp_order = SIGP_STOP;
- kvm_s390_vcpu_interrupt(cpu, &irq);
+ cpu_inject_stop(cpu);
}
si->cc = SIGP_CC_ORDER_CODE_ACCEPTED;
}
@@ -1653,9 +1650,6 @@ static void sigp_stop_and_store_status(CPUState *cs,
run_on_cpu_data arg)
{
S390CPU *cpu = S390_CPU(cs);
SigpInfo *si = arg.host_ptr;
- struct kvm_s390_irq irq = {
- .type = KVM_S390_SIGP_STOP,
- };
/* disabled wait - sleeping in user space */
if (s390_cpu_get_state(cpu) == CPU_STATE_OPERATING && cs->halted) {
@@ -1665,7 +1659,7 @@ static void sigp_stop_and_store_status(CPUState *cs,
run_on_cpu_data arg)
switch (s390_cpu_get_state(cpu)) {
case CPU_STATE_OPERATING:
cpu->env.sigp_order = SIGP_STOP_STORE_STATUS;
- kvm_s390_vcpu_interrupt(cpu, &irq);
+ cpu_inject_stop(cpu);
/* store will be performed when handling the stop intercept */
break;
case CPU_STATE_STOPPED:
@@ -1755,9 +1749,6 @@ static void sigp_restart(CPUState *cs, run_on_cpu_data
arg)
{
S390CPU *cpu = S390_CPU(cs);
SigpInfo *si = arg.host_ptr;
- struct kvm_s390_irq irq = {
- .type = KVM_S390_RESTART,
- };
switch (s390_cpu_get_state(cpu)) {
case CPU_STATE_STOPPED:
@@ -1767,7 +1758,7 @@ static void sigp_restart(CPUState *cs, run_on_cpu_data
arg)
s390_cpu_set_state(CPU_STATE_OPERATING, cpu);
break;
case CPU_STATE_OPERATING:
- kvm_s390_vcpu_interrupt(cpu, &irq);
+ cpu_inject_restart(cpu);
break;
}
si->cc = SIGP_CC_ORDER_CODE_ACCEPTED;
@@ -2818,3 +2809,21 @@ void kvm_s390_apply_cpu_model(const S390CPUModel *model,
Error **errp)
kvm_s390_enable_cmma();
}
}
+
+void kvm_s390_restart_interrupt(S390CPU *cpu)
+{
+ struct kvm_s390_irq irq = {
+ .type = KVM_S390_RESTART,
+ };
+
+ kvm_s390_vcpu_interrupt(cpu, &irq);
+}
+
+void kvm_s390_stop_interrupt(S390CPU *cpu)
+{
+ struct kvm_s390_irq irq = {
+ .type = KVM_S390_SIGP_STOP,
+ };
+
+ kvm_s390_vcpu_interrupt(cpu, &irq);
+}
diff --git a/target/s390x/kvm_s390x.h b/target/s390x/kvm_s390x.h
index 501fc5aabd..46dbb742f0 100644
--- a/target/s390x/kvm_s390x.h
+++ b/target/s390x/kvm_s390x.h
@@ -42,6 +42,8 @@ void kvm_s390_cmma_reset(void);
void kvm_s390_reset_vcpu(S390CPU *cpu);
int kvm_s390_set_mem_limit(uint64_t new_limit, uint64_t *hw_limit);
void kvm_s390_crypto_reset(void);
+void kvm_s390_restart_interrupt(S390CPU *cpu);
+void kvm_s390_stop_interrupt(S390CPU *cpu);
/* implemented outside of target/s390x/ */
int kvm_s390_inject_flic(struct kvm_s390_irq *irq);
--
2.13.6
- [qemu-s390x] [PULL 04/46] s390x/tcg: cleanup service interrupt injection, (continued)
- [qemu-s390x] [PULL 04/46] s390x/tcg: cleanup service interrupt injection, Cornelia Huck, 2017/10/20
- [qemu-s390x] [PULL 05/46] s390x/tcg: injection of emergency signals and external calls, Cornelia Huck, 2017/10/20
- [qemu-s390x] [PULL 08/46] s390x/tcg: STOPPED cpus can never wake up, Cornelia Huck, 2017/10/20
- [qemu-s390x] [PULL 06/46] s390x/tcg: rework checking for deliverable interrupts, Cornelia Huck, 2017/10/20
- [qemu-s390x] [PULL 07/46] s390x/tcg: take care of external interrupt subclasses, Cornelia Huck, 2017/10/20
- [qemu-s390x] [PULL 09/46] s390x/tcg: a CPU cannot switch state due to an interrupt, Cornelia Huck, 2017/10/20
- [qemu-s390x] [PULL 11/46] s390x/tcg: handle WAIT PSWs during interrupt injection, Cornelia Huck, 2017/10/20
- [qemu-s390x] [PULL 10/46] target/s390x: factor out handling of WAIT PSW into s390_handle_wait(), Cornelia Huck, 2017/10/20
- [qemu-s390x] [PULL 13/46] s390x/kvm: pass ipb directly into handle_sigp(), Cornelia Huck, 2017/10/20
- [qemu-s390x] [PULL 12/46] target/s390x: interpret PSW_MASK_WAIT only for TCG, Cornelia Huck, 2017/10/20
- [qemu-s390x] [PULL 14/46] s390x/kvm: generalize SIGP stop and restart interrupt injection,
Cornelia Huck <=
- [qemu-s390x] [PULL 15/46] s390x/kvm: factor out storing of CPU status, Cornelia Huck, 2017/10/20
- [qemu-s390x] [PULL 17/46] s390x/kvm: drop two debug prints, Cornelia Huck, 2017/10/20
- [qemu-s390x] [PULL 16/46] s390x/kvm: factor out storing of adtl CPU status, Cornelia Huck, 2017/10/20
- [qemu-s390x] [PULL 19/46] s390x/kvm: factor out actual handling of STOP interrupts, Cornelia Huck, 2017/10/20
- [qemu-s390x] [PULL 21/46] s390x/tcg: implement SIGP SENSE, Cornelia Huck, 2017/10/20
- [qemu-s390x] [PULL 20/46] s390x/tcg: implement SIGP SENSE RUNNING STATUS, Cornelia Huck, 2017/10/20
- [qemu-s390x] [PULL 22/46] s390x/tcg: implement SIGP EXTERNAL CALL, Cornelia Huck, 2017/10/20
- [qemu-s390x] [PULL 18/46] s390x/kvm: factor out SIGP code into sigp.c, Cornelia Huck, 2017/10/20
- [qemu-s390x] [PULL 23/46] s390x/tcg: implement SIGP EMERGENCY SIGNAL, Cornelia Huck, 2017/10/20
- [qemu-s390x] [PULL 24/46] s390x/tcg: implement SIGP CONDITIONAL EMERGENCY SIGNAL, Cornelia Huck, 2017/10/20