Commit 7b3e8de9 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven

m68k/sun3: Dynamically allocate the table to track IOMMU use

As Sun 3 kernels cannot be multi-platform due to the different Sun 3 MMU
type, it made sense to statically allocate the table to track IOMMU use.

However, Sun 3x kernels can be multi-platform. Furthermore, Sun 3x uses
a larger table than Sun 3 (8192 bytes instead of 512 bytes).

Hence switch to dynamic allocation of this table using the bootmem
allocator to avoid wasting 8192 bytes when not running on a Sun 3x.
As this allocator returns zeroed memory, there's no need to explicitly
initialize the table to zeroes.
Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
parent a4df02a2
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
* Contains common routines for sun3/sun3x DVMA management. * Contains common routines for sun3/sun3x DVMA management.
*/ */
#include <linux/bootmem.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -31,7 +32,7 @@ static inline void dvma_unmap_iommu(unsigned long a, int b) ...@@ -31,7 +32,7 @@ static inline void dvma_unmap_iommu(unsigned long a, int b)
extern void sun3_dvma_init(void); extern void sun3_dvma_init(void);
#endif #endif
static unsigned long iommu_use[IOMMU_TOTAL_ENTRIES]; static unsigned long *iommu_use;
#define dvma_index(baddr) ((baddr - DVMA_START) >> DVMA_PAGE_SHIFT) #define dvma_index(baddr) ((baddr - DVMA_START) >> DVMA_PAGE_SHIFT)
...@@ -266,7 +267,7 @@ void __init dvma_init(void) ...@@ -266,7 +267,7 @@ void __init dvma_init(void)
list_add(&(hole->list), &hole_list); list_add(&(hole->list), &hole_list);
memset(iommu_use, 0, sizeof(iommu_use)); iommu_use = alloc_bootmem(IOMMU_TOTAL_ENTRIES * sizeof(unsigned long));
dvma_unmap_iommu(DVMA_START, DVMA_SIZE); dvma_unmap_iommu(DVMA_START, DVMA_SIZE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment