Message ID | 20250310151414.11550-3-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | qapi/machine: Make @dump-skeys command generic | expand |
On 10/03/2025 16.14, Philippe Mathieu-Daudé wrote: > The storage keys are part of the machine memory. > > Introduce the TYPE_DUMP_SKEYS_INTERFACE type, > allowing machine using storage keys to dump them > when a DumpSKeysInterface::qmp_dump_skeys() callback > is provided. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > include/hw/s390x/storage-keys.h | 15 +++++++++++++++ > hw/s390x/s390-skeys.c | 5 +++++ > 2 files changed, 20 insertions(+) Reviewed-by: Thomas Huth <thuth@redhat.com>
On Mon, 2025-03-10 at 16:14 +0100, Philippe Mathieu-Daudé wrote: > The storage keys are part of the machine memory. > > Introduce the TYPE_DUMP_SKEYS_INTERFACE type, > allowing machine using storage keys to dump them > when a DumpSKeysInterface::qmp_dump_skeys() callback > is provided. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > include/hw/s390x/storage-keys.h | 15 +++++++++++++++ > hw/s390x/s390-skeys.c | 5 +++++ > 2 files changed, 20 insertions(+) Reviewed-by: Eric Farman <farman@linux.ibm.com>
diff --git a/include/hw/s390x/storage-keys.h b/include/hw/s390x/storage-keys.h index 408d2815d4d..fb766d4631b 100644 --- a/include/hw/s390x/storage-keys.h +++ b/include/hw/s390x/storage-keys.h @@ -125,4 +125,19 @@ S390SKeysState *s390_get_skeys_device(void); void hmp_dump_skeys(Monitor *mon, const QDict *qdict); void hmp_info_skeys(Monitor *mon, const QDict *qdict); +#define TYPE_DUMP_SKEYS_INTERFACE "dump-skeys-interface" + +typedef struct DumpSKeysInterface DumpSKeysInterface; +DECLARE_CLASS_CHECKERS(DumpSKeysInterface, DUMP_SKEYS_INTERFACE, + TYPE_DUMP_SKEYS_INTERFACE) + +struct DumpSKeysInterface { + InterfaceClass parent_class; + + /** + * @qmp_dump_skeys: Callback to dump guest's storage keys to @filename. + */ + void (*qmp_dump_skeys)(const char *filename, Error **errp); +}; + #endif /* S390_STORAGE_KEYS_H */ diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c index d50e71b927a..0d3d4f74b4c 100644 --- a/hw/s390x/s390-skeys.c +++ b/hw/s390x/s390-skeys.c @@ -474,6 +474,11 @@ static void s390_skeys_class_init(ObjectClass *oc, void *data) } static const TypeInfo s390_skeys_types[] = { + { + .name = TYPE_DUMP_SKEYS_INTERFACE, + .parent = TYPE_INTERFACE, + .class_size = sizeof(DumpSKeysInterface), + }, { .name = TYPE_S390_SKEYS, .parent = TYPE_DEVICE,
The storage keys are part of the machine memory. Introduce the TYPE_DUMP_SKEYS_INTERFACE type, allowing machine using storage keys to dump them when a DumpSKeysInterface::qmp_dump_skeys() callback is provided. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- include/hw/s390x/storage-keys.h | 15 +++++++++++++++ hw/s390x/s390-skeys.c | 5 +++++ 2 files changed, 20 insertions(+)