Re: [RFC v2 12/18] guest memory protection: Perform KVM init via interface

2020-06-01 Thread Richard Henderson
On 6/1/20 8:39 PM, Richard Henderson wrote: > On 5/20/20 8:42 PM, David Gibson wrote: >> +if (object_dynamic_cast(obj, TYPE_GUEST_MEMORY_PROTECTION)) { >> +GuestMemoryProtection *gmpo = GUEST_MEMORY_PROTECTION(obj); > > This duplicates the interface check. You should use > >

Re: [RFC v2 12/18] guest memory protection: Perform KVM init via interface

2020-06-01 Thread Richard Henderson
On 5/20/20 8:42 PM, David Gibson wrote: > +if (object_dynamic_cast(obj, TYPE_GUEST_MEMORY_PROTECTION)) { > +GuestMemoryProtection *gmpo = GUEST_MEMORY_PROTECTION(obj); This duplicates the interface check. You should use gmpo = (GuestMemoryProtection *) object_dynamic_ca

[RFC v2 12/18] guest memory protection: Perform KVM init via interface

2020-05-20 Thread David Gibson
Currently the "memory-encryption" machine option is notionally generic, but in fact is only used for AMD SEV setups. Make another step towards it being actually generic, but having using the GuestMemoryProtection QOM interface to dispatch the initial setup, rather than directly calling sev_guest_i