Re: [PATCH 1/9] mm: Introduce new vm_insert_range API

2018-11-16 Thread Souptick Joarder
On Fri, Nov 16, 2018 at 11:59 PM Mike Rapoport wrote: > > On Thu, Nov 15, 2018 at 09:15:30PM +0530, Souptick Joarder wrote: > > Previouly drivers have their own way of mapping range of > > kernel pages/memory into user vma and this was done by > > invoking vm_insert_page() within a loop. > > > >

Re: [PATCH v4 6/8] vfio/mdev: Add iommu place holders in mdev_device

2018-11-16 Thread Lu Baolu
Hi, On 11/16/18 4:57 PM, Christoph Hellwig wrote: On Fri, Nov 16, 2018 at 09:20:48AM +0800, Lu Baolu wrote: Please keep symbols mdev_set/get_iommu_device(dev, iommu_device) non-GPL same as other exported symbols from mdev_core module. Yes. It will be fixed in the next version. No. mdev

[PATCH v3 14/15] iommu/mediatek: Constify iommu_ops

2018-11-16 Thread Yong Wu
From: Arvind Yadav iommu_ops are not supposed to change at runtime. Functions 'iommu_device_set_ops' and 'bus_set_iommu' working with const iommu_ops provided by . So mark the non-const structs as const. Signed-off-by: Arvind Yadav Signed-off-by: Yong Wu [Yong: Change the title to

[PATCH v3 15/15] iommu/mediatek: Switch to SPDX license identifier

2018-11-16 Thread Yong Wu
Switch to SPDX license identifier for MediaTek iommu/smi and their header files. Signed-off-by: Yong Wu Reviewed-by: Rob Herring --- drivers/iommu/mtk_iommu.c | 9 + drivers/iommu/mtk_iommu.h | 10 +- drivers/iommu/mtk_iommu_v1.c

[PATCH v3 13/15] memory: mtk-smi: Get rid of need_larbid

2018-11-16 Thread Yong Wu
The "mediatek,larb-id" has already been parsed in MTK IOMMU driver. It's no need to parse it again in SMI driver. Only clean some codes. This patch is fit for all the current mt2701, mt2712, mt7623, mt8173 and mt8183. Signed-off-by: Yong Wu --- drivers/memory/mtk-smi.c | 27

[PATCH v3 11/15] iommu/mediatek: Add VLD_PA_RANGE register backup when suspend

2018-11-16 Thread Yong Wu
The register VLD_PA_RNG(0x118) was forgot to backup while adding 4GB mode support for mt2712. this patch add it. Fixes: 30e2fccf9512 ("iommu/mediatek: Enlarge the validate PA range for 4GB mode") Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 2 ++ drivers/iommu/mtk_iommu.h | 1 + 2

[PATCH v3 12/15] iommu/mediatek: Add shutdown callback

2018-11-16 Thread Yong Wu
In the reboot burning test, if some Multimedia HW has something wrong, It may keep send the invalid request to IOMMU. In order to avoid affect the reboot flow, we add the shutdown callback to disable M4U HW when shutdown. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 6 ++ 1 file

[PATCH v3 10/15] memory: mtk-smi: Add bus_sel for mt8183

2018-11-16 Thread Yong Wu
There are 2 mmu cells in a M4U HW. we could adjust some larbs entering mmu0 or mmu1 to balance the bandwidth via the smi-common register SMI_BUS_SEL(0x220)(Each larb occupy 2 bits). In mt8183, For better performance, we switch larb1/2/3/7 to enter mmu1 while the others still keep enter mmu0. In

[PATCH v3 09/15] memory: mtk-smi: Use a struct for the platform data for smi-common

2018-11-16 Thread Yong Wu
Use a struct as the platform special data instead of the enumeration. Also there is a minor change that moving the position of "enum mtk_smi_gen" definition, this is because we expect define "struct mtk_smi_common_plat" before it is referred. This is a prepare patch for adding bus_sel for

[PATCH v3 08/15] memory: mtk-smi: Invoke pm runtime_callback to enable clocks

2018-11-16 Thread Yong Wu
This patch only move the clk_prepare_enable and config_port into the runtime suspend/resume callback. It doesn't change the code content and sequence. This is a prepare patch for adjusting SMI_BUS_SEL for mt8183. (SMI_BUS_SEL need to be restored after smi-common resume every time.) Also it gives

[PATCH v3 06/15] iommu/mediatek: Add mt8183 IOMMU support

2018-11-16 Thread Yong Wu
The M4U IP blocks in mt8183 is MediaTek's generation2 M4U which use the ARM Short-descriptor like mt8173, and most of the HW registers are the same. Here list main changes in mt8183: 1) mt8183 has only one M4U HW like mt8173. 2) mt8183 don't have its "bclk" clock, the M4U use the EMI clock which

[PATCH v3 05/15] iommu/io-pgtable-arm-v7s: Extend MediaTek 4GB Mode

2018-11-16 Thread Yong Wu
MediaTek extend the arm v7s descriptor to support the dram over 4GB. In the mt2712 and mt8173, it's called "4GB mode", the physical address is from 0x4000_ to 0x1_3fff_, but from EMI point of view, it is remapped to high address from 0x1__ to 0x1__, the bit32 is always

[PATCH v3 07/15] iommu/mediatek: Add mmu1 support

2018-11-16 Thread Yong Wu
Normally the M4U HW connect EMI with smi. the diagram is like below: EMI | M4U | smi-common | - ||| |... larb0 larb1 larb2 larb3 Actually there are 2 mmu cells

[PATCH v3 02/15] iommu/mediatek: Use a struct as the platform data

2018-11-16 Thread Yong Wu
Use a struct as the platform special data instead of the enumeration. This is a prepare patch for adding mt8183 iommu support. Signed-off-by: Yong Wu --- drivers/iommu/mtk_iommu.c | 24 drivers/iommu/mtk_iommu.h | 6 +- 2 files changed, 21 insertions(+), 9

[PATCH v3 01/15] dt-bindings: mediatek: Add binding for mt8183 IOMMU and SMI

2018-11-16 Thread Yong Wu
This patch adds decriptions for mt8183 IOMMU and SMI. mt8183 has only one M4U like mt8173 and is also MTK IOMMU gen2 which uses ARM Short-Descriptor translation table format. The mt8183 M4U-SMI HW diagram is as below: EMI |

[PATCH v3 04/15] iommu/io-pgtable-arm-v7s: Add paddr_to_iopte and iopte_to_paddr helpers

2018-11-16 Thread Yong Wu
Add two helper functions: paddr_to_iopte and iopte_to_paddr. Signed-off-by: Yong Wu Reviewed-by: Robin Murphy --- drivers/iommu/io-pgtable-arm-v7s.c | 45 -- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/drivers/iommu/io-pgtable-arm-v7s.c

[PATCH v3 03/15] memory: mtk-smi: Use a general config_port interface

2018-11-16 Thread Yong Wu
The config_port of mt2712 and mt8183 are the same. Use a general config_port interface instead. In addition, in mt2712, larb8 and larb9 are the bdpsys larbs which are not the normal larb, their register space are different from the normal one. thus, we can not call the general config_port. In

[PATCH v3 00/15] MT8183 IOMMU SUPPORT

2018-11-16 Thread Yong Wu
This patchset mainly adds support for mt8183 IOMMU and SMI. mt8183 has only one M4U like mt8173 and is also MTK IOMMU gen2 which uses ARM Short-Descriptor translation table format. The mt8183 M4U-SMI HW diagram is as below: EMI |

Re: [PATCH v4 3/7] of: Allow the iommu-map property to omit untranslated devices

2018-11-16 Thread Rob Herring
On Thu, 15 Nov 2018 16:52:30 +, Jean-Philippe Brucker wrote: > In PCI root complex nodes, the iommu-map property describes the IOMMU that > translates each endpoint. On some platforms, the IOMMU itself is presented > as a PCI endpoint (e.g. AMD IOMMU and virtio-iommu). This isn't supported >

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

2018-11-16 Thread Jean-Philippe Brucker
Hi Eric, On 16/11/2018 06:08, Auger Eric wrote: >> +struct viommu_domain { >> +struct iommu_domain domain; >> +struct viommu_dev *viommu; >> +struct mutexmutex; > same naming/comment as in smmu driver may help here > struct mutex

Re: [PATCH 1/9] mm: Introduce new vm_insert_range API

2018-11-16 Thread Mike Rapoport
On Thu, Nov 15, 2018 at 09:15:30PM +0530, Souptick Joarder wrote: > Previouly drivers have their own way of mapping range of > kernel pages/memory into user vma and this was done by > invoking vm_insert_page() within a loop. > > As this pattern is common across different drivers, it can > be

Re: [PATCH 1/9] mm: Introduce new vm_insert_range API

2018-11-16 Thread Slavomir Kaslev
On Thu, Nov 15, 2018 at 5:42 PM Souptick Joarder wrote: > > Previouly drivers have their own way of mapping range of > kernel pages/memory into user vma and this was done by > invoking vm_insert_page() within a loop. > > As this pattern is common across different drivers, it can > be generalized

Re: [PATCH 1/9] mm: Introduce new vm_insert_range API

2018-11-16 Thread Randy Dunlap
On 11/16/18 12:15 AM, Souptick Joarder wrote: > On Fri, Nov 16, 2018 at 12:11 PM Matthew Wilcox wrote: >> >> On Fri, Nov 16, 2018 at 11:00:30AM +0530, Souptick Joarder wrote: >>> On Thu, Nov 15, 2018 at 11:44 PM Randy Dunlap wrote: On 11/15/18 7:45 AM, Souptick Joarder wrote: What is

Re: [PATCH 2/2] arch: switch the default on ARCH_HAS_SG_CHAIN

2018-11-16 Thread Palmer Dabbelt
On Fri, 09 Nov 2018 01:00:08 PST (-0800), Christoph Hellwig wrote: These days architectures are mostly out of the business of dealing with struct scatterlist at all, unless they have architecture specific iommu drivers. Replace the ARCH_HAS_SG_CHAIN symbol with a ARCH_NO_SG_CHAIN one only

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

2018-11-16 Thread Auger Eric
Hi Jean, On 11/15/18 5:52 PM, Jean-Philippe Brucker wrote: > Implement the virtio-iommu driver, following specification v0.8 [1]. > > Changes since v3 [2]: > * Rebase onto v4.20-rc2. Patch 3 now touches drivers/of/base.c instead > of drivers/pci/of.c, since the map_rid() function has moved. > *

Re: [PATCH v5 00/21] IOMMU: Tegra GART driver clean up and optimization

2018-11-16 Thread Dmitry Osipenko
On 01.10.2018 1:48, Dmitry Osipenko wrote: > Hello, > > This patch-series integrates the GART (IOMMU) driver with the Memory > Controller driver, that allows to report the name of a faulty memory > client on GART page fault. A major code clean up and performance > optimization is performed in

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

2018-11-16 Thread Vivek Gautam
qcom,smmu-v2 is an arm,smmu-v2 implementation with specific clock and power requirements. On msm8996, multiple cores, viz. mdss, video, etc. use this smmu. On sdm845, this smmu is used with gpu. Add bindings for the same. Signed-off-by: Vivek Gautam Reviewed-by: Rob Herring Reviewed-by: Tomasz

[RESEND PATCH v17 1/5] iommu/arm-smmu: Add pm_runtime/sleep ops

2018-11-16 Thread Vivek Gautam
From: Sricharan R The smmu needs to be functional only when the respective master's using it are active. The device_link feature helps to track such functional dependencies, so that the iommu gets powered when the master device enables itself using pm_runtime. So by adapting the smmu driver for

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

2018-11-16 Thread Vivek Gautam
From: Sricharan R The smmu device probe/remove and add/remove master device callbacks gets called when the smmu is not linked to its master, that is without the context of the master device. So calling runtime apis in those places separately. Global locks are also initialized before enabling

[RESEND PATCH v17 3/5] iommu/arm-smmu: Add the device_link between masters and smmu

2018-11-16 Thread Vivek Gautam
From: Sricharan R Finally add the device link between the master device and smmu, so that the smmu gets runtime enabled/disabled only when the master needs it. This is done from add_device callback which gets called once when the master is added to the smmu. Signed-off-by: Sricharan R

[RESEND PATCH v17 4/5] dt-bindings: arm-smmu: Add bindings for qcom, smmu-v2

2018-11-16 Thread Vivek Gautam
Add bindings doc for Qcom's smmu-v2 implementation. Signed-off-by: Vivek Gautam Reviewed-by: Tomasz Figa Tested-by: Srinivas Kandagatla Reviewed-by: Rob Herring Reviewed-by: Robin Murphy --- .../devicetree/bindings/iommu/arm,smmu.txt | 39 ++ 1 file changed, 39

[RESEND PATCH v17 0/5] iommu/arm-smmu: Add runtime pm/sleep support

2018-11-16 Thread Vivek Gautam
Hi Will, I am resending this series after we concluded on comments [1,2] on v16 of this patch-series, and the subsequent patch [3] was posted. Kindly merge this series. Thanks Vivek Previous version of this patch series is @ [4]. Also refer to [4] for change logs for previous versions. [1]

Re: [PATCH 1/4] PCI / ACPI: Identify external PCI devices

2018-11-16 Thread Lorenzo Pieralisi
On Thu, Nov 15, 2018 at 07:33:54PM +, mario.limoncie...@dell.com wrote: > > > > -Original Message- > > From: Mika Westerberg > > Sent: Thursday, November 15, 2018 1:01 PM > > To: Lorenzo Pieralisi > > Cc: Lukas Wunner; iommu@lists.linux-foundation.org; Joerg Roedel; David > >

Re: [PATCH 1/4] PCI / ACPI: Identify external PCI devices

2018-11-16 Thread Mika Westerberg
On Fri, Nov 16, 2018 at 01:18:04AM -0800, Christoph Hellwig wrote: > On Thu, Nov 15, 2018 at 09:10:26PM +0200, Mika Westerberg wrote: > > FireWire is kind of different but there are connectors such as > > ExpressCard and NVMe (over U.2 connector) which carry PCIe and are > > relatively easy to

Re: [PATCH 1/4] PCI / ACPI: Identify external PCI devices

2018-11-16 Thread Christoph Hellwig
On Thu, Nov 15, 2018 at 09:10:26PM +0200, Mika Westerberg wrote: > FireWire is kind of different but there are connectors such as > ExpressCard and NVMe (over U.2 connector) which carry PCIe and are > relatively easy to access without need for a screwdriver. AFAIK some > eGPUs are also using some

Re: [PATCH v4 6/8] vfio/mdev: Add iommu place holders in mdev_device

2018-11-16 Thread Christoph Hellwig
On Fri, Nov 16, 2018 at 09:20:48AM +0800, Lu Baolu wrote: > > Please keep symbols mdev_set/get_iommu_device(dev, iommu_device) non-GPL > > same as other exported symbols from mdev_core module. > > Yes. It will be fixed in the next version. No. mdev shall not be used to circumvent the exports in

Re: [PATCH v4 6/7] iommu/virtio: Add probe request

2018-11-16 Thread Auger Eric
Hi Jean, On 11/15/18 5:52 PM, Jean-Philippe Brucker wrote: > When the device offers the probe feature, send a probe request for each > device managed by the IOMMU. Extract RESV_MEM information. When we > encounter a MSI doorbell region, set it up as a IOMMU_RESV_MSI region. > This will tell other

Re: [PATCH 1/9] mm: Introduce new vm_insert_range API

2018-11-16 Thread Souptick Joarder
On Fri, Nov 16, 2018 at 12:11 PM Matthew Wilcox wrote: > > On Fri, Nov 16, 2018 at 11:00:30AM +0530, Souptick Joarder wrote: > > On Thu, Nov 15, 2018 at 11:44 PM Randy Dunlap wrote: > > > On 11/15/18 7:45 AM, Souptick Joarder wrote: > > > What is the opposite of vm_insert_range() or even of