Changeset b4655da in mainline for kernel/arch/sparc64/src/mm/sun4v/tlb.c
- Timestamp:
- 2009-11-06T16:59:40Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 74cbac7d
- Parents:
- 66e08d02
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/src/mm/sun4v/tlb.c
r66e08d02 rb4655da 37 37 #include <mm/as.h> 38 38 #include <mm/asid.h> 39 #include <arch/sun4v/hypercall.h> 39 40 #include <arch/mm/frame.h> 40 41 #include <arch/mm/page.h> 41 #include <arch/mm/mmu.h> 42 #include <arch/mm/tte.h> 43 #include <arch/mm/tlb.h> 42 44 #include <arch/interrupt.h> 43 45 #include <interrupt.h> … … 70 72 }; 71 73 74 /** Invalidate all unlocked ITLB and DTLB entries. */ 75 void tlb_invalidate_all(void) 76 { 77 uint64_t errno = __hypercall_fast3(MMU_DEMAP_ALL, 0, 0, 78 MMU_FLAG_DTLB | MMU_FLAG_ITLB); 79 if (errno != EOK) { 80 panic("Error code = %d.\n", errno); 81 } 82 } 83 72 84 void tlb_arch_init(void) 73 85 { 74 /* 75 * Invalidate all non-locked DTLB and ITLB entries. 76 */ 77 //MH 78 //tlb_invalidate_all(); 79 80 /* 81 * Clear both SFSRs. 82 */ 83 //MH 84 //dtlb_sfsr_write(0); 85 //itlb_sfsr_write(0); 86 tlb_invalidate_all(); 86 87 } 87 88 … … 97 98 bool locked, bool cacheable) 98 99 { 100 #if 0 99 101 tlb_tag_access_reg_t tag; 100 102 tlb_data_t data; … … 124 126 125 127 dtlb_data_in_write(data.value); 128 #endif 126 129 } 127 130 … … 135 138 void dtlb_pte_copy(pte_t *t, size_t index, bool ro) 136 139 { 140 #if 0 137 141 tlb_tag_access_reg_t tag; 138 142 tlb_data_t data; … … 163 167 164 168 dtlb_data_in_write(data.value); 169 #endif 165 170 } 166 171 … … 172 177 void itlb_pte_copy(pte_t *t, size_t index) 173 178 { 179 #if 0 174 180 tlb_tag_access_reg_t tag; 175 181 tlb_data_t data; … … 197 203 198 204 itlb_data_in_write(data.value); 205 #endif 199 206 } 200 207 … … 362 369 static void print_tlb_entry(int i, tlb_tag_read_reg_t t, tlb_data_t d) 363 370 { 371 #if 0 364 372 printf("%d: vpn=%#llx, context=%d, v=%d, size=%d, nfo=%d, " 365 373 "ie=%d, soft2=%#x, pfn=%#x, soft=%#x, l=%d, " … … 367 375 t.context, d.v, d.size, d.nfo, d.ie, d.soft2, 368 376 d.pfn, d.soft, d.l, d.cp, d.cv, d.e, d.p, d.w, d.g); 377 #endif 369 378 } 370 379 … … 502 511 } 503 512 504 #if defined (US)505 /** Invalidate all unlocked ITLB and DTLB entries. */506 void tlb_invalidate_all(void)507 {508 int i;509 510 /*511 * Walk all ITLB and DTLB entries and remove all unlocked mappings.512 *513 * The kernel doesn't use global mappings so any locked global mappings514 * found must have been created by someone else. Their only purpose now515 * is to collide with proper mappings. Invalidate immediately. It should516 * be safe to invalidate them as late as now.517 */518 519 tlb_data_t d;520 tlb_tag_read_reg_t t;521 522 for (i = 0; i < ITLB_ENTRY_COUNT; i++) {523 d.value = itlb_data_access_read(i);524 if (!d.l || d.g) {525 t.value = itlb_tag_read_read(i);526 d.v = false;527 itlb_tag_access_write(t.value);528 itlb_data_access_write(i, d.value);529 }530 }531 532 for (i = 0; i < DTLB_ENTRY_COUNT; i++) {533 d.value = dtlb_data_access_read(i);534 if (!d.l || d.g) {535 t.value = dtlb_tag_read_read(i);536 d.v = false;537 dtlb_tag_access_write(t.value);538 dtlb_data_access_write(i, d.value);539 }540 }541 542 }543 544 #elif defined (US3)545 546 /** Invalidate all unlocked ITLB and DTLB entries. */547 void tlb_invalidate_all(void)548 {549 itlb_demap(TLB_DEMAP_ALL, 0, 0);550 dtlb_demap(TLB_DEMAP_ALL, 0, 0);551 }552 553 #endif554 555 513 /** Invalidate all ITLB and DTLB entries that belong to specified ASID 556 514 * (Context).
Note:
See TracChangeset
for help on using the changeset viewer.