From: Pierre Morel <pmorel@linux.ibm.com>
To: "Cédric Le Goater" <clg@kaod.org>, qemu-s390x@nongnu.org
Cc: qemu-devel@nongnu.org, borntraeger@de.ibm.com,
pasic@linux.ibm.com, richard.henderson@linaro.org,
david@redhat.com, thuth@redhat.com, cohuck@redhat.com,
mst@redhat.com, pbonzini@redhat.com, kvm@vger.kernel.org,
ehabkost@redhat.com, marcel.apfelbaum@gmail.com,
eblake@redhat.com, armbru@redhat.com, seiden@linux.ibm.com,
nrb@linux.ibm.com, scgl@linux.ibm.com, frankja@linux.ibm.com,
berrange@redhat.com
Subject: Re: [PATCH v11 09/11] s390x/cpu topology: add topology machine property
Date: Wed, 16 Nov 2022 13:39:25 +0100 [thread overview]
Message-ID: <757660a9-97e7-5529-dcf2-a575c19cee28@linux.ibm.com> (raw)
In-Reply-To: <b5540c7e-3c06-565a-6571-55c167ec347b@kaod.org>
On 11/15/22 14:48, Cédric Le Goater wrote:
> On 11/3/22 18:01, Pierre Morel wrote:
>> We keep the possibility to switch on/off the topology on newer
>> machines with the property topology=[on|off].
>
> The code has changed. You will need to rebase. May be after the
> 8.0 machine is introduced, or include Cornelia's patch in the
> respin.
>
> https://lore.kernel.org/qemu-devel/20221111124534.129111-1-cohuck@redhat.com/
>
>>
>> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
>> ---
>> include/hw/boards.h | 3 +++
>> include/hw/s390x/cpu-topology.h | 8 +++-----
>> include/hw/s390x/s390-virtio-ccw.h | 1 +
>> hw/core/machine.c | 3 +++
>> hw/s390x/cpu-topology.c | 19 +++++++++++++++++++
>> hw/s390x/s390-virtio-ccw.c | 28 ++++++++++++++++++++++++++++
>> util/qemu-config.c | 4 ++++
>> qemu-options.hx | 6 +++++-
>> 8 files changed, 66 insertions(+), 6 deletions(-)
>>
>> diff --git a/include/hw/boards.h b/include/hw/boards.h
>> index 311ed17e18..67147c47bf 100644
>> --- a/include/hw/boards.h
>> +++ b/include/hw/boards.h
>> @@ -379,6 +379,9 @@ struct MachineState {
>> } \
>> type_init(machine_initfn##_register_types)
>> +extern GlobalProperty hw_compat_7_2[];
>> +extern const size_t hw_compat_7_2_len;
>> +
>> extern GlobalProperty hw_compat_7_1[];
>> extern const size_t hw_compat_7_1_len;
>> diff --git a/include/hw/s390x/cpu-topology.h
>> b/include/hw/s390x/cpu-topology.h
>> index 6fec10e032..f566394302 100644
>> --- a/include/hw/s390x/cpu-topology.h
>> +++ b/include/hw/s390x/cpu-topology.h
>> @@ -12,6 +12,8 @@
>> #include "hw/qdev-core.h"
>> #include "qom/object.h"
>> +#include "cpu.h"
>> +#include "hw/s390x/s390-virtio-ccw.h"
>> #define S390_TOPOLOGY_CPU_IFL 0x03
>> #define S390_TOPOLOGY_MAX_ORIGIN ((63 + S390_MAX_CPUS) / 64)
>> @@ -38,10 +40,6 @@ struct S390Topology {
>> OBJECT_DECLARE_SIMPLE_TYPE(S390Topology, S390_CPU_TOPOLOGY)
>> void s390_topology_new_cpu(S390CPU *cpu);
>> -
>> -static inline bool s390_has_topology(void)
>> -{
>> - return false;
>> -}
>> +bool s390_has_topology(void);
>> #endif
>> diff --git a/include/hw/s390x/s390-virtio-ccw.h
>> b/include/hw/s390x/s390-virtio-ccw.h
>> index 89fca3f79f..d7602aedda 100644
>> --- a/include/hw/s390x/s390-virtio-ccw.h
>> +++ b/include/hw/s390x/s390-virtio-ccw.h
>> @@ -28,6 +28,7 @@ struct S390CcwMachineState {
>> bool dea_key_wrap;
>> bool pv;
>> bool zpcii_disable;
>> + bool cpu_topology;
>> uint8_t loadparm[8];
>> void *topology;
>> };
>> diff --git a/hw/core/machine.c b/hw/core/machine.c
>> index aa520e74a8..4f46d4ef23 100644
>> --- a/hw/core/machine.c
>> +++ b/hw/core/machine.c
>> @@ -40,6 +40,9 @@
>> #include "hw/virtio/virtio-pci.h"
>> #include "qom/object_interfaces.h"
>> +GlobalProperty hw_compat_7_2[] = {};
>> +const size_t hw_compat_7_2_len = G_N_ELEMENTS(hw_compat_7_2);
>> +
>> GlobalProperty hw_compat_7_1[] = {};
>> const size_t hw_compat_7_1_len = G_N_ELEMENTS(hw_compat_7_1);
>> diff --git a/hw/s390x/cpu-topology.c b/hw/s390x/cpu-topology.c
>> index fc220bd8ac..c1550cc1e8 100644
>> --- a/hw/s390x/cpu-topology.c
>> +++ b/hw/s390x/cpu-topology.c
>> @@ -73,6 +73,25 @@ void s390_handle_ptf(S390CPU *cpu, uint8_t r1,
>> uintptr_t ra)
>> }
>> }
>> +bool s390_has_topology(void)
>> +{
>> + static S390CcwMachineState *ccw;
>> + Object *obj;
>> +
>> + if (ccw) {
>> + return ccw->cpu_topology;
>
> Shouldn't we test the capability also ?
>
> return s390mc->topology_capable && ccw->cpu_topology;
yes thanks
>
>> + }
>> +
>> + /* we have to bail out for the "none" machine */
>> + obj = object_dynamic_cast(qdev_get_machine(),
>> + TYPE_S390_CCW_MACHINE);
>> + if (!obj) {
>> + return false;
>> + }
>
> Should be an assert I think.
OK
>
>> + ccw = S390_CCW_MACHINE(obj);
>> + return ccw->cpu_topology;
>> +}
>> +
>> /*
>> * s390_topology_new_cpu:
>> * @cpu: a pointer to the new CPU
>> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
>> index f1a9d6e793..ebb5615337 100644
>> --- a/hw/s390x/s390-virtio-ccw.c
>> +++ b/hw/s390x/s390-virtio-ccw.c
>> @@ -710,6 +710,26 @@ bool hpage_1m_allowed(void)
>> return get_machine_class()->hpage_1m_allowed;
>> }
>> +static inline bool machine_get_topology(Object *obj, Error **errp)
>> +{
>> + S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
>> +
>> + return ms->cpu_topology;
>> +}
>> +
>> +static inline void machine_set_topology(Object *obj, bool value,
>> Error **errp)
>> +{
>> + S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
>
> You could introduce :
>
> S390CcwMachineClass *s390mc = S390_CCW_MACHINE_GET_CLASS(ms);
Yes thanks
>
>
>> +
>> + if (!get_machine_class()->topology_capable) {
>
> and
> !s390mc->topology_capable
>
>> + error_setg(errp, "Property cpu-topology not available on
>> machine %s",
>> + get_machine_class()->parent_class.name);
>> + return;
>> + }
>> +
>> + ms->cpu_topology = value;
>> +}
>> +
>> static void machine_get_loadparm(Object *obj, Visitor *v,
>> const char *name, void *opaque,
>> Error **errp)
>> @@ -809,6 +829,12 @@ static void ccw_machine_class_init(ObjectClass
>> *oc, void *data)
>> machine_set_zpcii_disable);
>> object_class_property_set_description(oc, "zpcii-disable",
>> "disable zPCI interpretation facilties");
>> +
>> + object_class_property_add_bool(oc, "topology",
>> + machine_get_topology,
>> + machine_set_topology);
>> + object_class_property_set_description(oc, "topology",
>> + "enable CPU topology");
>> }
>> static inline void s390_machine_initfn(Object *obj)
>> @@ -818,6 +844,7 @@ static inline void s390_machine_initfn(Object *obj)
>> ms->aes_key_wrap = true;
>> ms->dea_key_wrap = true;
>> ms->zpcii_disable = false;
>> + ms->cpu_topology = true;
>> }
>> static const TypeInfo ccw_machine_info = {
>> @@ -888,6 +915,7 @@ static void
>> ccw_machine_7_1_instance_options(MachineState *machine)
>> s390_cpudef_featoff_greater(16, 1, S390_FEAT_PAIE);
>> s390_set_qemu_cpu_model(0x8561, 15, 1, qemu_cpu_feat);
>> ms->zpcii_disable = true;
>> + ms->cpu_topology = true;
>
> shouldn't this be false ?
:) yes
I forgot to change this when I change the logic.
Thanks,
Pierre
--
Pierre Morel
IBM Lab Boeblingen
next prev parent reply other threads:[~2022-11-16 12:40 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-03 17:01 [PATCH v11 00/11] s390x: CPU Topology Pierre Morel
2022-11-03 17:01 ` [PATCH v11 01/11] s390x: Register TYPE_S390_CCW_MACHINE properties as class properties Pierre Morel
2022-11-04 6:32 ` Thomas Huth
2022-11-04 10:16 ` Pierre Morel
2022-11-04 10:53 ` Cédric Le Goater
2022-11-04 13:58 ` Pierre Morel
2022-11-04 14:29 ` Thomas Huth
2022-11-04 14:57 ` Pierre Morel
2022-11-06 11:37 ` Thomas Huth
2022-11-07 9:52 ` Pierre Morel
2022-11-03 17:01 ` [PATCH v11 02/11] s390x/cpu topology: add max_threads machine class attribute Pierre Morel
2022-11-03 17:01 ` [PATCH v11 03/11] s390x/cpu topology: core_id sets s390x CPU topology Pierre Morel
2022-11-15 11:15 ` Cédric Le Goater
2022-11-16 10:17 ` Pierre Morel
2022-11-03 17:01 ` [PATCH v11 04/11] s390x/cpu topology: reporting the CPU topology to the guest Pierre Morel
2022-11-15 11:21 ` Cédric Le Goater
2022-11-16 10:27 ` Pierre Morel
2022-11-17 8:40 ` Cédric Le Goater
2022-11-17 9:32 ` Pierre Morel
2022-11-21 14:13 ` Cédric Le Goater
2022-11-22 9:05 ` Pierre Morel
2022-11-27 10:46 ` Pierre Morel
2022-11-03 17:01 ` [PATCH v11 05/11] s390x/cpu_topology: resetting the Topology-Change-Report Pierre Morel
2022-11-03 17:01 ` [PATCH v11 06/11] s390x/cpu_topology: CPU topology migration Pierre Morel
2022-11-03 17:01 ` [PATCH v11 07/11] target/s390x: interception of PTF instruction Pierre Morel
2022-11-03 17:01 ` [PATCH v11 08/11] s390x/cpu topology: add topology_capable QEMU capability Pierre Morel
2022-11-15 13:27 ` Cédric Le Goater
2022-11-16 11:23 ` Pierre Morel
2022-11-03 17:01 ` [PATCH v11 09/11] s390x/cpu topology: add topology machine property Pierre Morel
2022-11-03 17:20 ` Cornelia Huck
2022-11-04 10:09 ` Pierre Morel
2022-11-15 13:48 ` Cédric Le Goater
2022-11-16 12:39 ` Pierre Morel [this message]
[not found] ` <PH0PR22MB3210864C22AD57E5B32F626991079@PH0PR22MB3210.namprd22.prod.outlook.com>
2022-11-16 13:17 ` Thank you! s390x/cpu topology Jadon
2022-11-03 17:01 ` [PATCH v11 10/11] s390x/cpu_topology: activating CPU topology Pierre Morel
2022-11-03 17:01 ` [PATCH v11 11/11] docs/s390x: document s390x 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=757660a9-97e7-5529-dcf2-a575c19cee28@linux.ibm.com \
--to=pmorel@linux.ibm.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=clg@kaod.org \
--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=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=nrb@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=scgl@linux.ibm.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.