Re: [PATCH v4 13/25] KVM: arm64: Instantiate pKVM hypervisor VM and vCPU structures from EL1

Quentin Perret
2022-10-19T16:03:53Z

On Monday 17 Oct 2022 at 12:51:57 (+0100), Will Deacon wrote:
> +struct kvm_protected_vm {
> + pkvm_handle_t handle;
> + struct mutex vm_lock;
> +
> + struct {
> + void *pgd;
> + void *vm;
> + void *vcpus[KVM_MAX_VCPUS];

That's memory that's 'wasted' for everyone :/

> + } hyp_donations;
> +};
> +
> struct kvm_arch {
> struct kvm_s2_mmu mmu;
>
> @@ -170,10 +181,10 @@ struct kvm_arch {
> struct kvm_smccc_features smccc_feat;
>
> /*
> - * For an untrusted host VM, 'pkvm_handle' is used to lookup
> + * For an untrusted host VM, 'pkvm.handle' is used to lookup
> * the associated pKVM instance in the hypervisor.
> */
> - pkvm_handle_t pkvm_handle;
> + struct kvm_protected_vm pkvm;

Maybe make this a pointer that will be !NULL only when pKVM is enabled?

> };