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

Re: [Xen-devel] [PATCH v7 4/7] iommu: introduce iommu_map_page_nocrash



>>> On 15.10.18 at 12:35, <paul.durrant@xxxxxxxxxx> wrote:
> --- a/xen/drivers/passthrough/iommu.c
> +++ b/xen/drivers/passthrough/iommu.c
> @@ -313,16 +313,23 @@ void iommu_domain_destroy(struct domain *d)
>      hd->reserved_ranges = NULL;
>  }
>  
> -int iommu_map_page(struct domain *d, dfn_t dfn, mfn_t mfn,
> -                   unsigned int flags)
> +int iommu_map_page_nocrash(struct domain *d, dfn_t dfn, mfn_t mfn,
> +                           unsigned int flags)

Did you consider using a flag bit instead of introducing a funnily
named function (I sincerely hope that in the common case none
of our code crashes)?

>  {
>      const struct domain_iommu *hd = dom_iommu(d);
> -    int rc;
>  
>      if ( !iommu_enabled || !hd->platform_ops )
>          return 0;
>  
> -    rc = hd->platform_ops->map_page(d, dfn, mfn, flags);
> +    return hd->platform_ops->map_page(d, dfn, mfn, flags);
> +}
> +
> +int iommu_map_page(struct domain *d, dfn_t dfn, mfn_t mfn,
> +                   unsigned int flags)
> +{
> +    int rc;
> +
> +    rc = iommu_map_page_nocrash(d, dfn, mfn, flags);

Otherwise, if the function split is indeed the better route, please
make this the initializer of the variable.

Jan



_______________________________________________
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®.