|
|
bf143f |
From 429c4cc750affe82b89867668ff2515a8a66732e Mon Sep 17 00:00:00 2001
|
|
|
bf143f |
From: Thomas Huth <thuth@redhat.com>
|
|
|
bf143f |
Date: Fri, 18 Nov 2022 15:23:19 +0100
|
|
|
bf143f |
Subject: [PATCH 2/3] s390x: Register TYPE_S390_CCW_MACHINE properties as class
|
|
|
bf143f |
properties
|
|
|
bf143f |
MIME-Version: 1.0
|
|
|
bf143f |
Content-Type: text/plain; charset=UTF-8
|
|
|
bf143f |
Content-Transfer-Encoding: 8bit
|
|
|
bf143f |
|
|
|
bf143f |
RH-Author: Thomas Huth <thuth@redhat.com>
|
|
|
bf143f |
RH-MergeRequest: 233: s390x: Document the "loadparm" machine property
|
|
|
bf143f |
RH-Bugzilla: 2128225
|
|
|
bf143f |
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
bf143f |
RH-Acked-by: Cédric Le Goater <clg@redhat.com>
|
|
|
bf143f |
RH-Acked-by: Jon Maloy <jmaloy@redhat.com>
|
|
|
bf143f |
RH-Commit: [2/2] 28a0086cb0e8be2535deafdd9115cadd7ff033f3
|
|
|
bf143f |
|
|
|
bf143f |
Currently, when running 'qemu-system-s390x -M s390-ccw-virtio,help'
|
|
|
bf143f |
the s390x-specific properties are not listed anymore. This happens
|
|
|
bf143f |
because since commit d8fb7d0969 ("vl: switch -M parsing to keyval")
|
|
|
bf143f |
the properties have to be defined at the class level and not at the
|
|
|
bf143f |
instance level anymore. Fix it on s390x now, too, by moving the
|
|
|
bf143f |
registration of the properties to the class level"
|
|
|
bf143f |
|
|
|
bf143f |
Fixes: d8fb7d0969 ("vl: switch -M parsing to keyval")
|
|
|
bf143f |
Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
|
|
|
bf143f |
Message-Id: <20221103170150.20789-2-pmorel@linux.ibm.com>
|
|
|
bf143f |
[thuth: Add patch description]
|
|
|
bf143f |
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
|
|
bf143f |
(cherry picked from commit 1fd396e32288bbf536483c74b68cb3ee86005a9f)
|
|
|
bf143f |
|
|
|
bf143f |
Conflicts:
|
|
|
bf143f |
hw/s390x/s390-virtio-ccw.c
|
|
|
bf143f |
(dropped the "zpcii-disable" property code - it's not used in downstream)
|
|
|
bf143f |
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
|
|
bf143f |
---
|
|
|
bf143f |
hw/s390x/s390-virtio-ccw.c | 117 +++++++++++++++++++++----------------
|
|
|
bf143f |
1 file changed, 67 insertions(+), 50 deletions(-)
|
|
|
bf143f |
|
|
|
bf143f |
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
|
|
|
bf143f |
index a9617ab79f..4a7cd21cac 100644
|
|
|
bf143f |
--- a/hw/s390x/s390-virtio-ccw.c
|
|
|
bf143f |
+++ b/hw/s390x/s390-virtio-ccw.c
|
|
|
bf143f |
@@ -42,6 +42,7 @@
|
|
|
bf143f |
#include "sysemu/sysemu.h"
|
|
|
bf143f |
#include "hw/s390x/pv.h"
|
|
|
bf143f |
#include "migration/blocker.h"
|
|
|
bf143f |
+#include "qapi/visitor.h"
|
|
|
bf143f |
|
|
|
bf143f |
static Error *pv_mig_blocker;
|
|
|
bf143f |
|
|
|
bf143f |
@@ -588,38 +589,6 @@ static ram_addr_t s390_fixup_ram_size(ram_addr_t sz)
|
|
|
bf143f |
return newsz;
|
|
|
bf143f |
}
|
|
|
bf143f |
|
|
|
bf143f |
-static void ccw_machine_class_init(ObjectClass *oc, void *data)
|
|
|
bf143f |
-{
|
|
|
bf143f |
- MachineClass *mc = MACHINE_CLASS(oc);
|
|
|
bf143f |
- NMIClass *nc = NMI_CLASS(oc);
|
|
|
bf143f |
- HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
|
|
|
bf143f |
- S390CcwMachineClass *s390mc = S390_CCW_MACHINE_CLASS(mc);
|
|
|
bf143f |
-
|
|
|
bf143f |
- s390mc->ri_allowed = true;
|
|
|
bf143f |
- s390mc->cpu_model_allowed = true;
|
|
|
bf143f |
- s390mc->css_migration_enabled = true;
|
|
|
bf143f |
- s390mc->hpage_1m_allowed = true;
|
|
|
bf143f |
- mc->init = ccw_init;
|
|
|
bf143f |
- mc->reset = s390_machine_reset;
|
|
|
bf143f |
- mc->block_default_type = IF_VIRTIO;
|
|
|
bf143f |
- mc->no_cdrom = 1;
|
|
|
bf143f |
- mc->no_floppy = 1;
|
|
|
bf143f |
- mc->no_parallel = 1;
|
|
|
bf143f |
- mc->no_sdcard = 1;
|
|
|
bf143f |
- mc->max_cpus = S390_MAX_CPUS;
|
|
|
bf143f |
- mc->has_hotpluggable_cpus = true;
|
|
|
bf143f |
- assert(!mc->get_hotplug_handler);
|
|
|
bf143f |
- mc->get_hotplug_handler = s390_get_hotplug_handler;
|
|
|
bf143f |
- mc->cpu_index_to_instance_props = s390_cpu_index_to_props;
|
|
|
bf143f |
- mc->possible_cpu_arch_ids = s390_possible_cpu_arch_ids;
|
|
|
bf143f |
- /* it is overridden with 'host' cpu *in kvm_arch_init* */
|
|
|
bf143f |
- mc->default_cpu_type = S390_CPU_TYPE_NAME("qemu");
|
|
|
bf143f |
- hc->plug = s390_machine_device_plug;
|
|
|
bf143f |
- hc->unplug_request = s390_machine_device_unplug_request;
|
|
|
bf143f |
- nc->nmi_monitor_handler = s390_nmi;
|
|
|
bf143f |
- mc->default_ram_id = "s390.ram";
|
|
|
bf143f |
-}
|
|
|
bf143f |
-
|
|
|
bf143f |
static inline bool machine_get_aes_key_wrap(Object *obj, Error **errp)
|
|
|
bf143f |
{
|
|
|
bf143f |
S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
|
|
|
bf143f |
@@ -694,19 +663,29 @@ bool hpage_1m_allowed(void)
|
|
|
bf143f |
return get_machine_class()->hpage_1m_allowed;
|
|
|
bf143f |
}
|
|
|
bf143f |
|
|
|
bf143f |
-static char *machine_get_loadparm(Object *obj, Error **errp)
|
|
|
bf143f |
+static void machine_get_loadparm(Object *obj, Visitor *v,
|
|
|
bf143f |
+ const char *name, void *opaque,
|
|
|
bf143f |
+ Error **errp)
|
|
|
bf143f |
{
|
|
|
bf143f |
S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
|
|
|
bf143f |
+ char *str = g_strndup((char *) ms->loadparm, sizeof(ms->loadparm));
|
|
|
bf143f |
|
|
|
bf143f |
- /* make a NUL-terminated string */
|
|
|
bf143f |
- return g_strndup((char *) ms->loadparm, sizeof(ms->loadparm));
|
|
|
bf143f |
+ visit_type_str(v, name, &str, errp);
|
|
|
bf143f |
+ g_free(str);
|
|
|
bf143f |
}
|
|
|
bf143f |
|
|
|
bf143f |
-static void machine_set_loadparm(Object *obj, const char *val, Error **errp)
|
|
|
bf143f |
+static void machine_set_loadparm(Object *obj, Visitor *v,
|
|
|
bf143f |
+ const char *name, void *opaque,
|
|
|
bf143f |
+ Error **errp)
|
|
|
bf143f |
{
|
|
|
bf143f |
S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
|
|
|
bf143f |
+ char *val;
|
|
|
bf143f |
int i;
|
|
|
bf143f |
|
|
|
bf143f |
+ if (!visit_type_str(v, name, &val, errp)) {
|
|
|
bf143f |
+ return;
|
|
|
bf143f |
+ }
|
|
|
bf143f |
+
|
|
|
bf143f |
for (i = 0; i < sizeof(ms->loadparm) && val[i]; i++) {
|
|
|
bf143f |
uint8_t c = qemu_toupper(val[i]); /* mimic HMC */
|
|
|
bf143f |
|
|
|
bf143f |
@@ -724,29 +703,67 @@ static void machine_set_loadparm(Object *obj, const char *val, Error **errp)
|
|
|
bf143f |
ms->loadparm[i] = ' '; /* pad right with spaces */
|
|
|
bf143f |
}
|
|
|
bf143f |
}
|
|
|
bf143f |
-static inline void s390_machine_initfn(Object *obj)
|
|
|
bf143f |
+
|
|
|
bf143f |
+static void ccw_machine_class_init(ObjectClass *oc, void *data)
|
|
|
bf143f |
{
|
|
|
bf143f |
- object_property_add_bool(obj, "aes-key-wrap",
|
|
|
bf143f |
- machine_get_aes_key_wrap,
|
|
|
bf143f |
- machine_set_aes_key_wrap);
|
|
|
bf143f |
- object_property_set_description(obj, "aes-key-wrap",
|
|
|
bf143f |
+ MachineClass *mc = MACHINE_CLASS(oc);
|
|
|
bf143f |
+ NMIClass *nc = NMI_CLASS(oc);
|
|
|
bf143f |
+ HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
|
|
|
bf143f |
+ S390CcwMachineClass *s390mc = S390_CCW_MACHINE_CLASS(mc);
|
|
|
bf143f |
+
|
|
|
bf143f |
+ s390mc->ri_allowed = true;
|
|
|
bf143f |
+ s390mc->cpu_model_allowed = true;
|
|
|
bf143f |
+ s390mc->css_migration_enabled = true;
|
|
|
bf143f |
+ s390mc->hpage_1m_allowed = true;
|
|
|
bf143f |
+ mc->init = ccw_init;
|
|
|
bf143f |
+ mc->reset = s390_machine_reset;
|
|
|
bf143f |
+ mc->block_default_type = IF_VIRTIO;
|
|
|
bf143f |
+ mc->no_cdrom = 1;
|
|
|
bf143f |
+ mc->no_floppy = 1;
|
|
|
bf143f |
+ mc->no_parallel = 1;
|
|
|
bf143f |
+ mc->no_sdcard = 1;
|
|
|
bf143f |
+ mc->max_cpus = S390_MAX_CPUS;
|
|
|
bf143f |
+ mc->has_hotpluggable_cpus = true;
|
|
|
bf143f |
+ assert(!mc->get_hotplug_handler);
|
|
|
bf143f |
+ mc->get_hotplug_handler = s390_get_hotplug_handler;
|
|
|
bf143f |
+ mc->cpu_index_to_instance_props = s390_cpu_index_to_props;
|
|
|
bf143f |
+ mc->possible_cpu_arch_ids = s390_possible_cpu_arch_ids;
|
|
|
bf143f |
+ /* it is overridden with 'host' cpu *in kvm_arch_init* */
|
|
|
bf143f |
+ mc->default_cpu_type = S390_CPU_TYPE_NAME("qemu");
|
|
|
bf143f |
+ hc->plug = s390_machine_device_plug;
|
|
|
bf143f |
+ hc->unplug_request = s390_machine_device_unplug_request;
|
|
|
bf143f |
+ nc->nmi_monitor_handler = s390_nmi;
|
|
|
bf143f |
+ mc->default_ram_id = "s390.ram";
|
|
|
bf143f |
+
|
|
|
bf143f |
+ object_class_property_add_bool(oc, "aes-key-wrap",
|
|
|
bf143f |
+ machine_get_aes_key_wrap,
|
|
|
bf143f |
+ machine_set_aes_key_wrap);
|
|
|
bf143f |
+ object_class_property_set_description(oc, "aes-key-wrap",
|
|
|
bf143f |
"enable/disable AES key wrapping using the CPACF wrapping key");
|
|
|
bf143f |
- object_property_set_bool(obj, "aes-key-wrap", true, NULL);
|
|
|
bf143f |
|
|
|
bf143f |
- object_property_add_bool(obj, "dea-key-wrap",
|
|
|
bf143f |
- machine_get_dea_key_wrap,
|
|
|
bf143f |
- machine_set_dea_key_wrap);
|
|
|
bf143f |
- object_property_set_description(obj, "dea-key-wrap",
|
|
|
bf143f |
+ object_class_property_add_bool(oc, "dea-key-wrap",
|
|
|
bf143f |
+ machine_get_dea_key_wrap,
|
|
|
bf143f |
+ machine_set_dea_key_wrap);
|
|
|
bf143f |
+ object_class_property_set_description(oc, "dea-key-wrap",
|
|
|
bf143f |
"enable/disable DEA key wrapping using the CPACF wrapping key");
|
|
|
bf143f |
- object_property_set_bool(obj, "dea-key-wrap", true, NULL);
|
|
|
bf143f |
- object_property_add_str(obj, "loadparm",
|
|
|
bf143f |
- machine_get_loadparm, machine_set_loadparm);
|
|
|
bf143f |
- object_property_set_description(obj, "loadparm",
|
|
|
bf143f |
+
|
|
|
bf143f |
+ object_class_property_add(oc, "loadparm", "loadparm",
|
|
|
bf143f |
+ machine_get_loadparm, machine_set_loadparm,
|
|
|
bf143f |
+ NULL, NULL);
|
|
|
bf143f |
+ object_class_property_set_description(oc, "loadparm",
|
|
|
bf143f |
"Up to 8 chars in set of [A-Za-z0-9. ] (lower case chars converted"
|
|
|
bf143f |
" to upper case) to pass to machine loader, boot manager,"
|
|
|
bf143f |
" and guest kernel");
|
|
|
bf143f |
}
|
|
|
bf143f |
|
|
|
bf143f |
+static inline void s390_machine_initfn(Object *obj)
|
|
|
bf143f |
+{
|
|
|
bf143f |
+ S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
|
|
|
bf143f |
+
|
|
|
bf143f |
+ ms->aes_key_wrap = true;
|
|
|
bf143f |
+ ms->dea_key_wrap = true;
|
|
|
bf143f |
+}
|
|
|
bf143f |
+
|
|
|
bf143f |
static const TypeInfo ccw_machine_info = {
|
|
|
bf143f |
.name = TYPE_S390_CCW_MACHINE,
|
|
|
bf143f |
.parent = TYPE_MACHINE,
|
|
|
bf143f |
--
|
|
|
bf143f |
2.37.3
|
|
|
bf143f |
|