All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: Joerg Roedel <joro@8bytes.org>
Cc: iommu@lists.linux-foundation.org,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	Joerg Roedel <jroedel@suse.de>
Subject: Re: [PATCH] iommu/rockchip: Make use of 'struct iommu_device'
Date: Mon, 03 Apr 2017 11:56:59 +0200	[thread overview]
Message-ID: <1785458.LaVlbOJ67B@diego> (raw)
In-Reply-To: <1490970624-19981-1-git-send-email-joro@8bytes.org>

Hi Joerg,

Am Freitag, 31. März 2017, 16:30:24 CEST schrieb Joerg Roedel:
> From: Joerg Roedel <jroedel@suse.de>
> 
> Register hardware IOMMUs seperatly with the iommu-core code
> and add a sysfs representation of the iommu topology.
> 
> Signed-off-by: Joerg Roedel <jroedel@suse.de>

In general works, and I still keep a working iommu-based display :-)
I can also see my two vop iommus under /sys/class/iommu now.

Links in the devices subdirectory do not work though, see below:

> ---
>  drivers/iommu/rockchip-iommu.c | 30 ++++++++++++++++++++++++++++--
>  1 file changed, 28 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
> index 9afcbf7..36d0890 100644
> --- a/drivers/iommu/rockchip-iommu.c
> +++ b/drivers/iommu/rockchip-iommu.c
> @@ -1054,6 +1056,10 @@ static int rk_iommu_add_device(struct device *dev)
>  	if (ret)
>  		goto err_remove_device;
> 
> +	iommu = rk_iommu_from_dev(dev);
> +	if (iommu)
> +		iommu_device_link(&iommu->iommu, dev);
> +

It looks like the iommu association can very well run before the iommu
actually probes, via the bus_set_iommu and which happens on my veyron-pinky
device). Thus iommu is NULL, as platform_set_drvdata in probe hasn't run yet
and the link is never created.

[    0.034180] iommu: Adding device ff930000.vop to group 0
[    0.034198] rk_iommu_from_dev: found iommu ff930300.iommu for ff930000.vop with data at   (null)
[    0.034209] rk_iommu_add_device: rk_iommu_from_dev returned   (null) for ff930000.vop
[    0.034232] iommu: Adding device ff940000.vop to group 1
[    0.034247] rk_iommu_from_dev: found iommu ff940300.iommu for ff940000.vop with data at   (null)
[    0.034258] rk_iommu_add_device: rk_iommu_from_dev returned   (null) for ff940000.vop
[    0.034342] rk_iommu_probe: set_drvdata for ff930300.iommu at ee2c7a10
[    0.034411] rk_iommu_probe: set_drvdata for ff940300.iommu at ee2c7c10
[    7.326395] rk_iommu_from_dev: found iommu ff930300.iommu for ff930000.vop with data at ee2c7a10


Not sure what the proper solution is though.


Heiko

WARNING: multiple messages have this Message-ID (diff)
From: heiko@sntech.de (Heiko Stübner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] iommu/rockchip: Make use of 'struct iommu_device'
Date: Mon, 03 Apr 2017 11:56:59 +0200	[thread overview]
Message-ID: <1785458.LaVlbOJ67B@diego> (raw)
In-Reply-To: <1490970624-19981-1-git-send-email-joro@8bytes.org>

Hi Joerg,

Am Freitag, 31. M?rz 2017, 16:30:24 CEST schrieb Joerg Roedel:
> From: Joerg Roedel <jroedel@suse.de>
> 
> Register hardware IOMMUs seperatly with the iommu-core code
> and add a sysfs representation of the iommu topology.
> 
> Signed-off-by: Joerg Roedel <jroedel@suse.de>

In general works, and I still keep a working iommu-based display :-)
I can also see my two vop iommus under /sys/class/iommu now.

Links in the devices subdirectory do not work though, see below:

> ---
>  drivers/iommu/rockchip-iommu.c | 30 ++++++++++++++++++++++++++++--
>  1 file changed, 28 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
> index 9afcbf7..36d0890 100644
> --- a/drivers/iommu/rockchip-iommu.c
> +++ b/drivers/iommu/rockchip-iommu.c
> @@ -1054,6 +1056,10 @@ static int rk_iommu_add_device(struct device *dev)
>  	if (ret)
>  		goto err_remove_device;
> 
> +	iommu = rk_iommu_from_dev(dev);
> +	if (iommu)
> +		iommu_device_link(&iommu->iommu, dev);
> +

It looks like the iommu association can very well run before the iommu
actually probes, via the bus_set_iommu and which happens on my veyron-pinky
device). Thus iommu is NULL, as platform_set_drvdata in probe hasn't run yet
and the link is never created.

[    0.034180] iommu: Adding device ff930000.vop to group 0
[    0.034198] rk_iommu_from_dev: found iommu ff930300.iommu for ff930000.vop with data at   (null)
[    0.034209] rk_iommu_add_device: rk_iommu_from_dev returned   (null) for ff930000.vop
[    0.034232] iommu: Adding device ff940000.vop to group 1
[    0.034247] rk_iommu_from_dev: found iommu ff940300.iommu for ff940000.vop with data at   (null)
[    0.034258] rk_iommu_add_device: rk_iommu_from_dev returned   (null) for ff940000.vop
[    0.034342] rk_iommu_probe: set_drvdata for ff930300.iommu at ee2c7a10
[    0.034411] rk_iommu_probe: set_drvdata for ff940300.iommu at ee2c7c10
[    7.326395] rk_iommu_from_dev: found iommu ff930300.iommu for ff930000.vop with data at ee2c7a10


Not sure what the proper solution is though.


Heiko

  reply	other threads:[~2017-04-03  9:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31 14:30 [PATCH] iommu/rockchip: Make use of 'struct iommu_device' Joerg Roedel
2017-03-31 14:30 ` Joerg Roedel
2017-03-31 14:30 ` Joerg Roedel
2017-04-03  9:56 ` Heiko Stübner [this message]
2017-04-03  9:56   ` Heiko Stübner
2017-04-03 11:07   ` Joerg Roedel
2017-04-03 11:07     ` Joerg Roedel
2017-04-03 11:07     ` Joerg Roedel
     [not found]     ` <20170403110758.GB4683-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2017-04-03 11:11       ` Heiko Stübner
2017-04-03 11:11         ` Heiko Stübner
2017-04-03 11:11         ` Heiko Stübner
2017-04-03 11:18         ` Joerg Roedel
2017-04-03 11:18           ` Joerg Roedel
2017-04-03 11:18           ` Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1785458.LaVlbOJ67B@diego \
    --to=heiko@sntech.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=jroedel@suse.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.