Re: [PATCH 5/8] KVM: pfncache: allow a cache to be activated with a fixed (userspace) HVA

From: David Woodhouse
Date: Thu Sep 14 2023 - 05:29:10 EST


On Thu, 2023-09-14 at 08:49 +0000, Paul Durrant wrote:
>
>  int kvm_gpc_refresh(struct gfn_to_pfn_cache *gpc, unsigned long len)
>  {
> -       return __kvm_gpc_refresh(gpc, gpc->gpa, len);
> +       return __kvm_gpc_refresh(gpc, gpc->addr, len, gpc->addr_is_gpa);
>  }
>  EXPORT_SYMBOL_GPL(kvm_gpc_refresh);

I think I have a slight preference for leaving kvm_gpc_refresh()
working on a GPA unconditionally, thus calling __kvm_gpc_refresh() with
the final argument set to true.

Introduce another one-line wrapper kvm_gpc_refresh_hva() for the false
case. And perhaps BUG_ON() calling the 'wrong' refresh function?

Attachment: smime.p7s
Description: S/MIME cryptographic signature