Message ID | 20220902172737.170349-9-mjrosato@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | s390x/pci: zPCI interpretation support | expand |
On 02/09/2022 19.27, Matthew Rosato wrote: > The zpcii-disable machine property can be used to force-disable the use > of zPCI interpretation facilities for a VM. By default, this setting > will be off for machine 7.2 and newer. > > Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com> > --- > hw/s390x/s390-pci-kvm.c | 4 +++- > hw/s390x/s390-virtio-ccw.c | 25 +++++++++++++++++++++++++ > include/hw/s390x/s390-virtio-ccw.h | 1 + > qemu-options.hx | 8 +++++++- > util/qemu-config.c | 4 ++++ > 5 files changed, 40 insertions(+), 2 deletions(-) > > diff --git a/hw/s390x/s390-pci-kvm.c b/hw/s390x/s390-pci-kvm.c > index 9134fe185f..5eb7fd12e2 100644 > --- a/hw/s390x/s390-pci-kvm.c > +++ b/hw/s390x/s390-pci-kvm.c > @@ -22,7 +22,9 @@ > > bool s390_pci_kvm_interp_allowed(void) > { > - return kvm_s390_get_zpci_op() && !s390_is_pv(); > + return (kvm_s390_get_zpci_op() && !s390_is_pv() && > + !object_property_get_bool(OBJECT(qdev_get_machine()), > + "zpcii-disable", NULL)); > } > > int s390_pci_kvm_aif_enable(S390PCIBusDevice *pbdev, ZpciFib *fib, bool assist) > diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c > index 9a2467c889..f8ecb6172c 100644 > --- a/hw/s390x/s390-virtio-ccw.c > +++ b/hw/s390x/s390-virtio-ccw.c > @@ -645,6 +645,21 @@ static inline void machine_set_dea_key_wrap(Object *obj, bool value, > ms->dea_key_wrap = value; > } > > +static inline bool machine_get_zpcii_disable(Object *obj, Error **errp) > +{ > + S390CcwMachineState *ms = S390_CCW_MACHINE(obj); > + > + return ms->zpcii_disable; > +} > + > +static inline void machine_set_zpcii_disable(Object *obj, bool value, > + Error **errp) > +{ > + S390CcwMachineState *ms = S390_CCW_MACHINE(obj); > + > + ms->zpcii_disable = value; > +} > + > static S390CcwMachineClass *current_mc; > > /* > @@ -740,6 +755,13 @@ static inline void s390_machine_initfn(Object *obj) > "Up to 8 chars in set of [A-Za-z0-9. ] (lower case chars converted" > " to upper case) to pass to machine loader, boot manager," > " and guest kernel"); > + > + object_property_add_bool(obj, "zpcii-disable", > + machine_get_zpcii_disable, > + machine_set_zpcii_disable); > + object_property_set_description(obj, "zpcii-disable", > + "disable zPCI interpretation facilties"); > + object_property_set_bool(obj, "zpcii-disable", false, NULL); > } > > static const TypeInfo ccw_machine_info = { > @@ -803,8 +825,11 @@ DEFINE_CCW_MACHINE(7_2, "7.2", true); > > static void ccw_machine_7_1_instance_options(MachineState *machine) > { > + S390CcwMachineState *ms = S390_CCW_MACHINE(machine); > + > ccw_machine_7_2_instance_options(machine); > s390_cpudef_featoff_greater(16, 1, S390_FEAT_PAIE); > + ms->zpcii_disable = true; > } > > static void ccw_machine_7_1_class_options(MachineClass *mc) > diff --git a/include/hw/s390x/s390-virtio-ccw.h b/include/hw/s390x/s390-virtio-ccw.h > index 3331990e02..8a0090a071 100644 > --- a/include/hw/s390x/s390-virtio-ccw.h > +++ b/include/hw/s390x/s390-virtio-ccw.h > @@ -27,6 +27,7 @@ struct S390CcwMachineState { > bool aes_key_wrap; > bool dea_key_wrap; > bool pv; > + bool zpcii_disable; > uint8_t loadparm[8]; > }; > > diff --git a/qemu-options.hx b/qemu-options.hx > index 31c04f7eea..7427dd1ed5 100644 > --- a/qemu-options.hx > +++ b/qemu-options.hx > @@ -37,7 +37,8 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ > " memory-encryption=@var{} memory encryption object to use (default=none)\n" > " 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", > + " 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", > QEMU_ARCH_ALL) > SRST > ``-machine [type=]name[,prop=value[,...]]`` > @@ -157,6 +158,11 @@ SRST > :: > > -machine cxl-fmw.0.targets.0=cxl.0,cxl-fmw.0.targets.1=cxl.1,cxl-fmw.0.size=128G,cxl-fmw.0.interleave-granularity=512k > + > + ``zpcii-disable=on|off`` > + 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. > ERST > > DEF("M", HAS_ARG, QEMU_OPTION_M, > diff --git a/util/qemu-config.c b/util/qemu-config.c > index 433488aa56..5325f6bf80 100644 > --- a/util/qemu-config.c > +++ b/util/qemu-config.c > @@ -236,6 +236,10 @@ static QemuOptsList machine_opts = { > .help = "Up to 8 chars in set of [A-Za-z0-9. ](lower case chars" > " converted to upper case) to pass to machine" > " loader, boot manager, and guest kernel", > + },{ > + .name = "zpcii-disable", > + .type = QEMU_OPT_BOOL, > + .help = "disable zPCI interpretation facilities", > }, > { /* End of list */ } > } Reviewed-by: Thomas Huth <thuth@redhat.com>
Hello, On 9/2/22 19:27, Matthew Rosato wrote: > The zpcii-disable machine property can be used to force-disable the use > of zPCI interpretation facilities for a VM. By default, this setting > will be off for machine 7.2 and newer. KVM will tell if the zPCI interpretation feature is available for the VM depending on the host capabilities and activation can be handled with the "interpret" property at the device level. For migration compatibility, zPCI interpretation can be globally deactivated with a compat property. So, I don't understand how the "zpcii-disable" machine option is useful. The patch could possibly be reverted for 7.2 and replaced with : @@ -921,9 +921,13 @@ static void ccw_machine_7_1_instance_opt static void ccw_machine_7_1_class_options(MachineClass *mc) { S390CcwMachineClass *s390mc = S390_CCW_MACHINE_CLASS(mc); + static GlobalProperty compat[] = { + { TYPE_S390_PCI_DEVICE, "interpret", "off", }, + }; ccw_machine_7_2_class_options(mc); compat_props_add(mc->compat_props, hw_compat_7_1, hw_compat_7_1_len); + compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); s390mc->max_threads = S390_MAX_CPUS; s390mc->topology_capable = false; } Thanks, C. > > Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com> > --- > hw/s390x/s390-pci-kvm.c | 4 +++- > hw/s390x/s390-virtio-ccw.c | 25 +++++++++++++++++++++++++ > include/hw/s390x/s390-virtio-ccw.h | 1 + > qemu-options.hx | 8 +++++++- > util/qemu-config.c | 4 ++++ > 5 files changed, 40 insertions(+), 2 deletions(-) > > diff --git a/hw/s390x/s390-pci-kvm.c b/hw/s390x/s390-pci-kvm.c > index 9134fe185f..5eb7fd12e2 100644 > --- a/hw/s390x/s390-pci-kvm.c > +++ b/hw/s390x/s390-pci-kvm.c > @@ -22,7 +22,9 @@ > > bool s390_pci_kvm_interp_allowed(void) > { > - return kvm_s390_get_zpci_op() && !s390_is_pv(); > + return (kvm_s390_get_zpci_op() && !s390_is_pv() && > + !object_property_get_bool(OBJECT(qdev_get_machine()), > + "zpcii-disable", NULL)); > } > > int s390_pci_kvm_aif_enable(S390PCIBusDevice *pbdev, ZpciFib *fib, bool assist) > diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c > index 9a2467c889..f8ecb6172c 100644 > --- a/hw/s390x/s390-virtio-ccw.c > +++ b/hw/s390x/s390-virtio-ccw.c > @@ -645,6 +645,21 @@ static inline void machine_set_dea_key_wrap(Object *obj, bool value, > ms->dea_key_wrap = value; > } > > +static inline bool machine_get_zpcii_disable(Object *obj, Error **errp) > +{ > + S390CcwMachineState *ms = S390_CCW_MACHINE(obj); > + > + return ms->zpcii_disable; > +} > + > +static inline void machine_set_zpcii_disable(Object *obj, bool value, > + Error **errp) > +{ > + S390CcwMachineState *ms = S390_CCW_MACHINE(obj); > + > + ms->zpcii_disable = value; > +} > + > static S390CcwMachineClass *current_mc; > > /* > @@ -740,6 +755,13 @@ static inline void s390_machine_initfn(Object *obj) > "Up to 8 chars in set of [A-Za-z0-9. ] (lower case chars converted" > " to upper case) to pass to machine loader, boot manager," > " and guest kernel"); > + > + object_property_add_bool(obj, "zpcii-disable", > + machine_get_zpcii_disable, > + machine_set_zpcii_disable); > + object_property_set_description(obj, "zpcii-disable", > + "disable zPCI interpretation facilties"); > + object_property_set_bool(obj, "zpcii-disable", false, NULL); > } > > static const TypeInfo ccw_machine_info = { > @@ -803,8 +825,11 @@ DEFINE_CCW_MACHINE(7_2, "7.2", true); > > static void ccw_machine_7_1_instance_options(MachineState *machine) > { > + S390CcwMachineState *ms = S390_CCW_MACHINE(machine); > + > ccw_machine_7_2_instance_options(machine); > s390_cpudef_featoff_greater(16, 1, S390_FEAT_PAIE); > + ms->zpcii_disable = true; > } > > static void ccw_machine_7_1_class_options(MachineClass *mc) > diff --git a/include/hw/s390x/s390-virtio-ccw.h b/include/hw/s390x/s390-virtio-ccw.h > index 3331990e02..8a0090a071 100644 > --- a/include/hw/s390x/s390-virtio-ccw.h > +++ b/include/hw/s390x/s390-virtio-ccw.h > @@ -27,6 +27,7 @@ struct S390CcwMachineState { > bool aes_key_wrap; > bool dea_key_wrap; > bool pv; > + bool zpcii_disable; > uint8_t loadparm[8]; > }; > > diff --git a/qemu-options.hx b/qemu-options.hx > index 31c04f7eea..7427dd1ed5 100644 > --- a/qemu-options.hx > +++ b/qemu-options.hx > @@ -37,7 +37,8 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ > " memory-encryption=@var{} memory encryption object to use (default=none)\n" > " 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", > + " 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", > QEMU_ARCH_ALL) > SRST > ``-machine [type=]name[,prop=value[,...]]`` > @@ -157,6 +158,11 @@ SRST > :: > > -machine cxl-fmw.0.targets.0=cxl.0,cxl-fmw.0.targets.1=cxl.1,cxl-fmw.0.size=128G,cxl-fmw.0.interleave-granularity=512k > + > + ``zpcii-disable=on|off`` > + 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. > ERST > > DEF("M", HAS_ARG, QEMU_OPTION_M, > diff --git a/util/qemu-config.c b/util/qemu-config.c > index 433488aa56..5325f6bf80 100644 > --- a/util/qemu-config.c > +++ b/util/qemu-config.c > @@ -236,6 +236,10 @@ static QemuOptsList machine_opts = { > .help = "Up to 8 chars in set of [A-Za-z0-9. ](lower case chars" > " converted to upper case) to pass to machine" > " loader, boot manager, and guest kernel", > + },{ > + .name = "zpcii-disable", > + .type = QEMU_OPT_BOOL, > + .help = "disable zPCI interpretation facilities", > }, > { /* End of list */ } > }
On 07/11/2022 10.53, Cédric Le Goater wrote: > Hello, > > On 9/2/22 19:27, Matthew Rosato wrote: >> The zpcii-disable machine property can be used to force-disable the use >> of zPCI interpretation facilities for a VM. By default, this setting >> will be off for machine 7.2 and newer. > > KVM will tell if the zPCI interpretation feature is available for > the VM depending on the host capabilities and activation can be > handled with the "interpret" property at the device level. > > For migration compatibility, zPCI interpretation can be globally > deactivated with a compat property. So, I don't understand how the > "zpcii-disable" machine option is useful. > > The patch could possibly be reverted for 7.2 and replaced with : > > @@ -921,9 +921,13 @@ static void ccw_machine_7_1_instance_opt > static void ccw_machine_7_1_class_options(MachineClass *mc) > { > S390CcwMachineClass *s390mc = S390_CCW_MACHINE_CLASS(mc); > + static GlobalProperty compat[] = { > + { TYPE_S390_PCI_DEVICE, "interpret", "off", }, > + }; > ccw_machine_7_2_class_options(mc); > compat_props_add(mc->compat_props, hw_compat_7_1, hw_compat_7_1_len); > + compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); > s390mc->max_threads = S390_MAX_CPUS; > s390mc->topology_capable = false; > > } Thinking about this twice, I'm not sure whether we would need it at all since zpci cannot be migrated at all (see the "unmigratable = 1" in hw/s390x/s390-pci-bus.c) ... OTOH, doing it via the compat_props also does not really hurt. Anyway, the zpcii-disable switch really does not seem to be necessary... Matthew, do you think it's ok if we revert "zpcii-disable" patch? Thomas
diff --git a/hw/s390x/s390-pci-kvm.c b/hw/s390x/s390-pci-kvm.c index 9134fe185f..5eb7fd12e2 100644 --- a/hw/s390x/s390-pci-kvm.c +++ b/hw/s390x/s390-pci-kvm.c @@ -22,7 +22,9 @@ bool s390_pci_kvm_interp_allowed(void) { - return kvm_s390_get_zpci_op() && !s390_is_pv(); + return (kvm_s390_get_zpci_op() && !s390_is_pv() && + !object_property_get_bool(OBJECT(qdev_get_machine()), + "zpcii-disable", NULL)); } int s390_pci_kvm_aif_enable(S390PCIBusDevice *pbdev, ZpciFib *fib, bool assist) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 9a2467c889..f8ecb6172c 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -645,6 +645,21 @@ static inline void machine_set_dea_key_wrap(Object *obj, bool value, ms->dea_key_wrap = value; } +static inline bool machine_get_zpcii_disable(Object *obj, Error **errp) +{ + S390CcwMachineState *ms = S390_CCW_MACHINE(obj); + + return ms->zpcii_disable; +} + +static inline void machine_set_zpcii_disable(Object *obj, bool value, + Error **errp) +{ + S390CcwMachineState *ms = S390_CCW_MACHINE(obj); + + ms->zpcii_disable = value; +} + static S390CcwMachineClass *current_mc; /* @@ -740,6 +755,13 @@ static inline void s390_machine_initfn(Object *obj) "Up to 8 chars in set of [A-Za-z0-9. ] (lower case chars converted" " to upper case) to pass to machine loader, boot manager," " and guest kernel"); + + object_property_add_bool(obj, "zpcii-disable", + machine_get_zpcii_disable, + machine_set_zpcii_disable); + object_property_set_description(obj, "zpcii-disable", + "disable zPCI interpretation facilties"); + object_property_set_bool(obj, "zpcii-disable", false, NULL); } static const TypeInfo ccw_machine_info = { @@ -803,8 +825,11 @@ DEFINE_CCW_MACHINE(7_2, "7.2", true); static void ccw_machine_7_1_instance_options(MachineState *machine) { + S390CcwMachineState *ms = S390_CCW_MACHINE(machine); + ccw_machine_7_2_instance_options(machine); s390_cpudef_featoff_greater(16, 1, S390_FEAT_PAIE); + ms->zpcii_disable = true; } static void ccw_machine_7_1_class_options(MachineClass *mc) diff --git a/include/hw/s390x/s390-virtio-ccw.h b/include/hw/s390x/s390-virtio-ccw.h index 3331990e02..8a0090a071 100644 --- a/include/hw/s390x/s390-virtio-ccw.h +++ b/include/hw/s390x/s390-virtio-ccw.h @@ -27,6 +27,7 @@ struct S390CcwMachineState { bool aes_key_wrap; bool dea_key_wrap; bool pv; + bool zpcii_disable; uint8_t loadparm[8]; }; diff --git a/qemu-options.hx b/qemu-options.hx index 31c04f7eea..7427dd1ed5 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -37,7 +37,8 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ " memory-encryption=@var{} memory encryption object to use (default=none)\n" " 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", + " 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", QEMU_ARCH_ALL) SRST ``-machine [type=]name[,prop=value[,...]]`` @@ -157,6 +158,11 @@ SRST :: -machine cxl-fmw.0.targets.0=cxl.0,cxl-fmw.0.targets.1=cxl.1,cxl-fmw.0.size=128G,cxl-fmw.0.interleave-granularity=512k + + ``zpcii-disable=on|off`` + 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. ERST DEF("M", HAS_ARG, QEMU_OPTION_M, diff --git a/util/qemu-config.c b/util/qemu-config.c index 433488aa56..5325f6bf80 100644 --- a/util/qemu-config.c +++ b/util/qemu-config.c @@ -236,6 +236,10 @@ static QemuOptsList machine_opts = { .help = "Up to 8 chars in set of [A-Za-z0-9. ](lower case chars" " converted to upper case) to pass to machine" " loader, boot manager, and guest kernel", + },{ + .name = "zpcii-disable", + .type = QEMU_OPT_BOOL, + .help = "disable zPCI interpretation facilities", }, { /* End of list */ } }
The zpcii-disable machine property can be used to force-disable the use of zPCI interpretation facilities for a VM. By default, this setting will be off for machine 7.2 and newer. Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com> --- hw/s390x/s390-pci-kvm.c | 4 +++- hw/s390x/s390-virtio-ccw.c | 25 +++++++++++++++++++++++++ include/hw/s390x/s390-virtio-ccw.h | 1 + qemu-options.hx | 8 +++++++- util/qemu-config.c | 4 ++++ 5 files changed, 40 insertions(+), 2 deletions(-)