iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>
To: Antonios Motakis
	<a.motakis-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@public.gmane.org>
Cc: open list <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"agraf-l3A5Bk7waGM@public.gmane.org"
	<agraf-l3A5Bk7waGM@public.gmane.org>,
	"B08248-KZfg59tc24xl57MIdRCFDg@public.gmane.org"
	<B08248-KZfg59tc24xl57MIdRCFDg@public.gmane.org>,
	"open list:IOMMU DRIVERS"
	<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	"tech-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@public.gmane.org"
	<tech-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@public.gmane.org>,
	"kvmarm-FPEHb7Xf0XXUo1n7N8X6UoWGPAHP3yOg@public.gmane.org"
	<kvmarm-FPEHb7Xf0XXUo1n7N8X6UoWGPAHP3yOg@public.gmane.org>,
	"moderated list:ARM SMMU DRIVER"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH 2/2] ARM: SMMU: return NULL on error in arm_smmu_iova_to_phys
Date: Mon, 14 Oct 2013 18:09:48 +0100	[thread overview]
Message-ID: <20131014170948.GS10491@mudshark.cambridge.arm.com> (raw)
In-Reply-To: <CAG8rG2yE=xWmYP_bOy7=jzWEQKNkbgk-9_Jecnx_XXx=jC9i_Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Mon, Oct 14, 2013 at 04:17:51PM +0100, Antonios Motakis wrote:
> On Mon, Oct 14, 2013 at 2:48 PM, Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org> wrote:
> > On Fri, Oct 11, 2013 at 02:24:47PM +0100, Antonios Motakis wrote:
> >> The return value of arm_smmu_iova_to_phys is directly passed to the
> >> user of the IOMMU API via iommu_iova_to_phys; however the ARM SMMU
> >> driver returns -EINVAL on error, which is not consistent with the
> >> rest of the drivers implementing the IOMMU API. VFIO also relies on
> >> the call returning NULL when a page has not been mapped already.
> >>
> >> Signed-off-by: Antonios Motakis <a.motakis-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@public.gmane.org>
> >> ---
> >>  drivers/iommu/arm-smmu.c | 5 +----
> >>  1 file changed, 1 insertion(+), 4 deletions(-)
> >>
> >> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> >> index 8b71332..fe81b20 100644
> >> --- a/drivers/iommu/arm-smmu.c
> >> +++ b/drivers/iommu/arm-smmu.c
> >> @@ -1480,10 +1480,7 @@ static phys_addr_t arm_smmu_iova_to_phys(struct iommu_domain *domain,
> >>
> >>  err_unlock:
> >>       spin_unlock(&smmu_domain->lock);
> >> -     dev_warn(smmu->dev,
> >> -              "invalid (corrupt?) page tables detected for iova 0x%llx\n",
> >> -              (unsigned long long)iova);
> >> -     return -EINVAL;
> >> +     return NULL;
> >
> > Why are you removing the warning message?
> 
> VFIO will exercise this code path every time when mapping DMA memory.
> This is normal and VFIO *expects* the function to fail - it is only if
> the function succeeds that VFIO needs to back down from the DMA
> mapping and fail.
> 
> This means that there would be a warning every time a VFIO user maps
> some memory for DMA use, even though nothing went wrong.

Ok, in which case it might be worth reworking arm_smmu_iova_to_phys to treat
{pgd,pud,pmd,pte}_none different from {pgd,pud,pmd,pte}_bad.

Will

  parent reply	other threads:[~2013-10-14 17:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-11 13:24 [PATCH 1/2] ARM: SMMU: add devices attached to the SMMU to an IOMMU group Antonios Motakis
     [not found] ` <1381497887-14586-1-git-send-email-a.motakis-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@public.gmane.org>
2013-10-11 13:24   ` [PATCH 2/2] ARM: SMMU: return NULL on error in arm_smmu_iova_to_phys Antonios Motakis
     [not found]     ` <1381497887-14586-2-git-send-email-a.motakis-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@public.gmane.org>
2013-10-14 12:48       ` Will Deacon
     [not found]         ` <20131014124837.GD10491-MRww78TxoiP5vMa5CHWGZ34zcgK1vI+I0E9HWUfgJXw@public.gmane.org>
2013-10-14 15:17           ` Antonios Motakis
     [not found]             ` <CAG8rG2yE=xWmYP_bOy7=jzWEQKNkbgk-9_Jecnx_XXx=jC9i_Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-10-14 17:09               ` Will Deacon [this message]
     [not found]                 ` <20131014170948.GS10491-MRww78TxoiP5vMa5CHWGZ34zcgK1vI+I0E9HWUfgJXw@public.gmane.org>
2013-11-07 18:58                   ` Will Deacon
2013-10-14 12:48   ` [PATCH 1/2] ARM: SMMU: add devices attached to the SMMU to an IOMMU group Will Deacon
2013-10-14 15:13     ` Antonios Motakis
     [not found]       ` <CAG8rG2wftreREPnCbH8cKtsHD4TXBFAYGfY0ZMmsX3UW757r4Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-10-14 17:07         ` Will Deacon
     [not found]           ` <20131014170719.GR10491-MRww78TxoiP5vMa5CHWGZ34zcgK1vI+I0E9HWUfgJXw@public.gmane.org>
2013-10-18 10:29             ` Antonios Motakis

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=20131014170948.GS10491@mudshark.cambridge.arm.com \
    --to=will.deacon-5wv7dgnigg8@public.gmane.org \
    --cc=B08248-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    --cc=a.motakis-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@public.gmane.org \
    --cc=agraf-l3A5Bk7waGM@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=kvmarm-FPEHb7Xf0XXUo1n7N8X6UoWGPAHP3yOg@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=tech-lrHrjnjw1UfHK3s98zE1ajGjJy/sRE9J@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 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).