[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 21/34] x86/mm: p2m_flush and nvcpu_flush are HVM only



>>> On 17.08.18 at 17:12, <wei.liu2@xxxxxxxxxx> wrote:
> p2m_flush is only called by HAP code, nvcpu_flush is only useful for
> nestedhvm, both of which depend on HVM support.
> 
> Enclose their code in CONFIG_HVM. Add assertions.

But why do you put the #ifdef-s inside the functions, rather than
around them? From what you say, without CONFIG_HVM no caller
should exist.

Jan

> Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
> ---
>  xen/arch/x86/mm/p2m.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
> index 1089b86..1a04b34 100644
> --- a/xen/arch/x86/mm/p2m.c
> +++ b/xen/arch/x86/mm/p2m.c
> @@ -1785,10 +1785,13 @@ p2m_flush_table(struct p2m_domain *p2m)
>  void
>  p2m_flush(struct vcpu *v, struct p2m_domain *p2m)
>  {
> +#if CONFIG_HVM
> +    ASSERT(is_hvm_vcpu(v));
>      ASSERT(v->domain == p2m->domain);
>      vcpu_nestedhvm(v).nv_p2m = NULL;
>      p2m_flush_table(p2m);
>      hvm_asid_flush_vcpu(v);
> +#endif
>  }
>  
>  void
> @@ -1839,8 +1842,11 @@ static void assign_np2m(struct vcpu *v, struct 
> p2m_domain *p2m)
>  
>  static void nvcpu_flush(struct vcpu *v)
>  {
> +#if CONFIG_HVM
> +    ASSERT(is_hvm_vcpu(v));
>      hvm_asid_flush_vcpu(v);
>      vcpu_nestedhvm(v).stale_np2m = true;
> +#endif
>  }
>  
>  struct p2m_domain *
> -- 
> git-series 0.9.1





_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.