On Fri, 4 Dec 2020 16:44:05 +1100 David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> wrote: > At the moment AMD SEV sets a special function pointer, plus an opaque > handle in KVMState to let things know how to encrypt guest memory. > > Now that we have a QOM interface for handling things related to securable > guest memory, use a QOM method on that interface, rather than a bare > function pointer for this. > > Signed-off-by: David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> > Reviewed-by: Richard Henderson <richard.henderson@xxxxxxxxxx> > --- > accel/kvm/kvm-all.c | 36 +++++--- > accel/kvm/sev-stub.c | 9 +- > include/exec/securable-guest-memory.h | 2 + > include/sysemu/sev.h | 5 +- > target/i386/monitor.c | 1 - > target/i386/sev.c | 116 ++++++++++---------------- > 6 files changed, 77 insertions(+), 92 deletions(-) > > @@ -224,7 +224,7 @@ int kvm_get_max_memslots(void) > > bool kvm_memcrypt_enabled(void) > { > - if (kvm_state && kvm_state->memcrypt_handle) { > + if (kvm_state && kvm_state->sgm) { If we want to generalize the concept, maybe check for encrypt_data in sgm here? There's probably room for different callbacks in the sgm structure. > return true; > } >