From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmKb9-0003e9-Rg for qemu-devel@nongnu.org; Wed, 14 Oct 2015 07:52:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZmKb7-0000fe-F3 for qemu-devel@nongnu.org; Wed, 14 Oct 2015 07:51:59 -0400 Received: from e06smtp17.uk.ibm.com ([195.75.94.113]:36720) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmKb7-0000eC-6H for qemu-devel@nongnu.org; Wed, 14 Oct 2015 07:51:57 -0400 Received: from localhost by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 14 Oct 2015 12:51:56 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id AA67B1B0805F for ; Wed, 14 Oct 2015 12:51:58 +0100 (BST) Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t9EBpr2i30146610 for ; Wed, 14 Oct 2015 11:51:53 GMT Received: from d06av02.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t9EBprhJ024449 for ; Wed, 14 Oct 2015 05:51:53 -0600 From: Cornelia Huck Date: Wed, 14 Oct 2015 13:51:47 +0200 Message-Id: <1444823507-7267-10-git-send-email-cornelia.huck@de.ibm.com> In-Reply-To: <1444823507-7267-1-git-send-email-cornelia.huck@de.ibm.com> References: <1444823507-7267-1-git-send-email-cornelia.huck@de.ibm.com> Subject: [Qemu-devel] [PATCH 9/9] s390x/cmma: clean up cmma reset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Cornelia Huck , borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com, agraf@suse.de, David Hildenbrand 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 5cab944..e66a60d 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.1