From: Wei Yang <weiyang@linux.vnet.ibm.com>
To: Wei Yang <weiyang@linux.vnet.ibm.com>
Cc: benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc/iommu: use iommu_num_pages() to calculate the number of iommu page
Date: Thu, 1 Oct 2015 07:50:55 +0800 [thread overview]
Message-ID: <20150930235054.GA1530@Richards-MBP.lan> (raw)
In-Reply-To: <1442667867-1802-1-git-send-email-weiyang@linux.vnet.ibm.com>
Hmm... some comments on this one? like it or not?
On Sat, Sep 19, 2015 at 09:04:27PM +0800, Wei Yang wrote:
>On PowerPC, currently we support different value of PAGE_SIZE and different
>value of IOMMU Page Size.
>
>In case the PAGE_SIZE is 4K and the IOMMU Page Size is 16M, and driver
>asked for some DMA less than 16M, the current calculation would return 0
>and the following allocation in iommu_alloc() would fail.
>
>This patch uses iommu_num_pages() to calculate it.
>
>Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
>---
> arch/powerpc/kernel/iommu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
>index a8e3490..9885397 100644
>--- a/arch/powerpc/kernel/iommu.c
>+++ b/arch/powerpc/kernel/iommu.c
>@@ -842,7 +842,7 @@ void *iommu_alloc_coherent(struct device *dev, struct iommu_table *tbl,
> memset(ret, 0, size);
>
> /* Set up tces to cover the allocated range */
>- nio_pages = size >> tbl->it_page_shift;
>+ nio_pages = iommu_num_pages(0, size, IOMMU_PAGE_SIZE(tbl));
> io_order = get_iommu_order(size, tbl);
> mapping = iommu_alloc(dev, tbl, ret, nio_pages, DMA_BIDIRECTIONAL,
> mask >> tbl->it_page_shift, io_order, NULL);
>--
>2.5.0
--
Richard Yang
Help you, Help me
next prev parent reply other threads:[~2015-09-30 23:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-19 13:04 [PATCH] powerpc/iommu: use iommu_num_pages() to calculate the number of iommu page Wei Yang
2015-09-30 23:50 ` Wei Yang [this message]
2015-10-01 4:15 ` Michael Ellerman
2015-10-01 22:51 ` Wei Yang
2015-11-12 2:32 ` Wei Yang
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=20150930235054.GA1530@Richards-MBP.lan \
--to=weiyang@linux.vnet.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.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).