]> git.hungrycats.org Git - linux/commitdiff
[SPARC]: Trap table alignment for Hyperspace (Keith Weselowsky).
authorPete Zaitcev <zaitcev@redhat.com>
Sat, 12 Jul 2003 15:13:40 +0000 (08:13 -0700)
committerDavid S. Miller <davem@nuts.ninka.net>
Sat, 12 Jul 2003 15:13:40 +0000 (08:13 -0700)
arch/sparc/mm/srmmu.c
include/asm-sparc/pgtsrmmu.h

index fac374c2814cd9930e469b27a346440b373949bd..498a72a8d9e990a2dec4d281776f7e78bd10ae8d 100644 (file)
@@ -148,6 +148,9 @@ extern unsigned long fix_kmap_end;
 /* 1 bit <=> 256 bytes of nocache <=> 64 PTEs */
 #define SRMMU_NOCACHE_BITMAP_SHIFT (PAGE_SHIFT - 4)
 
+/* The context table is a nocache user with the biggest alignment needs. */
+#define SRMMU_NOCACHE_ALIGN_MAX (sizeof(ctxd_t)*SRMMU_MAX_CONTEXTS)
+
 void *srmmu_nocache_pool;
 void *srmmu_nocache_bitmap;
 static struct bit_map srmmu_nocache_map;
@@ -320,6 +323,10 @@ static unsigned long __srmmu_get_nocache(int size, int align)
                printk("Size 0x%x unaligned int nocache request\n", size);
                size += SRMMU_NOCACHE_BITMAP_SHIFT-1;
        }
+       if (align > SRMMU_NOCACHE_ALIGN_MAX) {
+               BUG();
+               return 0;
+       }
 
        offset = bit_map_string_get(&srmmu_nocache_map,
                                        size >> SRMMU_NOCACHE_BITMAP_SHIFT,
@@ -425,7 +432,8 @@ void srmmu_nocache_init(void)
 
        bitmap_bits = srmmu_nocache_size >> SRMMU_NOCACHE_BITMAP_SHIFT;
 
-       srmmu_nocache_pool = __alloc_bootmem(srmmu_nocache_size, PAGE_SIZE, 0UL);
+       srmmu_nocache_pool = __alloc_bootmem(srmmu_nocache_size,
+               SRMMU_NOCACHE_ALIGN_MAX, 0UL);
        memset(srmmu_nocache_pool, 0, srmmu_nocache_size);
 
        srmmu_nocache_bitmap = __alloc_bootmem(bitmap_bits >> 3, SMP_CACHE_BYTES, 0UL);
index 0d90d4c018844beb422ea6afe9bb50e0a9a7beeb..6d41b8b055bb85b650c4f1b553db6672c06b3c16 100644 (file)
@@ -13,6 +13,9 @@
 #include <asm/thread_info.h>   /* TI_UWINMASK for WINDOW_FLUSH */
 #endif
 
+/* Number of contexts is implementation-dependent; 64k is the most we support */
+#define SRMMU_MAX_CONTEXTS     65536
+
 /* PMD_SHIFT determines the size of the area a second-level page table entry can map */
 #define SRMMU_PMD_SHIFT         18
 #define SRMMU_PMD_SIZE          (1UL << SRMMU_PMD_SHIFT)