Re: [PATCH] dma-debug: fix debug_dma_assert_idle(), use rcu_read_lock()

2020-08-13 Thread Christoph Hellwig
On Thu, Aug 13, 2020 at 12:02:41PM -0700, Linus Torvalds wrote: > Yeah, that's ridiculously expensive, and serializes things for no good reason. > > Your patch looks obviously correct to me (Christoph?), It also looks correct to me. > but it also > makes me go "why are we doing this in the

[PATCH 18/19] iommu/arm-smmu: add a way for implementations to influence SCTLR

2020-08-13 Thread Rob Clark
From: Rob Clark For the Adreno GPU's SMMU, we want SCTLR.HUPCF set to ensure that pending translations are not terminated on iova fault. Otherwise a terminated CP read could hang the GPU by returning invalid command-stream data. Signed-off-by: Rob Clark ---

[PATCH 13/19] drm/msm: Set the global virtual address range from the IOMMU domain

2020-08-13 Thread Rob Clark
From: Jordan Crouse Use the aperture settings from the IOMMU domain to set up the virtual address range for the GPU. This allows us to transparently deal with IOMMU side features (like split pagetables). Signed-off-by: Jordan Crouse Signed-off-by: Rob Clark ---

[PATCH 17/19] arm: dts: qcom: sm845: Set the compatible string for the GPU SMMU

2020-08-13 Thread Rob Clark
From: Jordan Crouse Set the qcom,adreno-smmu compatible string for the GPU SMMU to enable split pagetables and per-instance pagetables for drm/msm. Signed-off-by: Jordan Crouse Signed-off-by: Rob Clark --- arch/arm64/boot/dts/qcom/sdm845.dtsi | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH 14/19] drm/msm: Add support to create a local pagetable

2020-08-13 Thread Rob Clark
From: Jordan Crouse Add support to create a io-pgtable for use by targets that support per-instance pagetables. In order to support per-instance pagetables the GPU SMMU device needs to have the qcom,adreno-smmu compatible string and split pagetables enabled. Signed-off-by: Jordan Crouse

[PATCH 12/19] drm/msm: Drop context arg to gpu->submit()

2020-08-13 Thread Rob Clark
From: Jordan Crouse Now that we can get the ctx from the submitqueue, the extra arg is redundant. Signed-off-by: Jordan Crouse [split out of previous patch to reduce churny noise] Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 12 +---

[PATCH 19/19] drm/msm: show process names in gem_describe

2020-08-13 Thread Rob Clark
From: Rob Clark In $debugfs/gem we already show any vma(s) associated with an object. Also show process names if the vma's address space is a per-process address space. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/msm_drv.c | 2 +- drivers/gpu/drm/msm/msm_gem.c | 25

[PATCH 16/19] drm/msm/a6xx: Add support for per-instance pagetables

2020-08-13 Thread Rob Clark
From: Jordan Crouse Add support for using per-instance pagetables if all the dependencies are available. Signed-off-by: Jordan Crouse Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 70 +++ drivers/gpu/drm/msm/adreno/a6xx_gpu.h | 1 +

[PATCH 15/19] drm/msm: Add support for private address space instances

2020-08-13 Thread Rob Clark
From: Jordan Crouse Add support for allocating private address space instances. Targets that support per-context pagetables should implement their own function to allocate private address spaces. The default will return a pointer to the global address space. Signed-off-by: Jordan Crouse

[PATCH 09/19] iommu/arm-smmu-qcom: Add implementation for the adreno GPU SMMU

2020-08-13 Thread Rob Clark
From: Jordan Crouse Add a special implementation for the SMMU attached to most Adreno GPU target triggered from the qcom,adreno-smmu compatible string. The new Adreno SMMU implementation will enable split pagetables (TTBR1) for the domain attached to the GPU device (SID 0) and hard code it

[PATCH 05/19] iommu: add private interface for adreno-smmu

2020-08-13 Thread Rob Clark
From: Rob Clark This interface will be used for drm/msm to coordinate with the qcom_adreno_smmu_impl to enable/disable TTBR0 translation. Once TTBR0 translation is enabled, the GPU's CP (Command Processor) will directly switch TTBR0 pgtables (and do the necessary TLB inv) synchronized to the

[PATCH 08/19] iommu/arm-smmu: constify some helpers

2020-08-13 Thread Rob Clark
From: Rob Clark Sprinkle a few `const`s where helpers don't need write access. Signed-off-by: Rob Clark --- drivers/iommu/arm/arm-smmu/arm-smmu.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.h

[PATCH 07/19] drm/msm: set adreno_smmu as gpu's drvdata

2020-08-13 Thread Rob Clark
From: Rob Clark This will be populated by adreno-smmu, to provide a way for coordinating enabling/disabling TTBR0 translation. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/adreno/adreno_device.c | 2 -- drivers/gpu/drm/msm/msm_gpu.c | 2 +- drivers/gpu/drm/msm/msm_gpu.h

[PATCH 02/19] iommu/arm-smmu: Pass io-pgtable config to implementation specific function

2020-08-13 Thread Rob Clark
From: Jordan Crouse Construct the io-pgtable config before calling the implementation specific init_context function and pass it so the implementation specific function can get a chance to change it before the io-pgtable is created. Signed-off-by: Jordan Crouse Signed-off-by: Rob Clark ---

[PATCH 03/19] iommu/arm-smmu: Add support for split pagetables

2020-08-13 Thread Rob Clark
From: Jordan Crouse Enable TTBR1 for a context bank if IO_PGTABLE_QUIRK_ARM_TTBR1 is selected by the io-pgtable configuration. Signed-off-by: Jordan Crouse Signed-off-by: Rob Clark --- drivers/iommu/arm/arm-smmu/arm-smmu.c | 21 - drivers/iommu/arm/arm-smmu/arm-smmu.h |

[PATCH 06/19] drm/msm/gpu: add dev_to_gpu() helper

2020-08-13 Thread Rob Clark
From: Rob Clark In a later patch, the drvdata will not directly be 'struct msm_gpu *', so add a helper to reduce the churn. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/adreno/adreno_device.c | 10 -- drivers/gpu/drm/msm/msm_gpu.c | 6 +++---

[PATCH 11/19] drm/msm: Add a context pointer to the submitqueue

2020-08-13 Thread Rob Clark
From: Jordan Crouse Each submitqueue is attached to a context. Add a pointer to the context to the submitqueue at create time and refcount it so that it stays around through the life of the queue. Co-developed-by: Rob Clark Signed-off-by: Jordan Crouse Signed-off-by: Rob Clark ---

[PATCH 04/19] iommu/arm-smmu: Prepare for the adreno-smmu implementation

2020-08-13 Thread Rob Clark
From: Jordan Crouse Do a bit of prep work to add the upcoming adreno-smmu implementation. Add an hook to allow the implementation to choose which context banks to allocate. Move some of the common structs to arm-smmu.h in anticipation of them being used by the implementations and update some

[PATCH 10/19] dt-bindings: arm-smmu: Add compatible string for Adreno GPU SMMU

2020-08-13 Thread Rob Clark
From: Jordan Crouse Every Qcom Adreno GPU has an embedded SMMU for its own use. These devices depend on unique features such as split pagetables, different stall/halt requirements and other settings. Identify them with a compatible string so that they can be identified in the arm-smmu

[PATCH 01/19] drm/msm: remove dangling submitqueue references

2020-08-13 Thread Rob Clark
From: Rob Clark Currently it doesn't matter, since we free the ctx immediately. But when we start refcnt'ing the ctx, we don't want old dangling list entries to hang around. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/msm_submitqueue.c | 4 +++- 1 file changed, 3 insertions(+), 1

[PATCH 00/19] iommu/arm-smmu + drm/msm: per-process GPU pgtables

2020-08-13 Thread Rob Clark
From: Rob Clark NOTE: Since Jordan was out today, and I wanted to keep things moving on this, I took the liberty of respinning his series (originally titled "iommu/arm-smmu: Add Adreno SMMU specific implementation") with updates based on Will's review comments, and some fixes

Re: [PATCH] dma-debug: fix debug_dma_assert_idle(), use rcu_read_lock()

2020-08-13 Thread Dan Williams
On Thu, Aug 13, 2020 at 12:03 PM Linus Torvalds wrote: > > On Wed, Aug 12, 2020 at 8:17 PM Hugh Dickins wrote: > > > > Since commit 2a9127fcf229 ("mm: rewrite wait_on_page_bit_common() logic") > > improved unlock_page(), it has become more noticeable how cow_user_page() > > in a kernel with

Re: [PATCH] dma-debug: fix debug_dma_assert_idle(), use rcu_read_lock()

2020-08-13 Thread Linus Torvalds
On Wed, Aug 12, 2020 at 8:17 PM Hugh Dickins wrote: > > Since commit 2a9127fcf229 ("mm: rewrite wait_on_page_bit_common() logic") > improved unlock_page(), it has become more noticeable how cow_user_page() > in a kernel with CONFIG_DMA_API_DEBUG=y can create and suffer from heavy > contention on

Re: [Freedreno] [PATCH v12 07/13] drm/msm: Add a context pointer to the submitqueue

2020-08-13 Thread Rob Clark
On Mon, Aug 10, 2020 at 3:27 PM Jordan Crouse wrote: > > Each submitqueue is attached to a context. Add a pointer to the > context to the submitqueue at create time and refcount it so > that it stays around through the life of the queue. > > GPU submissions can access the active context via the

Re: [Freedreno] [PATCH v12 04/13] iommu: Add a domain attribute to get/set a pagetable configuration

2020-08-13 Thread Rob Clark
On Thu, Aug 13, 2020 at 8:19 AM Will Deacon wrote: > > On Thu, Aug 13, 2020 at 08:11:02AM -0700, Rob Clark wrote: > > On Thu, Aug 13, 2020 at 6:14 AM Will Deacon wrote: > > > > > > On Mon, Aug 10, 2020 at 04:26:48PM -0600, Jordan Crouse wrote: > > > > Add domain attribute

Re: [Freedreno] [PATCH v12 07/13] drm/msm: Add a context pointer to the submitqueue

2020-08-13 Thread Rob Clark
On Mon, Aug 10, 2020 at 3:27 PM Jordan Crouse wrote: > > Each submitqueue is attached to a context. Add a pointer to the > context to the submitqueue at create time and refcount it so > that it stays around through the life of the queue. > > GPU submissions can access the active context via the

Re: nvme crash - Re: linux-next: Tree for Aug 13

2020-08-13 Thread Christoph Hellwig
On Thu, Aug 13, 2020 at 12:00:19PM +0100, John Garry wrote: > On 13/08/2020 07:58, Stephen Rothwell wrote: > > Hi all, > > Hi guys, > > I have experienced this this crash below on linux-next for the last few days > on my arm64 system. Linus' master branch today also has it. Adding Robin and the

Re: [Freedreno] [PATCH v12 04/13] iommu: Add a domain attribute to get/set a pagetable configuration

2020-08-13 Thread Will Deacon
On Thu, Aug 13, 2020 at 08:11:02AM -0700, Rob Clark wrote: > On Thu, Aug 13, 2020 at 6:14 AM Will Deacon wrote: > > > > On Mon, Aug 10, 2020 at 04:26:48PM -0600, Jordan Crouse wrote: > > > Add domain attribute DOMAIN_ATTR_PGTABLE_CFG. This will be used by > > > arm-smmu to share the current

Re: [Freedreno] [PATCH v12 04/13] iommu: Add a domain attribute to get/set a pagetable configuration

2020-08-13 Thread Rob Clark
On Thu, Aug 13, 2020 at 6:14 AM Will Deacon wrote: > > On Mon, Aug 10, 2020 at 04:26:48PM -0600, Jordan Crouse wrote: > > Add domain attribute DOMAIN_ATTR_PGTABLE_CFG. This will be used by > > arm-smmu to share the current pagetable configuration with the > > leaf driver and to allow the leaf

Re: [PATCH v6 05/15] vfio: Add PASID allocation/free support

2020-08-13 Thread Auger Eric
Yi, On 7/28/20 8:27 AM, Liu Yi L wrote: > Shared Virtual Addressing (a.k.a Shared Virtual Memory) allows sharing > multiple process virtual address spaces with the device for simplified > programming model. PASID is used to tag an virtual address space in DMA > requests and to identify the

Re: [PATCH v6 06/15] iommu/vt-d: Support setting ioasid set to domain

2020-08-13 Thread Auger Eric
Hi Yi, On 7/28/20 8:27 AM, Liu Yi L wrote: > From IOMMU p.o.v., PASIDs allocated and managed by external components > (e.g. VFIO) will be passed in for gpasid_bind/unbind operation. IOMMU > needs some knowledge to check the PASID ownership, hence add an interface > for those components to tell

Re: [PATCH v12 05/13] iommu/arm-smmu-qcom: Add implementation for the adreno GPU SMMU

2020-08-13 Thread Will Deacon
On Mon, Aug 10, 2020 at 04:26:49PM -0600, Jordan Crouse wrote: > Add a special implementation for the SMMU attached to most Adreno GPU > target triggered from the qcom,adreno-smmu compatible string. > > The new Adreno SMMU implementation will enable split pagetables > (TTBR1) for the domain

Re: [PATCH v6 04/15] vfio/type1: Report iommu nesting info to userspace

2020-08-13 Thread Auger Eric
Hi Yi, On 7/28/20 8:27 AM, Liu Yi L wrote: > This patch exports iommu nesting capability info to user space through > VFIO. Userspace is expected to check this info for supported uAPIs (e.g. > PASID alloc/free, bind page table, and cache invalidation) and the vendor > specific format information

Re: [PATCH v12 00/13] iommu/arm-smmu: Add Adreno SMMU specific implementation

2020-08-13 Thread Will Deacon
On Mon, Aug 10, 2020 at 04:26:44PM -0600, Jordan Crouse wrote: > This series adds an Adreno SMMU implementation to arm-smmu to allow GPU > hardware > pagetable switching. > > The Adreno GPU has built in capabilities to switch the TTBR0 pagetable during > runtime to allow each individual instance

Re: [PATCH v12 04/13] iommu: Add a domain attribute to get/set a pagetable configuration

2020-08-13 Thread Will Deacon
On Mon, Aug 10, 2020 at 04:26:48PM -0600, Jordan Crouse wrote: > Add domain attribute DOMAIN_ATTR_PGTABLE_CFG. This will be used by > arm-smmu to share the current pagetable configuration with the > leaf driver and to allow the leaf driver to set up a new pagetable > configuration under certain

Re: [RFC v12 13/13] iommu/arm-smmu: Add a init_context_bank implementation hook

2020-08-13 Thread Will Deacon
On Mon, Aug 10, 2020 at 04:26:57PM -0600, Jordan Crouse wrote: > Add a new implementation hook to allow the implementation specific code > to tweek the context bank configuration just before it gets written. > The first user will be the Adreno GPU implementation to turn on > SCTLR.HUPCF to ensure

Re: [PATCH v6 02/15] iommu: Report domain nesting info

2020-08-13 Thread Auger Eric
Yi, On 7/28/20 8:27 AM, Liu Yi L wrote: > IOMMUs that support nesting translation needs report the capability info s/needs/need to > to userspace. It gives information about requirements the userspace needs > to implement plus other features characterizing the physical implementation. > > This

Re: [PATCH v7 6/7] iommu/uapi: Handle data and argsz filled by users

2020-08-13 Thread Auger Eric
Hi Yi, On 8/13/20 11:38 AM, Liu, Yi L wrote: >> From: Auger Eric >> Sent: Thursday, August 13, 2020 5:31 PM >> >> Hi Yi, >> >> On 8/13/20 11:25 AM, Liu, Yi L wrote: >>> Hi Eric, >>> >>> From: Auger Eric Sent: Thursday, August 13, 2020 5:12 PM Hi Jacob, On 7/30/20

RE: [PATCH v7 6/7] iommu/uapi: Handle data and argsz filled by users

2020-08-13 Thread Liu, Yi L
> From: Auger Eric > Sent: Thursday, August 13, 2020 5:31 PM > > Hi Yi, > > On 8/13/20 11:25 AM, Liu, Yi L wrote: > > Hi Eric, > > > > > >> From: Auger Eric > >> Sent: Thursday, August 13, 2020 5:12 PM > >> > >> Hi Jacob, > >> > >> On 7/30/20 2:21 AM, Jacob Pan wrote: > >>> IOMMU user APIs are

Re: [PATCH v7 6/7] iommu/uapi: Handle data and argsz filled by users

2020-08-13 Thread Auger Eric
Hi Yi, On 8/13/20 11:25 AM, Liu, Yi L wrote: > Hi Eric, > > >> From: Auger Eric >> Sent: Thursday, August 13, 2020 5:12 PM >> >> Hi Jacob, >> >> On 7/30/20 2:21 AM, Jacob Pan wrote: >>> IOMMU user APIs are responsible for processing user data. This patch >>> changes the interface such that

Re: [PATCH v7 3/7] iommu/uapi: Introduce enum type for PASID data format

2020-08-13 Thread Auger Eric
Hi Jacob, On 7/30/20 2:21 AM, Jacob Pan wrote: > There can be multiple vendor-specific PASID data formats used in UAPI > structures. This patch adds enum type with a last entry which makes > range checking much easier. > > Suggested-by: Alex Williamson > Signed-off-by: Jacob Pan > --- >

RE: [PATCH v7 6/7] iommu/uapi: Handle data and argsz filled by users

2020-08-13 Thread Liu, Yi L
Hi Eric, > From: Auger Eric > Sent: Thursday, August 13, 2020 5:12 PM > > Hi Jacob, > > On 7/30/20 2:21 AM, Jacob Pan wrote: > > IOMMU user APIs are responsible for processing user data. This patch > > changes the interface such that user pointers can be passed into IOMMU > > code directly.

Re: [PATCH v7 7/7] iommu/vt-d: Check UAPI data processed by IOMMU core

2020-08-13 Thread Auger Eric
Hi Jacob, On 7/30/20 2:21 AM, Jacob Pan wrote: > IOMMU generic layer already does sanity checks UAPI data for version > match and argsz range under generic information. > Remove the redundant version check from VT-d driver and check for vendor > specific data size. > > Signed-off-by: Jacob Pan

Re: [PATCH v7 6/7] iommu/uapi: Handle data and argsz filled by users

2020-08-13 Thread Auger Eric
Hi Jacob, On 7/30/20 2:21 AM, Jacob Pan wrote: > IOMMU user APIs are responsible for processing user data. This patch > changes the interface such that user pointers can be passed into IOMMU > code directly. Separate kernel APIs without user pointers are introduced > for in-kernel users of the

Re: [PATCH v7 5/7] iommu/uapi: Rename uapi functions

2020-08-13 Thread Auger Eric
Hi Jacob, On 7/30/20 2:21 AM, Jacob Pan wrote: > User APIs such as iommu_sva_unbind_gpasid() may also be used by the > kernel. Since we introduced user pointer to the UAPI functions, Practically this is done in the next patch. What about something like: We plan to have two flavors of the same

[PATCH] dma-debug: fix debug_dma_assert_idle(), use rcu_read_lock()

2020-08-13 Thread Hugh Dickins via iommu
Since commit 2a9127fcf229 ("mm: rewrite wait_on_page_bit_common() logic") improved unlock_page(), it has become more noticeable how cow_user_page() in a kernel with CONFIG_DMA_API_DEBUG=y can create and suffer from heavy contention on DMA debug's radix_lock in debug_dma_assert_idle(). It is only

Re: [PATCH v8 05/14] media: rkisp1: add Rockchip ISP1 subdev driver

2020-08-13 Thread Dafna Hirschfeld
Am 07.08.20 um 18:08 schrieb Dafna Hirschfeld: Hi Am 06.08.20 um 14:22 schrieb Tomasz Figa: On Thu, Aug 6, 2020 at 11:21 AM Dafna Hirschfeld wrote: Am 05.08.20 um 23:10 schrieb Dafna Hirschfeld: Hi On 22.07.20 17:24, Tomasz Figa wrote: Hi Dafna, On Sat, Jul 11, 2020 at 01:04:31PM