Re: [PATCH 2/5] kernel/dma: remove unnecessary unmap_kernel_range

2021-01-25 Thread Christoph Hellwig
On Tue, Jan 26, 2021 at 02:54:01PM +1000, Nicholas Piggin wrote: > vunmap will remove ptes. Looks good, Reviewed-by: Christoph Hellwig ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [RFT PATCH 0/3] Performance regression noted in v5.11-rc after c062db039f40

2021-01-25 Thread Lu Baolu
On 2021/1/26 3:31, Chuck Lever wrote: On Jan 25, 2021, at 12:39 PM, Chuck Lever wrote: Hello Lu - Many thanks for your prototype. On Jan 24, 2021, at 9:38 PM, Lu Baolu wrote: This patch series is only for Request-For-Testing purpose. It aims to fix the performance regression reported

Re: [PATCH 2/3] memory: mtk-smi: Add module_exit and module_license

2021-01-25 Thread Yong Wu
On Mon, 2021-01-25 at 11:40 +0100, Krzysztof Kozlowski wrote: > On Mon, Jan 25, 2021 at 05:28:05PM +0800, Yong Wu wrote: > > On Mon, 2021-01-25 at 09:40 +0100, Krzysztof Kozlowski wrote: > > > On Mon, Jan 25, 2021 at 02:49:41PM +0800, Yong Wu wrote: > > > > On Fri, 2021-01-22 at 22:34 +0100,

[PATCH v2] memory: mtk-smi: Support SMI modular

2021-01-25 Thread Yong Wu
This patch mainly support SMI modular. Switch MTK_SMI to tristate, and add module_exit/module_license. Signed-off-by: Yong Wu --- This patch rebase on the clean v5.11-rc1. and this one: memory: mtk-smi: Use platform_register_drivers

[PATCH 2/5] kernel/dma: remove unnecessary unmap_kernel_range

2021-01-25 Thread Nicholas Piggin
vunmap will remove ptes. Cc: Christoph Hellwig Cc: Marek Szyprowski Cc: Robin Murphy Cc: iommu@lists.linux-foundation.org Signed-off-by: Nicholas Piggin --- kernel/dma/remap.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/dma/remap.c b/kernel/dma/remap.c index

RE: [RFC PATCH v2] uacce: Add uacce_ctrl misc device

2021-01-25 Thread Song Bao Hua (Barry Song)
> -Original Message- > From: Jason Gunthorpe [mailto:j...@ziepe.ca] > Sent: Tuesday, January 26, 2021 2:13 PM > To: Song Bao Hua (Barry Song) > Cc: Wangzhou (B) ; Greg Kroah-Hartman > ; Arnd Bergmann ; Zhangfei Gao > ; linux-accelerat...@lists.ozlabs.org; >

Re: [RFC PATCH v2] uacce: Add uacce_ctrl misc device

2021-01-25 Thread Jason Gunthorpe
On Mon, Jan 25, 2021 at 11:35:22PM +, Song Bao Hua (Barry Song) wrote: > > On Mon, Jan 25, 2021 at 10:21:14PM +, Song Bao Hua (Barry Song) wrote: > > > mlock, while certainly be able to prevent swapping out, it won't > > > be able to stop page moving due to: > > > * memory compaction in

RE: [PATCH v5 04/16] iommu/hyperv: don't setup IRQ remapping when running as root

2021-01-25 Thread Michael Kelley via iommu
From: Wei Liu Sent: Wednesday, January 20, 2021 4:01 AM > > The IOMMU code needs more work. We're sure for now the IRQ remapping > hooks are not applicable when Linux is the root partition. > > Signed-off-by: Wei Liu > Acked-by: Joerg Roedel > Reviewed-by: Vitaly Kuznetsov > --- >

Re: [RFC PATCH v2] uacce: Add uacce_ctrl misc device

2021-01-25 Thread Jason Gunthorpe
On Mon, Jan 25, 2021 at 10:21:14PM +, Song Bao Hua (Barry Song) wrote: > mlock, while certainly be able to prevent swapping out, it won't > be able to stop page moving due to: > * memory compaction in alloc_pages() > * making huge pages > * numa balance > * memory compaction in CMA Enabling

RE: [RFC PATCH v2] uacce: Add uacce_ctrl misc device

2021-01-25 Thread Song Bao Hua (Barry Song)
> -Original Message- > From: owner-linux...@kvack.org [mailto:owner-linux...@kvack.org] On Behalf Of > Jason Gunthorpe > Sent: Tuesday, January 26, 2021 12:16 PM > To: Song Bao Hua (Barry Song) > Cc: Wangzhou (B) ; Greg Kroah-Hartman > ; Arnd Bergmann ; Zhangfei Gao > ;

RE: [RFC PATCH v2] uacce: Add uacce_ctrl misc device

2021-01-25 Thread Song Bao Hua (Barry Song)
> -Original Message- > From: Jason Gunthorpe [mailto:j...@ziepe.ca] > Sent: Tuesday, January 26, 2021 4:47 AM > To: Wangzhou (B) > Cc: Greg Kroah-Hartman ; Arnd Bergmann > ; Zhangfei Gao ; > linux-accelerat...@lists.ozlabs.org; linux-ker...@vger.kernel.org; >

[PATCH] iommu/arm-smmu-qcom: Fix mask extraction for bootloader programmed SMRs

2021-01-25 Thread Isaac J. Manjarres
When extracting the mask for a SMR that was programmed by the bootloader, the SMR's valid bit is also extracted and is treated as part of the mask, which is not correct. Consider the scenario where an SMMU master whose context is determined by a bootloader programmed SMR is removed (omitting parts

Re: [PATCH v2 1/3] iommu/arm-smmu: Add support for driver IOMMU fault handlers

2021-01-25 Thread Jordan Crouse
On Fri, Jan 22, 2021 at 12:53:17PM +, Robin Murphy wrote: > On 2021-01-22 12:41, Will Deacon wrote: > >On Tue, Nov 24, 2020 at 12:15:58PM -0700, Jordan Crouse wrote: > >>Call report_iommu_fault() to allow upper-level drivers to register their > >>own fault handlers. > >> > >>Signed-off-by:

Re: [PATCH 1/1] iommu/arm-smmu-v3: add support for BBML

2021-01-25 Thread Robin Murphy
On 2021-01-23 10:08, Leizhen (ThunderTown) wrote: On 2021/1/22 20:51, Will Deacon wrote: On Thu, Nov 26, 2020 at 11:42:30AM +0800, Zhen Lei wrote: When changing from a set of pages/smaller blocks to a larger block for an address, the software should follow the sequence of BBML processing.

Re: [PATCH 1/1] iommu/arm-smmu-v3: add support for BBML

2021-01-25 Thread Robin Murphy
On 2021-01-23 10:20, Leizhen (ThunderTown) wrote: On 2021/1/22 21:00, Robin Murphy wrote: On 2021-01-22 12:51, Will Deacon wrote: On Thu, Nov 26, 2020 at 11:42:30AM +0800, Zhen Lei wrote: When changing from a set of pages/smaller blocks to a larger block for an address, the software should

Re: [RFT PATCH 0/3] Performance regression noted in v5.11-rc after c062db039f40

2021-01-25 Thread Chuck Lever
> On Jan 25, 2021, at 12:39 PM, Chuck Lever wrote: > > Hello Lu - > > Many thanks for your prototype. > > >> On Jan 24, 2021, at 9:38 PM, Lu Baolu wrote: >> >> This patch series is only for Request-For-Testing purpose. It aims to >> fix the performance regression reported here. >> >>

Re: [PATCH] swiotlb: Validate bounce size in the sync/unmap path

2021-01-25 Thread Martin Radev
On Mon, Jan 18, 2021 at 10:14:28AM -0500, Konrad Rzeszutek Wilk wrote: > On Mon, Jan 18, 2021 at 12:44:58PM +0100, Martin Radev wrote: > > On Wed, Jan 13, 2021 at 12:30:17PM +0100, Christoph Hellwig wrote: > > > On Tue, Jan 12, 2021 at 04:07:29PM +0100, Martin Radev wrote: > > > > The size of the

Re: [RFT PATCH 0/3] Performance regression noted in v5.11-rc after c062db039f40

2021-01-25 Thread Chuck Lever
Hello Lu - Many thanks for your prototype. > On Jan 24, 2021, at 9:38 PM, Lu Baolu wrote: > > This patch series is only for Request-For-Testing purpose. It aims to > fix the performance regression reported here. > >

Re: [RFC PATCH v2] uacce: Add uacce_ctrl misc device

2021-01-25 Thread Jason Gunthorpe
On Mon, Jan 25, 2021 at 04:34:56PM +0800, Zhou Wang wrote: > +static int uacce_pin_page(struct uacce_pin_container *priv, > + struct uacce_pin_address *addr) > +{ > + unsigned int flags = FOLL_FORCE | FOLL_WRITE; > + unsigned long first, last, nr_pages; > +

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

AMD-Vi: Unable to read/write to IOMMU perf counter

2021-01-25 Thread Tj (Elloe Linux)
Lenovo E495 reports: pci :00:00.2: AMD-Vi: Unable to read/write to IOMMU perf counter. pci :00:00.2: can't derive routing for PCI INT A pci :00:00.2: PCI INT A: not connected I found an existing identical bug report that doesn't seem to have gained any attention:

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

2021-01-25 Thread Jonathan Cameron
On Mon, 25 Jan 2021 12:06:51 +0100 Jean-Philippe Brucker wrote: > The SMMU provides a Stall model for handling page faults in platform > devices. It is similar to PCIe PRI, but doesn't require devices to have > their own translation cache. Instead, faulting transactions are parked > and the OS

Re: [PATCH RFC v1 00/15] iommu/virtio: Nested stage support with Arm

2021-01-25 Thread Vivek Kumar Gautam
Hi Shameer, On 1/22/21 9:19 PM, Shameerali Kolothum Thodi wrote: Hi Vivek, -Original Message- From: Vivek Kumar Gautam [mailto:vivek.gau...@arm.com] Sent: 21 January 2021 17:34 To: Auger Eric ; linux-ker...@vger.kernel.org; linux-arm-ker...@lists.infradead.org;

Re: [RFC PATCH v2] uacce: Add uacce_ctrl misc device

2021-01-25 Thread Zhou Wang
On 2021/1/25 17:28, Greg Kroah-Hartman wrote: > On Mon, Jan 25, 2021 at 04:34:56PM +0800, Zhou Wang wrote: >> +static int uacce_pin_page(struct uacce_pin_container *priv, >> + struct uacce_pin_address *addr) >> +{ >> +unsigned int flags = FOLL_FORCE | FOLL_WRITE; >> +

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

2021-01-25 Thread Jean-Philippe Brucker
The SMMU provides a Stall model for handling page faults in platform devices. It is similar to PCIe PRI, but doesn't require devices to have their own translation cache. Instead, faulting transactions are parked and the OS is given a chance to fix the page tables and retry the transaction. Enable

[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(-) diff --git

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

2021-01-25 Thread Jean-Philippe Brucker
Some systems allow devices to handle I/O Page Faults in the core mm. For example systems implementing the PCIe PRI extension or Arm SMMU stall model. Infrastructure for reporting these recoverable page faults was added to the IOMMU core by commit 0c830e6b3282 ("iommu: Introduce device fault report

[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
The IOPF (I/O Page Fault) feature is now enabled independently from the SVA feature, because some IOPF implementations are device-specific and do not require IOMMU support for PCIe PRI or Arm SMMU stall. Enable IOPF unconditionally when enabling SVA for now. In the future, if a device driver

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

2021-01-25 Thread Jean-Philippe Brucker
Some devices manage I/O Page Faults (IOPF) themselves instead of relying on PCIe PRI or Arm SMMU stall. Allow their drivers to enable SVA without mandating IOMMU-managed IOPF. The other device drivers now need to first enable IOMMU_DEV_FEAT_IOPF before enabling IOMMU_DEV_FEAT_SVA. Enabling

[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: Jean-Philippe Brucker ---

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

2021-01-25 Thread Jean-Philippe Brucker
Add stall support to the SMMUv3, along with a common I/O Page Fault handler. This version fixes a typo introduced in v10 [1] and adds review tags (thanks!) You can find the range diff for v10->v11 below. [1] https://lore.kernel.org/linux-iommu/20210121123623.2060416-1-jean-phili...@linaro.org/

Re: [PATCH 2/3] memory: mtk-smi: Add module_exit and module_license

2021-01-25 Thread Krzysztof Kozlowski
On Mon, Jan 25, 2021 at 05:28:05PM +0800, Yong Wu wrote: > On Mon, 2021-01-25 at 09:40 +0100, Krzysztof Kozlowski wrote: > > On Mon, Jan 25, 2021 at 02:49:41PM +0800, Yong Wu wrote: > > > On Fri, 2021-01-22 at 22:34 +0100, Krzysztof Kozlowski wrote: > > > > On Thu, Jan 21, 2021 at 02:24:28PM

Re: [PATCH 3/3] memory: mtk-smi: Switch MTK_SMI to tristate

2021-01-25 Thread Yong Wu
On Mon, 2021-01-25 at 09:44 +0100, Krzysztof Kozlowski wrote: > On Mon, Jan 25, 2021 at 02:49:44PM +0800, Yong Wu wrote: > > On Fri, 2021-01-22 at 22:35 +0100, Krzysztof Kozlowski wrote: > > > On Thu, Jan 21, 2021 at 02:24:29PM +0800, Yong Wu wrote: > > > > This patch switches MTK_SMI to tristate.

Re: [RFC PATCH v2] uacce: Add uacce_ctrl misc device

2021-01-25 Thread Greg Kroah-Hartman
On Mon, Jan 25, 2021 at 04:34:56PM +0800, Zhou Wang wrote: > +static int uacce_pin_page(struct uacce_pin_container *priv, > + struct uacce_pin_address *addr) > +{ > + unsigned int flags = FOLL_FORCE | FOLL_WRITE; > + unsigned long first, last, nr_pages; > + struct

Re: [PATCH 2/3] memory: mtk-smi: Add module_exit and module_license

2021-01-25 Thread Yong Wu
On Mon, 2021-01-25 at 09:40 +0100, Krzysztof Kozlowski wrote: > On Mon, Jan 25, 2021 at 02:49:41PM +0800, Yong Wu wrote: > > On Fri, 2021-01-22 at 22:34 +0100, Krzysztof Kozlowski wrote: > > > On Thu, Jan 21, 2021 at 02:24:28PM +0800, Yong Wu wrote: > > > > The config MTK_SMI always depends on

Re: [PATCH 3/3] memory: mtk-smi: Switch MTK_SMI to tristate

2021-01-25 Thread Krzysztof Kozlowski
On Mon, Jan 25, 2021 at 02:49:44PM +0800, Yong Wu wrote: > On Fri, 2021-01-22 at 22:35 +0100, Krzysztof Kozlowski wrote: > > On Thu, Jan 21, 2021 at 02:24:29PM +0800, Yong Wu wrote: > > > This patch switches MTK_SMI to tristate. Support it could be 'm'. > > > > > > Meanwhile, Fix a build issue

Re: [PATCH RFC v1 00/15] iommu/virtio: Nested stage support with Arm

2021-01-25 Thread Auger Eric
Hi Vivek, On 1/21/21 6:34 PM, Vivek Kumar Gautam wrote: > Hi Eric, > > > On 1/19/21 2:33 PM, Auger Eric wrote: >> Hi Vivek, >> >> On 1/15/21 1:13 PM, Vivek Gautam wrote: >>> This patch-series aims at enabling Nested stage translation in guests >>> using virtio-iommu as the paravirtualized

Re: [PATCH 2/3] memory: mtk-smi: Add module_exit and module_license

2021-01-25 Thread Krzysztof Kozlowski
On Mon, Jan 25, 2021 at 02:49:41PM +0800, Yong Wu wrote: > On Fri, 2021-01-22 at 22:34 +0100, Krzysztof Kozlowski wrote: > > On Thu, Jan 21, 2021 at 02:24:28PM +0800, Yong Wu wrote: > > > The config MTK_SMI always depends on MTK_IOMMU which is built-in > > > currently. Thus we don't have

[RFC PATCH v2] uacce: Add uacce_ctrl misc device

2021-01-25 Thread Zhou Wang
Uacce driver supports to use devices in user space safely by SVA. However, IO page fault may happen when doing DMA operations, which will affect DMA performance severely. For some accelerators which need stable performance, it is better to avoid IO page fault totally. Current memory related APIs,

Re: [PATCH 1/3] iommu/vt-d: Add rate limited information when PRQ overflows

2021-01-25 Thread Lu Baolu
Hi Kevin, On 2021/1/25 16:16, Tian, Kevin wrote: From: Lu Baolu Sent: Monday, January 25, 2021 2:29 PM Hi Kevin, On 2021/1/22 14:38, Tian, Kevin wrote: From: Lu Baolu Sent: Thursday, January 21, 2021 9:45 AM So that the uses could get chances to know what happened. Suggested-by: Ashok

RE: [PATCH 1/3] iommu/vt-d: Add rate limited information when PRQ overflows

2021-01-25 Thread Tian, Kevin
> From: Lu Baolu > Sent: Monday, January 25, 2021 2:29 PM > > Hi Kevin, > > On 2021/1/22 14:38, Tian, Kevin wrote: > >> From: Lu Baolu > >> Sent: Thursday, January 21, 2021 9:45 AM > >> > >> So that the uses could get chances to know what happened. > >> > >> Suggested-by: Ashok Raj > >>