Message ID | 20221103170150.20789-10-pmorel@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | s390x: CPU Topology | expand |
On Thu, Nov 03 2022, Pierre Morel <pmorel@linux.ibm.com> wrote: > We keep the possibility to switch on/off the topology on newer > machines with the property topology=[on|off]. > > 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; This still needs to go into a separate patch that introduces the 8.0 machine types for the relevant machines... I'll probably write that patch soon (next week or so), you can pick it then into this series. > + > extern GlobalProperty hw_compat_7_1[]; > extern const size_t hw_compat_7_1_len; >
On 11/3/22 18:20, Cornelia Huck wrote: > On Thu, Nov 03 2022, Pierre Morel <pmorel@linux.ibm.com> wrote: > >> We keep the possibility to switch on/off the topology on newer >> machines with the property topology=[on|off]. >> >> 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; > > This still needs to go into a separate patch that introduces the 8.0 > machine types for the relevant machines... I'll probably write that > patch soon (next week or so), you can pick it then into this series. > Oh sorry, I forgot to suppress these two definitions for this series. I do not need this for now. I will probably need your patch introducing the 8.0 for the next spin. Thanks, Pierre
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; > + } > + > + /* 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. > + 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); > + > + 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 ? Thanks, C. > } > > static void ccw_machine_7_1_class_options(MachineClass *mc) > diff --git a/util/qemu-config.c b/util/qemu-config.c > index 5325f6bf80..0a040552bd 100644 > --- a/util/qemu-config.c > +++ b/util/qemu-config.c > @@ -240,6 +240,10 @@ static QemuOptsList machine_opts = { > .name = "zpcii-disable", > .type = QEMU_OPT_BOOL, > .help = "disable zPCI interpretation facilities", > + },{ > + .name = "topology", > + .type = QEMU_OPT_BOOL, > + .help = "disable CPU topology", > }, > { /* End of list */ } > } > diff --git a/qemu-options.hx b/qemu-options.hx > index eb38e5dc40..ef59b28a03 100644 > --- a/qemu-options.hx > +++ b/qemu-options.hx > @@ -38,7 +38,8 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ > " hmat=on|off controls ACPI HMAT support (default=off)\n" > " memory-backend='backend-id' specifies explicitly provided backend for main RAM (default=none)\n" > " cxl-fmw.0.targets.0=firsttarget,cxl-fmw.0.targets.1=secondtarget,cxl-fmw.0.size=size[,cxl-fmw.0.interleave-granularity=granularity]\n" > - " zpcii-disable=on|off disables zPCI interpretation facilities (default=off)\n", > + " zpcii-disable=on|off disables zPCI interpretation facilities (default=off)\n" > + " topology=on|off disables CPU topology (default=off)\n", > QEMU_ARCH_ALL) > SRST > ``-machine [type=]name[,prop=value[,...]]`` > @@ -163,6 +164,9 @@ SRST > Disables zPCI interpretation facilties on s390-ccw hosts. > This feature can be used to disable hardware virtual assists > related to zPCI devices. The default is off. > + > + ``topology=on|off`` > + Disables CPU topology on for S390 machines starting with s390-ccw-virtio-7.3. > ERST > > DEF("M", HAS_ARG, QEMU_OPTION_M,
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
Friends, I am but a small bystander as I watch in awe at the incredible work each of you do to advance the Kernel and Linux. What you are working on is so important. Your ideas, and how you express them into the code you write, become the foundation for a better world. I can tell you that your support for s390x architecture is quite meaningful to my company as we work to improve access, cost, and positive outcomes in healthcare. We use many s390x Linux servers and VMs for critical systems. Thank you for everything you do. Many of us at many companies deeply appreciate you. With sincere respect, -Jadon Jadon McDowell | [optum%20logo%20gif%20200px] Director & Senior Principal Engineer, TLCP Enterprise Hosting Services: HPC Infrastructure Delivery Mobile: 612-940-9268 | jadon.mcdowell@optum.com<mailto:jadon.mcdowell@optum.com> This e-mail, including attachments, may include confidential and/or proprietary information, and may be used only by the person or entity to which it is addressed. If the reader of this e-mail is not the intended recipient or intended recipient’s authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and delete this e-mail immediately.
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; + } + + /* we have to bail out for the "none" machine */ + obj = object_dynamic_cast(qdev_get_machine(), + TYPE_S390_CCW_MACHINE); + if (!obj) { + return false; + } + 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); + + if (!get_machine_class()->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; } static void ccw_machine_7_1_class_options(MachineClass *mc) diff --git a/util/qemu-config.c b/util/qemu-config.c index 5325f6bf80..0a040552bd 100644 --- a/util/qemu-config.c +++ b/util/qemu-config.c @@ -240,6 +240,10 @@ static QemuOptsList machine_opts = { .name = "zpcii-disable", .type = QEMU_OPT_BOOL, .help = "disable zPCI interpretation facilities", + },{ + .name = "topology", + .type = QEMU_OPT_BOOL, + .help = "disable CPU topology", }, { /* End of list */ } } diff --git a/qemu-options.hx b/qemu-options.hx index eb38e5dc40..ef59b28a03 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -38,7 +38,8 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ " hmat=on|off controls ACPI HMAT support (default=off)\n" " memory-backend='backend-id' specifies explicitly provided backend for main RAM (default=none)\n" " cxl-fmw.0.targets.0=firsttarget,cxl-fmw.0.targets.1=secondtarget,cxl-fmw.0.size=size[,cxl-fmw.0.interleave-granularity=granularity]\n" - " zpcii-disable=on|off disables zPCI interpretation facilities (default=off)\n", + " zpcii-disable=on|off disables zPCI interpretation facilities (default=off)\n" + " topology=on|off disables CPU topology (default=off)\n", QEMU_ARCH_ALL) SRST ``-machine [type=]name[,prop=value[,...]]`` @@ -163,6 +164,9 @@ SRST Disables zPCI interpretation facilties on s390-ccw hosts. This feature can be used to disable hardware virtual assists related to zPCI devices. The default is off. + + ``topology=on|off`` + Disables CPU topology on for S390 machines starting with s390-ccw-virtio-7.3. ERST DEF("M", HAS_ARG, QEMU_OPTION_M,
We keep the possibility to switch on/off the topology on newer machines with the property topology=[on|off]. 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(-)