From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: qemu-devel@nongnu.org
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>,
borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com, agraf@suse.de,
David Hildenbrand <dahi@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH 9/9] s390x/cmma: clean up cmma reset
Date: Wed, 14 Oct 2015 13:51:47 +0200 [thread overview]
Message-ID: <1444823507-7267-10-git-send-email-cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <1444823507-7267-1-git-send-email-cornelia.huck@de.ibm.com>
From: David Hildenbrand <dahi@linux.vnet.ibm.com>
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>
---
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
prev parent reply other threads:[~2015-10-14 11:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-14 11:51 [Qemu-devel] [PATCH 0/9] Next set of s390x patches Cornelia Huck
2015-10-14 11:51 ` [Qemu-devel] [PATCH 1/9] util/qemu-config: fix missing machine command line options Cornelia Huck
2015-10-14 11:51 ` [Qemu-devel] [PATCH 2/9] s390x/virtio-ccw: fix 2.4 virtio compat Cornelia Huck
2015-10-14 11:51 ` [Qemu-devel] [PATCH 3/9] s390x/kvm: Fix vector validity bit in device machine checks Cornelia Huck
2015-10-14 11:51 ` [Qemu-devel] [PATCH 4/9] s390x: flagify mcic values Cornelia Huck
2015-10-14 11:51 ` [Qemu-devel] [PATCH 5/9] s390x: unify device reset during subsystem_reset() Cornelia Huck
2015-10-14 11:51 ` [Qemu-devel] [PATCH 6/9] s390x/ipl: we always have an ipl device Cornelia Huck
2015-10-14 11:51 ` [Qemu-devel] [PATCH 7/9] s390x: machine reset function with new ipl cpu handling Cornelia Huck
2015-10-14 11:51 ` [Qemu-devel] [PATCH 8/9] s390x: reset crypto only on clear reset and QEMU reset Cornelia Huck
2015-10-14 11:51 ` Cornelia Huck [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1444823507-7267-10-git-send-email-cornelia.huck@de.ibm.com \
--to=cornelia.huck@de.ibm.com \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=dahi@linux.vnet.ibm.com \
--cc=jfrei@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).