On 6/22/22 4:50 AM, Pierre Morel wrote:
On 6/6/22 22:36, 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.1 and newer.
Signed-off-by: Matthew Rosato <mjrosato@xxxxxxxxxxxxx>
---
hw/s390x/s390-pci-kvm.c | 4 +++-
hw/s390x/s390-virtio-ccw.c | 24 ++++++++++++++++++++++++
include/hw/s390x/s390-virtio-ccw.h | 1 +
qemu-options.hx | 8 +++++++-
util/qemu-config.c | 4 ++++
5 files changed, 39 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));
}
Isn't it a duplication of machine_get_zpcii_disable?
No, this will actually trigger machine_get_zpcii_disable -- it was setup
as the 'getter' routine in s390_machine_initfn() -- see below:
Wouldn't it better go to hw/s390x/kvm/ ?
There get the MachineState *ms = MACHINE(qdev_get_machine()) and return
the ms->zpcii_disable
?
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 cc3097bfee..70229b102b 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,
^^ Here.