From patchwork Tue Sep 30 08:57:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Freimann X-Patchwork-Id: 394815 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id ACED114007B for ; Tue, 30 Sep 2014 18:58:47 +1000 (EST) Received: from localhost ([::1]:41678 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYtGf-000344-LJ for incoming@patchwork.ozlabs.org; Tue, 30 Sep 2014 04:58:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50457) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYtFt-0001sp-NY for qemu-devel@nongnu.org; Tue, 30 Sep 2014 04:58:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XYtFl-00071L-Jm for qemu-devel@nongnu.org; Tue, 30 Sep 2014 04:57:57 -0400 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:55966) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYtFl-0006zh-B8 for qemu-devel@nongnu.org; Tue, 30 Sep 2014 04:57:49 -0400 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 30 Sep 2014 09:57:43 +0100 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 30 Sep 2014 09:57:41 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 280441B08049 for ; Tue, 30 Sep 2014 09:58:53 +0100 (BST) Received: from d06av07.portsmouth.uk.ibm.com (d06av07.portsmouth.uk.ibm.com [9.149.37.248]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s8U8vfm553936200 for ; Tue, 30 Sep 2014 08:57:41 GMT Received: from d06av07.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s8U8velm015020 for ; Tue, 30 Sep 2014 04:57:41 -0400 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s8U8veXE015015; Tue, 30 Sep 2014 04:57:40 -0400 Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 1122) id 7179F1224439; Tue, 30 Sep 2014 10:57:40 +0200 (CEST) From: Jens Freimann To: Christian Borntraeger , Alexander Graf , Cornelia Huck Date: Tue, 30 Sep 2014 10:57:31 +0200 Message-Id: <1412067452-32960-6-git-send-email-jfrei@linux.vnet.ibm.com> X-Mailer: git-send-email 1.8.5.5 In-Reply-To: <1412067452-32960-1-git-send-email-jfrei@linux.vnet.ibm.com> References: <1412067452-32960-1-git-send-email-jfrei@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14093008-1948-0000-0000-000001484B3B X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.75.94.110 Cc: David Hildenbrand , Jens Freimann , Andreas Faerber , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 5/6] s390x/kvm: reuse kvm_s390_reset_vcpu() to get rid of ifdefs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: David Hildenbrand 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 Signed-off-by: Jens Freimann Reviewed-by: Cornelia Huck CC: Andreas Faerber --- 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); } }