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