From: Joerg Roedel <joerg.roedel@amd.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: mingo@redhat.com, tglx@linutronix.de,
linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
bhavna.sarathy@amd.com, robert.richter@amd.com
Subject: Re: [PATCH] add iommu_num_pages helper function
Date: Fri, 25 Jul 2008 15:21:21 +0200 [thread overview]
Message-ID: <20080725132121.GZ7493@amd.com> (raw)
In-Reply-To: <20080725221553Q.fujita.tomonori@lab.ntt.co.jp>
On Fri, Jul 25, 2008 at 10:15:06PM +0900, FUJITA Tomonori wrote:
> On Fri, 25 Jul 2008 14:57:58 +0200
> Joerg Roedel <joerg.roedel@amd.com> wrote:
>
> > Calculating the number of pages from given address and length numbers is a task
> > required in multiple IOMMU implementations. So implement this as a generic
> > function into the IOMMU helper code.
> >
> > Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> > Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
> > ---
> > include/linux/iommu-helper.h | 1 +
> > lib/iommu-helper.c | 8 ++++++++
> > 2 files changed, 9 insertions(+), 0 deletions(-)
>
> Thanks. I planed to work on this after rc1. You beat me. :)
>
>
> > diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h
> > index c975caf..f8598f5 100644
> > --- a/include/linux/iommu-helper.h
> > +++ b/include/linux/iommu-helper.h
> > @@ -8,3 +8,4 @@ extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
> > unsigned long align_mask);
> > extern void iommu_area_free(unsigned long *map, unsigned long start,
> > unsigned int nr);
> > +extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len);
> > diff --git a/lib/iommu-helper.c b/lib/iommu-helper.c
> > index a3b8d4c..889ddce 100644
> > --- a/lib/iommu-helper.c
> > +++ b/lib/iommu-helper.c
> > @@ -80,3 +80,11 @@ void iommu_area_free(unsigned long *map, unsigned long start, unsigned int nr)
> > }
> > }
> > EXPORT_SYMBOL(iommu_area_free);
> > +
> > +unsigned long iommu_num_pages(unsigned long addr, unsigned long len)
> > +{
> > + unsigned long size = roundup((addr & ~PAGE_MASK) + len, PAGE_SIZE);
> > +
> > + return size >> PAGE_SHIFT;
> > +}
> > +EXPORT_SYMBOL(iommu_num_pages);
>
> This doesn't work since PAGE_SIZE != IOMMU_PAGE_SIZE on the majority
> of architectures.
A quick grep in include/ tells me that only powerpc is declaring
IOMMU_PAGE_SIZE by now.
Joerg
--
| AMD Saxony Limited Liability Company & Co. KG
Operating | Wilschdorfer Landstr. 101, 01109 Dresden, Germany
System | Register Court Dresden: HRA 4896
Research | General Partner authorized to represent:
Center | AMD Saxony LLC (Wilmington, Delaware, US)
| General Manager of AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy
next prev parent reply other threads:[~2008-07-25 13:22 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-25 12:57 [PATCH 0/3] IOMMU: move page number calculation to generic code Joerg Roedel
2008-07-25 12:57 ` [PATCH] add iommu_num_pages helper function Joerg Roedel
2008-07-25 13:15 ` FUJITA Tomonori
2008-07-25 13:21 ` Joerg Roedel [this message]
2008-07-25 13:34 ` FUJITA Tomonori
2008-07-25 13:41 ` Joerg Roedel
2008-07-25 13:57 ` FUJITA Tomonori
2008-07-25 14:14 ` Joerg Roedel
2008-07-25 14:32 ` FUJITA Tomonori
2008-07-26 13:41 ` Ingo Molnar
2008-07-29 1:07 ` Stephen Rothwell
2008-07-29 1:46 ` FUJITA Tomonori
2008-07-29 3:56 ` Stephen Rothwell
2008-07-29 4:38 ` FUJITA Tomonori
2008-07-29 5:26 ` David Miller
2008-07-29 5:42 ` FUJITA Tomonori
2008-07-29 5:24 ` David Miller
2008-07-29 5:42 ` FUJITA Tomonori
2008-07-29 6:45 ` Stephen Rothwell
2008-07-29 9:50 ` Joerg Roedel
2008-07-29 9:58 ` FUJITA Tomonori
2008-07-29 10:02 ` Joerg Roedel
2008-07-30 22:44 ` Benjamin Herrenschmidt
2008-07-31 2:07 ` FUJITA Tomonori
2008-07-29 10:10 ` David Miller
2008-07-29 10:26 ` Joerg Roedel
2008-07-29 10:27 ` FUJITA Tomonori
2008-07-29 10:31 ` Ingo Molnar
2008-07-29 10:33 ` David Miller
2008-07-29 12:45 ` Stephen Rothwell
2008-07-30 12:18 ` Joerg Roedel
2008-07-30 13:16 ` FUJITA Tomonori
2008-07-30 14:03 ` Joerg Roedel
2008-07-30 18:52 ` Joerg Roedel
2008-07-30 22:44 ` Benjamin Herrenschmidt
2008-07-29 11:27 ` Ingo Molnar
2008-07-29 15:45 ` Jesse Barnes
2008-07-25 12:57 ` [PATCH] AMD IOMMU: replace to_pages macro with iommu_num_pages Joerg Roedel
2008-07-25 12:58 ` [PATCH] x86 gart: " Joerg Roedel
2008-07-26 13:44 ` [PATCH 0/3] IOMMU: move page number calculation to generic code Ingo Molnar
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=20080725132121.GZ7493@amd.com \
--to=joerg.roedel@amd.com \
--cc=bhavna.sarathy@amd.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=robert.richter@amd.com \
--cc=tglx@linutronix.de \
/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.