Re: [PATCH 4/4 v6] iommu/fsl: Freescale PAMU driver and IOMMU API implementation.
Varun Sethi wrote: > + out_be32(&pamu_regs->ppbah, ((u64)ppaact_phys) >> 32); > + out_be32(&pamu_regs->ppbal, ppaact_phys); > + ppaact_phys = ppaact_phys + PAACT_SIZE; > + out_be32(&pamu_regs->pplah, ((u64)ppaact_phys) >> 32); > + out_be32(&pamu_regs->pplal, ppaact_phys); Instead of ((u64)ppaact_phys) >> 32, use upper_32_bits() and lower_32_bits(). > +#define PAACE_NUMBER_ENTRIES0xFF This is going to break with large LIODNs. Instead of hard-coding the size of the PPAACT, you need to scan the device tree for the largest LIODN, and make the array dynamically sized. -- Timur Tabi Linux kernel developer at Freescale ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [PATCH 3/4 v5] iommu/fsl: Add iommu domain attributes required by fsl PAMU driver.
On Mon, Dec 03, 2012 at 04:57:29PM +, Sethi Varun-B16395 wrote: > > > > -Original Message- > > From: iommu-boun...@lists.linux-foundation.org [mailto:iommu- > > boun...@lists.linux-foundation.org] On Behalf Of Joerg Roedel > > Sent: Sunday, December 02, 2012 7:33 PM > > To: Sethi Varun-B16395 > > Cc: linux-ker...@vger.kernel.org; iommu@lists.linux-foundation.org; Wood > > Scott-B07421; linuxppc-...@lists.ozlabs.org; Tabi Timur-B04825 > > Subject: Re: [PATCH 3/4 v5] iommu/fsl: Add iommu domain attributes > > required by fsl PAMU driver. > > > > Hmm, we need to work out a good abstraction for this. > > > > On Tue, Nov 20, 2012 at 07:24:56PM +0530, Varun Sethi wrote: > > > Added the following domain attributes required by FSL PAMU driver: > > > 1. Subwindows field added to the iommu domain geometry attribute. > > > > Are the Subwindows mapped with full size or do you map only parts of the > > subwindows? > > > [Sethi Varun-B16395] It's possible to map a part of the subwindow i.e. > size of the mapping can be less than the sub window size. Yes, I know that this is possible. But do you plan to support that or is it sufficient when the whole subwindow is mapped? Joerg ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
RE: [PATCH 3/4 v5] iommu/fsl: Add iommu domain attributes required by fsl PAMU driver.
> -Original Message- > From: iommu-boun...@lists.linux-foundation.org [mailto:iommu- > boun...@lists.linux-foundation.org] On Behalf Of Joerg Roedel > Sent: Sunday, December 02, 2012 7:33 PM > To: Sethi Varun-B16395 > Cc: linux-ker...@vger.kernel.org; iommu@lists.linux-foundation.org; Wood > Scott-B07421; linuxppc-...@lists.ozlabs.org; Tabi Timur-B04825 > Subject: Re: [PATCH 3/4 v5] iommu/fsl: Add iommu domain attributes > required by fsl PAMU driver. > > Hmm, we need to work out a good abstraction for this. > > On Tue, Nov 20, 2012 at 07:24:56PM +0530, Varun Sethi wrote: > > Added the following domain attributes required by FSL PAMU driver: > > 1. Subwindows field added to the iommu domain geometry attribute. > > Are the Subwindows mapped with full size or do you map only parts of the > subwindows? > [Sethi Varun-B16395] It's possible to map a part of the subwindow i.e. size of the mapping can be less than the sub window size. > > +* This attribute indicates number of DMA subwindows supported by > > +* the geometry. If there is a single window that maps the entire > > +* geometry, attribute must be set to "1". A value of "0" implies > > +* that this mechanism is not used at all(normal paging is used). > > +* Value other than* "0" or "1" indicates the actual number of > > +* subwindows. > > +*/ > > This semantic is ugly, how about a feature detection mechanism? > [Sethi Varun-B16395] A feature mechanism to query the type of IOMMU? -Varun ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
[PATCH 4/4] create context mapping entries for devices that use phantom functions.
Create context mapping for phantom functions. Signed-off-by: Andrew Cooks --- drivers/iommu/intel-iommu.c | 30 ++ 1 files changed, 30 insertions(+), 0 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 554e6ac..b3c9b55 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -1673,6 +1673,32 @@ static int domain_context_mapping_one(struct dmar_domain *domain, int segment, } static int +context_map_phantoms(struct dmar_domain *domain, struct pci_dev *pdev, + int translation) +{ + unsigned fn; + int ret; + + if (!pdev->phantoms_enabled) + return 0; + + pr_debug("context_map_phantoms()\n"); + + for (fn = 1 ; fn < 8 ; fn++) { + ret = domain_context_mapping_one(domain, + pci_domain_nr(pdev->bus), + pdev->bus->number, + fn, + translation); + if (ret) { + pr_info("function %d phantom mapping failed.\n", fn); + return ret; + } + } + return 0; +} + +static int domain_context_mapping(struct dmar_domain *domain, struct pci_dev *pdev, int translation) { @@ -1685,6 +1711,10 @@ domain_context_mapping(struct dmar_domain *domain, struct pci_dev *pdev, if (ret) return ret; + ret = context_map_phantoms(domain, pdev, translation); + if (ret) + return ret; + /* dependent device mapping */ tmp = pci_find_upstream_pcie_bridge(pdev); if (!tmp) -- 1.7.1 ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu