[PATCH v4 12/25] KVM: arm64: Add infrastructure to create and track pKVM instances at EL2
Quentin Perret
qperret at google.com
Tue Oct 18 09:21:11 PDT 2022
On Monday 17 Oct 2022 at 12:51:56 (+0100), Will Deacon wrote:
> +struct pkvm_hyp_vm {
> + struct kvm kvm;
> +
> + /* Backpointer to the host's (untrusted) KVM instance. */
> + struct kvm *host_kvm;
> +
> + /*
> + * Total amount of memory donated by the host for maintaining
> + * this 'struct pkvm_hyp_vm' in the hypervisor.
> + */
> + size_t donated_memory_size;
I think you could get rid of that member. IIUC, all you need to
re-compute it in the teardown path is the number of created vCPUs on
the host, which we should have safely stored in
pkvm_hyp_vm::kvm::created_vcpus.
> + /* The guest's stage-2 page-table managed by the hypervisor. */
> + struct kvm_pgtable pgt;
> +
> + /*
> + * The number of vcpus initialized and ready to run.
> + * Modifying this is protected by 'vm_table_lock'.
> + */
> + unsigned int nr_vcpus;
> +
> + /* Array of the hyp vCPU structures for this VM. */
> + struct pkvm_hyp_vcpu *vcpus[];
> +};
Cheers,
Quentin
More information about the linux-arm-kernel
mailing list