[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20081201181600.GE12816@amd.com>
Date: Mon, 1 Dec 2008 19:16:00 +0100
From: 'Joerg Roedel' <joerg.roedel@....com>
To: "Han, Weidong" <weidong.han@...el.com>
CC: "'kvm@...r.kernel.org'" <kvm@...r.kernel.org>,
"'linux-kernel@...r.kernel.org'" <linux-kernel@...r.kernel.org>,
"'iommu@...ts.linux-foundation.org'"
<iommu@...ts.linux-foundation.org>,
"'avi@...hat.com'" <avi@...hat.com>,
"'mingo@...hat.com'" <mingo@...hat.com>,
"'dwmw2@...radead.org'" <dwmw2@...radead.org>,
"'amit.shah@...hat.com'" <amit.shah@...hat.com>
Subject: Re: [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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists