Re: [PATCH v2 4/7] irqchip/gic-v3-its: Don't map the MSI page in its_irq_compose_msi_msg()

2019-05-01 Thread Julien Grall
On 30/04/2019 13:34, Auger Eric wrote: Hi Julien, Hi Eric, Thank you for the review! On 4/29/19 4:44 PM, Julien Grall wrote: its_irq_compose_msi_msg() may be called from non-preemptible context. However, on RT, iommu_dma_map_msi_msg requires to be called from a preemptible context. A

Re: [PATCH v4 0/3] PCIe Host request to reserve IOVA

2019-05-01 Thread Lorenzo Pieralisi
On Fri, Apr 12, 2019 at 08:43:32AM +0530, Srinath Mannam wrote: > Few SOCs have limitation that their PCIe host can't allow few inbound > address ranges. Allowed inbound address ranges are listed in dma-ranges > DT property and this address ranges are required to do IOVA mapping. > Remaining

Re: [PATCH v7 05/23] iommu: Introduce cache_invalidate API

2019-05-01 Thread Jean-Philippe Brucker
On 08/04/2019 13:18, Eric Auger wrote: > +int iommu_cache_invalidate(struct iommu_domain *domain, struct device *dev, > +struct iommu_cache_invalidate_info *inv_info) > +{ > + int ret = 0; > + > + if (unlikely(!domain->ops->cache_invalidate)) > + return

Re: [PATCH v4 3/3] PCI: iproc: Add sorted dma ranges resource entries to host bridge

2019-05-01 Thread Lorenzo Pieralisi
On Fri, Apr 12, 2019 at 08:43:35AM +0530, Srinath Mannam wrote: > IPROC host has the limitation that it can use only those address ranges > given by dma-ranges property as inbound address. So that the memory > address holes in dma-ranges should be reserved to allocate as DMA address. > > Inbound

Re: [PATCH v4 0/3] PCIe Host request to reserve IOVA

2019-05-01 Thread Srinath Mannam via iommu
Hi Lorenzo, Thanks a lot. Please see my reply below. On Wed, May 1, 2019 at 7:24 PM Lorenzo Pieralisi wrote: > > On Wed, May 01, 2019 at 02:20:56PM +0100, Robin Murphy wrote: > > On 2019-05-01 1:55 pm, Bjorn Helgaas wrote: > > > On Wed, May 01, 2019 at 12:30:38PM +0100, Lorenzo Pieralisi wrote:

[PATCH 5/7 v2] MIPS: use the generic uncached segment support in dma-direct

2019-05-01 Thread Christoph Hellwig
Stop providing our arch alloc/free hooks and just expose the segment offset instead. Signed-off-by: Christoph Hellwig --- arch/mips/Kconfig | 1 + arch/mips/include/asm/page.h | 3 --- arch/mips/jazz/jazzdma.c | 6 -- arch/mips/mm/dma-noncoherent.c | 26

Re: [PATCH v4 0/3] PCIe Host request to reserve IOVA

2019-05-01 Thread Robin Murphy
On 2019-05-01 1:55 pm, Bjorn Helgaas wrote: On Wed, May 01, 2019 at 12:30:38PM +0100, Lorenzo Pieralisi wrote: On Fri, Apr 12, 2019 at 08:43:32AM +0530, Srinath Mannam wrote: Few SOCs have limitation that their PCIe host can't allow few inbound address ranges. Allowed inbound address ranges

[PATCH v3 0/7] iommu/dma-iommu: Split iommu_dma_map_msi_msg in two parts

2019-05-01 Thread Julien Grall
Hi all, On RT, the function iommu_dma_map_msi_msg expects to be called from preemptible context. However, this is not always the case resulting a splat with !CONFIG_DEBUG_ATOMIC_SLEEP: [ 48.875777] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:974 [

Re: [RFC PATCH v9 03/13] mm: Add support for eXclusive Page Frame Ownership (XPFO)

2019-05-01 Thread Khalid Aziz
On 5/1/19 8:49 AM, Waiman Long wrote: > On Wed, Apr 03, 2019 at 11:34:04AM -0600, Khalid Aziz wrote: >> diff --git a/Documentation/admin-guide/kernel-parameters.txt > b/Documentation/admin-guide/kernel-parameters.txt > >> index 858b6c0b9a15..9b36da94760e 100644 >> ---

Re: [PATCH v4 3/3] PCI: iproc: Add sorted dma ranges resource entries to host bridge

2019-05-01 Thread Srinath Mannam via iommu
Hi Lorenzo, Please see my reply below. On Wed, May 1, 2019 at 8:07 PM Lorenzo Pieralisi wrote: > > On Fri, Apr 12, 2019 at 08:43:35AM +0530, Srinath Mannam wrote: > > IPROC host has the limitation that it can use only those address ranges > > given by dma-ranges property as inbound address. So

Re: [PATCH v4 0/3] PCIe Host request to reserve IOVA

2019-05-01 Thread Bjorn Helgaas
On Wed, May 01, 2019 at 12:30:38PM +0100, Lorenzo Pieralisi wrote: > On Fri, Apr 12, 2019 at 08:43:32AM +0530, Srinath Mannam wrote: > > Few SOCs have limitation that their PCIe host can't allow few inbound > > address ranges. Allowed inbound address ranges are listed in dma-ranges > > DT property

Re: [PATCH v2 4/7] irqchip/gic-v3-its: Don't map the MSI page in its_irq_compose_msi_msg()

2019-05-01 Thread Marc Zyngier
On 01/05/2019 12:14, Julien Grall wrote: > On 30/04/2019 13:34, Auger Eric wrote: >> Hi Julien, > > Hi Eric, > > Thank you for the review! > >> >> On 4/29/19 4:44 PM, Julien Grall wrote: >>> its_irq_compose_msi_msg() may be called from non-preemptible context. >>> However, on RT,

[PATCH v3 2/7] iommu/dma-iommu: Split iommu_dma_map_msi_msg() in two parts

2019-05-01 Thread Julien Grall
On RT, iommu_dma_map_msi_msg() may be called from non-preemptible context. This will lead to a splat with CONFIG_DEBUG_ATOMIC_SLEEP as the function is using spin_lock (they can sleep on RT). iommu_dma_map_msi_msg() is used to map the MSI page in the IOMMU PT and update the MSI message with the

[PATCH v3 7/7] iommu/dma-iommu: Remove iommu_dma_map_msi_msg()

2019-05-01 Thread Julien Grall
A recent change split iommu_dma_map_msi_msg() in two new functions. The function was still implemented to avoid modifying all the callers at once. Now that all the callers have been reworked, iommu_dma_map_msi_msg() can be removed. Signed-off-by: Julien Grall Reviewed-by: Robin Murphy

[PATCH v3 6/7] irqchip/gic-v3-mbi: Don't map the MSI page in mbi_compose_m{b, s}i_msg()

2019-05-01 Thread Julien Grall
The functions mbi_compose_m{b, s}i_msg may be called from non-preemptible context. However, on RT, iommu_dma_map_msi_msg() requires to be called from a preemptible context. A recent patch split iommu_dma_map_msi_msg in two new functions: one that should be called in preemptible context, the other

[PATCH v3 1/7] genirq/msi: Add a new field in msi_desc to store an IOMMU cookie

2019-05-01 Thread Julien Grall
When an MSI doorbell is located downstream of an IOMMU, it is required to swizzle the physical address with an appropriately-mapped IOVA for any device attached to one of our DMA ops domain. At the moment, the allocation of the mapping may be done when composing the message. However, the

[PATCH v3 3/7] irqchip/gicv2m: Don't map the MSI page in gicv2m_compose_msi_msg()

2019-05-01 Thread Julien Grall
gicv2m_compose_msi_msg() may be called from non-preemptible context. However, on RT, iommu_dma_map_msi_msg() requires to be called from a preemptible context. A recent change split iommu_dma_map_msi_msg() in two new functions: one that should be called in preemptible context, the other does not

[PATCH v3 5/7] irqchip/ls-scfg-msi: Don't map the MSI page in ls_scfg_msi_compose_msg()

2019-05-01 Thread Julien Grall
ls_scfg_msi_compose_msg() may be called from non-preemptible context. However, on RT, iommu_dma_map_msi_msg() requires to be called from a preemptible context. A recent patch split iommu_dma_map_msi_msg() in two new functions: one that should be called in preemptible context, the other does not

[PATCH v3 4/7] irqchip/gic-v3-its: Don't map the MSI page in its_irq_compose_msi_msg()

2019-05-01 Thread Julien Grall
its_irq_compose_msi_msg() may be called from non-preemptible context. However, on RT, iommu_dma_map_msi_msg requires to be called from a preemptible context. A recent change split iommu_dma_map_msi_msg() in two new functions: one that should be called in preemptible context, the other does not

Re: [PATCH v4 0/3] PCIe Host request to reserve IOVA

2019-05-01 Thread Lorenzo Pieralisi
On Wed, May 01, 2019 at 02:20:56PM +0100, Robin Murphy wrote: > On 2019-05-01 1:55 pm, Bjorn Helgaas wrote: > > On Wed, May 01, 2019 at 12:30:38PM +0100, Lorenzo Pieralisi wrote: > > > On Fri, Apr 12, 2019 at 08:43:32AM +0530, Srinath Mannam wrote: > > > > Few SOCs have limitation that their PCIe

Re: [RFC PATCH v9 03/13] mm: Add support for eXclusive Page Frame Ownership (XPFO)

2019-05-01 Thread Waiman Long
On Wed, Apr 03, 2019 at 11:34:04AM -0600, Khalid Aziz wrote: > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > index 858b6c0b9a15..9b36da94760e 100644 > --- a/Documentation/admin-guide/kernel-parameters.txt > +++

Re: [PATCH v4 0/3] PCIe Host request to reserve IOVA

2019-05-01 Thread Srinath Mannam via iommu
Hi Robin, Thank you so much for all the information. Regards, Srinath. On Wed, May 1, 2019 at 6:51 PM Robin Murphy wrote: > > On 2019-05-01 1:55 pm, Bjorn Helgaas wrote: > > On Wed, May 01, 2019 at 12:30:38PM +0100, Lorenzo Pieralisi wrote: > >> On Fri, Apr 12, 2019 at 08:43:32AM +0530,

Re: [PATCH 4/7] dma-direct: provide generic support for uncached kernel segments

2019-05-01 Thread Paul Burton
Hi Christoph, On Tue, Apr 30, 2019 at 07:00:29AM -0400, Christoph Hellwig wrote: > diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c > index 2c2772e9702a..d15a535c3e67 100644 > --- a/kernel/dma/direct.c > +++ b/kernel/dma/direct.c > @@ -164,6 +164,13 @@ void *dma_direct_alloc_pages(struct

Re: [PATCH v2 06/19] drivers core: Add I/O ASID allocator

2019-05-01 Thread Jean-Philippe Brucker
On 30/04/2019 21:24, Jacob Pan wrote: > On Thu, 25 Apr 2019 11:41:05 +0100 > Jean-Philippe Brucker wrote: > >> On 25/04/2019 11:17, Auger Eric wrote: +/** + * ioasid_alloc - Allocate an IOASID + * @set: the IOASID set + * @min: the minimum ID (inclusive) + * @max: the

Re: [PATCH 4/7] dma-direct: provide generic support for uncached kernel segments

2019-05-01 Thread Paul Burton
Hi Christoph, On Wed, May 01, 2019 at 07:29:12PM +0200, Christoph Hellwig wrote: > On Wed, May 01, 2019 at 05:18:59PM +, Paul Burton wrote: > > I'm not so sure about this part though. > > > > On MIPS we currently don't clear the allocated memory with memset. Is > > doing that really

Re: [PATCH 4/7] dma-direct: provide generic support for uncached kernel segments

2019-05-01 Thread Christoph Hellwig
On Wed, May 01, 2019 at 05:40:34PM +, Paul Burton wrote: > > > If it is necessary then as-is this code will clear the allocated memory > > > using uncached writes which will be pretty slow. It would be much more > > > efficient to perform the memset before arch_dma_prep_coherent() & before > >

[PATCH v5 3/3] PCI: iproc: Add sorted dma ranges resource entries to host bridge

2019-05-01 Thread Srinath Mannam via iommu
IPROC host has the limitation that it can use only those address ranges given by dma-ranges property as inbound address. So that the memory address holes in dma-ranges should be reserved to allocate as DMA address. Inbound address of host accessed by PCIe devices will not be translated before it

[PATCH v5 1/3] PCI: Add dma_ranges window list

2019-05-01 Thread Srinath Mannam via iommu
Add a dma_ranges field in PCI host bridge structure to hold resource entries list of memory regions in sorted order given through dma-ranges DT property. While initializing IOMMU domain of PCI EPs connected to that host bridge, this list of resources will be processed and IOVAs for the address

[PATCH v5 0/3] PCIe Host request to reserve IOVA

2019-05-01 Thread Srinath Mannam via iommu
Few SOCs have limitation that their PCIe host can't allow few inbound address ranges. Allowed inbound address ranges are listed in dma-ranges DT property and this address ranges are required to do IOVA mapping. Remaining address ranges have to be reserved in IOVA mapping. PCIe Host driver of

[PATCH v5 2/3] iommu/dma: Reserve IOVA for PCIe inaccessible DMA address

2019-05-01 Thread Srinath Mannam via iommu
dma_ranges field of PCI host bridge structure has resource entries in sorted order of address range given through dma-ranges DT property. This list is the accessible DMA address range. So that this resource list will be processed and reserve IOVA address to the inaccessible address holes in the

Re: [PATCH 5/7 v2] MIPS: use the generic uncached segment support in dma-direct

2019-05-01 Thread Paul Burton
Hi Christoph, On Wed, May 01, 2019 at 03:13:39PM +0200, Christoph Hellwig wrote: > Stop providing our arch alloc/free hooks and just expose the segment > offset instead. > > Signed-off-by: Christoph Hellwig > --- > arch/mips/Kconfig | 1 + > arch/mips/include/asm/page.h | 3

Re: [PATCH v2 1/9] soc/fsl/qman: fixup liodns only on ppc targets

2019-05-01 Thread Li Yang
On Sat, Apr 27, 2019 at 2:14 AM wrote: > > From: Laurentiu Tudor > > ARM SoCs use SMMU so the liodn fixup done in the qman driver is no > longer making sense and it also breaks the ICID settings inherited > from u-boot. Do the fixups only for PPC targets. > > Signed-off-by: Laurentiu Tudor

Re: [PATCH v2 2/9] soc/fsl/qbman_portals: add APIs to retrieve the probing status

2019-05-01 Thread Li Yang
On Sat, Apr 27, 2019 at 2:14 AM wrote: > > From: Laurentiu Tudor > > Add a couple of new APIs to check the probing status of the required > cpu bound qman and bman portals: > 'int bman_portals_probed()' and 'int qman_portals_probed()'. > They return the following values. > * 1 if qman/bman

Re: [PATCH 4/7] dma-direct: provide generic support for uncached kernel segments

2019-05-01 Thread Paul Burton
Hi Christoph, On Wed, May 01, 2019 at 07:49:05PM +0200, Christoph Hellwig wrote: > On Wed, May 01, 2019 at 05:40:34PM +, Paul Burton wrote: > > > > If it is necessary then as-is this code will clear the allocated memory > > > > using uncached writes which will be pretty slow. It would be much

[PATCH 1/2] iommu/vt-d: Set intel_iommu_gfx_mapped correctly

2019-05-01 Thread Lu Baolu
The intel_iommu_gfx_mapped flag is exported by the Intel IOMMU driver to indicate whether an IOMMU is used for the graphic device. In a virtualized IOMMU environment (e.g. QEMU), an include-all IOMMU is used for graphic device. This flag is found to be clear even the IOMMU is used. Cc: Ashok Raj

[PATCH 2/2] iommu/vt-d: Make kernel parameter igfx_off work with vIOMMU

2019-05-01 Thread Lu Baolu
The kernel parameter igfx_off is used by users to disable DMA remapping for the Intel integrated graphic device. It was designed for bare metal cases where a dedicated IOMMU is used for graphic. This doesn't apply to virtual IOMMU case where an include-all IOMMU is used. This makes the kernel

[PATCH 0/2] iommu/vt-d: Small fixes for 5.2-rc1

2019-05-01 Thread Lu Baolu
Hi Joerg, This includes two small fixes for virtual IOMMU running in qemu enviroment. On bare metal, we always have an dedicated IOMMU for Intel integrated graphic device. And some aspects of the driver was designed according to this. Unfortunately, in qemu environment, the virtual IOMMU has only

Re: [PATCH v3 02/10] swiotlb: Factor out slot allocation and free

2019-05-01 Thread Lu Baolu
Hi Robin, On 4/30/19 5:53 PM, Robin Murphy wrote: On 30/04/2019 03:02, Lu Baolu wrote: Hi Robin, On 4/29/19 7:06 PM, Robin Murphy wrote: On 29/04/2019 06:10, Lu Baolu wrote: Hi Christoph, On 4/26/19 11:04 PM, Christoph Hellwig wrote: On Thu, Apr 25, 2019 at 10:07:19AM +0800, Lu Baolu