[git pull] IOMMU Fixes for Linux v4.20-rc3

2018-11-23 Thread Joerg Roedel
Hi Linus, The following changes since commit 651022382c7f8da46cb4872a545ee1da6d097d2a: Linux 4.20-rc1 (2018-11-04 15:37:52 -0800) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git iommu-fixes-v4.20-rc3 for you to fetch changes up to

Re: [RFC PATCH 0/6] Auxiliary IOMMU domains and Arm SMMUv3

2018-11-23 Thread j...@8bytes.org
Hi Jean-Philippe, On Wed, Nov 21, 2018 at 07:05:13PM +, Jean-Philippe Brucker wrote: > For the moment though, I think we should allow device drivers to use the > DMA-API at the same time as SVA. Yeah, that makes sense. > If a device driver has to map a management ring buffer for example, >

Re: remove the ->mapping_error method from dma_map_ops V2

2018-11-23 Thread Joerg Roedel
On Fri, Nov 23, 2018 at 11:01:55AM +, Russell King - ARM Linux wrote: > Yuck. So, if we have a 4GB non-PAE 32-bit system, or a PAE system > where we have valid memory across the 4GB boundary and no IOMMU, > we have to reserve the top 4K page in the first 4GB of RAM? But that is only needed

Re: [PATCH v4 8/8] vfio/type1: Handle different mdev isolation type

2018-11-23 Thread Auger Eric
Hi Lu, On 11/5/18 8:34 AM, Lu Baolu wrote: > This adds the support to determine the isolation type > of a mediated device group by checking whether it has > an iommu device. If an iommu device exists, an iommu > domain will be allocated and then attached to the iommu > device. Otherwise, keep the

Re: [PATCH 6/9] iommu/dma-iommu.c: Convert to use vm_insert_range

2018-11-23 Thread Robin Murphy
On 15/11/2018 15:49, Souptick Joarder wrote: Convert to use vm_insert_range() to map range of kernel memory to user vma. Signed-off-by: Souptick Joarder Reviewed-by: Matthew Wilcox --- drivers/iommu/dma-iommu.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git

Re: [PATCH v2 0/3] iommu/io-pgtable-arm-v7s: Use DMA32 zone for page tables

2018-11-23 Thread Michal Hocko
On Fri 23-11-18 13:23:41, Vlastimil Babka wrote: > On 11/22/18 9:23 AM, Christoph Hellwig wrote: [...] > > But I do agree with the sentiment of not wanting to spread GFP_DMA32 > > futher into the slab allocator. > > I don't see a problem with GFP_DMA32 for custom caches. Generic > kmalloc() would

Re: [PATCH v3] iommu/dma: Use NUMA aware memory allocations in __iommu_dma_alloc_pages()

2018-11-23 Thread John Garry
On 21/11/2018 16:57, Will Deacon wrote: On Wed, Nov 21, 2018 at 04:47:48PM +, John Garry wrote: On 21/11/2018 16:07, Will Deacon wrote: On Wed, Nov 21, 2018 at 10:54:10PM +0800, John Garry wrote: From: Ganapatrao Kulkarni Change function __iommu_dma_alloc_pages() to allocate pages for

Re: remove the ->mapping_error method from dma_map_ops V2

2018-11-23 Thread Russell King - ARM Linux
On Fri, Nov 23, 2018 at 02:03:13PM +0100, Joerg Roedel wrote: > On Fri, Nov 23, 2018 at 11:01:55AM +, Russell King - ARM Linux wrote: > > Yuck. So, if we have a 4GB non-PAE 32-bit system, or a PAE system > > where we have valid memory across the 4GB boundary and no IOMMU, > > we have to

Re: [PATCH v4 7/8] vfio/type1: Add domain at(de)taching group helpers

2018-11-23 Thread Auger Eric
Hi Lu, On 11/5/18 8:34 AM, Lu Baolu wrote: > This adds helpers to attach or detach a domain to a > group. This will replace iommu_attach_group() which > only works for pci devices. s/pci/non mdev? > > If a domain is attaching to a group which includes the > mediated devices, it should attach to

Re: [RFC PATCH 0/6] Auxiliary IOMMU domains and Arm SMMUv3

2018-11-23 Thread j...@8bytes.org
On Wed, Nov 21, 2018 at 12:40:44PM +0800, Lu Baolu wrote: > Can you please elaborate a bit more about the concept of subdomains? > From my point of view, an aux-domain is a normal un-managed domain which > has a PASID and could be attached to any ADIs through the aux-domain > specific

Re: [PATCH v2 07/17] debugobjects: Move printk out of db lock critical sections

2018-11-23 Thread Petr Mladek
On Thu 2018-11-22 15:29:35, Waiman Long wrote: > On 11/22/2018 11:02 AM, Petr Mladek wrote: > > Anyway, I wonder what was the primary motivation for this patch. > > Was it the system hang? Or was it lockdep report about nesting > > two terminal locks: db->lock, pool_lock with logbuf_lock? > > The

Re: [PATCH v5 5/7] iommu: Add virtio-iommu driver

2018-11-23 Thread Auger Eric
Hi Jean, On 11/22/18 8:37 PM, Jean-Philippe Brucker wrote: > The virtio IOMMU is a para-virtualized device, allowing to send IOMMU > requests such as map/unmap over virtio transport without emulating page > tables. This implementation handles ATTACH, DETACH, MAP and UNMAP > requests. > > The

Re: [PATCH] mm: Replace all open encodings for NUMA_NO_NODE

2018-11-23 Thread David Hildenbrand
On 23.11.18 10:54, Anshuman Khandual wrote: > At present there are multiple places where invalid node number is encoded > as -1. Even though implicitly understood it is always better to have macros > in there. Replace these open encodings for an invalid node number with the > global macro

Re: [PATCH v2 3/3] iommu/io-pgtable-arm-v7s: Request DMA32 memory, and improve debugging

2018-11-23 Thread Vlastimil Babka
On 11/22/18 2:20 AM, Nicolas Boichat wrote: > On Thu, Nov 22, 2018 at 2:02 AM Michal Hocko wrote: >> >> On Wed 21-11-18 16:46:38, Will Deacon wrote: >>> On Sun, Nov 11, 2018 at 05:03:41PM +0800, Nicolas Boichat wrote: >>> >>> It's a bit grotty that GFP_DMA32 doesn't just map to GFP_DMA on 32-bit

Re: [RFC PATCH 0/6] Auxiliary IOMMU domains and Arm SMMUv3

2018-11-23 Thread j...@8bytes.org
Hi Kevin, On Thu, Nov 22, 2018 at 08:39:19AM +, Tian, Kevin wrote: > I agree special action needs to be taken for everything else (other than > DMA-API), but the point that I didn't get is why the action must be based > a new SVA-type domain, instead of extending default domain with SVA >

Re: [PATCH v2 0/3] iommu/io-pgtable-arm-v7s: Use DMA32 zone for page tables

2018-11-23 Thread Vlastimil Babka
On 11/22/18 9:23 AM, Christoph Hellwig wrote: > On Wed, Nov 21, 2018 at 10:26:26PM +, Robin Murphy wrote: >> TBH, if this DMA32 stuff is going to be contentious we could possibly just >> rip out the offending kmem_cache - it seemed like good practice for the >> use-case, but provided

Re: [PATCH v5 0/7] Add virtio-iommu driver

2018-11-23 Thread Auger Eric
Hi Jean, On 11/22/18 8:37 PM, Jean-Philippe Brucker wrote: > Implement the virtio-iommu driver, following specification v0.9 [1]. > > Since v4 [2] I fixed the issues reported by Eric, and added Reviewed-by > from Eric and Rob. Thanks! > > I changed the specification to fix one inconsistency

Re: [PATCH v2 09/17] debugobjects: Make object hash locks nestable terminal locks

2018-11-23 Thread Petr Mladek
On Thu 2018-11-22 15:17:52, Waiman Long wrote: > On 11/22/2018 10:33 AM, Petr Mladek wrote: > > On Mon 2018-11-19 13:55:18, Waiman Long wrote: > >> By making the object hash locks nestable terminal locks, we can avoid > >> a bunch of unnecessary lockdep validations as well as saving space > >> in

[PATCH] mm: Replace all open encodings for NUMA_NO_NODE

2018-11-23 Thread Anshuman Khandual
At present there are multiple places where invalid node number is encoded as -1. Even though implicitly understood it is always better to have macros in there. Replace these open encodings for an invalid node number with the global macro NUMA_NO_NODE. This helps remove NUMA related assumptions

Re: [PATCH v2 07/17] debugobjects: Move printk out of db lock critical sections

2018-11-23 Thread Petr Mladek
On Fri 2018-11-23 11:40:48, Sergey Senozhatsky wrote: > On (11/22/18 11:16), Peter Zijlstra wrote: > > > So maybe we need to switch debug objects print-outs to _always_ > > > printk_deferred(). Debug objects can be used in code which cannot > > > do direct printk() - timekeeping is just one

Re: [PATCH v3] drm/rockchip: update cursors asynchronously through atomic.

2018-11-23 Thread Michael Zoran
On Fri, 2018-11-23 at 11:27 +0900, Tomasz Figa wrote: > > The point here is not about setting and resetting the plane->fb > pointer. It's about what happens inside > drm_atomic_set_fb_for_plane(). > > It calls drm_framebuffer_get() for the new fb and > drm_framebuffer_put() for the old fb. In

Re: [PATCH v4 1/8] iommu: Add APIs for multiple domains per device

2018-11-23 Thread Auger Eric
Hi Lu, On 11/5/18 8:34 AM, Lu Baolu wrote: > Sharing a physical PCI device in a finer-granularity way > is becoming a consensus in the industry. IOMMU vendors > are also engaging efforts to support such sharing as well > as possible. Among the efforts, the capability of support >

Re: [PATCH v4 2/8] iommu/vt-d: Add multiple domains per device query

2018-11-23 Thread Auger Eric
Hi, On 11/5/18 8:34 AM, Lu Baolu wrote: > Add the response to IOMMU_DEV_ATTR_AUXD_CAPABILITY capability query > through iommu_get_dev_attr(). commit title: Advertise auxiliary domain capability? > > Cc: Ashok Raj > Cc: Jacob Pan > Cc: Kevin Tian > Signed-off-by: Lu Baolu > Signed-off-by:

Re: [PATCH v4 4/8] iommu/vt-d: Attach/detach domains in auxiliary mode

2018-11-23 Thread Auger Eric
Hi Lu, On 11/5/18 8:34 AM, Lu Baolu wrote: > When multiple domains per device has been enabled by the > device driver, the device will tag the default PASID for > the domain to all DMA traffics out of the subset of this > device; and the IOMMU should translate the DMA requests > in PASID

Re: remove the ->mapping_error method from dma_map_ops V2

2018-11-23 Thread Joerg Roedel
On Thu, Nov 22, 2018 at 05:52:15PM +, Robin Murphy wrote: > Unfortunately, with things like the top-down IOVA allocator, and 32-bit > systems in general, "the top 4095" values may well still be valid addresses > - we're relying on a 1-byte mapping of the very top byte of memory/IOVA > space

Re: [RESEND PATCH v17 5/5] iommu/arm-smmu: Add support for qcom,smmu-v2 variant

2018-11-23 Thread Vivek Gautam
Hi Will, On Wed, Nov 21, 2018 at 11:09 PM Will Deacon wrote: > > [+Thor] > > On Fri, Nov 16, 2018 at 04:54:30PM +0530, Vivek Gautam wrote: > > qcom,smmu-v2 is an arm,smmu-v2 implementation with specific > > clock and power requirements. > > On msm8996, multiple cores, viz. mdss, video, etc. use

Re: [RESEND PATCH v17 5/5] iommu/arm-smmu: Add support for qcom,smmu-v2 variant

2018-11-23 Thread Vivek Gautam
Hi Tomasz, On Fri, Nov 23, 2018 at 2:52 PM Tomasz Figa wrote: > > Hi Vivek, Will, > > On Fri, Nov 23, 2018 at 6:13 PM Vivek Gautam > wrote: > > > > Hi Will, > > > > On Wed, Nov 21, 2018 at 11:09 PM Will Deacon wrote: > > > > > > [+Thor] > > > > > > On Fri, Nov 16, 2018 at 04:54:30PM +0530,

Re: remove the ->mapping_error method from dma_map_ops V2

2018-11-23 Thread Russell King - ARM Linux
On Fri, Nov 23, 2018 at 11:49:18AM +0100, Joerg Roedel wrote: > On Thu, Nov 22, 2018 at 05:52:15PM +, Robin Murphy wrote: > > Unfortunately, with things like the top-down IOVA allocator, and 32-bit > > systems in general, "the top 4095" values may well still be valid addresses > > - we're

Re: [PATCH] mm: Replace all open encodings for NUMA_NO_NODE

2018-11-23 Thread Anshuman Khandual
min On 11/23/2018 04:06 PM, David Hildenbrand wrote: > On 23.11.18 10:54, Anshuman Khandual wrote: >> At present there are multiple places where invalid node number is encoded >> as -1. Even though implicitly understood it is always better to have macros >> in there. Replace these open encodings

Re: [RESEND PATCH v17 5/5] iommu/arm-smmu: Add support for qcom,smmu-v2 variant

2018-11-23 Thread Tomasz Figa
Hi Vivek, Will, On Fri, Nov 23, 2018 at 6:13 PM Vivek Gautam wrote: > > Hi Will, > > On Wed, Nov 21, 2018 at 11:09 PM Will Deacon wrote: > > > > [+Thor] > > > > On Fri, Nov 16, 2018 at 04:54:30PM +0530, Vivek Gautam wrote: > > > qcom,smmu-v2 is an arm,smmu-v2 implementation with specific > > >

Re: [PATCH v2 07/17] debugobjects: Move printk out of db lock critical sections

2018-11-23 Thread Petr Mladek
On Thu 2018-11-22 14:57:02, Waiman Long wrote: > On 11/21/2018 09:04 PM, Sergey Senozhatsky wrote: > > On (11/21/18 11:49), Waiman Long wrote: > > [..] > >>> case ODEBUG_STATE_ACTIVE: > >>> - debug_print_object(obj, "init"); > >>> state = obj->state; > >>>

Re: [PATCH v5 5/7] iommu: Add virtio-iommu driver

2018-11-23 Thread Michael S. Tsirkin
On Thu, Nov 22, 2018 at 07:37:59PM +, Jean-Philippe Brucker wrote: > The virtio IOMMU is a para-virtualized device, allowing to send IOMMU > requests such as map/unmap over virtio transport without emulating page > tables. This implementation handles ATTACH, DETACH, MAP and UNMAP > requests. >

Re: [PATCH 6/9] iommu/dma-iommu.c: Convert to use vm_insert_range

2018-11-23 Thread Matthew Wilcox
On Fri, Nov 23, 2018 at 05:23:06PM +, Robin Murphy wrote: > On 15/11/2018 15:49, Souptick Joarder wrote: > > Convert to use vm_insert_range() to map range of kernel > > memory to user vma. > > > > Signed-off-by: Souptick Joarder > > Reviewed-by: Matthew Wilcox > > --- > >

Re: [PATCH] mm: Replace all open encodings for NUMA_NO_NODE

2018-11-23 Thread Andrew Morton
On Fri, 23 Nov 2018 15:24:16 +0530 Anshuman Khandual wrote: > At present there are multiple places where invalid node number is encoded > as -1. Even though implicitly understood it is always better to have macros > in there. Replace these open encodings for an invalid node number with the >

Re: [PATCH 06/10] swiotlb: use swiotlb_map_page in swiotlb_map_sg_attrs

2018-11-23 Thread Will Deacon
Hi John, On Tue, Nov 20, 2018 at 10:25:16AM +0100, Christoph Hellwig wrote: > On Mon, Nov 19, 2018 at 03:22:13PM -0800, John Stultz wrote: > > > + sg->dma_address = dma_addr; > > > sg_dma_len(sg) = sg->length; > > > } > > > > I know Robin has already replied

Re: [PATCH v5 5/7] iommu: Add virtio-iommu driver

2018-11-23 Thread Michael S. Tsirkin
On Thu, Nov 22, 2018 at 07:37:59PM +, Jean-Philippe Brucker wrote: > The virtio IOMMU is a para-virtualized device, allowing to send IOMMU > requests such as map/unmap over virtio transport without emulating page > tables. This implementation handles ATTACH, DETACH, MAP and UNMAP > requests. >

Re: [PATCH 06/10] swiotlb: use swiotlb_map_page in swiotlb_map_sg_attrs

2018-11-23 Thread Robin Murphy
Hi Will, On 2018-11-23 6:27 pm, Will Deacon wrote: Hi John, On Tue, Nov 20, 2018 at 10:25:16AM +0100, Christoph Hellwig wrote: On Mon, Nov 19, 2018 at 03:22:13PM -0800, John Stultz wrote: + sg->dma_address = dma_addr; sg_dma_len(sg) = sg->length; } I

Re: [PATCH v5 5/7] iommu: Add virtio-iommu driver

2018-11-23 Thread Michael S. Tsirkin
On Thu, Nov 22, 2018 at 07:37:59PM +, Jean-Philippe Brucker wrote: > The virtio IOMMU is a para-virtualized device, allowing to send IOMMU > requests such as map/unmap over virtio transport without emulating page > tables. This implementation handles ATTACH, DETACH, MAP and UNMAP > requests. >

Re: [RESEND PATCH v17 5/5] iommu/arm-smmu: Add support for qcom,smmu-v2 variant

2018-11-23 Thread Will Deacon
On Fri, Nov 23, 2018 at 03:06:29PM +0530, Vivek Gautam wrote: > On Fri, Nov 23, 2018 at 2:52 PM Tomasz Figa wrote: > > On Fri, Nov 23, 2018 at 6:13 PM Vivek Gautam > > wrote: > > > On Wed, Nov 21, 2018 at 11:09 PM Will Deacon wrote: > > > > On Fri, Nov 16, 2018 at 04:54:30PM +0530, Vivek Gautam

Re: [RESEND PATCH v17 2/5] iommu/arm-smmu: Invoke pm_runtime during probe, add/remove device

2018-11-23 Thread Will Deacon
On Thu, Nov 22, 2018 at 05:32:24PM +0530, Vivek Gautam wrote: > Hi Will, > > On Wed, Nov 21, 2018 at 11:09 PM Will Deacon wrote: > > > > On Fri, Nov 16, 2018 at 04:54:27PM +0530, Vivek Gautam wrote: > > > From: Sricharan R > > > > > > The smmu device probe/remove and add/remove master device

Re: [PATCH 6/9] iommu/dma-iommu.c: Convert to use vm_insert_range

2018-11-23 Thread Souptick Joarder
On Sat, Nov 24, 2018 at 3:04 AM Matthew Wilcox wrote: > > On Fri, Nov 23, 2018 at 05:23:06PM +, Robin Murphy wrote: > > On 15/11/2018 15:49, Souptick Joarder wrote: > > > Convert to use vm_insert_range() to map range of kernel > > > memory to user vma. > > > > > > Signed-off-by: Souptick