[PATCH RESEND v2 4/5] iommu/tegra-smmu: Rework tegra_smmu_probe_device()

2020-11-25 Thread Nicolin Chen
gpu: Adding to iommu group 3 Note that dmesg log above is testing with IOMMU_DOMAIN_UNMANAGED. Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Acked-by: Thierry Reding Signed-off-by: Nicolin Chen --- drivers/iommu/tegra-smmu.c | 96 ++ 1 file changed, 15 in

[PATCH RESEND v2 5/5] iommu/tegra-smmu: Add PCI support

2020-11-25 Thread Nicolin Chen
This patch simply adds support for PCI devices. Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Acked-by: Thierry Reding Signed-off-by: Nicolin Chen --- drivers/iommu/tegra-smmu.c | 35 +-- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git

[PATCH RESEND v2 3/5] iommu/tegra-smmu: Use fwspec in tegra_smmu_(de)attach_dev

2020-11-25 Thread Nicolin Chen
this patch uses fwspec in tegra_smmu_(de)attach_dev() so as to replace the redundant DT polling code. Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Acked-by: Thierry Reding Signed-off-by: Nicolin Chen --- drivers/iommu/tegra-smmu.c | 56 -- 1 file c

[PATCH RESEND v2 2/5] iommu/tegra-smmu: Expand mutex protection range

2020-11-25 Thread Nicolin Chen
This is used to protect potential race condition at use_count. since probes of client drivers, calling attach_dev(), may run concurrently. Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Acked-by: Thierry Reding Signed-off-by: Nicolin Chen --- drivers/iommu/tegra-smmu.c | 34

[PATCH RESEND v2 1/5] iommu/tegra-smmu: Unwrap tegra_smmu_group_get

2020-11-25 Thread Nicolin Chen
ist for other devices to match. This patch simply unwraps the function to clean it up. Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Acked-by: Thierry Reding Signed-off-by: Nicolin Chen --- drivers/iommu/tegra-smmu.c | 19 --- 1 file changed, 4 insertions(+), 15 deleti

[PATCH RESEND v2 0/5] iommu/tegra-smmu: Some pending reviewed changes

2020-11-25 Thread Nicolin Chen
ot; Series-2: https://lkml.org/lkml/2020/10/9/808 "[PATCH v7 0/3] iommu/tegra-smmu: Add PCI support" Nicolin Chen (5): iommu/tegra-smmu: Unwrap tegra_smmu_group_get iommu/tegra-smmu: Expand mutex protection range iommu/tegra-smmu: Use fwspec in tegra_smmu_(de)attach_dev i

Re: [PATCH RESEND 0/5] iommu/tegra-smmu: Some pending reviewed changes

2020-11-25 Thread Nicolin Chen
On Wed, Nov 25, 2020 at 09:55:10AM +, Will Deacon wrote: > On Tue, Nov 24, 2020 at 03:12:16PM -0800, Nicolin Chen wrote: > > On Wed, Nov 25, 2020 at 02:05:14AM +0300, Dmitry Osipenko wrote: > > > 25.11.2020 00:21, Nicolin Chen пишет: > > > > These five patches wer

Re: [PATCH RESEND 0/5] iommu/tegra-smmu: Some pending reviewed changes

2020-11-24 Thread Nicolin Chen
On Wed, Nov 25, 2020 at 02:05:14AM +0300, Dmitry Osipenko wrote: > 25.11.2020 00:21, Nicolin Chen пишет: > > Hi Joerg, > > > > These five patches were acked by Thierry and acked-n-tested by > > Dmitry a while ago. Would it be possible for you to apply them? > &g

Re: [PATCH RESEND 0/5] iommu/tegra-smmu: Some pending reviewed changes

2020-11-24 Thread Nicolin Chen
Hi Joerg, These five patches were acked by Thierry and acked-n-tested by Dmitry a while ago. Would it be possible for you to apply them? Thanks! On Wed, Nov 11, 2020 at 02:21:24PM -0800, Nicolin Chen wrote: > This is a merged set of resend for previously two series of patches > tha

[PATCH RESEND 3/5] iommu/tegra-smmu: Use fwspec in tegra_smmu_(de)attach_dev

2020-11-11 Thread Nicolin Chen
this patch uses fwspec in tegra_smmu_(de)attach_dev() so as to replace the redundant DT polling code. Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Signed-off-by: Nicolin Chen --- drivers/iommu/tegra-smmu.c | 56 -- 1 file changed, 23 inserti

[PATCH RESEND 4/5] iommu/tegra-smmu: Rework tegra_smmu_probe_device()

2020-11-11 Thread Nicolin Chen
gpu: Adding to iommu group 3 Note that dmesg log above is testing with IOMMU_DOMAIN_UNMANAGED. Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Signed-off-by: Nicolin Chen --- drivers/iommu/tegra-smmu.c | 96 ++ 1 file changed, 15 insertions(+), 81 deletions(-)

[PATCH RESEND 5/5] iommu/tegra-smmu: Add PCI support

2020-11-11 Thread Nicolin Chen
This patch simply adds support for PCI devices. Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Signed-off-by: Nicolin Chen --- drivers/iommu/tegra-smmu.c | 35 +-- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/drivers/iommu/tegra

[PATCH RESEND 1/5] iommu/tegra-smmu: Unwrap tegra_smmu_group_get

2020-11-11 Thread Nicolin Chen
ist for other devices to match. This patch simply unwraps the function to clean it up. Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Acked-by: Thierry Reding Signed-off-by: Nicolin Chen --- drivers/iommu/tegra-smmu.c | 19 --- 1 file changed, 4 insertions(+), 15 deleti

[PATCH RESEND 0/5] iommu/tegra-smmu: Some pending reviewed changes

2020-11-11 Thread Nicolin Chen
t;[PATCH v7 0/3] iommu/tegra-smmu: Add PCI support" Nicolin Chen (5): iommu/tegra-smmu: Unwrap tegra_smmu_group_get iommu/tegra-smmu: Expand mutex protection range iommu/tegra-smmu: Use fwspec in tegra_smmu_(de)attach_dev iommu/tegra-smmu: Rework tegra_smmu_probe_device() iommu/tegra-s

[PATCH RESEND 2/5] iommu/tegra-smmu: Expand mutex protection range

2020-11-11 Thread Nicolin Chen
This is used to protect potential race condition at use_count. since probes of client drivers, calling attach_dev(), may run concurrently. Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Acked-by: Thierry Reding Signed-off-by: Nicolin Chen --- drivers/iommu/tegra-smmu.c | 34

Re: [PATCH v7 0/3] iommu/tegra-smmu: Add PCI support

2020-11-07 Thread Nicolin Chen
On Fri, Oct 09, 2020 at 09:19:33AM -0700, Nicolin Chen wrote: > This series is to add PCI support in tegra-smmu driver. This v7 has fixed all the existing comments and been in the maillist for nearly a month. Can anyone please apply them? Thanks Nic > Changelog (Detail in each patch) &g

Re: [PATCH v4 0/2] iommu/tegra-smmu: Two followup changes

2020-11-07 Thread Nicolin Chen
On Mon, Sep 28, 2020 at 11:13:23PM -0700, Nicolin Chen wrote: > Two followup patches for tegra-smmu: > PATCH-1 is a clean-up patch for the recently applied SWGROUP change. > PATCH-2 fixes a potential race condition These two changes have Acked-by and Reviewed-by for a month already. Who

Re: [PATCH v7 3/3] iommu/tegra-smmu: Add PCI support

2020-10-16 Thread Nicolin Chen
On Fri, Oct 16, 2020 at 03:10:26PM +0100, Robin Murphy wrote: > On 2020-10-16 04:53, Nicolin Chen wrote: > > On Thu, Oct 15, 2020 at 10:55:52AM +0100, Robin Murphy wrote: > > > On 2020-10-15 05:13, Nicolin Chen wrote: > > > > On Wed, Oct 14, 2020 at 06:42:

Re: [PATCH v7 3/3] iommu/tegra-smmu: Add PCI support

2020-10-15 Thread Nicolin Chen
On Thu, Oct 15, 2020 at 10:55:52AM +0100, Robin Murphy wrote: > On 2020-10-15 05:13, Nicolin Chen wrote: > > On Wed, Oct 14, 2020 at 06:42:36PM +0100, Robin Murphy wrote: > > > On 2020-10-09 17:19, Nicolin Chen wrote: > > > > This patch simpl

Re: [PATCH v7 3/3] iommu/tegra-smmu: Add PCI support

2020-10-14 Thread Nicolin Chen
On Wed, Oct 14, 2020 at 06:42:36PM +0100, Robin Murphy wrote: > On 2020-10-09 17:19, Nicolin Chen wrote: > > This patch simply adds support for PCI devices. > > > > Reviewed-by: Dmitry Osipenko > > Tested-by: Dmitry Osipenko > > Signed-off-by: Nicolin Chen >

[PATCH v7 2/3] iommu/tegra-smmu: Rework tegra_smmu_probe_device()

2020-10-09 Thread Nicolin Chen
gpu: Adding to iommu group 3 Note that dmesg log above is testing with IOMMU_DOMAIN_UNMANAGED. Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Signed-off-by: Nicolin Chen --- Changelog v6->v7 * Added comments for put_device(), suggested by Thierry. v5->v6 * Dropped NULL mc/smmu pointe

[PATCH v7 0/3] iommu/tegra-smmu: Add PCI support

2020-10-09 Thread Nicolin Chen
pointer v2->v3 * Replaced with devm_tegra_get_memory_controller * Updated changes by following Dmitry's comments v1->v2 * Added PATCH-1 suggested by Dmitry * Reworked PATCH-2 to unify certain code Nicolin Chen (3): iommu/tegra-smmu: Use fwspec in tegra_smmu_(de)attach_dev iom

[PATCH v7 1/3] iommu/tegra-smmu: Use fwspec in tegra_smmu_(de)attach_dev

2020-10-09 Thread Nicolin Chen
this patch uses fwspec in tegra_smmu_(de)attach_dev() so as to replace the redundant DT polling code. Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Signed-off-by: Nicolin Chen --- Changelog v6->v7: * No change v5->v6: * Added Dmitry's Reviewed-by and Tested-by v4->v5

[PATCH v7 3/3] iommu/tegra-smmu: Add PCI support

2020-10-09 Thread Nicolin Chen
This patch simply adds support for PCI devices. Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Signed-off-by: Nicolin Chen --- Changelog v6->v7 * Renamed goto labels, suggested by Thierry. v5->v6 * Added Dmitry's Reviewed-by and Tested-by. v4->v5 * Added Dmitry's Revie

Re: [PATCH v4 2/3] iommu/tegra-smmu: Rework tegra_smmu_probe_device()

2020-10-09 Thread Nicolin Chen
On Fri, Oct 09, 2020 at 02:25:56PM +0200, Thierry Reding wrote: > On Thu, Oct 08, 2020 at 02:12:10PM -0700, Nicolin Chen wrote: > > On Thu, Oct 08, 2020 at 11:53:43AM +0200, Thierry Reding wrote: > > > On Mon, Oct 05, 2020 at 06:05:46PM -0700, Nicolin Chen wrote: > > > &

Re: [PATCH v4 2/3] iommu/tegra-smmu: Rework tegra_smmu_probe_device()

2020-10-08 Thread Nicolin Chen
On Thu, Oct 08, 2020 at 11:53:43AM +0200, Thierry Reding wrote: > On Mon, Oct 05, 2020 at 06:05:46PM -0700, Nicolin Chen wrote: > > On Mon, Oct 05, 2020 at 11:57:54AM +0200, Thierry Reding wrote: > > > On Fri, Oct 02, 2020 at 11:58:29AM -0700, Nicolin Chen wrote: > > > &

Re: [PATCH v5 2/3] iommu/tegra-smmu: Rework tegra_smmu_probe_device()

2020-10-05 Thread Nicolin Chen
On Mon, Oct 05, 2020 at 12:56:38PM +0200, Thierry Reding wrote: > On Mon, Oct 05, 2020 at 11:41:08AM +0300, Dmitry Osipenko wrote: > > 05.10.2020 00:57, Nicolin Chen пишет: > > > On Sat, Oct 03, 2020 at 05:06:42PM +0300, Dmitry Osipenko wrote: > > >> 03.10.

Re: [PATCH v4 2/3] iommu/tegra-smmu: Rework tegra_smmu_probe_device()

2020-10-05 Thread Nicolin Chen
On Mon, Oct 05, 2020 at 11:57:54AM +0200, Thierry Reding wrote: > On Fri, Oct 02, 2020 at 11:58:29AM -0700, Nicolin Chen wrote: > > On Fri, Oct 02, 2020 at 06:02:18PM +0300, Dmitry Osipenko wrote: > > > 02.10.2020 09:08, Nicolin Chen пишет: > > > > static int teg

Re: [PATCH v4 3/3] iommu/tegra-smmu: Add PCI support

2020-10-05 Thread Nicolin Chen
On Mon, Oct 05, 2020 at 12:04:19PM +0200, Thierry Reding wrote: > > +err_bus_set: __maybe_unused; > > + bus_set_iommu(_bus_type, NULL); > > +err_unregister: > > + iommu_device_unregister(>iommu); > > +err_sysfs: > > + iommu_device_sysfs_remove(>iommu); > > Can you please switch to label

[PATCH v6 2/3] iommu/tegra-smmu: Rework tegra_smmu_probe_device()

2020-10-04 Thread Nicolin Chen
gpu: Adding to iommu group 3 Note that dmesg log above is testing with IOMMU_DOMAIN_UNMANAGED. Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Signed-off-by: Nicolin Chen --- Changelog v5->v6 * Dropped NULL mc/smmu pointer check, suggested by Dmitry. * Updated commit message with te

[PATCH v6 1/3] iommu/tegra-smmu: Use fwspec in tegra_smmu_(de)attach_dev

2020-10-04 Thread Nicolin Chen
this patch uses fwspec in tegra_smmu_(de)attach_dev() so as to replace the redundant DT polling code. Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Signed-off-by: Nicolin Chen --- Changelog v5->v6: * Added Dmitry's Reviewed-by and Tested-by v4->v5: * Removed "index" a

[PATCH v6 3/3] iommu/tegra-smmu: Add PCI support

2020-10-04 Thread Nicolin Chen
This patch simply adds support for PCI devices. Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Signed-off-by: Nicolin Chen --- Changelog v5->v6 * Added Dmitry's Reviewed-by and Tested-by. v4->v5 * Added Dmitry's Reviewed-by v3->v4 * Dropped !iommu_present() check

[PATCH v6 0/3] iommu/tegra-smmu: Add PCI support

2020-10-04 Thread Nicolin Chen
uggested by Dmitry * Reworked PATCH-2 to unify certain code Nicolin Chen (3): iommu/tegra-smmu: Use fwspec in tegra_smmu_(de)attach_dev iommu/tegra-smmu: Rework tegra_smmu_probe_device() iommu/tegra-smmu: Add PCI support drivers/iommu/tegra-smmu.c | 180 -

Re: [PATCH v5 3/3] iommu/tegra-smmu: Add PCI support

2020-10-04 Thread Nicolin Chen
On Sat, Oct 03, 2020 at 05:16:20PM +0300, Dmitry Osipenko wrote: > 03.10.2020 09:59, Nicolin Chen пишет: > > This patch simply adds support for PCI devices. > > > > Signed-off-by: Nicolin Chen > > Reviewed-by: Dmitry Osipenko > > Small nit: yours s-b t

Re: [PATCH v5 2/3] iommu/tegra-smmu: Rework tegra_smmu_probe_device()

2020-10-04 Thread Nicolin Chen
On Sat, Oct 03, 2020 at 05:05:52PM +0300, Dmitry Osipenko wrote: > 03.10.2020 09:59, Nicolin Chen пишет: > > ubuntu@jetson:~$ dmesg | grep iommu > > iommu: Default domain type: Translated > > tegra-i2c 7000c400.i2c: Adding to iommu group 0 > > teg

Re: [PATCH v5 2/3] iommu/tegra-smmu: Rework tegra_smmu_probe_device()

2020-10-04 Thread Nicolin Chen
On Sat, Oct 03, 2020 at 05:06:42PM +0300, Dmitry Osipenko wrote: > 03.10.2020 09:59, Nicolin Chen пишет: > > static int tegra_smmu_of_xlate(struct device *dev, > >struct of_phandle_args *args) > > { > > + struct platform_device *iommu_pd

[PATCH v5 0/3] iommu/tegra-smmu: Add PCI support

2020-10-03 Thread Nicolin Chen
other way to get smmu pointer v2->v3 * Replaced with devm_tegra_get_memory_controller * Updated changes by following Dmitry's comments v1->v2 * Added PATCH-1 suggested by Dmitry * Reworked PATCH-2 to unify certain code Nicolin Chen (3): iommu/tegra-smmu: Use fwspec in tegra_smmu_(de)att

[PATCH v5 3/3] iommu/tegra-smmu: Add PCI support

2020-10-03 Thread Nicolin Chen
This patch simply adds support for PCI devices. Signed-off-by: Nicolin Chen Reviewed-by: Dmitry Osipenko --- Changelog v4->v5 * Added Dmitry's Reviewed-by v3->v4 * Dropped !iommu_present() check * Added CONFIG_PCI check in the exit path v2->v3 * Replaced ternary conditional

[PATCH v5 1/3] iommu/tegra-smmu: Use fwspec in tegra_smmu_(de)attach_dev

2020-10-03 Thread Nicolin Chen
this patch uses fwspec in tegra_smmu_(de)attach_dev() so as to replace the redundant DT polling code. Signed-off-by: Nicolin Chen --- Changelog v4->v5: * Removed "index" and "err" assigning to 0 v3->v4: * Seperated the change, as a cleanup, from the rework patch v1->

[PATCH v5 2/3] iommu/tegra-smmu: Rework tegra_smmu_probe_device()

2020-10-03 Thread Nicolin Chen
ing to iommu group 0 tegra-i2c 7000d000.i2c: Adding to iommu group 0 tegra-pcie 1003000.pcie: Adding to iommu group 1 ... Note that dmesg log above is testing with IOMMU_DOMAIN_UNMANAGED. Signed-off-by: Nicolin Chen --- Changelog v4->v5 * Replaced of_node_put() with put_device

Re: [PATCH v4 1/3] iommu/tegra-smmu: Use fwspec in tegra_smmu_(de)attach_dev

2020-10-02 Thread Nicolin Chen
On Fri, Oct 02, 2020 at 11:12:18PM +0300, Dmitry Osipenko wrote: > 02.10.2020 22:45, Nicolin Chen пишет: > > On Fri, Oct 02, 2020 at 05:41:50PM +0300, Dmitry Osipenko wrote: > >> 02.10.2020 09:08, Nicolin Chen пишет: > >>> static int tegra_smmu_attach_d

Re: [PATCH v4 1/3] iommu/tegra-smmu: Use fwspec in tegra_smmu_(de)attach_dev

2020-10-02 Thread Nicolin Chen
On Fri, Oct 02, 2020 at 05:52:00PM +0300, Dmitry Osipenko wrote: > 02.10.2020 17:22, Dmitry Osipenko пишет: > > 02.10.2020 09:08, Nicolin Chen пишет: > >> static int tegra_smmu_attach_dev(struct iommu_domain *domain, > >> struct device *

Re: [PATCH v4 2/3] iommu/tegra-smmu: Rework tegra_smmu_probe_device()

2020-10-02 Thread Nicolin Chen
On Fri, Oct 02, 2020 at 05:58:29PM +0300, Dmitry Osipenko wrote: > 02.10.2020 17:22, Dmitry Osipenko пишет: > > 02.10.2020 09:08, Nicolin Chen пишет: > >> -static void tegra_smmu_release_device(struct device *dev) > >> -{ > >> - dev_iommu_priv_set(d

Re: [PATCH v4 1/3] iommu/tegra-smmu: Use fwspec in tegra_smmu_(de)attach_dev

2020-10-02 Thread Nicolin Chen
On Fri, Oct 02, 2020 at 05:41:50PM +0300, Dmitry Osipenko wrote: > 02.10.2020 09:08, Nicolin Chen пишет: > > static int tegra_smmu_attach_dev(struct iommu_domain *domain, > > struct device *dev) > > { > > + struct iommu_fwspec *fwspec

Re: [PATCH v4 2/3] iommu/tegra-smmu: Rework tegra_smmu_probe_device()

2020-10-02 Thread Nicolin Chen
On Fri, Oct 02, 2020 at 06:02:18PM +0300, Dmitry Osipenko wrote: > 02.10.2020 09:08, Nicolin Chen пишет: > > static int tegra_smmu_of_xlate(struct device *dev, > >struct of_phandle_args *args) > > { > > + struct platform_device *iommu_pd

Re: [PATCH v4 2/3] iommu/tegra-smmu: Rework tegra_smmu_probe_device()

2020-10-02 Thread Nicolin Chen
On Fri, Oct 02, 2020 at 05:23:14PM +0300, Dmitry Osipenko wrote: > 02.10.2020 09:08, Nicolin Chen пишет: > > static struct iommu_device *tegra_smmu_probe_device(struct device *dev) > > { > > - struct device_node *np = dev->of_node; > > - struct tegra_smm

Re: [PATCH v4 3/3] iommu/tegra-smmu: Add PCI support

2020-10-02 Thread Nicolin Chen
On Fri, Oct 02, 2020 at 05:35:24PM +0300, Dmitry Osipenko wrote: > 02.10.2020 09:08, Nicolin Chen пишет: > > @@ -865,7 +866,11 @@ static struct iommu_group > > *tegra_smmu_device_group(struct device *dev) > > group->smmu = smmu; > > group->soc

[PATCH v4 3/3] iommu/tegra-smmu: Add PCI support

2020-10-02 Thread Nicolin Chen
This patch simply adds support for PCI devices. Signed-off-by: Nicolin Chen --- Changelog v3->v4 * Dropped !iommu_present() check * Added CONFIG_PCI check in the exit path v2->v3 * Replaced ternary conditional operator with if-else in .device_group() * Dropped change in tegra_smmu_

[PATCH v4 1/3] iommu/tegra-smmu: Use fwspec in tegra_smmu_(de)attach_dev

2020-10-02 Thread Nicolin Chen
this patch uses fwspec in tegra_smmu_(de)attach_dev() so as to replace the redundant DT polling code. Signed-off-by: Nicolin Chen --- Changelog v3->v4: * Seperated the change, as a cleanup, from the rework patch v1->v3: * N/A drivers/iommu/tegra-smmu.c | 50 +++---

[PATCH v4 0/3] iommu/tegra-smmu: Add PCI support

2020-10-02 Thread Nicolin Chen
d PATCH-1 suggested by Dmitry * Reworked PATCH-2 to unify certain code Nicolin Chen (3): iommu/tegra-smmu: Use fwspec in tegra_smmu_(de)attach_dev iommu/tegra-smmu: Rework tegra_smmu_probe_device() iommu/tegra-smmu: Add PCI support drivers/iommu/tegra-smm

[PATCH v4 2/3] iommu/tegra-smmu: Rework tegra_smmu_probe_device()

2020-10-02 Thread Nicolin Chen
uring stage of tegra_smmu_probe/tegra_mc_probe(). 2) Moving dev_iommu_priv_set() to of_xlate() so we can get smmu pointer in tegra_smmu_probe_device() to replace DTB polling. 3) Removing tegra_smmu_configure() accordingly since iommu core takes care of it. Signed-off-by: Nicolin Ch

Re: [PATCH v3 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev

2020-10-01 Thread Nicolin Chen
On Fri, Oct 02, 2020 at 04:55:34AM +0300, Dmitry Osipenko wrote: > 02.10.2020 04:07, Nicolin Chen пишет: > > On Thu, Oct 01, 2020 at 11:33:38PM +0300, Dmitry Osipenko wrote: > >>>>> If we can't come to an agreement on globalizing mc pointer, would > >>>&g

Re: [PATCH v3 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev

2020-10-01 Thread Nicolin Chen
f so, I > think it should be safe to remove this. I am attaching a patch that works with both IOMMU_DOMAIN_UNMANAGED and IOMMU_DOMAIN_DMA. Would it be possible for you to give a test? The implementation of getting mc->smmu is using a parent_driver as I was asking you in the other reply. Yet, it

Re: [PATCH v3 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev

2020-10-01 Thread Nicolin Chen
On Thu, Oct 01, 2020 at 11:33:38PM +0300, Dmitry Osipenko wrote: > >>> If we can't come to an agreement on globalizing mc pointer, would > >>> it be possible to pass tegra_mc_driver through tegra_smmu_probe() > >>> so we can continue to use driver_find_device_by_fwnode() as v1? > >>> > >>> v1:

Re: [PATCH v3 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev

2020-10-01 Thread Nicolin Chen
On Thu, Oct 01, 2020 at 12:23:16PM +0200, Thierry Reding wrote: > > >> It looks to me like the only reason why you need this new global > > >> API is > > > >> because PCI devices may not have a device tree node with a phandle > > > >> to > > > >> the IOMMU. However, SMMU

Re: [PATCH v3 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev

2020-10-01 Thread Nicolin Chen
On Thu, Oct 01, 2020 at 11:51:52AM +0200, Thierry Reding wrote: > > > >> ... > > > It looks to me like the only reason why you need this new global API > > > is > > > because PCI devices may not have a device tree node with a phandle to > > > the IOMMU. However, SMMU support

Re: [PATCH v3 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev

2020-09-30 Thread Nicolin Chen
On Thu, Oct 01, 2020 at 05:06:19AM +0300, Dmitry Osipenko wrote: > 01.10.2020 04:26, Nicolin Chen пишет: > > On Thu, Oct 01, 2020 at 12:56:46AM +0300, Dmitry Osipenko wrote: > >> 01.10.2020 00:32, Nicolin Chen пишет: > >>> On Thu, Oct 01, 2020 at 12:24:25A

Re: [PATCH v3 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev

2020-09-30 Thread Nicolin Chen
On Thu, Oct 01, 2020 at 12:56:46AM +0300, Dmitry Osipenko wrote: > 01.10.2020 00:32, Nicolin Chen пишет: > > On Thu, Oct 01, 2020 at 12:24:25AM +0300, Dmitry Osipenko wrote: > >> ... > >>>> It looks to me like the only reason why you need this new global API

Re: [PATCH v3 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev

2020-09-30 Thread Nicolin Chen
On Thu, Oct 01, 2020 at 12:24:25AM +0300, Dmitry Osipenko wrote: > ... > >> It looks to me like the only reason why you need this new global API is > >> because PCI devices may not have a device tree node with a phandle to > >> the IOMMU. However, SMMU support for PCI will only be enabled if the >

Re: [PATCH v3 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev

2020-09-30 Thread Nicolin Chen
On Wed, Sep 30, 2020 at 06:09:43PM +0300, Dmitry Osipenko wrote: > ... > > static int tegra_smmu_attach_dev(struct iommu_domain *domain, > > struct device *dev) > > { > > + struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev); > > struct tegra_smmu *smmu =

Re: [PATCH v3 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev

2020-09-30 Thread Nicolin Chen
On Wed, Sep 30, 2020 at 05:31:31PM +0200, Thierry Reding wrote: > On Wed, Sep 30, 2020 at 01:42:57AM -0700, Nicolin Chen wrote: > > Previously the driver relies on bus_set_iommu() in .probe() to call > > in .probe_device() function so each client can poll iommus property > >

Re: [PATCH v3 3/3] iommu/tegra-smmu: Add PCI support

2020-09-30 Thread Nicolin Chen
On Wed, Sep 30, 2020 at 05:53:20PM +0300, Dmitry Osipenko wrote: > ... > > +#ifdef CONFIG_PCI > > + if (!iommu_present(_bus_type)) { > > > In the previous reply you said that you're borrowing this check from the > arm-smmu driver, but arm-smmu also has a similar check for > platform_bus_type,

Re: [PATCH v3 1/3] memory: tegra: Add devm_tegra_get_memory_controller()

2020-09-30 Thread Nicolin Chen
On Wed, Sep 30, 2020 at 11:07:32AM +0200, Krzysztof Kozlowski wrote: > "On Wed, 30 Sep 2020 at 10:48, Nicolin Chen wrote: > > > > From: Dmitry Osipenko > > > > Multiple Tegra drivers need to retrieve Memory Controller and hence there > > is quite some d

Re: [PATCH v3 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev

2020-09-30 Thread Nicolin Chen
On Wed, Sep 30, 2020 at 11:21:14AM +0200, Krzysztof Kozlowski wrote: > On Wed, 30 Sep 2020 at 10:48, Nicolin Chen wrote: > > > > Previously the driver relies on bus_set_iommu() in .probe() to call > > in .probe_device() function so each client can poll iommus property &g

[PATCH v3 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev

2020-09-30 Thread Nicolin Chen
ode, tegra_smmu_find/tegra_smmu_configure() 3) Calling devm_tegra_get_memory_controller() in .probe_device() 4) Also dropping the hack in .probe() that's no longer needed. Signed-off-by: Nicolin Chen --- Changelog v2->v3 * Used devm_tegra_get_memory_controller() to get mc pointer * Re

[PATCH v3 1/3] memory: tegra: Add devm_tegra_get_memory_controller()

2020-09-30 Thread Nicolin Chen
From: Dmitry Osipenko Multiple Tegra drivers need to retrieve Memory Controller and hence there is quite some duplication of the retrieval code among the drivers. Let's add a new common helper for the retrieval of the MC. Signed-off-by: Dmitry Osipenko Signed-off-by: Nicolin Chen

[PATCH v3 0/3] iommu/tegra-smmu: Add PCI support

2020-09-30 Thread Nicolin Chen
ted changes by following Dmitry's comments v1->v2 * Added PATCH-1 suggested by Dmitry * Reworked PATCH-2 to unify certain code Dmitry Osipenko (1): memory: tegra: Add devm_tegra_get_memory_controller() Nicolin Chen (2): iommu/tegra-smmu: Rework .probe_device and .attach_dev iommu/tegr

[PATCH v3 3/3] iommu/tegra-smmu: Add PCI support

2020-09-30 Thread Nicolin Chen
This patch simply adds support for PCI devices. Signed-off-by: Nicolin Chen --- Changelog v2->v3 * Replaced ternary conditional operator with if-else in .device_group() * Dropped change in tegra_smmu_remove() v1->v2 * Added error-out labels in tegra_smmu_probe() * Dropped pci_reque

Re: [PATCH v2 1/3] memory: tegra: Add helper function tegra_get_memory_controller

2020-09-30 Thread Nicolin Chen
Hi Krzysztof, On Wed, Sep 30, 2020 at 09:21:39AM +0200, Krzysztof Kozlowski wrote: > On Wed, 30 Sep 2020 at 02:35, Nicolin Chen wrote: > > > > This can be used by both tegra-smmu and tegra20-devfreq drivers. > > > > Suggested-by: Dmitry Osipenko >

Re: [PATCH v2 3/3] iommu/tegra-smmu: Add PCI support

2020-09-30 Thread Nicolin Chen
On Wed, Sep 30, 2020 at 08:58:50AM +0300, Dmitry Osipenko wrote: > 30.09.2020 08:29, Nicolin Chen пишет: > > Hi Dmitry, > > > > On Wed, Sep 30, 2020 at 08:10:07AM +0300, Dmitry Osipenko wrote: > >> 30.09.2020 03:30, Nicolin Chen пишет: > >>> - group-&

Re: [PATCH v2 3/3] iommu/tegra-smmu: Add PCI support

2020-09-30 Thread Nicolin Chen
On Wed, Sep 30, 2020 at 09:01:09AM +0300, Dmitry Osipenko wrote: > 30.09.2020 08:34, Nicolin Chen пишет: > > On Wed, Sep 30, 2020 at 08:10:35AM +0300, Dmitry Osipenko wrote: > >> 30.09.2020 03:30, Nicolin Chen пишет: > >>> void tegra_smmu_

Re: [PATCH v2 1/3] memory: tegra: Add helper function tegra_get_memory_controller

2020-09-30 Thread Nicolin Chen
On Wed, Sep 30, 2020 at 09:32:20AM +0300, Dmitry Osipenko wrote: > 30.09.2020 08:44, Nicolin Chen пишет: > > On Wed, Sep 30, 2020 at 08:12:10AM +0300, Dmitry Osipenko wrote: > >> 30.09.2020 03:30, Nicolin Chen пишет: > >> ... > >>> int tegra_mc_write

Re: [PATCH v2 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev

2020-09-30 Thread Nicolin Chen
On Wed, Sep 30, 2020 at 08:20:50AM +0300, Dmitry Osipenko wrote: > 30.09.2020 08:10, Dmitry Osipenko пишет: > > 30.09.2020 03:30, Nicolin Chen пишет: > >> static void tegra_smmu_release_device(struct device *dev) > > > > The tegra_get_memory_controller() uses o

Re: [PATCH v2 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev

2020-09-30 Thread Nicolin Chen
On Wed, Sep 30, 2020 at 08:59:45AM +0300, Dmitry Osipenko wrote: > 30.09.2020 08:41, Nicolin Chen пишет: > > On Wed, Sep 30, 2020 at 08:39:54AM +0300, Dmitry Osipenko wrote: > >> 30.09.2020 03:30, Nicolin Chen пишет: > >>> static int tegra_smmu_attach_d

Re: [PATCH v2 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev

2020-09-30 Thread Nicolin Chen
On Wed, Sep 30, 2020 at 09:10:38AM +0300, Dmitry Osipenko wrote: > 30.09.2020 08:49, Nicolin Chen пишет: > > On Wed, Sep 30, 2020 at 08:11:52AM +0300, Dmitry Osipenko wrote: > >> 30.09.2020 03:30, Nicolin Chen пишет: > >>> + /* An invalid mc pointer means mc

Re: [PATCH v2 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev

2020-09-29 Thread Nicolin Chen
On Wed, Sep 30, 2020 at 08:20:50AM +0300, Dmitry Osipenko wrote: > 30.09.2020 08:10, Dmitry Osipenko пишет: > > 30.09.2020 03:30, Nicolin Chen пишет: > >> static void tegra_smmu_release_device(struct device *dev) > > > > The tegra_get_memory_controller() uses o

Re: [PATCH v2 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev

2020-09-29 Thread Nicolin Chen
On Wed, Sep 30, 2020 at 08:11:52AM +0300, Dmitry Osipenko wrote: > 30.09.2020 03:30, Nicolin Chen пишет: > > + /* An invalid mc pointer means mc and smmu drivers are not ready */ > > + if (IS_ERR_OR_NULL(mc)) > > tegra_get_memory_controller() doesn't return NULL. Well, I

Re: [PATCH v2 1/3] memory: tegra: Add helper function tegra_get_memory_controller

2020-09-29 Thread Nicolin Chen
On Wed, Sep 30, 2020 at 08:12:10AM +0300, Dmitry Osipenko wrote: > 30.09.2020 03:30, Nicolin Chen пишет: > ... > > int tegra_mc_write_emem_configuration(struct tegra_mc *mc, unsigned long > > rate); > > unsigned int tegra_mc_get_emem_device_count(struct tegra_mc *m

Re: [PATCH v2 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev

2020-09-29 Thread Nicolin Chen
On Wed, Sep 30, 2020 at 08:39:54AM +0300, Dmitry Osipenko wrote: > 30.09.2020 03:30, Nicolin Chen пишет: > > static int tegra_smmu_attach_dev(struct iommu_domain *domain, > > struct device *dev) > > { > > + struct iommu_fwspec *fwspec

Re: [PATCH v2 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev

2020-09-29 Thread Nicolin Chen
On Wed, Sep 30, 2020 at 08:24:02AM +0300, Dmitry Osipenko wrote: > 30.09.2020 03:30, Nicolin Chen пишет: > > + /* > > +* IOMMU core allows -ENODEV return to carry on. So bypass any call > > +* from bus_set_iommu() during tegra_smmu_probe(), as a device will > &g

Re: [PATCH v2 3/3] iommu/tegra-smmu: Add PCI support

2020-09-29 Thread Nicolin Chen
On Wed, Sep 30, 2020 at 08:10:35AM +0300, Dmitry Osipenko wrote: > 30.09.2020 03:30, Nicolin Chen пишет: > > void tegra_smmu_remove(struct tegra_smmu *smmu) > > { > > + bus_set_iommu(_bus_type, NULL); > > Why only platform_bus? Is this really needed at all?

Re: [PATCH v2 3/3] iommu/tegra-smmu: Add PCI support

2020-09-29 Thread Nicolin Chen
Hi Dmitry, On Wed, Sep 30, 2020 at 08:10:07AM +0300, Dmitry Osipenko wrote: > 30.09.2020 03:30, Nicolin Chen пишет: > > - group->group = iommu_group_alloc(); > > + group->group = pci ? pci_device_group(dev) : iommu_group_alloc(); > > This will be nicer to write

Re: [PATCH v2 3/3] iommu/tegra-smmu: Add PCI support

2020-09-29 Thread Nicolin Chen
On Wed, Sep 30, 2020 at 08:10:00AM +0300, Dmitry Osipenko wrote: > 30.09.2020 03:30, Nicolin Chen пишет: > ... > > +#ifdef CONFIG_PCI > > + if (!iommu_present(_bus_type)) { > > Could you please explain why this check is needed? That's referencing what's in the arm-sm

Re: [PATCH v4 2/2] iommu/tegra-smmu: Expand mutex protection range

2020-09-29 Thread Nicolin Chen
On Tue, Sep 29, 2020 at 08:42:52PM +0300, Dmitry Osipenko wrote: > 29.09.2020 09:13, Nicolin Chen пишет: > > This is used to protect potential race condition at use_count. > > since probes of client drivers, calling attach_dev(), may run > > concurrently. > > >

[PATCH v2 0/3] iommu/tegra-smmu: Add PCI support

2020-09-29 Thread Nicolin Chen
ode Prvious versions v1: https://lkml.org/lkml/2020/9/26/66 Nicolin Chen (3): memory: tegra: Add helper function tegra_get_memory_controller iommu/tegra-smmu: Rework .probe_device and .attach_dev iommu/tegra-smmu: Add PCI support drivers/iommu/tegra-smmu.c |

[PATCH v2 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev

2020-09-29 Thread Nicolin Chen
ing code, tegra_smmu_find/tegra_smmu_configure() 3) Calling tegra_get_memory_controller() in .probe_device() instead 4) Also dropping the hack in .probe() that's no longer needed. Signed-off-by: Nicolin Chen --- Changelog v1->v2 * Replaced in .probe_device() tegra_smmu_find/tegra_smmu_con

[PATCH v2 1/3] memory: tegra: Add helper function tegra_get_memory_controller

2020-09-29 Thread Nicolin Chen
This can be used by both tegra-smmu and tegra20-devfreq drivers. Suggested-by: Dmitry Osipenko Signed-off-by: Nicolin Chen --- Changelog v1->v2 * N/A drivers/memory/tegra/mc.c | 23 +++ include/soc/tegra/mc.h| 1 + 2 files changed, 24 insertions(+) diff --

[PATCH v2 3/3] iommu/tegra-smmu: Add PCI support

2020-09-29 Thread Nicolin Chen
This patch simply adds support for PCI devices. Also reverses bus_set_iommu in tegra_smmu_remove(). Signed-off-by: Nicolin Chen --- Changelog v1->v2 * Added error-out labels in tegra_smmu_probe() * Dropped pci_request_acs() since IOMMU core would call it. drivers/iommu/tegra-smmu.c |

[PATCH v4 1/2] iommu/tegra-smmu: Unwrap tegra_smmu_group_get

2020-09-29 Thread Nicolin Chen
ist for other devices to match. This patch simply unwraps the function to clean it up. Signed-off-by: Nicolin Chen --- Changelog v2->v4: * N/A v1->v2: * Changed type of swgroup to "unsigned int", following Thierry's commnets. drivers/iommu/tegra-smmu.c | 19 ---

[PATCH v4 2/2] iommu/tegra-smmu: Expand mutex protection range

2020-09-29 Thread Nicolin Chen
This is used to protect potential race condition at use_count. since probes of client drivers, calling attach_dev(), may run concurrently. Signed-off-by: Nicolin Chen --- Changelog v3->v4: * Fixed typo "Expend" => "Expand" v2->v3: * Renamed label "er

[PATCH v4 0/2] iommu/tegra-smmu: Two followup changes

2020-09-29 Thread Nicolin Chen
arated first two changs of V1 so they may get applied first, since the other three changes need some extra time to finalize. Nicolin Chen (2): iommu/tegra-smmu: Unwrap tegra_smmu_group_get iommu/tegra-smmu: Expand mutex protection range drivers/iommu/tegra-smmu.c | 53 +

Re: [PATCH v3 2/2] iommu/tegra-smmu: Expend mutex protection range

2020-09-29 Thread Nicolin Chen
On Tue, Sep 29, 2020 at 07:03:36AM +0100, Christoph Hellwig wrote: > On Mon, Sep 28, 2020 at 09:52:47PM -0700, Nicolin Chen wrote: > > This is used to protect potential race condition at use_count. > > since probes of client drivers, calling attach_dev(), may run > > concurr

Re: [PATCH 3/5] iommu/tegra-smmu: Use iommu_fwspec in .probe_/.attach_device()

2020-09-28 Thread Nicolin Chen
On Tue, Sep 29, 2020 at 07:06:37AM +0300, Dmitry Osipenko wrote: > ... > >> As I mentioned in another reply, I think tegra_smmu_find() should be all > >> you need in this case. > > > > This function is used by .probe_device() where its dev pointer is > > an SMMU client. IIUC, tegra_smmu_find()

[PATCH v3 0/2] iommu/tegra-smmu: Two followup changes

2020-09-28 Thread Nicolin Chen
et applied first, since the other three changes need some extra time to finalize. Nicolin Chen (2): iommu/tegra-smmu: Unwrap tegra_smmu_group_get iommu/tegra-smmu: Expend mutex protection range drivers/iommu/tegra-smmu.c | 53 ++ 1 file changed, 25 i

[PATCH v3 1/2] iommu/tegra-smmu: Unwrap tegra_smmu_group_get

2020-09-28 Thread Nicolin Chen
ist for other devices to match. This patch simply unwraps the function to clean it up. Signed-off-by: Nicolin Chen --- Changelog v2->v3: * N/A v1->v2: * Changed type of swgroup to "unsigned int", following Thierry's commnets. drivers/iommu/tegra-smmu.c | 19 ---

[PATCH v3 2/2] iommu/tegra-smmu: Expend mutex protection range

2020-09-28 Thread Nicolin Chen
This is used to protect potential race condition at use_count. since probes of client drivers, calling attach_dev(), may run concurrently. Signed-off-by: Nicolin Chen --- Changelog v2->v3: * Renamed label "err_unlock" to "unlock" v1->v2: * N/A drive

Re: [PATCH v2 2/2] iommu/tegra-smmu: Expend mutex protection range

2020-09-28 Thread Nicolin Chen
On Tue, Sep 29, 2020 at 03:17:58AM +0300, Dmitry Osipenko wrote: > ... > > static bool tegra_smmu_capable(enum iommu_cap cap) > > @@ -420,17 +413,21 @@ static int tegra_smmu_as_prepare(struct tegra_smmu > > *smmu, > > struct tegra_smmu_as *as) > > { > > u32

[PATCH v2 0/2] iommu/tegra-smmu: Two followup changes

2020-09-28 Thread Nicolin Chen
ize. Nicolin Chen (2): iommu/tegra-smmu: Unwrap tegra_smmu_group_get iommu/tegra-smmu: Expend mutex protection range drivers/iommu/tegra-smmu.c | 53 ++ 1 file changed, 25 insertions(+), 28 deletions(-) -- 2.1

[PATCH v2 2/2] iommu/tegra-smmu: Expend mutex protection range

2020-09-28 Thread Nicolin Chen
This is used to protect potential race condition at use_count. since probes of client drivers, calling attach_dev(), may run concurrently. Signed-off-by: Nicolin Chen --- Changelog v1->v2: * N/A drivers/iommu/tegra-smmu.c | 34 +- 1 file changed, 21 inserti

[PATCH v2 1/2] iommu/tegra-smmu: Unwrap tegra_smmu_group_get

2020-09-28 Thread Nicolin Chen
ist for other devices to match. This patch simply unwraps the function to clean it up. Signed-off-by: Nicolin Chen --- Changelog v1->v2: * Changed type of swgroup to "unsigned int", following Thierry's commnets. drivers/iommu/tegra-smmu.c | 19 --- 1 file chang

  1   2   3   >