Changeset da1bafb in mainline for kernel/arch/sparc64/src/mm/sun4v/as.c
- Timestamp:
- 2010-05-24T18:57:31Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0095368
- Parents:
- 666f492
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/src/mm/sun4v/as.c
r666f492 rda1bafb 44 44 45 45 #ifdef CONFIG_TSB 46 46 47 #include <arch/mm/tsb.h> 47 48 #include <arch/memstr.h> … … 50 51 #include <bitops.h> 51 52 #include <macros.h> 53 52 54 #endif /* CONFIG_TSB */ 53 55 … … 61 63 } 62 64 63 int as_constructor_arch(as_t *as, int flags)65 int as_constructor_arch(as_t *as, unsigned int flags) 64 66 { 65 67 #ifdef CONFIG_TSB 66 int order = fnzb32(68 uint8_t order = fnzb32( 67 69 (TSB_ENTRY_COUNT * sizeof(tsb_entry_t)) >> FRAME_WIDTH); 68 70 69 71 uintptr_t tsb = (uintptr_t) frame_alloc(order, flags); 70 72 71 73 if (!tsb) 72 74 return -1; 73 75 74 76 as->arch.tsb_description.page_size = PAGESIZE_8K; 75 77 as->arch.tsb_description.associativity = 1; … … 79 81 as->arch.tsb_description.reserved = 0; 80 82 as->arch.tsb_description.context = 0; 81 83 82 84 memsetb((void *) PA2KA(as->arch.tsb_description.tsb_base), 83 85 TSB_ENTRY_COUNT * sizeof(tsb_entry_t), 0); 84 86 #endif 87 85 88 return 0; 86 89 } … … 91 94 size_t cnt = (TSB_ENTRY_COUNT * sizeof(tsb_entry_t)) >> FRAME_WIDTH; 92 95 frame_free((uintptr_t) as->arch.tsb_description.tsb_base); 96 93 97 return cnt; 94 98 #else … … 97 101 } 98 102 99 int as_create_arch(as_t *as, int flags)103 int as_create_arch(as_t *as, unsigned int flags) 100 104 { 101 105 #ifdef CONFIG_TSB 102 106 tsb_invalidate(as, 0, (size_t) -1); 103 107 #endif 108 104 109 return 0; 105 110 } … … 111 116 * 112 117 * @param as Address space. 118 * 113 119 */ 114 120 void as_install_arch(as_t *as) 115 121 { 116 122 mmu_secondary_context_write(as->asid); 117 #ifdef CONFIG_TSB 123 124 #ifdef CONFIG_TSB 118 125 uintptr_t base = ALIGN_DOWN(config.base, 1 << KERNEL_PAGE_WIDTH); 119 126 120 127 ASSERT(as->arch.tsb_description.tsb_base); 121 128 uintptr_t tsb = PA2KA(as->arch.tsb_description.tsb_base); 122 129 123 130 if (!overlaps(tsb, 8 * MMU_PAGE_SIZE, base, 1 << KERNEL_PAGE_WIDTH)) { 124 131 /* … … 126 133 * by the locked 4M kernel DTLB entry. We need 127 134 * to map both TSBs explicitly. 135 * 128 136 */ 129 137 mmu_demap_page(tsb, 0, MMU_FLAG_DTLB); 130 138 dtlb_insert_mapping(tsb, KA2PA(tsb), PAGESIZE_64K, true, true); 131 139 } 132 140 133 141 __hypercall_fast2(MMU_TSB_CTXNON0, 1, KA2PA(&(as->arch.tsb_description))); 134 135 142 #endif 136 143 } … … 142 149 * 143 150 * @param as Address space. 151 * 144 152 */ 145 153 void as_deinstall_arch(as_t *as) 146 154 { 147 148 155 /* 149 156 * Note that we don't and may not lock the address space. That's ok … … 151 158 * 152 159 * Moreover, the as->asid is protected by asidlock, which is being held. 160 * 153 161 */ 154 162 155 163 #ifdef CONFIG_TSB 156 164 uintptr_t base = ALIGN_DOWN(config.base, 1 << KERNEL_PAGE_WIDTH); 157 165 158 166 ASSERT(as->arch.tsb_description.tsb_base); 159 167 160 168 uintptr_t tsb = PA2KA(as->arch.tsb_description.tsb_base); 161 169 162 170 if (!overlaps(tsb, 8 * MMU_PAGE_SIZE, base, 1 << KERNEL_PAGE_WIDTH)) { 163 171 /* … … 165 173 * by the locked 4M kernel DTLB entry. We need 166 174 * to demap the entry installed by as_install_arch(). 175 * 167 176 */ 168 177 __hypercall_fast3(MMU_UNMAP_PERM_ADDR, tsb, 0, MMU_FLAG_DTLB);
Note:
See TracChangeset
for help on using the changeset viewer.