Re: [PATCH 2/2] IOMMU Identity Mapping Support: Intel IOMMUimplementation

From: Chris Wright
Date: Thu Jun 18 2009 - 16:03:58 EST


* Yu, Fenghua (fenghua.yu@xxxxxxxxx) wrote:
> >> @@ -2259,6 +2394,9 @@ static dma_addr_t __intel_map_single(struct device
> >*hwdev, phys_addr_t paddr,
> >> int ret;
> >> struct intel_iommu *iommu;
> >>
> >> + if (identity_list(pdev))
> >> + return paddr;
> >> +
> >
> >This is same as DUMMY_DEVICE_DOMAIN_INFO. Please consolidate to a test
> >that just says "do i need translation".
> >
>
> The purpose of identity_list() is to have an interface for future when we need to set 1:1 mapping on some specific devices instead of all (just like Muli Ben-Yehuda suggested earlier in this thread).
>
> Right now it's almost empty. Yeah, I can change this checking to simply:
> if (iommu_identity_mapping)
> return paddr;
>

That's fine, I figured that's why you had the list check. But my point is
there are 2 ways to test for the same thing, which is whether a translation
is needed or not.

So a simple helper to help clarify what is going on. Like this:

static int iommu_dummy(struct pci_device *pdev)
{
return (pdev->dev.archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO);
}

static int iommu_no_mapping(struct pci_device *pdev)
{
if (identity_list(pdev) || iommu_dummy(pdev))
return 1;
return 0;
}

> >And what about DMA mask smaller than physical memory. The PT mode drops
> >back to swiotlb iirc.

Also...this?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/