lkml.org 
[lkml]   [2008]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/9] add frontend implementation for the IOMMU API
On Fri, Nov 28, 2008 at 10:50:36AM +0800, Han, Weidong wrote:
> Joerg Roedel wrote:
> > +struct iommu_domain *iommu_domain_alloc(struct device *dev)
> > +{
> > + struct iommu_domain *domain;
> > + int ret;
> > +
> > + domain = kmalloc(sizeof(*domain), GFP_KERNEL);
> > + if (!domain)
> > + return NULL;
> > +
> > + ret = iommu_ops->domain_init(domain, dev);
> > + if (ret)
> > + goto out_free;
> > +
> > + return domain;
> > +
> > +out_free:
> > + kfree(domain);
> > +
> > + return NULL;
> > +}
> > +EXPORT_SYMBOL_GPL(iommu_domain_alloc);
>
> remove the parameter dev.

[x] Done.

> > +
> > +void iommu_domain_free(struct iommu_domain *domain)
> > +{
> > + iommu_ops->domain_destroy(domain);
> > + kfree(domain);
> > +}
> > +EXPORT_SYMBOL_GPL(iommu_domain_free);
> > +
> > +int iommu_attach_device(struct iommu_domain *domain, struct device
> > *dev) +{
> > + return iommu_ops->attach_dev(domain, dev);
> > +}
> > +EXPORT_SYMBOL_GPL(iommu_attach_device);
> > +
> > +void iommu_detach_device(struct iommu_domain *domain, struct device
> > *dev) +{
> > + iommu_ops->detach_dev(domain, dev);
> > +}
> > +EXPORT_SYMBOL_GPL(iommu_detach_device);
> > +
> > +int iommu_map_address(struct iommu_domain *domain,
> > + dma_addr_t iova, phys_addr_t paddr,
> > + size_t size, int prot)
> > +{
> > + return iommu_ops->map(domain, iova, paddr, size, prot);
> > +}
> > +EXPORT_SYMBOL_GPL(iommu_map_address);
>
> change to:
> int iommu_map_pages(struct iommu_domain *domain, unsigned long gfn,
> unsigned long pfn, unsigned long npages, int prot)
> {
> return iommu_ops->map(domain, gfn, pfn, npages, prot);
> }
> EXPORT_SYMBOL_GPL(iommu_map_pages);
>
> int iommu_unmap_pages(struct iommu_domain *domain, unsigned long gfn, unsigned long npages)
> {
> return iommu_ops->map(domain, gfn, npages);
> }
> EXPORT_SYMBOL_GPL(iommu_unmap_pages);

Ok, I added the unmap function. But I think this API should work with
addresses instead of page numbers. This way the IO page size is
transparent for the user.

--
| AMD Saxony Limited Liability Company & Co. KG
Operating | Wilschdorfer Landstr. 101, 01109 Dresden, Germany
System | Register Court Dresden: HRA 4896
Research | General Partner authorized to represent:
Center | AMD Saxony LLC (Wilmington, Delaware, US)
| General Manager of AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy



\
 
 \ /
  Last update: 2008-12-01 19:19    [W:2.574 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site