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

Re: [Xen-devel] [PATCH v2 14/21] xen/passthrough: Introduce iommu_construct



>>> On 31.07.14 at 17:00, <julien.grall@xxxxxxxxxx> wrote:
> +int iommu_construct(struct domain *d)
> +{
> +    int rc = 0;
> +
> +    /*
> +     * The caller should check we effectively need to set up the IOMMMU
> +     * for this domain.
> +     */
> +    ASSERT(need_iommu(d) <= 0);
> +
> +    if ( need_iommu(d) > 0 )
> +        return 0;

Either ASSERT() or if() (and in the latter case there's be no need for
the callers to check unless they need the check for other purposes).

> +
> +    if ( !iommu_use_hap_pt(d) )
> +    {
> +        rc = arch_iommu_populate_page_table(d);
> +        if ( rc )
> +            return rc;
> +    }
> +
> +    d->need_iommu = 1;

This wasn't removed from the caller - an oversight?

> --- a/xen/drivers/passthrough/pci.c
> +++ b/xen/drivers/passthrough/pci.c
> @@ -1342,14 +1342,10 @@ static int assign_device(struct domain *d, u16 seg, 
> u8 bus, u8 devfn)
>  
>      if ( need_iommu(d) <= 0 )
>      {
> -        if ( !iommu_use_hap_pt(d) )
> -        {
> -            rc = arch_iommu_populate_page_table(d);
> -            if ( rc )
> -            {
> -                spin_unlock(&pcidevs_lock);
> -                return rc;
> -            }
> +        rc = iommu_construct(d);
> +        if ( rc ) {

Coding style.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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