All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
Cc: "iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org"
	<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH] iommu/arm-smmu: Play nice on non-ARM/SMMU systems
Date: Tue, 11 Nov 2014 17:18:53 +0100	[thread overview]
Message-ID: <20141111161852.GB27754@ulmo> (raw)
In-Reply-To: <20141110172539.GM23942-5wv7dgnIgG8@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 2050 bytes --]

On Mon, Nov 10, 2014 at 05:25:39PM +0000, Will Deacon wrote:
> On Fri, Nov 07, 2014 at 03:26:18PM +0000, Thierry Reding wrote:
> > From: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> > 
> > Currently the driver registers IOMMU bus operations for all busses even
> > if no ARM SMMU is present on a system. Depending on the driver probing
> > order this prevents the driver for the real IOMMU to register itself as
> > the bus-wide IOMMU.
> > 
> > Signed-off-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> > ---
> >  drivers/iommu/arm-smmu.c | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> > 
> > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> > index 60558f794922..e154826d8b1d 100644
> > --- a/drivers/iommu/arm-smmu.c
> > +++ b/drivers/iommu/arm-smmu.c
> > @@ -2072,8 +2072,20 @@ static struct platform_driver arm_smmu_driver = {
> >  
> >  static int __init arm_smmu_init(void)
> >  {
> > +	struct device_node *np;
> >  	int ret;
> >  
> > +	/*
> > +	 * Play nice with systems that don't have an ARM SMMU by checking that
> > +	 * an ARM SMMU exists in the system before proceeding with the driver
> > +	 * and IOMMU bus operation registration.
> > +	 */
> > +	np = of_find_matching_node(NULL, arm_smmu_of_match);
> > +	if (!np)
> > +		return 0;
> > +
> > +	of_node_put(np);
> > +
> 
> Hopefully, this will be solved shortly by the of_iommu_configure series I've
> been dragging my feet with recently. However, since that's not done yet,
> this looks like the best thing for now, even if it's a bit of a bodge.
> 
> Have you checked/updated other IOMMMU drivers too?

ARM SMMU was the only one being enabled on 64-bit where I noticed this,
but from a quick glance a couple of the other ARM driver are affected as
well. I'll see if I can find the time to come up with a similar patch.

Of course if these IOMMU drivers were proper drivers and bind to a
device, then this problem wouldn't exist in the first place.

Thierry

[-- Attachment #1.2: Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



WARNING: multiple messages have this Message-ID (diff)
From: thierry.reding@gmail.com (Thierry Reding)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] iommu/arm-smmu: Play nice on non-ARM/SMMU systems
Date: Tue, 11 Nov 2014 17:18:53 +0100	[thread overview]
Message-ID: <20141111161852.GB27754@ulmo> (raw)
In-Reply-To: <20141110172539.GM23942@arm.com>

On Mon, Nov 10, 2014 at 05:25:39PM +0000, Will Deacon wrote:
> On Fri, Nov 07, 2014 at 03:26:18PM +0000, Thierry Reding wrote:
> > From: Thierry Reding <treding@nvidia.com>
> > 
> > Currently the driver registers IOMMU bus operations for all busses even
> > if no ARM SMMU is present on a system. Depending on the driver probing
> > order this prevents the driver for the real IOMMU to register itself as
> > the bus-wide IOMMU.
> > 
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
> > ---
> >  drivers/iommu/arm-smmu.c | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> > 
> > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> > index 60558f794922..e154826d8b1d 100644
> > --- a/drivers/iommu/arm-smmu.c
> > +++ b/drivers/iommu/arm-smmu.c
> > @@ -2072,8 +2072,20 @@ static struct platform_driver arm_smmu_driver = {
> >  
> >  static int __init arm_smmu_init(void)
> >  {
> > +	struct device_node *np;
> >  	int ret;
> >  
> > +	/*
> > +	 * Play nice with systems that don't have an ARM SMMU by checking that
> > +	 * an ARM SMMU exists in the system before proceeding with the driver
> > +	 * and IOMMU bus operation registration.
> > +	 */
> > +	np = of_find_matching_node(NULL, arm_smmu_of_match);
> > +	if (!np)
> > +		return 0;
> > +
> > +	of_node_put(np);
> > +
> 
> Hopefully, this will be solved shortly by the of_iommu_configure series I've
> been dragging my feet with recently. However, since that's not done yet,
> this looks like the best thing for now, even if it's a bit of a bodge.
> 
> Have you checked/updated other IOMMMU drivers too?

ARM SMMU was the only one being enabled on 64-bit where I noticed this,
but from a quick glance a couple of the other ARM driver are affected as
well. I'll see if I can find the time to come up with a similar patch.

Of course if these IOMMU drivers were proper drivers and bind to a
device, then this problem wouldn't exist in the first place.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141111/4f1cb4d7/attachment.sig>

  parent reply	other threads:[~2014-11-11 16:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-07 15:26 [PATCH] iommu/arm-smmu: Play nice on non-ARM/SMMU systems Thierry Reding
2014-11-07 15:26 ` Thierry Reding
     [not found] ` <1415373978-16203-1-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-11-10 17:25   ` Will Deacon
2014-11-10 17:25     ` Will Deacon
     [not found]     ` <20141110172539.GM23942-5wv7dgnIgG8@public.gmane.org>
2014-11-11 16:18       ` Thierry Reding [this message]
2014-11-11 16:18         ` Thierry Reding

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=20141111161852.GB27754@ulmo \
    --to=thierry.reding-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=will.deacon-5wv7dgnIgG8@public.gmane.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.