2009-11-14 11:48:35

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH 0/3] IOMMU initialization cleanups

Some minor cleanups against tip.


2009-11-14 11:48:31

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH 1/3] x86: set dma_ops to nommu_dma_ops by default

we set dma_ops to nommu_dma_ops at two different places for x86_32 and
x86_64. This unifies them by setting dma_ops to nommu_dma_ops by
default.

Signed-off-by: FUJITA Tomonori <[email protected]>
---
arch/x86/kernel/pci-dma.c | 4 +---
arch/x86/kernel/pci-swiotlb.c | 3 +--
2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 20c3dc3..bf621b9 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -15,7 +15,7 @@

static int forbid_dac __read_mostly;

-struct dma_map_ops *dma_ops;
+struct dma_map_ops *dma_ops = &nommu_dma_ops;
EXPORT_SYMBOL(dma_ops);

static int iommu_sac_force __read_mostly;
@@ -126,8 +126,6 @@ void __init pci_iommu_alloc(void)
#ifdef CONFIG_X86_64
/* free the range so iommu could get some range less than 4G */
dma32_free_bootmem();
-#else
- dma_ops = &nommu_dma_ops;
#endif
if (pci_swiotlb_init())
return;
diff --git a/arch/x86/kernel/pci-swiotlb.c b/arch/x86/kernel/pci-swiotlb.c
index a6e5d0f..e36e71d 100644
--- a/arch/x86/kernel/pci-swiotlb.c
+++ b/arch/x86/kernel/pci-swiotlb.c
@@ -61,8 +61,7 @@ int __init pci_swiotlb_init(void)
if (swiotlb) {
swiotlb_init(0);
dma_ops = &swiotlb_dma_ops;
- } else
- dma_ops = &nommu_dma_ops;
+ }

return swiotlb_force;
}
--
1.5.6.5

2009-11-14 11:48:34

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH 2/3] x86: move iommu_shutdown_noop to x86_init.c

iommu_init_noop() is in arch/x86/kernel/x86_init.c but
iommu_shutdown_noop() in arch/x86/include/asm/iommu.h.

This moves iommu_shutdown_noop() to x86_init.c for consistency.

Signed-off-by: FUJITA Tomonori <[email protected]>
---
arch/x86/include/asm/iommu.h | 1 -
arch/x86/kernel/x86_init.c | 1 +
2 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/iommu.h b/arch/x86/include/asm/iommu.h
index df42a71..345c99c 100644
--- a/arch/x86/include/asm/iommu.h
+++ b/arch/x86/include/asm/iommu.h
@@ -1,7 +1,6 @@
#ifndef _ASM_X86_IOMMU_H
#define _ASM_X86_IOMMU_H

-static inline void iommu_shutdown_noop(void) {}
extern struct dma_map_ops nommu_dma_ops;
extern int force_iommu, no_iommu;
extern int iommu_detected;
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
index c46984d..80f3ae2 100644
--- a/arch/x86/kernel/x86_init.c
+++ b/arch/x86/kernel/x86_init.c
@@ -20,6 +20,7 @@ void __cpuinit x86_init_noop(void) { }
void __init x86_init_uint_noop(unsigned int unused) { }
void __init x86_init_pgd_noop(pgd_t *unused) { }
int __init iommu_init_noop(void) { return 0; }
+void __init iommu_shutdown_noop(void) { }

/*
* The platform setup functions are preset with the default functions
--
1.5.6.5

2009-11-14 11:48:16

by FUJITA Tomonori

[permalink] [raw]
Subject: [PATCH 3/3] remove duplicate extern declarations for swiotlb_force

Cc: [email protected]
Signed-off-by: FUJITA Tomonori <[email protected]>
---
arch/ia64/include/asm/swiotlb.h | 2 --
arch/x86/include/asm/swiotlb.h | 4 ----
include/linux/swiotlb.h | 2 ++
3 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/ia64/include/asm/swiotlb.h b/arch/ia64/include/asm/swiotlb.h
index dcbaea7..f0acde6 100644
--- a/arch/ia64/include/asm/swiotlb.h
+++ b/arch/ia64/include/asm/swiotlb.h
@@ -4,8 +4,6 @@
#include <linux/dma-mapping.h>
#include <linux/swiotlb.h>

-extern int swiotlb_force;
-
#ifdef CONFIG_SWIOTLB
extern int swiotlb;
extern void pci_swiotlb_init(void);
diff --git a/arch/x86/include/asm/swiotlb.h b/arch/x86/include/asm/swiotlb.h
index 940f13a..87ffcb1 100644
--- a/arch/x86/include/asm/swiotlb.h
+++ b/arch/x86/include/asm/swiotlb.h
@@ -3,10 +3,6 @@

#include <linux/swiotlb.h>

-/* SWIOTLB interface */
-
-extern int swiotlb_force;
-
#ifdef CONFIG_SWIOTLB
extern int swiotlb;
extern int pci_swiotlb_init(void);
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index eb9bdb4..febedcf 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -7,6 +7,8 @@ struct device;
struct dma_attrs;
struct scatterlist;

+extern int swiotlb_force;
+
/*
* Maximum allowable number of contiguous slabs to map,
* must be a power of 2. What is the appropriate value ?
--
1.5.6.5

2009-11-15 09:01:07

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH 0/3] IOMMU initialization cleanups


* FUJITA Tomonori <[email protected]> wrote:

> Some minor cleanups against tip.

Applied to the tip:core/iommu tree, thanks Fujita!

Ingo

2009-11-15 10:29:18

by FUJITA Tomonori

[permalink] [raw]
Subject: [tip:core/iommu] x86: Set dma_ops to nommu_dma_ops by default

Commit-ID: a3b28ee1090072092e2be043c24df94230e725b2
Gitweb: http://git.kernel.org/tip/a3b28ee1090072092e2be043c24df94230e725b2
Author: FUJITA Tomonori <[email protected]>
AuthorDate: Sat, 14 Nov 2009 20:46:36 +0900
Committer: Ingo Molnar <[email protected]>
CommitDate: Sun, 15 Nov 2009 09:03:09 +0100

x86: Set dma_ops to nommu_dma_ops by default

We set dma_ops to nommu_dma_ops at two different places for
x86_32 and x86_64. This unifies them by setting dma_ops to
nommu_dma_ops by default.

Signed-off-by: FUJITA Tomonori <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
---
arch/x86/kernel/pci-dma.c | 4 +---
arch/x86/kernel/pci-swiotlb.c | 3 +--
2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 0b11bf1..f170b53 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -15,7 +15,7 @@

static int forbid_dac __read_mostly;

-struct dma_map_ops *dma_ops;
+struct dma_map_ops *dma_ops = &nommu_dma_ops;
EXPORT_SYMBOL(dma_ops);

static int iommu_sac_force __read_mostly;
@@ -128,8 +128,6 @@ void __init pci_iommu_alloc(void)
#ifdef CONFIG_X86_64
/* free the range so iommu could get some range less than 4G */
dma32_free_bootmem();
-#else
- dma_ops = &nommu_dma_ops;
#endif
if (pci_swiotlb_init())
return;
diff --git a/arch/x86/kernel/pci-swiotlb.c b/arch/x86/kernel/pci-swiotlb.c
index a6e5d0f..e36e71d 100644
--- a/arch/x86/kernel/pci-swiotlb.c
+++ b/arch/x86/kernel/pci-swiotlb.c
@@ -61,8 +61,7 @@ int __init pci_swiotlb_init(void)
if (swiotlb) {
swiotlb_init(0);
dma_ops = &swiotlb_dma_ops;
- } else
- dma_ops = &nommu_dma_ops;
+ }

return swiotlb_force;
}

2009-11-15 10:29:40

by FUJITA Tomonori

[permalink] [raw]
Subject: [tip:core/iommu] x86: Move iommu_shutdown_noop to x86_init.c

Commit-ID: 94a15564ac63af6bb2ff8d4d04f86d5e7ee0278a
Gitweb: http://git.kernel.org/tip/94a15564ac63af6bb2ff8d4d04f86d5e7ee0278a
Author: FUJITA Tomonori <[email protected]>
AuthorDate: Sat, 14 Nov 2009 20:46:37 +0900
Committer: Ingo Molnar <[email protected]>
CommitDate: Sun, 15 Nov 2009 09:03:10 +0100

x86: Move iommu_shutdown_noop to x86_init.c

iommu_init_noop() is in arch/x86/kernel/x86_init.c but
iommu_shutdown_noop() in arch/x86/include/asm/iommu.h.

This moves iommu_shutdown_noop() to x86_init.c for consistency.

Signed-off-by: FUJITA Tomonori <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
---
arch/x86/include/asm/iommu.h | 1 -
arch/x86/kernel/x86_init.c | 1 +
2 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/iommu.h b/arch/x86/include/asm/iommu.h
index df42a71..345c99c 100644
--- a/arch/x86/include/asm/iommu.h
+++ b/arch/x86/include/asm/iommu.h
@@ -1,7 +1,6 @@
#ifndef _ASM_X86_IOMMU_H
#define _ASM_X86_IOMMU_H

-static inline void iommu_shutdown_noop(void) {}
extern struct dma_map_ops nommu_dma_ops;
extern int force_iommu, no_iommu;
extern int iommu_detected;
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
index c46984d..80f3ae2 100644
--- a/arch/x86/kernel/x86_init.c
+++ b/arch/x86/kernel/x86_init.c
@@ -20,6 +20,7 @@ void __cpuinit x86_init_noop(void) { }
void __init x86_init_uint_noop(unsigned int unused) { }
void __init x86_init_pgd_noop(pgd_t *unused) { }
int __init iommu_init_noop(void) { return 0; }
+void __init iommu_shutdown_noop(void) { }

/*
* The platform setup functions are preset with the default functions

2009-11-15 10:29:52

by FUJITA Tomonori

[permalink] [raw]
Subject: [tip:core/iommu] swiotlb: Remove duplicate swiotlb_force extern declarations

Commit-ID: 6959450e567c1f17d3ce8489099fc56c3721d577
Gitweb: http://git.kernel.org/tip/6959450e567c1f17d3ce8489099fc56c3721d577
Author: FUJITA Tomonori <[email protected]>
AuthorDate: Sat, 14 Nov 2009 20:46:38 +0900
Committer: Ingo Molnar <[email protected]>
CommitDate: Sun, 15 Nov 2009 09:03:10 +0100

swiotlb: Remove duplicate swiotlb_force extern declarations

Signed-off-by: FUJITA Tomonori <[email protected]>
Cc: [email protected]
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
---
arch/ia64/include/asm/swiotlb.h | 2 --
arch/x86/include/asm/swiotlb.h | 4 ----
include/linux/swiotlb.h | 2 ++
3 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/ia64/include/asm/swiotlb.h b/arch/ia64/include/asm/swiotlb.h
index dcbaea7..f0acde6 100644
--- a/arch/ia64/include/asm/swiotlb.h
+++ b/arch/ia64/include/asm/swiotlb.h
@@ -4,8 +4,6 @@
#include <linux/dma-mapping.h>
#include <linux/swiotlb.h>

-extern int swiotlb_force;
-
#ifdef CONFIG_SWIOTLB
extern int swiotlb;
extern void pci_swiotlb_init(void);
diff --git a/arch/x86/include/asm/swiotlb.h b/arch/x86/include/asm/swiotlb.h
index 940f13a..87ffcb1 100644
--- a/arch/x86/include/asm/swiotlb.h
+++ b/arch/x86/include/asm/swiotlb.h
@@ -3,10 +3,6 @@

#include <linux/swiotlb.h>

-/* SWIOTLB interface */
-
-extern int swiotlb_force;
-
#ifdef CONFIG_SWIOTLB
extern int swiotlb;
extern int pci_swiotlb_init(void);
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index eb9bdb4..febedcf 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -7,6 +7,8 @@ struct device;
struct dma_attrs;
struct scatterlist;

+extern int swiotlb_force;
+
/*
* Maximum allowable number of contiguous slabs to map,
* must be a power of 2. What is the appropriate value ?