Re: [RFC v2 8/8] iommu/arm-smmu: implement add_reserved_regions callback

2016-11-14 Thread Auger Eric
Hi Joerg, On 14/11/2016 17:20, Joerg Roedel wrote: > On Mon, Nov 14, 2016 at 05:08:16PM +0100, Auger Eric wrote: >> There are potentially several MSI doorbell physical pages in the SOC >> that are accessed through the IOMMU (translated). Each of those must >> have a corresponding IOVA and IOVA/PA

Re: [RFC v2 8/8] iommu/arm-smmu: implement add_reserved_regions callback

2016-11-14 Thread Joerg Roedel
On Mon, Nov 14, 2016 at 05:08:16PM +0100, Auger Eric wrote: > There are potentially several MSI doorbell physical pages in the SOC > that are accessed through the IOMMU (translated). Each of those must > have a corresponding IOVA and IOVA/PA mapping programmed in the IOMMU. > Else MSI will fault. >

Re: [RFC v2 8/8] iommu/arm-smmu: implement add_reserved_regions callback

2016-11-14 Thread Auger Eric
Hi Joerg, On 14/11/2016 16:31, Joerg Roedel wrote: > Hi Eric, > > On Fri, Nov 11, 2016 at 05:45:19PM +0100, Auger Eric wrote: >> On 11/11/2016 17:22, Joerg Roedel wrote: >>> So I think we need a way to tell userspace about the reserved regions >>> (per iommu-group) so that userspace knows where i

Re: [RFC v2 8/8] iommu/arm-smmu: implement add_reserved_regions callback

2016-11-14 Thread Joerg Roedel
Hi Eric, On Fri, Nov 11, 2016 at 05:45:19PM +0100, Auger Eric wrote: > On 11/11/2016 17:22, Joerg Roedel wrote: > > So I think we need a way to tell userspace about the reserved regions > > (per iommu-group) so that userspace knows where it can not map anything, > Current plan is to expose that i

Re: [RFC v2 8/8] iommu/arm-smmu: implement add_reserved_regions callback

2016-11-11 Thread Auger Eric
Hi Joerg, On 11/11/2016 17:22, Joerg Roedel wrote: > Hi Eric, > > On Fri, Nov 11, 2016 at 04:47:01PM +0100, Auger Eric wrote: >> Effectively in passthrough use case, the userspace defines the address >> space layout and maps guest RAM PA=IOVA to PAs (using >> VFIO_IOMMU_MAP_DMA). But this address

Re: [RFC v2 8/8] iommu/arm-smmu: implement add_reserved_regions callback

2016-11-11 Thread Joerg Roedel
Hi Eric, On Fri, Nov 11, 2016 at 04:47:01PM +0100, Auger Eric wrote: > Effectively in passthrough use case, the userspace defines the address > space layout and maps guest RAM PA=IOVA to PAs (using > VFIO_IOMMU_MAP_DMA). But this address space does not comprise the MSI > IOVAs. Userspace does not

Re: [RFC v2 8/8] iommu/arm-smmu: implement add_reserved_regions callback

2016-11-11 Thread Auger Eric
Hi Joerg, On 11/11/2016 12:42, Joerg Roedel wrote: > On Thu, Nov 10, 2016 at 07:00:52PM +0100, Auger Eric wrote: >> GICv2m and GICV3 ITS use dma-mapping iommu_dma_map_msi_msg to allocate >> an MSI IOVA on-demand. > > Yes, and it the right thing to do there because as a DMA-API > implementation th

Re: [RFC v2 8/8] iommu/arm-smmu: implement add_reserved_regions callback

2016-11-11 Thread Joerg Roedel
On Fri, Nov 11, 2016 at 02:34:39PM +, Robin Murphy wrote: > On 10/11/16 16:16, Joerg Roedel wrote: > > On Thu, Nov 10, 2016 at 04:07:08PM +, Robin Murphy wrote: > >> On 10/11/16 15:46, Joerg Roedel wrote: > >>> On Fri, Nov 04, 2016 at 11:24:06AM +, Eric Auger wrote: > +reso

Re: [RFC v2 8/8] iommu/arm-smmu: implement add_reserved_regions callback

2016-11-11 Thread Robin Murphy
On 10/11/16 16:16, Joerg Roedel wrote: > On Thu, Nov 10, 2016 at 04:07:08PM +, Robin Murphy wrote: >> On 10/11/16 15:46, Joerg Roedel wrote: >>> On Fri, Nov 04, 2016 at 11:24:06AM +, Eric Auger wrote: + resource_list_for_each_entry(window, &bridge->windows) { + if (resou

Re: [RFC v2 8/8] iommu/arm-smmu: implement add_reserved_regions callback

2016-11-11 Thread Joerg Roedel
On Thu, Nov 10, 2016 at 07:00:52PM +0100, Auger Eric wrote: > GICv2m and GICV3 ITS use dma-mapping iommu_dma_map_msi_msg to allocate > an MSI IOVA on-demand. Yes, and it the right thing to do there because as a DMA-API implementation the dma-iommu code cares about the address space allocation. As

Re: [RFC v2 8/8] iommu/arm-smmu: implement add_reserved_regions callback

2016-11-10 Thread Auger Eric
Hi Joerg, On 10/11/2016 17:13, Joerg Roedel wrote: > On Thu, Nov 10, 2016 at 04:57:51PM +0100, Auger Eric wrote: >> It does not only serve the purpose to register the MSI IOVA region. We >> also need to allocate an iova_domain where MSI IOVAs will be allocated >> upon the request of the relevant M

Re: [RFC v2 8/8] iommu/arm-smmu: implement add_reserved_regions callback

2016-11-10 Thread Joerg Roedel
On Thu, Nov 10, 2016 at 04:07:08PM +, Robin Murphy wrote: > On 10/11/16 15:46, Joerg Roedel wrote: > > On Fri, Nov 04, 2016 at 11:24:06AM +, Eric Auger wrote: > >> + resource_list_for_each_entry(window, &bridge->windows) { > >> + if (resource_type(window->res) != IORESOURCE_MEM &&

Re: [RFC v2 8/8] iommu/arm-smmu: implement add_reserved_regions callback

2016-11-10 Thread Joerg Roedel
On Thu, Nov 10, 2016 at 04:57:51PM +0100, Auger Eric wrote: > It does not only serve the purpose to register the MSI IOVA region. We > also need to allocate an iova_domain where MSI IOVAs will be allocated > upon the request of the relevant MSI controllers. Do you mean you don't > like to use the i

Re: [RFC v2 8/8] iommu/arm-smmu: implement add_reserved_regions callback

2016-11-10 Thread Robin Murphy
On 10/11/16 15:46, Joerg Roedel wrote: > On Fri, Nov 04, 2016 at 11:24:06AM +, Eric Auger wrote: >> The function populates the list of reserved regions with the >> PCI host bridge windows and the MSI IOVA range. >> >> At the moment an arbitray MSI IOVA window is set at 0x800 >> of size 1MB.

Re: [RFC v2 8/8] iommu/arm-smmu: implement add_reserved_regions callback

2016-11-10 Thread Auger Eric
Hi Joerg, On 10/11/2016 16:46, Joerg Roedel wrote: > On Fri, Nov 04, 2016 at 11:24:06AM +, Eric Auger wrote: >> The function populates the list of reserved regions with the >> PCI host bridge windows and the MSI IOVA range. >> >> At the moment an arbitray MSI IOVA window is set at 0x800 >>

Re: [RFC v2 8/8] iommu/arm-smmu: implement add_reserved_regions callback

2016-11-10 Thread Joerg Roedel
On Fri, Nov 04, 2016 at 11:24:06AM +, Eric Auger wrote: > The function populates the list of reserved regions with the > PCI host bridge windows and the MSI IOVA range. > > At the moment an arbitray MSI IOVA window is set at 0x800 > of size 1MB. > > Signed-off-by: Eric Auger > > --- >

Re: [RFC v2 8/8] iommu/arm-smmu: implement add_reserved_regions callback

2016-11-04 Thread Robin Murphy
On 04/11/16 11:24, Eric Auger wrote: > The function populates the list of reserved regions with the > PCI host bridge windows and the MSI IOVA range. > > At the moment an arbitray MSI IOVA window is set at 0x800 > of size 1MB. > > Signed-off-by: Eric Auger > > --- > > RFC v1 -> v2: use def

[RFC v2 8/8] iommu/arm-smmu: implement add_reserved_regions callback

2016-11-04 Thread Eric Auger
The function populates the list of reserved regions with the PCI host bridge windows and the MSI IOVA range. At the moment an arbitray MSI IOVA window is set at 0x800 of size 1MB. Signed-off-by: Eric Auger --- RFC v1 -> v2: use defines for MSI IOVA base and length --- drivers/iommu/arm-sm