[PATCH v14 10/10] iommu/arm-smmu-v3: Add stall support for platform devices

2021-04-01 Thread Jean-Philippe Brucker
initializes the fault queue for the device. Tested-by: Zhangfei Gao Reviewed-by: Eric Auger Reviewed-by: Jonathan Cameron Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 43 .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 59 +- drivers/iommu/arm

[PATCH v14 09/10] ACPI/IORT: Enable stall support for platform devices

2021-04-01 Thread Jean-Philippe Brucker
Copy the "Stall supported" bit, that tells whether a named component supports stall, into the dma-can-stall device property. Acked-by: Jonathan Cameron Signed-off-by: Jean-Philippe Brucker --- drivers/acpi/arm64/iort.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)

[PATCH v14 08/10] dt-bindings: document stall property for IOMMU masters

2021-04-01 Thread Jean-Philippe Brucker
On ARM systems, some platform devices behind an IOMMU may support stall, which is the ability to recover from page faults. Let the firmware tell us when a device supports stall. Reviewed-by: Eric Auger Reviewed-by: Rob Herring Signed-off-by: Jean-Philippe Brucker --- .../devicetree/bindings

[PATCH v14 07/10] iommu/arm-smmu-v3: Maintain a SID->device structure

2021-04-01 Thread Jean-Philippe Brucker
When handling faults from the event or PRI queue, we need to find the struct device associated with a SID. Add a rb_tree to keep track of SIDs. Acked-by: Jonathan Cameron Reviewed-by: Eric Auger Reviewed-by: Keqian Zhu Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3

[PATCH v14 04/10] iommu/vt-d: Support IOMMU_DEV_FEAT_IOPF

2021-04-01 Thread Jean-Philippe Brucker
Allow drivers to query and enable IOMMU_DEV_FEAT_IOPF, which amounts to checking whether PRI is enabled. Reviewed-by: Lu Baolu Signed-off-by: Jean-Philippe Brucker --- Cc: David Woodhouse Cc: Lu Baolu --- drivers/iommu/intel/iommu.c | 11 --- 1 file changed, 8 insertions(+), 3

[PATCH v14 03/10] iommu: Separate IOMMU_DEV_FEAT_IOPF from IOMMU_DEV_FEAT_SVA

2021-04-01 Thread Jean-Philippe Brucker
IOMMU_DEV_FEAT_IOPF on its own doesn't have any effect visible to the device driver, it is used in combination with other features. Reviewed-by: Eric Auger Reviewed-by: Lu Baolu Signed-off-by: Jean-Philippe Brucker --- Cc: Arnd Bergmann Cc: David Woodhouse Cc: Greg Kroah-Hartman Cc: Joerg Roedel Cc

[PATCH v14 05/10] uacce: Enable IOMMU_DEV_FEAT_IOPF

2021-04-01 Thread Jean-Philippe Brucker
implementing a uacce interface doesn't need IOPF support, it will need to tell the uacce module, for example with a new flag. Acked-by: Zhangfei Gao Signed-off-by: Jean-Philippe Brucker --- Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: Zhangfei Gao Cc: Zhou Wang --- drivers/misc/uacce/uacce.c

[PATCH v14 01/10] iommu: Fix comment for struct iommu_fwspec

2021-04-01 Thread Jean-Philippe Brucker
on Signed-off-by: Jean-Philippe Brucker --- include/linux/iommu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 5e7fe519430a..1d422bf722a1 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -571,7 +571,

[PATCH v14 02/10] iommu/arm-smmu-v3: Use device properties for pasid-num-bits

2021-04-01 Thread Jean-Philippe Brucker
Auger Signed-off-by: Jean-Philippe Brucker --- include/linux/iommu.h | 2 -- drivers/acpi/arm64/iort.c | 13 +++-- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 3 ++- drivers/iommu/of_iommu.c| 5 - 4 files changed, 9

[PATCH v14 00/10] iommu: I/O page faults for SMMUv3

2021-04-01 Thread Jean-Philippe Brucker
not possible, please pick patches 1-6 so the Vt-d driver can start using them. [v13] https://lore.kernel.org/linux-iommu/20210302092644.2553014-1-jean-phili...@linaro.org/ Jean-Philippe Brucker (10): iommu: Fix comment for struct iommu_fwspec iommu/arm-smmu-v3: Use device properties for pasid

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-04-01 Thread Jean-Philippe Brucker
On Thu, Apr 01, 2021 at 07:04:01AM +, Liu, Yi L wrote: > > - how about AMD and ARM's vSVA support? Their PASID allocation and page > > table > > happens within guest. They only need to bind the guest PASID table to > > host. In this case each VM has its own IOASID space, and the host IOASID

Re: [PATCH v13 00/10] iommu: I/O page faults for SMMUv3

2021-03-30 Thread Jean-Philippe Brucker
Hi Will, Joerg, On Tue, Mar 02, 2021 at 10:26:36AM +0100, Jean-Philippe Brucker wrote: > Add stall support to the SMMUv3 driver, along with a common I/O Page > Fault handler. I only have review/ack tags and one assert_lockdep to add to this series. Should I send a v14 now or wait a little

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-03-30 Thread Jean-Philippe Brucker
On Tue, Mar 30, 2021 at 10:07:55AM -0300, Jason Gunthorpe wrote: > On Fri, Mar 26, 2021 at 09:06:42AM +0100, Jean-Philippe Brucker wrote: > > > It's not inconceivable to have a control queue doing DMA tagged with > > PASID. The devices I know either use untagged DMA, or ha

Re: [PATCH RFC v1 02/15] iommu: Add a simple PASID table library

2021-03-29 Thread Jean-Philippe Brucker
On Fri, Mar 12, 2021 at 06:17:55PM +0530, Vivek Kumar Gautam wrote: > > Regarding the overall design, I was initially assigning page directories > > instead of whole PASID tables, which would simplify the driver and host > > implementation. A major complication, however, is SMMUv3 accesses PASID >

Re: [PATCH RFC v1 15/15] iommu/virtio: Update fault type and reason info for viommu fault

2021-03-29 Thread Jean-Philippe Brucker
On Fri, Mar 12, 2021 at 06:39:05PM +0530, Vivek Kumar Gautam wrote: > To complete the page request we would also need to send the response back to > the host from virtio backend when handling page request. So the virtio > command should also be accompanied with a vfio api to send the page request

Re: [PATCH RFC v1 13/15] iommu/virtio: Attach Arm PASID tables when available

2021-03-29 Thread Jean-Philippe Brucker
On Fri, Mar 12, 2021 at 06:59:17PM +0530, Vivek Kumar Gautam wrote: > > > + /* XXX HACK: set feature bit ARM_SMMU_FEAT_2_LVL_CDTAB */ > > > + pst_cfg->vendor.cfg.feat_flag |= (1 << 1); > > > > Oh right, this flag is missing. I'll add > > > >#define VIRTIO_IOMMU_PST_ARM_SMMU3_F_CD2L (1ULL <<

Re: [PATCH v13 07/10] iommu/arm-smmu-v3: Maintain a SID->device structure

2021-03-26 Thread Jean-Philippe Brucker
On Thu, Mar 25, 2021 at 05:48:07PM +, Will Deacon wrote: > > +/* smmu->streams_mutex must be held */ > > Can you add a lockdep assertion for that? Sure > > +__maybe_unused > > +static struct arm_smmu_master * > > +arm_smmu_find_master(struct arm_smmu_device *smmu, u32 sid) > > +{ > > +

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-03-26 Thread Jean-Philippe Brucker
On Thu, Mar 25, 2021 at 02:16:45PM -0300, Jason Gunthorpe wrote: > On Thu, Mar 25, 2021 at 10:02:36AM -0700, Jacob Pan wrote: > > Hi Jean-Philippe, > > > > On Thu, 25 Mar 2021 11:21:40 +0100, Jean-Philippe Brucker > > wrote: > > > > > On Wed, Mar 24,

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-03-25 Thread Jean-Philippe Brucker
On Wed, Mar 24, 2021 at 10:02:46AM -0700, Jacob Pan wrote: > > And a flag IOMMU_SVA_BIND_SUPERVISOR (not that I plan to implement it in > > the SMMU, but I think we need to clean the current usage) > > > You mean move #define SVM_FLAG_SUPERVISOR_MODE out of Intel code to be a > generic flag in

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-03-25 Thread Jean-Philippe Brucker
On Wed, Mar 24, 2021 at 03:12:30PM -0700, Jacob Pan wrote: > Hi Jason, > > On Wed, 24 Mar 2021 14:03:38 -0300, Jason Gunthorpe wrote: > > > On Wed, Mar 24, 2021 at 10:02:46AM -0700, Jacob Pan wrote: > > > > Also wondering about device driver allocating auxiliary domains for > > > > their

Re: [PATCH v13 06/10] iommu: Add a page fault handler

2021-03-23 Thread Jean-Philippe Brucker
On Tue, Mar 02, 2021 at 09:57:27PM -0800, Raj, Ashok wrote: > > + ret = handle_mm_fault(vma, prm->addr, fault_flags, NULL); > > Should we add a trace similar to trace_page_fault_user() or kernel in > arch/x86/kernel/mm/fault.c Yes that would definitely be useful for debugging hardware and

Re: [PATCH v13 06/10] iommu: Add a page fault handler

2021-03-23 Thread Jean-Philippe Brucker
On Wed, Mar 03, 2021 at 01:27:34PM +0800, Lu Baolu wrote: > I have tested this framework with the Intel VT-d implementation. It > works as expected. Hence, > > Reviewed-by: Lu Baolu > Tested-by: Lu Baolu Thanks! > One possible future optimization is that we could allow the system >

Re: [PATCH v13 06/10] iommu: Add a page fault handler

2021-03-23 Thread Jean-Philippe Brucker
insight. > > FWIW, > Reviewed-by:Jacob Pan Thanks! > On Tue, 2 Mar 2021 10:26:42 +0100, Jean-Philippe Brucker > wrote: > > +int iommu_queue_iopf(struct iommu_fault *fault, void *cookie) > > +{ > > + int ret; > > + struct iopf_group *group; > > + s

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-03-22 Thread Jean-Philippe Brucker
On Fri, Mar 19, 2021 at 11:22:21AM -0700, Jacob Pan wrote: > Hi Jason, > > On Fri, 19 Mar 2021 10:54:32 -0300, Jason Gunthorpe wrote: > > > On Fri, Mar 19, 2021 at 02:41:32PM +0100, Jean-Philippe Brucker wrote: > > > On Fri, Mar 19, 2021 at 09:46:45AM -

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-03-19 Thread Jean-Philippe Brucker
On Fri, Mar 19, 2021 at 09:46:45AM -0300, Jason Gunthorpe wrote: > On Fri, Mar 19, 2021 at 10:58:41AM +0100, Jean-Philippe Brucker wrote: > > > Although there is no use for it at the moment (only two upstream users and > > it looks like amdkfd always uses current too), I quite l

Re: [PATCH 0/3] Add support for ACPI VIOT

2021-03-19 Thread Jean-Philippe Brucker
Hi Eric, On Fri, Mar 19, 2021 at 11:58:49AM +0100, Auger Eric wrote: > Hi Jean, > > On 3/16/21 8:16 PM, Jean-Philippe Brucker wrote: > > Add a driver for the ACPI VIOT table, which enables virtio-iommu on > > non-devicetree platforms, including x86. This series depends on t

Re: [PATCH V4 05/18] iommu/ioasid: Redefine IOASID set and allocation APIs

2021-03-19 Thread Jean-Philippe Brucker
Hi Jacob, On Thu, Mar 18, 2021 at 05:22:34PM -0700, Jacob Pan wrote: > Hi Jean, > > Slightly off the title. As we are moving to use cgroup to limit PASID > allocations, it would be much simpler if we enforce on the current task. Yes I think we should do that. Is there a problem with charging

[PATCH 2/3] ACPI: Add driver for the VIOT table

2021-03-16 Thread Jean-Philippe Brucker
the vIOMMU and register the endpoint's DMA ops. If step (3) happens before step (2), it is deferred until the IOMMU is initialized, then retried. Signed-off-by: Jean-Philippe Brucker --- drivers/acpi/Kconfig | 3 + drivers/iommu/Kconfig| 1 + drivers/acpi/Makefile| 2

[PATCH 3/3] iommu/virtio: Enable x86 support

2021-03-16 Thread Jean-Philippe Brucker
With the VIOT support in place, x86 platforms can now use the virtio-iommu. The arm64 Kconfig selects IOMMU_DMA, while x86 IOMMU drivers select it themselves. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[PATCH 0/3] Add support for ACPI VIOT

2021-03-16 Thread Jean-Philippe Brucker
-1-jean-phili...@linaro.org/ Jean-Philippe Brucker (3): ACPICA: iASL: Add definitions for the VIOT table ACPI: Add driver for the VIOT table iommu/virtio: Enable x86 support drivers/acpi/Kconfig | 3 + drivers/iommu/Kconfig| 4 +- drivers/acpi/Makefile| 2

[PATCH 1/3] ACPICA: iASL: Add definitions for the VIOT table

2021-03-16 Thread Jean-Philippe Brucker
856a96fdf4b51b2b8da17529df0255e6f51f1b5b Link: https://github.com/acpica/acpica/commit/fc4e3331 Link: https://github.com/acpica/acpica/commit/2197e354 Link: https://github.com/acpica/acpica/commit/856a96fd Signed-off-by: Bob Moore Signed-off-by: Jean-Philippe Brucker --- include/acpi/actbl3.h | 67

Re: [PATCH 1/1] drm/amdkfd: fix build error with AMD_IOMMU_V2=m

2021-03-09 Thread Jean-Philippe Brucker
Hi Felix, On Tue, Mar 09, 2021 at 11:30:19AM -0500, Felix Kuehling wrote: > > I think the proper fix would be to not rely on custom hooks into a > > particular > > IOMMU driver, but to instead ensure that the amdgpu driver can do everything > > it needs through the regular linux/iommu.h

Re: [RFC PATCH 15/18] cgroup: Introduce ioasids controller

2021-03-05 Thread Jean-Philippe Brucker
On Fri, Mar 05, 2021 at 09:30:49AM +0100, Jean-Philippe Brucker wrote: > That works but isn't perfect, because the hardware resource of shared > address spaces can be much lower that PID limit - 16k ASIDs on Arm. To Sorry I meant 16-bit here - 64k Thanks

Re: [PATCH v12 03/13] vfio: VFIO_IOMMU_SET_MSI_BINDING

2021-03-05 Thread Jean-Philippe Brucker
Hi, On Tue, Feb 23, 2021 at 10:06:15PM +0100, Eric Auger wrote: > This patch adds the VFIO_IOMMU_SET_MSI_BINDING ioctl which aim > to (un)register the guest MSI binding to the host. This latter > then can use those stage 1 bindings to build a nested stage > binding targeting the physical MSIs.

Re: [RFC PATCH 15/18] cgroup: Introduce ioasids controller

2021-03-05 Thread Jean-Philippe Brucker
On Thu, Mar 04, 2021 at 09:46:03AM -0800, Jacob Pan wrote: > Hi Jean-Philippe, > > On Thu, 4 Mar 2021 10:49:37 +0100, Jean-Philippe Brucker > wrote: > > > On Wed, Mar 03, 2021 at 04:02:05PM -0800, Jacob Pan wrote: > > > Hi Jacob, > > > > > &

Re: [RFC PATCH 4/5] iommu/arm-smmu-v3: Use pinned VMID for NESTED stage with BTM

2021-03-04 Thread Jean-Philippe Brucker
Hi Shameer, On Mon, Feb 22, 2021 at 03:53:37PM +, Shameer Kolothum wrote: > If the SMMU supports BTM and the device belongs to NESTED domain > with shared pasid table, we need to use the VMID allocated by the > KVM for the s2 configuration. Hence, request a pinned VMID from KVM. > >

Re: [RFC PATCH 15/18] cgroup: Introduce ioasids controller

2021-03-04 Thread Jean-Philippe Brucker
On Wed, Mar 03, 2021 at 04:02:05PM -0800, Jacob Pan wrote: > Hi Jacob, > > On Wed, 3 Mar 2021 13:17:26 -0800, Jacob Pan > wrote: > > > Hi Tejun, > > > > On Wed, 3 Mar 2021 10:44:28 -0500, Tejun Heo wrote: > > > > > On Sat, Feb 27, 2021 at 02:01:23PM -0800, Jacob Pan wrote: > > > > IOASIDs

Re: [PATCH RFC v1 13/15] iommu/virtio: Attach Arm PASID tables when available

2021-03-03 Thread Jean-Philippe Brucker
On Fri, Jan 15, 2021 at 05:43:40PM +0530, Vivek Gautam wrote: [...] > +static int viommu_setup_pgtable(struct viommu_endpoint *vdev, > + struct viommu_domain *vdomain) > +{ > + int ret, id; > + u32 asid; > + enum io_pgtable_fmt fmt; > + struct

Re: [PATCH RFC v1 08/15] iommu: Add asid_bits to arm smmu-v3 stage1 table info

2021-03-03 Thread Jean-Philippe Brucker
On Fri, Jan 15, 2021 at 05:43:35PM +0530, Vivek Gautam wrote: > aisd_bits data is required to prepare stage-1 tables for arm-smmu-v3. > > Signed-off-by: Vivek Gautam > Cc: Joerg Roedel > Cc: Will Deacon > Cc: Robin Murphy > Cc: Jean-Philippe Brucker > Cc: Eric Auge

Re: [PATCH RFC v1 02/15] iommu: Add a simple PASID table library

2021-03-03 Thread Jean-Philippe Brucker
asive. Even if we called directly into the SMMU driver from the virtio one, we'd still need patch 3 and separate TLB invalidations ops. > Signed-off-by: Vivek Gautam > Cc: Joerg Roedel > Cc: Will Deacon > Cc: Robin Murphy > Cc: Jean-Philippe Brucker > Cc: Eric Auger >

Re: [PATCH RFC v1 15/15] iommu/virtio: Update fault type and reason info for viommu fault

2021-03-03 Thread Jean-Philippe Brucker
gned-off-by: Vivek Gautam > Cc: Joerg Roedel > Cc: Will Deacon > Cc: Michael S. Tsirkin > Cc: Robin Murphy > Cc: Jean-Philippe Brucker > Cc: Eric Auger > Cc: Alex Williamson > Cc: Kevin Tian > Cc: Jacob Pan > Cc: Liu Yi L > Cc: Lorenzo Pieralisi > Cc: Sh

Re: [PATCH RFC v1 05/15] iommu/arm-smmu-v3: Set sync op from consumer driver of cd-lib

2021-03-03 Thread Jean-Philippe Brucker
On Fri, Jan 15, 2021 at 05:43:32PM +0530, Vivek Gautam wrote: > Te change allows different consumers of arm-smmu-v3-cd-lib to set > their respective sync op for pasid entries. > > Signed-off-by: Vivek Gautam > Cc: Joerg Roedel > Cc: Will Deacon > Cc: Robin Murphy > C

Re: [PATCH RFC v1 06/15] iommu/virtio: Add headers for table format probing

2021-03-03 Thread Jean-Philippe Brucker
On Fri, Jan 15, 2021 at 05:43:33PM +0530, Vivek Gautam wrote: > From: Jean-Philippe Brucker > > Add required UAPI defines for probing table format for underlying > iommu hardware. The device may provide information about hardware > tables and additional capabilities

Re: [PATCH RFC v1 04/15] iommu/arm-smmu-v3: Update CD base address info for user-space

2021-03-03 Thread Jean-Philippe Brucker
On Fri, Jan 15, 2021 at 05:43:31PM +0530, Vivek Gautam wrote: > Update base address information in vendor pasid table info to pass that > to user-space for stage1 table management. > > Signed-off-by: Vivek Gautam > Cc: Joerg Roedel > Cc: Will Deacon > Cc: Robin Murphy

Re: [PATCH RFC v1 09/15] iommu/virtio: Update table format probing header

2021-03-03 Thread Jean-Philippe Brucker
On Fri, Jan 15, 2021 at 05:43:36PM +0530, Vivek Gautam wrote: > Add info about asid_bits and additional flags to table format > probing header. > > Signed-off-by: Vivek Gautam > Cc: Joerg Roedel > Cc: Will Deacon > Cc: Michael S. Tsirkin > Cc: Robin Murphy > Cc:

Re: [PATCH v6 08/12] fork: Clear PASID for new mm

2021-03-02 Thread Jean-Philippe Brucker
On Mon, Mar 01, 2021 at 03:00:11PM -0800, Jacob Pan wrote: > > functionality is not a problem without this patch on x86. But I think > I feel the reason that x86 doesn't care is that mm->pasid is not used > unless bind_mm is called. I think vt-d also maintains the global_svm_list, that tells

[PATCH] mm/fork: Clear PASID for new mm

2021-03-02 Thread Jean-Philippe Brucker
From: Fenghua Yu When a new mm is created, its PASID should be cleared, i.e. the PASID is initialized to its init state 0 on both ARM and X86. Reviewed-by: Tony Luck Signed-off-by: Fenghua Yu Signed-off-by: Jean-Philippe Brucker --- This patch was part of the series introducing mm->pa

[PATCH v13 10/10] iommu/arm-smmu-v3: Add stall support for platform devices

2021-03-02 Thread Jean-Philippe Brucker
initializes the fault queue for the device. Tested-by: Zhangfei Gao Reviewed-by: Jonathan Cameron Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 43 .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 59 +- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c

[PATCH v13 09/10] ACPI/IORT: Enable stall support for platform devices

2021-03-02 Thread Jean-Philippe Brucker
Copy the "Stall supported" bit, that tells whether a named component supports stall, into the dma-can-stall device property. Acked-by: Jonathan Cameron Signed-off-by: Jean-Philippe Brucker --- drivers/acpi/arm64/iort.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)

[PATCH v13 08/10] dt-bindings: document stall property for IOMMU masters

2021-03-02 Thread Jean-Philippe Brucker
On ARM systems, some platform devices behind an IOMMU may support stall, which is the ability to recover from page faults. Let the firmware tell us when a device supports stall. Reviewed-by: Eric Auger Reviewed-by: Rob Herring Signed-off-by: Jean-Philippe Brucker --- .../devicetree/bindings

[PATCH v13 06/10] iommu: Add a page fault handler

2021-03-02 Thread Jean-Philippe Brucker
Eric Auger Reviewed-by: Jonathan Cameron Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/Makefile| 1 + drivers/iommu/iommu-sva-lib.h | 53 include/linux/iommu.h | 2 + drivers/iommu/io-pgfault.c| 461 ++ 4 files changed, 517

[PATCH v13 07/10] iommu/arm-smmu-v3: Maintain a SID->device structure

2021-03-02 Thread Jean-Philippe Brucker
When handling faults from the event or PRI queue, we need to find the struct device associated with a SID. Add a rb_tree to keep track of SIDs. Acked-by: Jonathan Cameron Reviewed-by: Eric Auger Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 13

[PATCH v13 03/10] iommu: Separate IOMMU_DEV_FEAT_IOPF from IOMMU_DEV_FEAT_SVA

2021-03-02 Thread Jean-Philippe Brucker
IOMMU_DEV_FEAT_IOPF on its own doesn't have any effect visible to the device driver, it is used in combination with other features. Reviewed-by: Eric Auger Signed-off-by: Jean-Philippe Brucker --- Cc: Arnd Bergmann Cc: David Woodhouse Cc: Greg Kroah-Hartman Cc: Joerg Roedel Cc: Lu Baolu Cc

[PATCH v13 04/10] iommu/vt-d: Support IOMMU_DEV_FEAT_IOPF

2021-03-02 Thread Jean-Philippe Brucker
Allow drivers to query and enable IOMMU_DEV_FEAT_IOPF, which amounts to checking whether PRI is enabled. Reviewed-by: Lu Baolu Signed-off-by: Jean-Philippe Brucker --- Cc: David Woodhouse Cc: Lu Baolu --- drivers/iommu/intel/iommu.c | 11 --- 1 file changed, 8 insertions(+), 3

[PATCH v13 05/10] uacce: Enable IOMMU_DEV_FEAT_IOPF

2021-03-02 Thread Jean-Philippe Brucker
implementing a uacce interface doesn't need IOPF support, it will need to tell the uacce module, for example with a new flag. Acked-by: Zhangfei Gao Signed-off-by: Jean-Philippe Brucker --- Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: Zhangfei Gao Cc: Zhou Wang --- drivers/misc/uacce/uacce.c

[PATCH v13 01/10] iommu: Fix comment for struct iommu_fwspec

2021-03-02 Thread Jean-Philippe Brucker
Commit 986d5ecc5699 ("iommu: Move fwspec->iommu_priv to struct dev_iommu") removed iommu_priv from fwspec and commit 5702ee24182f ("ACPI/IORT: Check ATS capability in root complex nodes") added @flags. Update the struct doc. Acked-by: Jonathan Cameron Signed-off-by

[PATCH v13 00/10] iommu: I/O page faults for SMMUv3

2021-03-02 Thread Jean-Philippe Brucker
/mwhpr11mb188653af6efa0e55de17815f8c...@mwhpr11mb1886.namprd11.prod.outlook.com/ Jean-Philippe Brucker (10): iommu: Fix comment for struct iommu_fwspec iommu/arm-smmu-v3: Use device properties for pasid-num-bits iommu: Separate IOMMU_DEV_FEAT_IOPF from IOMMU_DEV_FEAT_SVA iommu/vt-d: Support

[PATCH v13 02/10] iommu/arm-smmu-v3: Use device properties for pasid-num-bits

2021-03-02 Thread Jean-Philippe Brucker
-by: Jean-Philippe Brucker --- include/linux/iommu.h | 2 -- drivers/acpi/arm64/iort.c | 13 +++-- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 3 ++- drivers/iommu/of_iommu.c| 5 - 4 files changed, 9 insertions(+), 14 deletions

Re: [PATCH v12 10/10] iommu/arm-smmu-v3: Add stall support for platform devices

2021-02-26 Thread Jean-Philippe Brucker
Hi Zhou, On Fri, Feb 26, 2021 at 05:43:27PM +0800, Zhou Wang wrote: > On 2021/2/1 19:14, Jean-Philippe Brucker wrote: > > Hi Zhou, > > > > On Mon, Feb 01, 2021 at 09:18:42AM +0800, Zhou Wang wrote: > >>> @@ -1033,8 +1076,7 @@ int arm_smmu_write_ctx_desc(struct ar

Re: [PATCH v6 08/12] fork: Clear PASID for new mm

2021-02-24 Thread Jean-Philippe Brucker
Hi Fenghua, [Trimmed the Cc list] On Mon, Jul 13, 2020 at 04:48:03PM -0700, Fenghua Yu wrote: > When a new mm is created, its PASID should be cleared, i.e. the PASID is > initialized to its init state 0 on both ARM and X86. I just noticed this patch was dropped in v7, and am wondering whether

Re: [EXTERNAL] Re: Question regarding VIOT proposal

2021-02-19 Thread Jean-Philippe Brucker
On Thu, Feb 18, 2021 at 04:39:43PM -0700, Al Stone wrote: > As of today, the proposal has been approved for inclusion in the next > release of the ACPI spec (whatever version gets released post the 6.4 > version that just came out). > > Congratulations ?!? :) > > And thanks to all for their

Re: [EXTERNAL] Re: Question regarding VIOT proposal

2021-02-17 Thread Jean-Philippe Brucker
On Tue, Feb 16, 2021 at 02:31:03PM -0700, Al Stone wrote: > Would you believe last week's meeting was canceled, too? Not sure > why the chair/co-chair are doing this but I'm finding it a little > frustrating. > > We'll try again this week ... again, apologies for the delays. I'd > recommend

Re: [RFC PATCH 01/11] iommu/arm-smmu-v3: Add feature detection for HTTU

2021-02-05 Thread Jean-Philippe Brucker
Hi Keqian, On Fri, Feb 05, 2021 at 05:13:50PM +0800, Keqian Zhu wrote: > > We need to accommodate the firmware override as well if we need this to be > > meaningful. Jean-Philippe is already carrying a suitable patch in the SVA > > stack[1]. > Robin, Thanks for pointing it out. > > Jean, I see

Re: [EXTERNAL] Re: Question regarding VIOT proposal

2021-02-03 Thread Jean-Philippe Brucker
On Tue, Feb 02, 2021 at 01:27:13PM -0700, Al Stone wrote: > On 02 Feb 2021 10:17, Jean-Philippe Brucker wrote: > > Hi Al, > > > > On Fri, Dec 04, 2020 at 01:18:25PM -0700, Al Stone wrote: > > > > I updated the doc: https://jpbrucker.net/virtio-iommu/viot/viot-v

Re: [EXTERNAL] Re: Question regarding VIOT proposal

2021-02-02 Thread Jean-Philippe Brucker
Hi Al, On Fri, Dec 04, 2020 at 01:18:25PM -0700, Al Stone wrote: > > I updated the doc: https://jpbrucker.net/virtio-iommu/viot/viot-v9.pdf > > You can incorporate it into the ASWG proposal. > > Changes since v8: > > * One typo (s/programing/programming/) > > * Modified the PCI Range node to

Re: [PATCH v12 10/10] iommu/arm-smmu-v3: Add stall support for platform devices

2021-02-01 Thread Jean-Philippe Brucker
On Mon, Feb 01, 2021 at 02:16:16PM +0100, Auger Eric wrote: > >>> + flt->type = IOMMU_FAULT_DMA_UNRECOV; > >>> + flt->event = (struct iommu_fault_unrecoverable) { > >>> + .reason = reason, > >>> + .flags = IOMMU_FAULT_UNRECOV_ADDR_VALID | > >>> +

Re: [PATCH v13 03/15] iommu/arm-smmu-v3: Maintain a SID->device structure

2021-02-01 Thread Jean-Philippe Brucker
On Mon, Feb 01, 2021 at 08:26:41PM +0800, Keqian Zhu wrote: > > +static int arm_smmu_insert_master(struct arm_smmu_device *smmu, > > + struct arm_smmu_master *master) > > +{ > > + int i; > > + int ret = 0; > > + struct arm_smmu_stream *new_stream, *cur_stream; > >

Re: [PATCH v12 10/10] iommu/arm-smmu-v3: Add stall support for platform devices

2021-02-01 Thread Jean-Philippe Brucker
Hi Zhou, On Mon, Feb 01, 2021 at 09:18:42AM +0800, Zhou Wang wrote: > > @@ -1033,8 +1076,7 @@ int arm_smmu_write_ctx_desc(struct arm_smmu_domain > > *smmu_domain, int ssid, > > FIELD_PREP(CTXDESC_CD_0_ASID, cd->asid) | > > CTXDESC_CD_0_V; > > > > -

Re: [PATCH v12 10/10] iommu/arm-smmu-v3: Add stall support for platform devices

2021-02-01 Thread Jean-Philippe Brucker
On Sun, Jan 31, 2021 at 07:29:09PM +0100, Auger Eric wrote: > Hi Jean, > > Some rather minor comments§questions below that may not justify a respin. > > On 1/27/21 4:43 PM, Jean-Philippe Brucker wrote: > > -static bool arm_smmu_iopf_supported(struct arm_smmu_mast

[PATCH v12 10/10] iommu/arm-smmu-v3: Add stall support for platform devices

2021-01-27 Thread Jean-Philippe Brucker
initializes the fault queue for the device. Tested-by: Zhangfei Gao Reviewed-by: Jonathan Cameron Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 43 .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 59 +- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c

[PATCH v12 09/10] ACPI/IORT: Enable stall support for platform devices

2021-01-27 Thread Jean-Philippe Brucker
Copy the "Stall supported" bit, that tells whether a named component supports stall, into the dma-can-stall device property. Acked-by: Jonathan Cameron Signed-off-by: Jean-Philippe Brucker --- drivers/acpi/arm64/iort.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)

[PATCH v12 07/10] iommu/arm-smmu-v3: Maintain a SID->device structure

2021-01-27 Thread Jean-Philippe Brucker
When handling faults from the event or PRI queue, we need to find the struct device associated with a SID. Add a rb_tree to keep track of SIDs. Acked-by: Jonathan Cameron Reviewed-by: Eric Auger Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 13

[PATCH v12 08/10] dt-bindings: document stall property for IOMMU masters

2021-01-27 Thread Jean-Philippe Brucker
On ARM systems, some platform devices behind an IOMMU may support stall, which is the ability to recover from page faults. Let the firmware tell us when a device supports stall. Reviewed-by: Rob Herring Signed-off-by: Jean-Philippe Brucker --- .../devicetree/bindings/iommu/iommu.txt

[PATCH v12 06/10] iommu: Add a page fault handler

2021-01-27 Thread Jean-Philippe Brucker
an Cameron Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/Makefile| 1 + drivers/iommu/iommu-sva-lib.h | 53 include/linux/iommu.h | 2 + drivers/iommu/io-pgfault.c| 461 ++ 4 files changed, 517 insertions(+) create mode 1006

[PATCH v12 05/10] uacce: Enable IOMMU_DEV_FEAT_IOPF

2021-01-27 Thread Jean-Philippe Brucker
implementing a uacce interface doesn't need IOPF support, it will need to tell the uacce module, for example with a new flag. Acked-by: Zhangfei Gao Signed-off-by: Jean-Philippe Brucker --- Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: Zhangfei Gao Cc: Zhou Wang --- drivers/misc/uacce/uacce.c

[PATCH v12 04/10] iommu/vt-d: Support IOMMU_DEV_FEAT_IOPF

2021-01-27 Thread Jean-Philippe Brucker
Allow drivers to query and enable IOMMU_DEV_FEAT_IOPF, which amounts to checking whether PRI is enabled. Reviewed-by: Lu Baolu Signed-off-by: Jean-Philippe Brucker --- Cc: David Woodhouse Cc: Lu Baolu --- drivers/iommu/intel/iommu.c | 11 --- 1 file changed, 8 insertions(+), 3

[PATCH v12 03/10] iommu: Separate IOMMU_DEV_FEAT_IOPF from IOMMU_DEV_FEAT_SVA

2021-01-27 Thread Jean-Philippe Brucker
IOMMU_DEV_FEAT_IOPF on its own doesn't have any effect visible to the device driver, it is used in combination with other features. Signed-off-by: Jean-Philippe Brucker --- Cc: Arnd Bergmann Cc: David Woodhouse Cc: Greg Kroah-Hartman Cc: Joerg Roedel Cc: Lu Baolu Cc: Will Deacon Cc: Zhangfei Gao

[PATCH v12 01/10] iommu: Fix comment for struct iommu_fwspec

2021-01-27 Thread Jean-Philippe Brucker
Commit 986d5ecc5699 ("iommu: Move fwspec->iommu_priv to struct dev_iommu") removed iommu_priv from fwspec and commit 5702ee24182f ("ACPI/IORT: Check ATS capability in root complex nodes") added @flags. Update the struct doc. Acked-by: Jonathan Cameron Signed-off-by

[PATCH v12 02/10] iommu/arm-smmu-v3: Use device properties for pasid-num-bits

2021-01-27 Thread Jean-Philippe Brucker
The pasid-num-bits property shouldn't need a dedicated fwspec field, it's a job for device properties. Add properties for IORT, and access the number of PASID bits using device_property_read_u32(). Suggested-by: Robin Murphy Acked-by: Jonathan Cameron Signed-off-by: Jean-Philippe Brucker

[PATCH v12 00/10] iommu: I/O page faults for SMMUv3

2021-01-27 Thread Jean-Philippe Brucker
://lore.kernel.org/linux-iommu/20210125110650.3232195-1-jean-phili...@linaro.org/ v10: https://lore.kernel.org/linux-iommu/20210121123623.2060416-1-jean-phili...@linaro.org/ v9: https://lore.kernel.org/linux-iommu/20210108145217.2254447-1-jean-phili...@linaro.org/ Jean-Philippe Brucker (10

Re: [PATCH v11 10/10] iommu/arm-smmu-v3: Add stall support for platform devices

2021-01-25 Thread Jean-Philippe Brucker
On Mon, Jan 25, 2021 at 01:50:09PM +, Jonathan Cameron wrote: > > +static int arm_smmu_master_sva_enable_iopf(struct arm_smmu_master *master) > > +{ > > + int ret; > > + struct device *dev = master->dev; > > + > > + /* > > +* Drivers for devices supporting PRI or stall should enable

[PATCH v11 10/10] iommu/arm-smmu-v3: Add stall support for platform devices

2021-01-25 Thread Jean-Philippe Brucker
initializes the fault queue for the device. Tested-by: Zhangfei Gao Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 43 .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 59 +- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 187 +- 3

[PATCH v11 09/10] ACPI/IORT: Enable stall support for platform devices

2021-01-25 Thread Jean-Philippe Brucker
Copy the "Stall supported" bit, that tells whether a named component supports stall, into the dma-can-stall device property. Acked-by: Jonathan Cameron Signed-off-by: Jean-Philippe Brucker --- drivers/acpi/arm64/iort.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)

[PATCH v11 06/10] iommu: Add a page fault handler

2021-01-25 Thread Jean-Philippe Brucker
an Cameron Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/Makefile| 1 + drivers/iommu/iommu-sva-lib.h | 53 include/linux/iommu.h | 2 + drivers/iommu/io-pgfault.c| 461 ++ 4 files changed, 517 insertions(+) create mode 1006

[PATCH v11 07/10] iommu/arm-smmu-v3: Maintain a SID->device structure

2021-01-25 Thread Jean-Philippe Brucker
When handling faults from the event or PRI queue, we need to find the struct device associated with a SID. Add a rb_tree to keep track of SIDs. Acked-by: Jonathan Cameron Reviewed-by: Eric Auger Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 13

[PATCH v11 08/10] dt-bindings: document stall property for IOMMU masters

2021-01-25 Thread Jean-Philippe Brucker
On ARM systems, some platform devices behind an IOMMU may support stall, which is the ability to recover from page faults. Let the firmware tell us when a device supports stall. Reviewed-by: Rob Herring Signed-off-by: Jean-Philippe Brucker --- .../devicetree/bindings/iommu/iommu.txt

[PATCH v11 04/10] iommu/vt-d: Support IOMMU_DEV_FEAT_IOPF

2021-01-25 Thread Jean-Philippe Brucker
Allow drivers to query and enable IOMMU_DEV_FEAT_IOPF, which amounts to checking whether PRI is enabled. Reviewed-by: Lu Baolu Signed-off-by: Jean-Philippe Brucker --- Cc: David Woodhouse Cc: Lu Baolu --- drivers/iommu/intel/iommu.c | 11 --- 1 file changed, 8 insertions(+), 3

[PATCH v11 05/10] uacce: Enable IOMMU_DEV_FEAT_IOPF

2021-01-25 Thread Jean-Philippe Brucker
implementing a uacce interface doesn't need IOPF support, it will need to tell the uacce module, for example with a new flag. Acked-by: Zhangfei Gao Signed-off-by: Jean-Philippe Brucker --- Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: Zhangfei Gao Cc: Zhou Wang --- drivers/misc/uacce/uacce.c

[PATCH v11 03/10] iommu: Separate IOMMU_DEV_FEAT_IOPF from IOMMU_DEV_FEAT_SVA

2021-01-25 Thread Jean-Philippe Brucker
IOMMU_DEV_FEAT_IOPF on its own doesn't have any effect visible to the device driver, it is used in combination with other features. Signed-off-by: Jean-Philippe Brucker --- Cc: Arnd Bergmann Cc: David Woodhouse Cc: Greg Kroah-Hartman Cc: Joerg Roedel Cc: Lu Baolu Cc: Will Deacon Cc: Zhangfei Gao

[PATCH v11 02/10] iommu/arm-smmu-v3: Use device properties for pasid-num-bits

2021-01-25 Thread Jean-Philippe Brucker
The pasid-num-bits property shouldn't need a dedicated fwspec field, it's a job for device properties. Add properties for IORT, and access the number of PASID bits using device_property_read_u32(). Suggested-by: Robin Murphy Acked-by: Jonathan Cameron Signed-off-by: Jean-Philippe Brucker

[PATCH v11 01/10] iommu: Fix comment for struct iommu_fwspec

2021-01-25 Thread Jean-Philippe Brucker
Commit 986d5ecc5699 ("iommu: Move fwspec->iommu_priv to struct dev_iommu") removed iommu_priv from fwspec and commit 5702ee24182f ("ACPI/IORT: Check ATS capability in root complex nodes") added @flags. Update the struct doc. Acked-by: Jonathan Cameron Signed-off-by

[PATCH v11 00/10] iommu: I/O page faults for SMMUv3

2021-01-25 Thread Jean-Philippe Brucker
org/ Jean-Philippe Brucker (10): iommu: Fix comment for struct iommu_fwspec iommu/arm-smmu-v3: Use device properties for pasid-num-bits iommu: Separate IOMMU_DEV_FEAT_IOPF from IOMMU_DEV_FEAT_SVA iommu/vt-d: Support IOMMU_DEV_FEAT_IOPF uacce: Enable IOMMU_DEV_FEAT_IOPF iommu: Add a p

[PATCH v2 0/3] iommu/arm-smmu-v3: TLB invalidation for SVA

2021-01-22 Thread Jean-Philippe Brucker
/ Jean-Philippe Brucker (3): iommu/arm-smmu-v3: Split arm_smmu_tlb_inv_range() iommu/arm-smmu-v3: Make BTM optional for SVA iommu/arm-smmu-v3: Add support for VHE drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 6 + .../iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 10 +- drivers/iommu/arm

[PATCH v2 3/3] iommu/arm-smmu-v3: Add support for VHE

2021-01-22 Thread Jean-Philippe Brucker
in the SMMU for all STEs. Normal DMA mappings will need to use TLBI_EL2 commands instead of TLBI_NH, but shouldn't be otherwise affected by this change. Acked-by: Will Deacon Reviewed-by: Jonathan Cameron Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 3

[PATCH v2 2/3] iommu/arm-smmu-v3: Make BTM optional for SVA

2021-01-22 Thread Jean-Philippe Brucker
When BTM isn't supported by the SMMU, send invalidations on the command queue. Reviewed-by: Jonathan Cameron Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 3 +++ drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 10 +++--- drivers/iommu/arm/arm

[PATCH v2 1/3] iommu/arm-smmu-v3: Split arm_smmu_tlb_inv_range()

2021-01-22 Thread Jean-Philippe Brucker
Extract some of the cmd initialization and the ATC invalidation from arm_smmu_tlb_inv_range(), to allow an MMU notifier to invalidate a VA range by ASID. Reviewed-by: Jonathan Cameron Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 63

Re: [PATCH 2/3] iommu/arm-smmu-v3: Make BTM optional for SVA

2021-01-22 Thread Jean-Philippe Brucker
On Fri, Jan 22, 2021 at 02:04:55PM +, Robin Murphy wrote: > > @@ -182,9 +183,13 @@ static void arm_smmu_mm_invalidate_range(struct > > mmu_notifier *mn, > > unsigned long start, unsigned long end) > > { > > struct arm_smmu_mmu_notifier *smmu_mn =

Re: [PATCH] iommu/arm-smmu-v3: Remove the page 1 fixup

2021-01-22 Thread Jean-Philippe Brucker
tecture spec (IHI0070D.a) defines SMMU_{EVENTQ,PRIQ}_{PROD,CONS} as > offsets relative to page 1, so the cleanup represents a little bit of > convergence as well as just lines of code saved. > > Signed-off-by: Robin Murphy Reviewed-by: Jean-Philippe Brucker > --- > drivers/

[PATCH 1/3] iommu/arm-smmu-v3: Split arm_smmu_tlb_inv_range()

2021-01-22 Thread Jean-Philippe Brucker
Extract some of the cmd initialization and the ATC invalidation from arm_smmu_tlb_inv_range(), to allow an MMU notifier to invalidate a VA range by ASID. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 62 - 1 file changed, 35

[PATCH 2/3] iommu/arm-smmu-v3: Make BTM optional for SVA

2021-01-22 Thread Jean-Philippe Brucker
When BTM isn't supported by the SMMU, send invalidations on the command queue. Signed-off-by: Jean-Philippe Brucker --- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h | 3 +++ drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c | 14 +++--- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c

<    1   2   3   4   5   6   7   8   9   10   >