mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-24 20:19:44 +00:00
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>
This commit is contained in:
parent
4ab729207f
commit
1cd4e0f6f0
@ -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 */
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user