From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54266) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoYP4-0005J9-2w for qemu-devel@nongnu.org; Tue, 20 Oct 2015 11:00:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZoYOx-0004eZ-DX for qemu-devel@nongnu.org; Tue, 20 Oct 2015 11:00:41 -0400 Received: from e06smtp15.uk.ibm.com ([195.75.94.111]:43823) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZoYOx-0004dV-3a for qemu-devel@nongnu.org; Tue, 20 Oct 2015 11:00:35 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 20 Oct 2015 16:00:34 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 9CCF81B0804B for ; Tue, 20 Oct 2015 16:00:39 +0100 (BST) Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t9KF0Wqk655772 for ; Tue, 20 Oct 2015 15:00:32 GMT Received: from d06av06.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t9KF0V2h025476 for ; Tue, 20 Oct 2015 09:00:31 -0600 From: Cornelia Huck Date: Tue, 20 Oct 2015 17:00:25 +0200 Message-Id: <1445353225-16775-10-git-send-email-cornelia.huck@de.ibm.com> In-Reply-To: <1445353225-16775-1-git-send-email-cornelia.huck@de.ibm.com> References: <1445353225-16775-1-git-send-email-cornelia.huck@de.ibm.com> Subject: [Qemu-devel] [PULL 9/9] s390x/cmma: clean up cmma reset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: borntraeger@de.ibm.com, qemu-devel@nongnu.org, agraf@suse.de, David Hildenbrand , jfrei@linux.vnet.ibm.com, Cornelia Huck From: David Hildenbrand The cmma reset is per VM, so we don't need a cpu object. We can directly make use of kvm_state, as it is already available when the reset is called. By moving the cmma reset in our machine reset function, we can avoid a manual reset handler. Acked-by: Christian Borntraeger Reviewed-by: Cornelia Huck Signed-off-by: David Hildenbrand Signed-off-by: Cornelia Huck --- hw/s390x/s390-virtio.c | 1 + target-s390x/cpu.h | 9 ++++----- target-s390x/kvm.c | 8 ++------ target-s390x/misc_helper.c | 4 ++-- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c index 9a7b7c2..cbde977 100644 --- a/hw/s390x/s390-virtio.c +++ b/hw/s390x/s390-virtio.c @@ -320,6 +320,7 @@ void s390_machine_reset(void) S390CPU *ipl_cpu = S390_CPU(qemu_get_cpu(0)); qemu_devices_reset(); + s390_cmma_reset(); s390_crypto_reset(); /* all cpus are stopped - configure and start the ipl cpu only */ diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h index ca98e5a..658cd9d 100644 --- a/target-s390x/cpu.h +++ b/target-s390x/cpu.h @@ -1160,7 +1160,7 @@ int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch, int vq, bool assign); int kvm_s390_cpu_restart(S390CPU *cpu); int kvm_s390_get_memslot_count(KVMState *s); -void kvm_s390_clear_cmma_callback(void *opaque); +void kvm_s390_cmma_reset(void); int kvm_s390_set_cpu_state(S390CPU *cpu, uint8_t cpu_state); void kvm_s390_reset_vcpu(S390CPU *cpu); int kvm_s390_set_mem_limit(KVMState *s, uint64_t new_limit, uint64_t *hw_limit); @@ -1190,7 +1190,7 @@ static inline int kvm_s390_cpu_restart(S390CPU *cpu) { return -ENOSYS; } -static inline void kvm_s390_clear_cmma_callback(void *opaque) +static inline void kvm_s390_cmma_reset(void) { } static inline int kvm_s390_get_memslot_count(KVMState *s) @@ -1229,11 +1229,10 @@ static inline int s390_set_memory_limit(uint64_t new_limit, uint64_t *hw_limit) return 0; } -static inline void cmma_reset(S390CPU *cpu) +static inline void s390_cmma_reset(void) { if (kvm_enabled()) { - CPUState *cs = CPU(cpu); - kvm_s390_clear_cmma_callback(cs->kvm_state); + kvm_s390_cmma_reset(); } } diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index 84dffe9..c3be180 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -173,16 +173,15 @@ int kvm_s390_set_mem_limit(KVMState *s, uint64_t new_limit, uint64_t *hw_limit) return kvm_vm_ioctl(s, KVM_SET_DEVICE_ATTR, &attr); } -void kvm_s390_clear_cmma_callback(void *opaque) +void kvm_s390_cmma_reset(void) { int rc; - KVMState *s = opaque; struct kvm_device_attr attr = { .group = KVM_S390_VM_MEM_CTRL, .attr = KVM_S390_VM_MEM_CLR_CMMA, }; - rc = kvm_vm_ioctl(s, KVM_SET_DEVICE_ATTR, &attr); + rc = kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr); trace_kvm_clear_cmma(rc); } @@ -200,9 +199,6 @@ static void kvm_s390_enable_cmma(KVMState *s) } rc = kvm_vm_ioctl(s, KVM_SET_DEVICE_ATTR, &attr); - if (!rc) { - qemu_register_reset(kvm_s390_clear_cmma_callback, s); - } trace_kvm_enable_cmma(rc); } diff --git a/target-s390x/misc_helper.c b/target-s390x/misc_helper.c index a692c44..b601a33 100644 --- a/target-s390x/misc_helper.c +++ b/target-s390x/misc_helper.c @@ -127,7 +127,7 @@ static int modified_clear_reset(S390CPU *cpu) CPU_FOREACH(t) { run_on_cpu(t, s390_do_cpu_full_reset, t); } - cmma_reset(cpu); + s390_cmma_reset(); subsystem_reset(); s390_crypto_reset(); scc->load_normal(CPU(cpu)); @@ -146,7 +146,7 @@ static int load_normal_reset(S390CPU *cpu) CPU_FOREACH(t) { run_on_cpu(t, s390_do_cpu_reset, t); } - cmma_reset(cpu); + s390_cmma_reset(); subsystem_reset(); scc->initial_cpu_reset(CPU(cpu)); scc->load_normal(CPU(cpu)); -- 2.6.2