hw/s390x: Introduce s390_skeys_get|set() helpers
s390_skeys_set() dispatch to S390SKeysClass::set_skeys(), and s390_skeys_get() to S390SKeysClass::get_skeys(). Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20240613104415.9643-2-philmd@linaro.org>
This commit is contained in:
parent
c3425158d6
commit
b926895357
@ -23,6 +23,7 @@
|
||||
#include "sysemu/kvm.h"
|
||||
#include "migration/qemu-file-types.h"
|
||||
#include "migration/register.h"
|
||||
#include "trace.h"
|
||||
|
||||
#define S390_SKEYS_BUFFER_SIZE (128 * KiB) /* Room for 128k storage keys */
|
||||
#define S390_SKEYS_SAVE_FLAG_EOS 0x01
|
||||
@ -54,6 +55,32 @@ void s390_skeys_init(void)
|
||||
qdev_realize(DEVICE(obj), NULL, &error_fatal);
|
||||
}
|
||||
|
||||
int s390_skeys_get(S390SKeysState *ks, uint64_t start_gfn,
|
||||
uint64_t count, uint8_t *keys)
|
||||
{
|
||||
S390SKeysClass *kc = S390_SKEYS_GET_CLASS(ks);
|
||||
int rc;
|
||||
|
||||
rc = kc->get_skeys(ks, start_gfn, count, keys);
|
||||
if (rc) {
|
||||
trace_s390_skeys_get_nonzero(rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
int s390_skeys_set(S390SKeysState *ks, uint64_t start_gfn,
|
||||
uint64_t count, uint8_t *keys)
|
||||
{
|
||||
S390SKeysClass *kc = S390_SKEYS_GET_CLASS(ks);
|
||||
int rc;
|
||||
|
||||
rc = kc->set_skeys(ks, start_gfn, count, keys);
|
||||
if (rc) {
|
||||
trace_s390_skeys_set_nonzero(rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void write_keys(FILE *f, uint8_t *keys, uint64_t startgfn,
|
||||
uint64_t count, Error **errp)
|
||||
{
|
||||
|
@ -36,3 +36,7 @@ s390_pci_unknown(const char *msg, uint32_t cmd) "%s unknown command 0x%x"
|
||||
s390_pci_bar(uint32_t bar, uint32_t addr, uint64_t size, uint32_t barsize) "bar %d addr 0x%x size 0x%" PRIx64 "barsize 0x%x"
|
||||
s390_pci_nodev(const char *cmd, uint32_t fh) "%s no pci dev fh 0x%x"
|
||||
s390_pci_invalid(const char *cmd, uint32_t fh) "%s invalid space fh 0x%x"
|
||||
|
||||
# s390-skeys.c
|
||||
s390_skeys_get_nonzero(int rc) "SKEY: Call to get_skeys unexpectedly returned %d"
|
||||
s390_skeys_set_nonzero(int rc) "SKEY: Call to set_skeys unexpectedly returned %d"
|
||||
|
@ -111,6 +111,16 @@ struct QEMUS390SKeysState {
|
||||
};
|
||||
|
||||
void s390_skeys_init(void);
|
||||
/**
|
||||
* @s390_skeys_get: See S390SKeysClass::get_skeys()
|
||||
*/
|
||||
int s390_skeys_get(S390SKeysState *ks, uint64_t start_gfn,
|
||||
uint64_t count, uint8_t *keys);
|
||||
/**
|
||||
* @s390_skeys_set: See S390SKeysClass::set_skeys()
|
||||
*/
|
||||
int s390_skeys_set(S390SKeysState *ks, uint64_t start_gfn,
|
||||
uint64_t count, uint8_t *keys);
|
||||
|
||||
S390SKeysState *s390_get_skeys_device(void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user