Re: [PATCH 1/2] Add new flush_iotlb_range and handle freelists when using iommu_unmap_fast

2020-08-17 Thread kernel test robot
Hi Tom, Thank you for the patch! Yet something to improve: [auto build test ERROR on tegra/for-next] [also build test ERROR on vfio/next v5.9-rc1 next-20200817] [cannot apply to iommu/next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we

[PATCH] iommu/vt-d:Add support for probing ACPI device in RMRR

2020-08-17 Thread FelixCuioc
After acpi device in RMRR is detected,it is necessary to establish a mapping for these devices. In acpi_device_create_direct_mappings(),create a mapping for the acpi device in RMRR. Add a helper to achieve the acpi namespace device can access the RMRR region. Signed-off-by: FelixCuioc ---

[PATCH] iommu/vt-d:Add support for detecting ACPI device in RMRR

2020-08-17 Thread FelixCuioc
Some ACPI devices need to issue dma requests to access the reserved memory area.BIOS uses the device scope type ACPI_NAMESPACE_DEVICE in RMRR to report these ACPI devices. This patch add support for detecting ACPI devices in RMRR. Signed-off-by: FelixCuioc --- drivers/iommu/intel/dmar.c | 74

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

2020-08-17 Thread Jacob Pan
On Sun, 16 Aug 2020 14:40:57 +0200 Auger Eric wrote: > Hi Yi, > > On 8/14/20 9:15 AM, Liu, Yi L wrote: > > Hi Eric, > > > >> From: Auger Eric > >> Sent: Thursday, August 13, 2020 8:53 PM > >> > >> Yi, > >> On 7/28/20 8:27 AM, Liu Yi L wrote: > >>> IOMMUs that support nesting translation

[PATCH 1/2] Add new flush_iotlb_range and handle freelists when using iommu_unmap_fast

2020-08-17 Thread Tom Murphy
Add a flush_iotlb_range to allow flushing of an iova range instead of a full flush in the dma-iommu path. Allow the iommu_unmap_fast to return newly freed page table pages and pass the freelist to queue_iova in the dma-iommu ops path. This patch is useful for iommu drivers (in this case the

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

2020-08-17 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 19/20] iommu/arm-smmu: add a way for implementations to influence SCTLR

2020-08-17 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 17/20] arm: dts: qcom: sm845: Set the compatible string for the GPU SMMU

2020-08-17 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 16/20] drm/msm/a6xx: Add support for per-instance pagetables

2020-08-17 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 | 63 +++ drivers/gpu/drm/msm/adreno/a6xx_gpu.h | 1 +

[PATCH v2] powerpc/pseries/svm: Allocate SWIOTLB buffer anywhere in memory

2020-08-17 Thread Thiago Jung Bauermann
POWER secure guests (i.e., guests which use the Protection Execution Facility) need to use SWIOTLB to be able to do I/O with the hypervisor, but they don't need the SWIOTLB memory to be in low addresses since the hypervisor doesn't have any addressing limitation. This solves a SWIOTLB

[PATCH 2/2] Handle init_iova_flush_queue failure in dma-iommu path

2020-08-17 Thread Tom Murphy
init_iova_flush_queue can fail if we run out of memory. Fall back to no flush queue if it fails. Signed-off-by: Tom Murphy --- drivers/iommu/dma-iommu.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index

Re: [PATCH v7 1/7] docs: IOMMU user API

2020-08-17 Thread Jacob Pan
On Wed, 12 Aug 2020 18:38:50 +0200 Auger Eric wrote: > Hi Jacob, > > On 7/30/20 2:21 AM, Jacob Pan wrote: > > IOMMU UAPI is newly introduced to support communications between > > guest virtual IOMMU and host IOMMU. There has been lots of > > discussions on how it should work with VFIO UAPI and

[PATCH RESEND v10 07/11] device-mapping: Introduce DMA range map, supplanting dma_pfn_offset

2020-08-17 Thread Jim Quinlan via iommu
The new field 'dma_range_map' in struct device is used to facilitate the use of single or multiple offsets between mapping regions of cpu addrs and dma addrs. It subsumes the role of "dev->dma_pfn_offset" which was only capable of holding a single uniform offset and had no region bounds checking.

[PATCH RESEND v10 00/11] PCI: brcmstb: enable PCIe for STB chips

2020-08-17 Thread Jim Quinlan via iommu
Patchset Summary: Enhance a PCIe host controller driver. Because of its unusual design we are foced to change dev->dma_pfn_offset into a more general role allowing multiple offsets. See the 'v1' notes below for more info. v10: Commit: "device-mapping: Introduce DMA range map,

Rename iommu_tlb_* functions to iommu_iotlb_*

2020-08-17 Thread Tom Murphy
To keep naming consistent we should stick with *iotlb*. This patch renames a few remaining functions. Signed-off-by: Tom Murphy --- drivers/iommu/dma-iommu.c | 2 +- drivers/iommu/iommu.c | 4 ++-- drivers/vfio/vfio_iommu_type1.c | 2 +- include/linux/io-pgtable.h | 2

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

2020-08-17 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 05/20] iommu: add private interface for adreno-smmu

2020-08-17 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 06/20] drm/msm/gpu: add dev_to_gpu() helper

2020-08-17 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 13/20] drm/msm: Set the global virtual address range from the IOMMU domain

2020-08-17 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 09/20] iommu/arm-smmu-qcom: Add implementation for the adreno GPU SMMU

2020-08-17 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 12/20] drm/msm: Drop context arg to gpu->submit()

2020-08-17 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 11/20] drm/msm: Add a context pointer to the submitqueue

2020-08-17 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 15/20] drm/msm: Add support for private address space instances

2020-08-17 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 08/20] iommu/arm-smmu: constify some helpers

2020-08-17 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/20] drm/msm: set adreno_smmu as gpu's drvdata

2020-08-17 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 14/20] drm/msm: Add support to create a local pagetable

2020-08-17 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 18/20] arm: dts: qcom: sc7180: Set the compatible string for the GPU SMMU

2020-08-17 Thread Rob Clark
From: Rob Clark 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: Rob Clark --- arch/arm64/boot/dts/qcom/sc7180.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

Re: [PATCH v7 2/7] iommu/uapi: Add argsz for user filled data

2020-08-17 Thread Jacob Pan
On Wed, 12 Aug 2020 18:59:14 +0200 Auger Eric wrote: > Hi, > > On 7/30/20 2:21 AM, Jacob Pan wrote: > > As IOMMU UAPI gets extended, user data size may increase. To support > > backward compatibiliy, this patch introduces a size field to each > > UAPI > s/compatibiliy/compatibility will fix

Re: [PATCH v2 01/12] ACPI/IORT: Make iort_match_node_callback walk the ACPI namespace for NC

2020-08-17 Thread Hanjun Guo
On 2020/7/2 16:22, Hanjun Guo wrote: As I said in previous email, I'm not against this patch, and seems have no regressions for platforms that using named component node such as D05/D06 (I will test it shortly to make sure), but it's better to update the wording of the spec (even after this

Re: [PATCH] swiotlb: Allow allocating buffer anywhere in memory

2020-08-17 Thread Thiago Jung Bauermann
Hello Christoph, Christoph Hellwig writes: > On Sat, Aug 15, 2020 at 05:45:36PM -0300, Thiago Jung Bauermann wrote: >> POWER secure guests (i.e., guests which use the Protection Execution >> Facility) need to use SWIOTLB to be able to do I/O with the hypervisor, but >> they don't need the

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

2020-08-17 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 00/20] iommu/arm-smmu + drm/msm: per-process GPU pgtables

2020-08-17 Thread Rob Clark
From: Rob Clark 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 or application to have its own pagetable. In order to

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

2020-08-17 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 04/20] iommu/arm-smmu: Prepare for the adreno-smmu implementation

2020-08-17 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 02/20] iommu/arm-smmu: Pass io-pgtable config to implementation specific function

2020-08-17 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 ---

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

2020-08-17 Thread Jacob Pan
On Thu, 13 Aug 2020 10:58:53 +0200 Auger Eric wrote: > 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.

Re: [PATCH v5] PCI/ACS: Enable PCI_ACS_TB and disable only when needed for ATS

2020-08-17 Thread Rajat Jain
Hello Bjorn, On Sat, Aug 1, 2020 at 5:30 PM Rajat Jain wrote: > > Hi Bjorn, > > > On Tue, Jul 14, 2020 at 1:24 PM Rajat Jain wrote: > > > > On Tue, Jul 14, 2020 at 1:15 PM Rajat Jain wrote: > > > > > > The ACS "Translation Blocking" bit blocks the translated addresses from > > > the devices.

RE: [PATCH v6 11/15] vfio/type1: Allow invalidating first-level/stage IOMMU cache

2020-08-17 Thread Liu, Yi L
Hi Eric, > From: Auger Eric > Sent: Sunday, August 16, 2020 7:35 PM > > Hi Yi, > > On 7/28/20 8:27 AM, Liu Yi L wrote: > > This patch provides an interface allowing the userspace to invalidate > > IOMMU cache for first-level page table. It is required when the first > > level IOMMU page table

RE: [PATCH v6 10/15] vfio/type1: Support binding guest page tables to PASID

2020-08-17 Thread Liu, Yi L
Hi Eric, > From: Auger Eric > Sent: Sunday, August 16, 2020 7:29 PM > > Hi Yi, > > On 7/28/20 8:27 AM, Liu Yi L wrote: > > Nesting translation allows two-levels/stages page tables, with 1st level > > for guest translations (e.g. GVA->GPA), 2nd level for host translations > > (e.g. GPA->HPA).

[PATCH 14/16] dt: add an spec for the Kirin36x0 SMMU

2020-08-17 Thread Mauro Carvalho Chehab
Describe the properties expected by the IOMMU driver used on Hikey960 and Hikey970 boards. Signed-off-by: Mauro Carvalho Chehab --- .../iommu/hisilicon,kirin36x0-smmu.yaml | 55 +++ 1 file changed, 55 insertions(+) create mode 100644

[PATCH 00/16] IOMMU driver for Kirin 960/970

2020-08-17 Thread Mauro Carvalho Chehab
Add a driver for the Kirin 960/970 iommu. As on the past series, this starts from the original 4.9 driver from the 96boards tree: https://github.com/96boards-hikey/linux/tree/hikey970-v4.9 The remaining patches add SPDX headers and make it build and run with the upstream Kernel.

Re: [PATCH 00/16] IOMMU driver for Kirin 960/970

2020-08-17 Thread Christoph Hellwig
On Mon, Aug 17, 2020 at 09:49:59AM +0200, Mauro Carvalho Chehab wrote: > Add a driver for the Kirin 960/970 iommu. > > As on the past series, this starts from the original 4.9 driver from > the 96boards tree: > > https://github.com/96boards-hikey/linux/tree/hikey970-v4.9 > > The remaining

RE: [PATCH v6 14/15] vfio: Document dual stage control

2020-08-17 Thread Liu, Yi L
Hi Eric, > From: Auger Eric > Sent: Sunday, August 16, 2020 7:52 PM > > Hi Yi, > > On 7/28/20 8:27 AM, Liu Yi L wrote: > > From: Eric Auger > > > > The VFIO API was enhanced to support nested stage control: a bunch of> new > ioctls and usage guideline. > > > > Let's document the process to

RE: [PATCH v6 14/15] vfio: Document dual stage control

2020-08-17 Thread Liu, Yi L
Hi Eric, > From: Eric Auger > Sent: Monday, August 17, 2020 3:41 PM > > Hi Yi, > > On 8/17/20 9:00 AM, Liu, Yi L wrote: > > Hi Eric, > > > >> From: Auger Eric > >> Sent: Sunday, August 16, 2020 7:52 PM > >> > >> Hi Yi, > >> > >> On 7/28/20 8:27 AM, Liu Yi L wrote: > >>> From: Eric Auger >

Re: [PATCH v6 15/15] iommu/vt-d: Support reporting nesting capability info

2020-08-17 Thread Auger Eric
On 8/17/20 9:05 AM, Liu, Yi L wrote: > Hi Eric, > >> Auger Eric >> Sent: Sunday, August 16, 2020 8:01 PM >> >> Hi Yi, >> >> On 7/28/20 8:27 AM, Liu Yi L wrote: >>> This patch reports nesting info, and only supports the case where all >>> the physical iomms have the same CAP/ECAP MASKS. >>

RE: [PATCH v6 15/15] iommu/vt-d: Support reporting nesting capability info

2020-08-17 Thread Liu, Yi L
Hi Eric, > Auger Eric > Sent: Sunday, August 16, 2020 8:01 PM > > Hi Yi, > > On 7/28/20 8:27 AM, Liu Yi L wrote: > > This patch reports nesting info, and only supports the case where all > > the physical iomms have the same CAP/ECAP MASKS. > s/iomms/iommus yep. > > > > Cc: Kevin Tian > >

Re: [PATCH v6 14/15] vfio: Document dual stage control

2020-08-17 Thread Eric Auger
Hi Yi, On 8/17/20 9:00 AM, Liu, Yi L wrote: > Hi Eric, > >> From: Auger Eric >> Sent: Sunday, August 16, 2020 7:52 PM >> >> Hi Yi, >> >> On 7/28/20 8:27 AM, Liu Yi L wrote: >>> From: Eric Auger >>> >>> The VFIO API was enhanced to support nested stage control: a bunch of> new >> ioctls and

RE: [PATCH v6 15/15] iommu/vt-d: Support reporting nesting capability info

2020-08-17 Thread Liu, Yi L
Eric, > From: Auger Eric > Sent: Monday, August 17, 2020 3:43 PM > > On 8/17/20 9:05 AM, Liu, Yi L wrote: > > Hi Eric, > > > >> Auger Eric > >> Sent: Sunday, August 16, 2020 8:01 PM > >> > >> Hi Yi, > >> > >> On 7/28/20 8:27 AM, Liu Yi L wrote: > >>> This patch reports nesting info, and only

Re: [PATCH 00/16] IOMMU driver for Kirin 960/970

2020-08-17 Thread Christoph Hellwig
On Mon, Aug 17, 2020 at 11:27:25AM +0200, Mauro Carvalho Chehab wrote: > I need to start from the original patch in order to preserve its > authorship. Nom you don't. We have plenty of example where people submit code written by other, especially when it is significantly reworked, > My plan is

Re: [PATCH 00/16] IOMMU driver for Kirin 960/970

2020-08-17 Thread Greg Kroah-Hartman
On Mon, Aug 17, 2020 at 12:46:17PM +0200, Mauro Carvalho Chehab wrote: > The main reason of submitting via staging is that I need to preserve > the patch that added this driver as-is, in order to preserve its > SoB and not causing legal issues. > > It it is OK for iommu to accept a submission

Re: [PATCH 00/16] IOMMU driver for Kirin 960/970

2020-08-17 Thread Mauro Carvalho Chehab
Em Mon, 17 Aug 2020 11:37:03 +0200 Greg Kroah-Hartman escreveu: > On Mon, Aug 17, 2020 at 11:27:25AM +0200, Mauro Carvalho Chehab wrote: > > Hi Christoph, > > > > Em Mon, 17 Aug 2020 09:21:06 +0100 > > Christoph Hellwig escreveu: > > > > > On Mon, Aug 17, 2020 at 09:49:59AM +0200, Mauro

Re: [PATCH] swiotlb: Allow allocating buffer anywhere in memory

2020-08-17 Thread Christoph Hellwig
On Sat, Aug 15, 2020 at 05:45:36PM -0300, Thiago Jung Bauermann wrote: > POWER secure guests (i.e., guests which use the Protection Execution > Facility) need to use SWIOTLB to be able to do I/O with the hypervisor, but > they don't need the SWIOTLB memory to be in low addresses since the >

Re: [PATCH 00/16] IOMMU driver for Kirin 960/970

2020-08-17 Thread Mauro Carvalho Chehab
Hi Christoph, Em Mon, 17 Aug 2020 09:21:06 +0100 Christoph Hellwig escreveu: > On Mon, Aug 17, 2020 at 09:49:59AM +0200, Mauro Carvalho Chehab wrote: > > Add a driver for the Kirin 960/970 iommu. > > > > As on the past series, this starts from the original 4.9 driver from > > the 96boards

Re: [PATCH 00/16] IOMMU driver for Kirin 960/970

2020-08-17 Thread Greg Kroah-Hartman
On Mon, Aug 17, 2020 at 11:27:25AM +0200, Mauro Carvalho Chehab wrote: > Hi Christoph, > > Em Mon, 17 Aug 2020 09:21:06 +0100 > Christoph Hellwig escreveu: > > > On Mon, Aug 17, 2020 at 09:49:59AM +0200, Mauro Carvalho Chehab wrote: > > > Add a driver for the Kirin 960/970 iommu. > > > > > >

Re: [PATCH 00/16] IOMMU driver for Kirin 960/970

2020-08-17 Thread Joerg Roedel
On Mon, Aug 17, 2020 at 12:53:45PM +0200, Greg Kroah-Hartman wrote: > You can always do this just fine, as one single patch. You do know > about the co-developed-by: line, right? Agreed. Please keep the main iommu driver in one patch and use co-developed-by. This makes it easier for me to review

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

2020-08-17 Thread Jordan Crouse
On Mon, Aug 17, 2020 at 09:10:46PM +0530, Akhil P Oommen wrote: > On 8/14/2020 8:11 AM, Rob Clark wrote: > >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 > >--- >

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

2020-08-17 Thread Jordan Crouse
On Thu, Aug 13, 2020 at 07:40:55PM -0700, Rob Clark wrote: > 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")

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

2020-08-17 Thread Jordan Crouse
On Thu, Aug 13, 2020 at 07:40:56PM -0700, Rob Clark wrote: > 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. Reviewed-by: Jordan Crouse > Signed-off-by: Rob

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

2020-08-17 Thread Jordan Crouse
On Thu, Aug 13, 2020 at 07:41:00PM -0700, Rob Clark wrote: > 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

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

2020-08-17 Thread Jordan Crouse
On Thu, Aug 13, 2020 at 07:41:01PM -0700, Rob Clark wrote: > From: Rob Clark > > In a later patch, the drvdata will not directly be 'struct msm_gpu *', > so add a helper to reduce the churn. > Reviewed-by: Jordan Crouse > Signed-off-by: Rob Clark > --- >

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

2020-08-17 Thread Jordan Crouse
On Thu, Aug 13, 2020 at 07:41:02PM -0700, Rob Clark wrote: > From: Rob Clark > > This will be populated by adreno-smmu, to provide a way for coordinating > enabling/disabling TTBR0 translation. > Reviewed-by: Jordan Crouse > Signed-off-by: Rob Clark > --- >

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

2020-08-17 Thread Jordan Crouse
On Thu, Aug 13, 2020 at 07:41:14PM -0700, Rob Clark wrote: > 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. Reviewed-by: Jordan Crouse > Signed-off-by: Rob Clark

[PATCH RESEND v9 11/13] iommu/arm-smmu-v3: Add SVA device feature

2020-08-17 Thread Jean-Philippe Brucker
Implement the IOMMU device feature callbacks to support the SVA feature. At the moment dev_has_feat() returns false since I/O Page Faults isn't yet implemented. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 26 ++

[PATCH RESEND v9 10/13] iommu/arm-smmu-v3: Check for SVA features

2020-08-17 Thread Jean-Philippe Brucker
Aggregate all sanity-checks for sharing CPU page tables with the SMMU under a single ARM_SMMU_FEAT_SVA bit. For PCIe SVA, users also need to check FEAT_ATS and FEAT_PRI. For platform SVA, they will have to check FEAT_STALLS. Introduce ARM_SMMU_FEAT_BTM (Broadcast TLB Maintenance), but don't

[PATCH RESEND v9 07/13] iommu/arm-smmu-v3: Move definitions to a header

2020-08-17 Thread Jean-Philippe Brucker
Allow sharing structure definitions with the upcoming SVA support for Arm SMMUv3, by moving them to a separate header. We could surgically extract only what is needed but keeping all definitions in one place looks nicer. Signed-off-by: Jean-Philippe Brucker ---

[PATCH RESEND v9 02/13] iommu/ioasid: Add ioasid references

2020-08-17 Thread Jean-Philippe Brucker
Let IOASID users take references to existing ioasids with ioasid_get(). ioasid_put() drops a reference and only frees the ioasid when its reference number is zero. It returns true if the ioasid was freed. For drivers that don't call ioasid_get(), ioasid_put() is the same as ioasid_free().

[PATCH RESEND v9 06/13] arm64: cpufeature: Export symbol read_sanitised_ftr_reg()

2020-08-17 Thread Jean-Philippe Brucker
The SMMUv3 driver would like to read the MMFR0 PARANGE field in order to share CPU page tables with devices. Allow the driver to be built as module by exporting the read_sanitized_ftr_reg() cpufeature symbol. Acked-by: Suzuki K Poulose Signed-off-by: Jean-Philippe Brucker ---

[PATCH RESEND v9 03/13] iommu/sva: Add PASID helpers

2020-08-17 Thread Jean-Philippe Brucker
Let IOMMU drivers allocate a single PASID per mm. Store the mm in the IOASID set to allow refcounting and searching mm by PASID, when handling an I/O page fault. Reviewed-by: Lu Baolu Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/Kconfig | 5 +++ drivers/iommu/Makefile

[PATCH RESEND v9 04/13] arm64: mm: Pin down ASIDs for sharing mm with devices

2020-08-17 Thread Jean-Philippe Brucker
To enable address space sharing with the IOMMU, introduce arm64_mm_context_get() and arm64_mm_context_put(), that pin down a context and ensure that it will keep its ASID after a rollover. Export the symbols to let the modular SMMUv3 driver use them. Pinning is necessary because a device

[PATCH RESEND v9 01/13] mm: Define pasid in mm

2020-08-17 Thread Jean-Philippe Brucker
From: Fenghua Yu PASID is shared by all threads in a process. So the logical place to keep track of it is in the "mm". Both ARM and X86 need to use the PASID in the "mm". Suggested-by: Christoph Hellwig Signed-off-by: Fenghua Yu Reviewed-by: Tony Luck ---

[PATCH RESEND v9 00/13] iommu: Shared Virtual Addressing for SMMUv3 (PT sharing part)

2020-08-17 Thread Jean-Philippe Brucker
This is version 9 of the page table sharing support for SMMUv3, rebased onto v5.9-rc1. v9 resend: * Rebased onto v5.9-rc1. Moved to drivers/iommu/arm/arm-smmu-v3/ as a result. v9: https://lore.kernel.org/linux-iommu/20200723145724.3014766-1-jean-phili...@linaro.org/ * Moved most of the SVA

[PATCH RESEND v9 08/13] iommu/arm-smmu-v3: Share process page tables

2020-08-17 Thread Jean-Philippe Brucker
With Shared Virtual Addressing (SVA), we need to mirror CPU TTBR, TCR, MAIR and ASIDs in SMMU contexts. Each SMMU has a single ASID space split into two sets, shared and private. Shared ASIDs correspond to those obtained from the arch ASID allocator, and private ASIDs are used for "classic"

[PATCH RESEND v9 05/13] iommu/io-pgtable-arm: Move some definitions to a header

2020-08-17 Thread Jean-Philippe Brucker
Extract some of the most generic TCR defines, so they can be reused by the page table sharing code. Acked-by: Will Deacon Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/io-pgtable-arm.h | 30 ++ drivers/iommu/io-pgtable-arm.c | 27 ++-

[PATCH RESEND v9 12/13] iommu/arm-smmu-v3: Implement iommu_sva_bind/unbind()

2020-08-17 Thread Jean-Philippe Brucker
The sva_bind() function allows devices to access process address spaces using a PASID (aka SSID). (1) bind() allocates or gets an existing MMU notifier tied to the (domain, mm) pair. Each mm gets one PASID. (2) Any change to the address space calls invalidate_range() which sends ATC

[PATCH RESEND v9 13/13] iommu/arm-smmu-v3: Hook up ATC invalidation to mm ops

2020-08-17 Thread Jean-Philippe Brucker
The invalidate_range() notifier is called for any change to the address space. Perform the required ATC invalidations. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h| 2 ++ .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c| 16 +++-

[PATCH RESEND v9 09/13] iommu/arm-smmu-v3: Seize private ASID

2020-08-17 Thread Jean-Philippe Brucker
The SMMU has a single ASID space, the union of shared and private ASID sets. This means that the SMMU driver competes with the arch allocator for ASIDs. Shared ASIDs are those of Linux processes, allocated by the arch, and contribute in broadcast TLB maintenance. Private ASIDs are allocated by the

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

2020-08-17 Thread Akhil P Oommen
On 8/14/2020 8:11 AM, Rob Clark wrote: 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 +++

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

2020-08-17 Thread Rob Clark
On Mon, Aug 17, 2020 at 8:41 AM Akhil P Oommen wrote: > > On 8/14/2020 8:11 AM, Rob Clark wrote: > > 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 > > --- >