diff options
author | David Hildenbrand <dahi@linux.vnet.ibm.com> | 2015-07-21 11:11:11 +0200 |
---|---|---|
committer | Cornelia Huck <cornelia.huck@de.ibm.com> | 2015-10-21 12:21:30 +0200 |
commit | 1cd4e0f6f0a6b1978a5868b41d4faae2071dc4ee (patch) | |
tree | a9e43a3179d5c28b91793436f3a3aa5310f06194 /target-s390x | |
parent | 4ab729207fe1464b19c6bec609cd545ab717174a (diff) | |
download | qemu-1cd4e0f6f0a6b1978a5868b41d4faae2071dc4ee.zip |
s390x/cmma: clean up cmma reset
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 <borntraeger@de.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'target-s390x')
-rw-r--r-- | target-s390x/cpu.h | 9 | ||||
-rw-r--r-- | target-s390x/kvm.c | 8 | ||||
-rw-r--r-- | target-s390x/misc_helper.c | 4 |
3 files changed, 8 insertions, 13 deletions
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h index ca98e5a547..658cd9d554 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 84dffe9067..c3be180de2 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 a692c44d82..b601a33606 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)); |