From: Pierre Morel <pmorel@linux.ibm.com>
To: qemu-s390x@nongnu.org
Cc: thuth@redhat.com, seiden@linux.ibm.com, nrb@linux.ibm.com,
ehabkost@redhat.com, kvm@vger.kernel.org, david@redhat.com,
eblake@redhat.com, cohuck@redhat.com,
richard.henderson@linaro.org, qemu-devel@nongnu.org,
armbru@redhat.com, pasic@linux.ibm.com, borntraeger@de.ibm.com,
mst@redhat.com, pbonzini@redhat.com, philmd@redhat.com,
frankja@linux.ibm.com
Subject: [PATCH v7 11/13] s390x: topology: resetting the Topology-Change-Report
Date: Wed, 20 Apr 2022 13:57:43 +0200 [thread overview]
Message-ID: <20220420115745.13696-12-pmorel@linux.ibm.com> (raw)
In-Reply-To: <20220420115745.13696-1-pmorel@linux.ibm.com>
During a subsystem reset the Topology-Change-Report is cleared.
Let's ask KVM to clear the MTCR in the case of a subsystem reset.
Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
hw/s390x/cpu-topology.c | 6 ++++++
hw/s390x/s390-virtio-ccw.c | 1 +
target/s390x/cpu-sysemu.c | 7 +++++++
target/s390x/cpu.h | 1 +
target/s390x/kvm/kvm.c | 31 +++++++++++++++++++++++++++++++
target/s390x/kvm/kvm_s390x.h | 2 ++
6 files changed, 48 insertions(+)
diff --git a/hw/s390x/cpu-topology.c b/hw/s390x/cpu-topology.c
index 3ae86f80f1..a4e9840cc0 100644
--- a/hw/s390x/cpu-topology.c
+++ b/hw/s390x/cpu-topology.c
@@ -561,6 +561,11 @@ static void s390_node_device_realize(DeviceState *dev, Error **errp)
qbus_set_hotplug_handler(bus, OBJECT(dev));
}
+static void s390_topology_reset(DeviceState *dev)
+{
+ s390_cpu_topology_mtr_reset();
+}
+
static void node_class_init(ObjectClass *oc, void *data)
{
DeviceClass *dc = DEVICE_CLASS(oc);
@@ -570,6 +575,7 @@ static void node_class_init(ObjectClass *oc, void *data)
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
dc->realize = s390_node_device_realize;
dc->desc = "topology node";
+ dc->reset = s390_topology_reset;
}
static const TypeInfo node_info = {
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 1ffaddebcc..d46bff1a8a 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -121,6 +121,7 @@ static const char *const reset_dev_types[] = {
"s390-flic",
"diag288",
TYPE_S390_PCI_HOST_BRIDGE,
+ TYPE_S390_TOPOLOGY_NODE,
};
static void subsystem_reset(void)
diff --git a/target/s390x/cpu-sysemu.c b/target/s390x/cpu-sysemu.c
index 948e4bd3e0..11d0d87301 100644
--- a/target/s390x/cpu-sysemu.c
+++ b/target/s390x/cpu-sysemu.c
@@ -306,3 +306,10 @@ void s390_do_cpu_set_diag318(CPUState *cs, run_on_cpu_data arg)
kvm_s390_set_diag318(cs, arg.host_ulong);
}
}
+
+void s390_cpu_topology_mtr_reset(void)
+{
+ if (kvm_enabled()) {
+ kvm_s390_cpu_topology_reset();
+ }
+}
diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
index a617c943ff..61a71a7807 100644
--- a/target/s390x/cpu.h
+++ b/target/s390x/cpu.h
@@ -825,6 +825,7 @@ void s390_enable_css_support(S390CPU *cpu);
void s390_do_cpu_set_diag318(CPUState *cs, run_on_cpu_data arg);
int s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch_id,
int vq, bool assign);
+void s390_cpu_topology_mtr_reset(void);
#ifndef CONFIG_USER_ONLY
unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu);
#else
diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
index e3792e52c2..f3924633c6 100644
--- a/target/s390x/kvm/kvm.c
+++ b/target/s390x/kvm/kvm.c
@@ -2585,3 +2585,34 @@ bool kvm_arch_cpu_check_are_resettable(void)
{
return true;
}
+
+static void kvm_s390_set_mtr(uint64_t attr)
+{
+ struct kvm_device_attr attribute = {
+ .group = KVM_S390_VM_CPU_TOPOLOGY,
+ .attr = attr,
+ };
+
+ int ret = kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attribute);
+
+ if (ret) {
+ error_report("Failed to set cpu topology attribute %lu: %s",
+ attr, strerror(-ret));
+ }
+}
+
+static void kvm_s390_reset_mtr(void)
+{
+ uint64_t attr = KVM_S390_VM_CPU_TOPO_MTR_CLEAR;
+
+ if (kvm_vm_check_attr(kvm_state, KVM_S390_VM_CPU_TOPOLOGY, attr)) {
+ kvm_s390_set_mtr(attr);
+ }
+}
+
+void kvm_s390_cpu_topology_reset(void)
+{
+ if (s390_has_feat(S390_FEAT_CONFIGURATION_TOPOLOGY)) {
+ kvm_s390_reset_mtr();
+ }
+}
diff --git a/target/s390x/kvm/kvm_s390x.h b/target/s390x/kvm/kvm_s390x.h
index 05a5e1e6f4..d717c05827 100644
--- a/target/s390x/kvm/kvm_s390x.h
+++ b/target/s390x/kvm/kvm_s390x.h
@@ -46,4 +46,6 @@ void kvm_s390_restart_interrupt(S390CPU *cpu);
void kvm_s390_stop_interrupt(S390CPU *cpu);
void kvm_s390_set_diag318(CPUState *cs, uint64_t diag318_info);
+void kvm_s390_cpu_topology_reset(void);
+
#endif /* KVM_S390X_H */
--
2.27.0
next prev parent reply other threads:[~2022-04-20 12:05 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-20 11:57 [PATCH v7 00/13] s390x: CPU Topology Pierre Morel
2022-04-20 11:57 ` [PATCH v7 01/13] Update linux headers Pierre Morel
2022-04-20 11:57 ` [PATCH v7 02/13] vfio: tolerate migration protocol v1 uapi renames Pierre Morel
2022-04-20 11:57 ` [PATCH v7 03/13] s390x: topology: CPU topology objects and structures Pierre Morel
2022-05-19 10:45 ` Thomas Huth
2022-05-19 15:22 ` Pierre Morel
2022-04-20 11:57 ` [PATCH v7 04/13] s390x: topology: implementating Store Topology System Information Pierre Morel
2022-05-24 10:59 ` Thomas Huth
2022-05-25 8:16 ` Pierre Morel
2022-05-24 11:08 ` Thomas Huth
2022-05-25 8:18 ` Pierre Morel
2022-04-20 11:57 ` [PATCH v7 05/13] s390x: topology: Adding books to CPU topology Pierre Morel
2022-04-20 11:57 ` [PATCH v7 06/13] s390x: topology: Adding books to STSI Pierre Morel
2022-05-24 11:07 ` Thomas Huth
2022-05-25 8:17 ` Pierre Morel
2022-04-20 11:57 ` [PATCH v7 07/13] s390x: topology: Adding drawers to CPU topology Pierre Morel
2022-04-20 11:57 ` [PATCH v7 08/13] s390x: topology: Adding drawers to STSI Pierre Morel
2022-05-24 11:10 ` Thomas Huth
2022-05-25 8:19 ` Pierre Morel
2022-04-20 11:57 ` [PATCH v7 09/13] s390x: topology: implementing numa for the s390x topology Pierre Morel
2022-04-20 11:57 ` [PATCH v7 10/13] s390x: kvm: topology: interception of PTF instruction Pierre Morel
2022-05-24 11:27 ` Thomas Huth
2022-05-25 8:22 ` Pierre Morel
2022-04-20 11:57 ` Pierre Morel [this message]
2022-04-20 11:57 ` [PATCH v7 12/13] s390x: CPU topology: CPU topology migration Pierre Morel
2022-05-24 11:32 ` Thomas Huth
2022-05-25 8:23 ` Pierre Morel
2022-04-20 11:57 ` [PATCH v7 13/13] s390x: topology: activating CPU topology Pierre Morel
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=20220420115745.13696-12-pmorel@linux.ibm.com \
--to=pmorel@linux.ibm.com \
--cc=armbru@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=eblake@redhat.com \
--cc=ehabkost@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=nrb@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=seiden@linux.ibm.com \
--cc=thuth@redhat.com \
/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).