[PATCH v2 13/18] KVM: arm64: Introduce __pkvm_host_wrprotect_guest()
Quentin Perret
qperret at google.com
Tue Dec 10 11:38:25 PST 2024
On Tuesday 10 Dec 2024 at 15:06:53 (+0000), Fuad Tabba wrote:
> > +static void handle___pkvm_host_wrprotect_guest(struct kvm_cpu_context *host_ctxt)
> > +{
> > + DECLARE_REG(pkvm_handle_t, handle, host_ctxt, 1);
> > + DECLARE_REG(u64, gfn, host_ctxt, 2);
> > + struct pkvm_hyp_vm *hyp_vm;
> > + int ret = -EINVAL;
> > +
> > + if (!is_protected_kvm_enabled())
> > + goto out;
> > +
> > + hyp_vm = get_pkvm_hyp_vm(handle);
> > + if (!hyp_vm)
> > + goto out;
> > + if (pkvm_hyp_vm_is_protected(hyp_vm))
> > + goto put_hyp_vm;
>
> These checks are (unsurprisingly) the same for all these functions.
> Does it make sense to have a helper do these checks?
Yup, that makes sense and should simplify the error handling on all the
call sites. I'll probably call that get_np_pkvm_hyp_vm() or something
along those lines and shove in pkvm.c in v3.
More information about the linux-arm-kernel
mailing list