iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Jian-Hong Pan <jian-hong@endlessm.com>
To: Lu Baolu <baolu.lu@linux.intel.com>
Cc: Linux Upstreaming Team <linux@endlessm.com>,
	David Woodhouse <dwmw2@infradead.org>,
	iommu@lists.linux-foundation.org,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] iommu/intel-iommu: set as DUMMY_DEVICE_DOMAIN_INFO if no IOMMU
Date: Tue, 4 Feb 2020 17:25:04 +0800	[thread overview]
Message-ID: <CAPpJ_edkkWm0DYHB3U8nQPv=z_o-aV4V7RDMuLTXL5N1H6ZYrA@mail.gmail.com> (raw)
In-Reply-To: <aab0948d-c6a3-baa1-7343-f18c936d662d@linux.intel.com>

Lu Baolu <baolu.lu@linux.intel.com> 於 2020年2月4日 週二 下午2:11寫道:
>
> Hi,
>
> On 2020/2/3 17:10, Jian-Hong Pan wrote:
> > If the device has no IOMMU, it still invokes iommu_need_mapping during
> > intel_alloc_coherent. However, iommu_need_mapping can only check the
> > device is DUMMY_DEVICE_DOMAIN_INFO or not. This patch marks the device
> > is a DUMMY_DEVICE_DOMAIN_INFO if the device has no IOMMU.
> >
> > Signed-off-by: Jian-Hong Pan <jian-hong@endlessm.com>
> > ---
> >   drivers/iommu/intel-iommu.c | 4 +++-
> >   1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
> > index 35a4a3abedc6..878bc986a015 100644
> > --- a/drivers/iommu/intel-iommu.c
> > +++ b/drivers/iommu/intel-iommu.c
> > @@ -5612,8 +5612,10 @@ static int intel_iommu_add_device(struct device *dev)
> >       int ret;
> >
> >       iommu = device_to_iommu(dev, &bus, &devfn);
> > -     if (!iommu)
> > +     if (!iommu) {
> > +             dev->archdata.iommu = DUMMY_DEVICE_DOMAIN_INFO;
>
> Is this a DMA capable device?

Do you mean is the device in DMA Remapping table?
Dump DMAR from ACPI table.  The device is not in the table.
So, it does not support DMAR, Intel IOMMU.

Or, should device_to_iommu be invoked in iommu_need_mapping to check
IOMMU feature again?

Best regards,
Jian-Hong Pan

> I am afraid some real bugs might be
> covered up if we marking the device as IOMMU dummy here.
>
> Best regards,
> baolu
>
> >               return -ENODEV;
> > +     }
> >
> >       iommu_device_link(&iommu->iommu, dev);
> >
> >
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2020-02-04  9:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-03  9:10 [PATCH] iommu/intel-iommu: set as DUMMY_DEVICE_DOMAIN_INFO if no IOMMU Jian-Hong Pan
2020-02-04  6:11 ` Lu Baolu
2020-02-04  9:25   ` Jian-Hong Pan [this message]
2020-02-05  1:28     ` Lu Baolu
2020-02-05 10:06       ` Jian-Hong Pan
2020-02-06  7:25         ` Jian-Hong Pan
2020-02-06  7:32           ` Christoph Hellwig
2020-02-06 10:49         ` Lu Baolu
2020-02-07  7:32           ` Jian-Hong Pan
2020-02-08  6:29             ` Lu Baolu
2020-02-11  9:26               ` Daniel Drake

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='CAPpJ_edkkWm0DYHB3U8nQPv=z_o-aV4V7RDMuLTXL5N1H6ZYrA@mail.gmail.com' \
    --to=jian-hong@endlessm.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@endlessm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).