qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jens Freimann <jfrei@linux.vnet.ibm.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>,
	Alexander Graf <agraf@suse.de>,
	Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: David Hildenbrand <dahi@linux.vnet.ibm.com>,
	Jens Freimann <jfrei@linux.vnet.ibm.com>,
	Andreas Faerber <afaerber@suse.de>,
	qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 5/6] s390x/kvm: reuse kvm_s390_reset_vcpu() to get rid of ifdefs
Date: Tue, 30 Sep 2014 10:57:31 +0200	[thread overview]
Message-ID: <1412067452-32960-6-git-send-email-jfrei@linux.vnet.ibm.com> (raw)
In-Reply-To: <1412067452-32960-1-git-send-email-jfrei@linux.vnet.ibm.com>

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

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 <dahi@linux.vnet.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
CC: Andreas Faerber <afaerber@suse.de>
---
 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.8.5.5

  parent reply	other threads:[~2014-09-30  8:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-30  8:57 [Qemu-devel] [PATCH 0/6] s390x/kvm: track logical cpu state and propagate to kvm Jens Freimann
2014-09-30  8:57 ` [Qemu-devel] [PATCH 1/6] linux-headers: update to 3.17-rc7 Jens Freimann
2014-09-30  9:23   ` Paolo Bonzini
2014-09-30  8:57 ` [Qemu-devel] [PATCH 2/6] s390x/kvm: introduce proper states for s390 cpus Jens Freimann
2014-09-30  8:57 ` [Qemu-devel] [PATCH 3/6] s390x/kvm: proper use of the cpu states OPERATING and STOPPED Jens Freimann
2014-09-30  8:57 ` [Qemu-devel] [PATCH 4/6] s390x/kvm: propagate s390 cpu state to kvm Jens Freimann
2014-09-30  8:57 ` Jens Freimann [this message]
2014-09-30  8:57 ` [Qemu-devel] [PATCH 6/6] s390x/kvm: synchronize the cpu state after SIGP (INITIAL) CPU RESET Jens Freimann
2014-10-01  8:38 ` [Qemu-devel] [PATCH 0/6] s390x/kvm: track logical cpu state and propagate to kvm Cornelia Huck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1412067452-32960-6-git-send-email-jfrei@linux.vnet.ibm.com \
    --to=jfrei@linux.vnet.ibm.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=dahi@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).