[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 5/8] s390x/kvm: reuse kvm_s390_reset_vcpu() to get ri
From: |
Cornelia Huck |
Subject: |
[Qemu-devel] [PULL 5/8] s390x/kvm: reuse kvm_s390_reset_vcpu() to get rid of ifdefs |
Date: |
Thu, 9 Oct 2014 15:35:58 +0200 |
From: David Hildenbrand <address@hidden>
This patch reuses kvm_s390_reset_vcpu() to get rid of some CONFIG_KVM and
CONFIG_USER_ONLY ifdefs in cpu.c.
In order to get rid of CONFIG_USER_ONLY, kvm_s390_reset_vcpu() has to provide a
dummy implementation - the two definitions are moved to the proper section in
cpu.h.
Signed-off-by: David Hildenbrand <address@hidden>
Signed-off-by: Jens Freimann <address@hidden>
Reviewed-by: Cornelia Huck <address@hidden>
CC: Andreas Faerber <address@hidden>
Tested-by: Christian Borntraeger <address@hidden>
Signed-off-by: Cornelia Huck <address@hidden>
---
target-s390x/cpu.c | 9 ++-------
target-s390x/cpu.h | 8 ++++----
target-s390x/kvm.c | 2 +-
3 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c
index 9dbb0df..ec7df90 100644
--- a/target-s390x/cpu.c
+++ b/target-s390x/cpu.c
@@ -117,14 +117,10 @@ static void s390_cpu_initial_reset(CPUState *s)
env->pfault_token = -1UL;
-#if defined(CONFIG_KVM)
/* Reset state inside the kernel that we cannot access yet from QEMU. */
if (kvm_enabled()) {
- if (kvm_vcpu_ioctl(s, KVM_S390_INITIAL_RESET, NULL)) {
- perror("Initial CPU reset failed");
- }
+ kvm_s390_reset_vcpu(cpu);
}
-#endif
}
/* CPUClass:reset() */
@@ -145,11 +141,10 @@ static void s390_cpu_full_reset(CPUState *s)
env->pfault_token = -1UL;
-#if !defined(CONFIG_USER_ONLY)
+ /* Reset state inside the kernel that we cannot access yet from QEMU. */
if (kvm_enabled()) {
kvm_s390_reset_vcpu(cpu);
}
-#endif
tlb_flush(s, 1);
}
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index 6b3aaed..fe2f95d 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -389,16 +389,12 @@ int s390_virtio_hypercall(CPUS390XState *env);
void s390_virtio_irq(int config_change, uint64_t token);
#ifdef CONFIG_KVM
-void kvm_s390_reset_vcpu(S390CPU *cpu);
void kvm_s390_virtio_irq(int config_change, uint64_t token);
void kvm_s390_service_interrupt(uint32_t parm);
void kvm_s390_vcpu_interrupt(S390CPU *cpu, struct kvm_s390_irq *irq);
void kvm_s390_floating_interrupt(struct kvm_s390_irq *irq);
int kvm_s390_inject_flic(struct kvm_s390_irq *irq);
#else
-static inline void kvm_s390_reset_vcpu(S390CPU *cpu)
-{
-}
static inline void kvm_s390_virtio_irq(int config_change, uint64_t token)
{
}
@@ -1073,6 +1069,7 @@ int kvm_s390_cpu_restart(S390CPU *cpu);
int kvm_s390_get_memslot_count(KVMState *s);
void kvm_s390_clear_cmma_callback(void *opaque);
int kvm_s390_set_cpu_state(S390CPU *cpu, uint8_t cpu_state);
+void kvm_s390_reset_vcpu(S390CPU *cpu);
#else
static inline void kvm_s390_io_interrupt(uint16_t subchannel_id,
uint16_t subchannel_nr,
@@ -1107,6 +1104,9 @@ static inline int kvm_s390_set_cpu_state(S390CPU *cpu,
uint8_t cpu_state)
{
return -ENOSYS;
}
+static inline void kvm_s390_reset_vcpu(S390CPU *cpu)
+{
+}
#endif
static inline void cmma_reset(S390CPU *cpu)
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index 7c90b18..e4c4c8d 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -198,7 +198,7 @@ void kvm_s390_reset_vcpu(S390CPU *cpu)
* Before this ioctl cpu_synchronize_state() is called in common kvm
* code (kvm-all) */
if (kvm_vcpu_ioctl(cs, KVM_S390_INITIAL_RESET, NULL)) {
- perror("Can't reset vcpu\n");
+ error_report("Initial CPU reset failed on CPU %i\n", cs->cpu_index);
}
}
--
1.7.9.5
- [Qemu-devel] [PULL 0/8] s390x patches for 2.2, Cornelia Huck, 2014/10/09
- [Qemu-devel] [PULL 2/8] s390x/kvm: introduce proper states for s390 cpus, Cornelia Huck, 2014/10/09
- [Qemu-devel] [PULL 3/8] s390x/kvm: proper use of the cpu states OPERATING and STOPPED, Cornelia Huck, 2014/10/09
- [Qemu-devel] [PULL 4/8] s390x/kvm: propagate s390 cpu state to kvm, Cornelia Huck, 2014/10/09
- [Qemu-devel] [PULL 1/8] linux-headers: update to 3.17-rc7, Cornelia Huck, 2014/10/09
- [Qemu-devel] [PULL 5/8] s390x/kvm: reuse kvm_s390_reset_vcpu() to get rid of ifdefs,
Cornelia Huck <=
- [Qemu-devel] [PULL 6/8] s390x/kvm: synchronize the cpu state after SIGP (INITIAL) CPU RESET, Cornelia Huck, 2014/10/09
- [Qemu-devel] [PULL 7/8] s390x/migration: migrate CPU state, Cornelia Huck, 2014/10/09
- [Qemu-devel] [PULL 8/8] s390x/virtio-ccw: fix vhost-scsi intialization, Cornelia Huck, 2014/10/09
- Re: [Qemu-devel] [PULL 0/8] s390x patches for 2.2, Peter Maydell, 2014/10/09