From: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
To: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: [PATCH] iommu/amd: Propagate IOVA allocation failure
Date: Tue, 30 May 2017 11:48:37 +0200 [thread overview]
Message-ID: <20170530094837.GH2818@8bytes.org> (raw)
In-Reply-To: <8c0c3a31fe97dd57102b35f9be1cd69487ef04a3.1495823154.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
On Fri, May 26, 2017 at 07:31:26PM +0100, Robin Murphy wrote:
> Unlike the old allocator, alloc_iova_fast() will return 0 if it failed
> to allocate a PFN. Since the callers of dma_ops_alloc_iova() would end
> up treating that as a valid address, translate it to the DMA_ERROR_CODE
> that they would expect.
>
> Fixes: 256e4621c21a ("iommu/amd: Make use of the generic IOVA allocator")
> Signed-off-by: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
> ---
>
> Just something I spotted whilst comparing dma_map_page() callchains...
>
> drivers/iommu/amd_iommu.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
> index 63cacf5d6cf2..489dc302899e 100644
> --- a/drivers/iommu/amd_iommu.c
> +++ b/drivers/iommu/amd_iommu.c
> @@ -1555,6 +1555,9 @@ static unsigned long dma_ops_alloc_iova(struct device *dev,
> if (!pfn)
> pfn = alloc_iova_fast(&dma_dom->iovad, pages, IOVA_PFN(dma_mask));
>
> + if (!pfn)
> + return DMA_ERROR_CODE;
> +
That shouldn't make a difference on x86 because the DMA_ERROR_CODE is 0
as well.
Joerg
next prev parent reply other threads:[~2017-05-30 9:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-26 18:31 [PATCH] iommu/amd: Propagate IOVA allocation failure Robin Murphy
[not found] ` <8c0c3a31fe97dd57102b35f9be1cd69487ef04a3.1495823154.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2017-05-30 9:48 ` Joerg Roedel [this message]
[not found] ` <20170530094837.GH2818-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2017-05-30 17:31 ` Robin Murphy
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=20170530094837.GH2818@8bytes.org \
--to=joro-zlv9swrftaidnm+yrofe0a@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=robin.murphy-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.