[PATCH 2/2] IOMMU Identity Mapping Support: Intel IOMMU implementation

Chris Wright chrisw at sous-sol.org
Thu Jun 18 13:02:56 PDT 2009


* Yu, Fenghua (fenghua.yu at intel.com) 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?


More information about the iommu mailing list