* [PATCH] AMD IOMMU: use iommu_device_max_index
@ 2008-09-28 15:06 FUJITA Tomonori
2008-10-01 16:30 ` Joerg Roedel
0 siblings, 1 reply; 4+ messages in thread
From: FUJITA Tomonori @ 2008-09-28 15:06 UTC (permalink / raw)
To: joerg.roedel; +Cc: mingo, linux-kernel
This is against tip/iommu.
=
From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Subject: [PATCH] AMD IOMMU: use iommu_device_max_index
AMD IOMMU can use iommu_device_max_index() instead of the homegrown
function.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
arch/x86/kernel/amd_iommu.c | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 2028810..34e4d11 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -480,10 +480,6 @@ static int init_unity_mappings_for_device(struct dma_ops_domain *dma_dom,
* efficient allocator.
*
****************************************************************************/
-static unsigned long dma_mask_to_pages(unsigned long mask)
-{
- return PAGE_ALIGN(mask) >> PAGE_SHIFT;
-}
/*
* The address allocator core function.
@@ -496,14 +492,14 @@ static unsigned long dma_ops_alloc_addresses(struct device *dev,
unsigned long align_mask,
u64 dma_mask)
{
- unsigned long limit = dma_mask_to_pages(dma_mask);
+ unsigned long limit;
unsigned long address;
- unsigned long size = dom->aperture_size >> PAGE_SHIFT;
unsigned long boundary_size;
boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1,
PAGE_SIZE) >> PAGE_SHIFT;
- limit = limit < size ? limit : size;
+ limit = iommu_device_max_index(dom->aperture_size >> PAGE_SHIFT, 0,
+ dma_mask >> PAGE_SHIFT);
if (dom->next_bit >= limit) {
dom->next_bit = 0;
--
1.5.4.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] AMD IOMMU: use iommu_device_max_index
2008-09-28 15:06 [PATCH] AMD IOMMU: use iommu_device_max_index FUJITA Tomonori
@ 2008-10-01 16:30 ` Joerg Roedel
2008-10-02 9:34 ` Ingo Molnar
0 siblings, 1 reply; 4+ messages in thread
From: Joerg Roedel @ 2008-10-01 16:30 UTC (permalink / raw)
To: FUJITA Tomonori; +Cc: mingo, linux-kernel
Ingo,
can you please apply this patch to your x86/iommu directly? For a single
patch it makes no sense to go through my tree.
Joerg
On Mon, Sep 29, 2008 at 12:06:36AM +0900, FUJITA Tomonori wrote:
> This is against tip/iommu.
>
> =
> From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> Subject: [PATCH] AMD IOMMU: use iommu_device_max_index
>
> AMD IOMMU can use iommu_device_max_index() instead of the homegrown
> function.
>
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
> ---
> arch/x86/kernel/amd_iommu.c | 10 +++-------
> 1 files changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
> index 2028810..34e4d11 100644
> --- a/arch/x86/kernel/amd_iommu.c
> +++ b/arch/x86/kernel/amd_iommu.c
> @@ -480,10 +480,6 @@ static int init_unity_mappings_for_device(struct dma_ops_domain *dma_dom,
> * efficient allocator.
> *
> ****************************************************************************/
> -static unsigned long dma_mask_to_pages(unsigned long mask)
> -{
> - return PAGE_ALIGN(mask) >> PAGE_SHIFT;
> -}
>
> /*
> * The address allocator core function.
> @@ -496,14 +492,14 @@ static unsigned long dma_ops_alloc_addresses(struct device *dev,
> unsigned long align_mask,
> u64 dma_mask)
> {
> - unsigned long limit = dma_mask_to_pages(dma_mask);
> + unsigned long limit;
> unsigned long address;
> - unsigned long size = dom->aperture_size >> PAGE_SHIFT;
> unsigned long boundary_size;
>
> boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1,
> PAGE_SIZE) >> PAGE_SHIFT;
> - limit = limit < size ? limit : size;
> + limit = iommu_device_max_index(dom->aperture_size >> PAGE_SHIFT, 0,
> + dma_mask >> PAGE_SHIFT);
>
> if (dom->next_bit >= limit) {
> dom->next_bit = 0;
> --
> 1.5.4.2
>
>
--
| 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] AMD IOMMU: use iommu_device_max_index
2008-10-01 16:30 ` Joerg Roedel
@ 2008-10-02 9:34 ` Ingo Molnar
2008-10-06 12:15 ` Thomas Gleixner
0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2008-10-02 9:34 UTC (permalink / raw)
To: Joerg Roedel; +Cc: FUJITA Tomonori, linux-kernel
* Joerg Roedel <joerg.roedel@amd.com> wrote:
> Ingo,
>
> can you please apply this patch to your x86/iommu directly? For a
> single patch it makes no sense to go through my tree.
sure - applied to tip/x86/iommu, thanks guys.
Ingo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] AMD IOMMU: use iommu_device_max_index
2008-10-02 9:34 ` Ingo Molnar
@ 2008-10-06 12:15 ` Thomas Gleixner
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2008-10-06 12:15 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Joerg Roedel, FUJITA Tomonori, linux-kernel
On Thu, 2 Oct 2008, Ingo Molnar wrote:
> * Joerg Roedel <joerg.roedel@amd.com> wrote:
>
> > Ingo,
> >
> > can you please apply this patch to your x86/iommu directly? For a
> > single patch it makes no sense to go through my tree.
>
> sure - applied to tip/x86/iommu, thanks guys.
breaks sparc64 build due to missing header guards.
Thanks,
tglx
-------------->
Subject: iommu: add missing header guards
From: Thomas Gleixner <tglx@linutronix.de>
Date: Mon, 06 Oct 2008 14:12:21 +0200
include/linux/iommu-helper.h has no header guards, which breaks
sparc64 build. Add them.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h
index 786539e..a6d0586 100644
--- a/include/linux/iommu-helper.h
+++ b/include/linux/iommu-helper.h
@@ -1,3 +1,6 @@
+#ifndef _LINUX_IOMMU_HELPER_H
+#define _LINUX_IOMMU_HELPER_H
+
static inline unsigned long iommu_device_max_index(unsigned long size,
unsigned long offset,
u64 dma_mask)
@@ -19,3 +22,5 @@ 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);
+
+#endif
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-10-06 12:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-28 15:06 [PATCH] AMD IOMMU: use iommu_device_max_index FUJITA Tomonori
2008-10-01 16:30 ` Joerg Roedel
2008-10-02 9:34 ` Ingo Molnar
2008-10-06 12:15 ` Thomas Gleixner
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).