Changes in kernel/arch/sparc64/src/mm/sun4v/tsb.c [74cbac7d:8c2214e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/src/mm/sun4v/tsb.c
r74cbac7d r8c2214e 1 1 /* 2 2 * Copyright (c) 2006 Jakub Jermar 3 * Copyright (c) 2009 Pavel Rimsky 3 4 * All rights reserved. 4 5 * … … 34 35 35 36 #include <arch/mm/tsb.h> 37 #include <arch/mm/pagesize.h> 36 38 #include <arch/mm/tlb.h> 37 39 #include <arch/mm/page.h> … … 49 51 * portions of both TSBs are invalidated at a time. 50 52 * 51 * @param as 52 * @param page First page to invalidate in TSB.53 * @param pages Number of pages to invalidate. Value of ( size_t) -1 means the54 * whole TSB.53 * @param as Address space. 54 * @param page First page to invalidate in TSB. 55 * @param pages Number of pages to invalidate. Value of (count_t) -1 means the 56 * whole TSB. 55 57 */ 56 58 void tsb_invalidate(as_t *as, uintptr_t page, size_t pages) 57 59 { 58 size_t i0; 59 size_t i; 60 size_t i0, i; 60 61 size_t cnt; 61 62 62 ASSERT(as->arch. itsb && as->arch.dtsb);63 ASSERT(as->arch.tsb_description.tsb_base); 63 64 64 65 i0 = (page >> MMU_PAGE_WIDTH) & TSB_INDEX_MASK; 65 ASSERT(i0 < ITSB_ENTRY_COUNT && i0 < DTSB_ENTRY_COUNT);66 ASSERT(i0 < TSB_ENTRY_COUNT); 66 67 67 if (pages == (size_t) - 1 || (pages * 2) > ITSB_ENTRY_COUNT)68 cnt = ITSB_ENTRY_COUNT;68 if (pages == (size_t) - 1 || (pages) > TSB_ENTRY_COUNT) 69 cnt = TSB_ENTRY_COUNT; 69 70 else 70 cnt = pages * 2;71 cnt = pages; 71 72 72 73 for (i = 0; i < cnt; i++) { 73 as->arch.itsb[(i0 + i) & (ITSB_ENTRY_COUNT - 1)].tag.invalid = 74 true; 75 as->arch.dtsb[(i0 + i) & (DTSB_ENTRY_COUNT - 1)].tag.invalid = 76 true; 74 ((tsb_entry_t *) PA2KA(as->arch.tsb_description.tsb_base))[ 75 (i0 + i) & (TSB_ENTRY_COUNT - 1)].data.v = false; 77 76 } 78 77 } … … 81 80 * 82 81 * @param t Software PTE. 83 * @param index Zero if lower 8K-subpage, one if higher 8K subpage.84 82 */ 85 void itsb_pte_copy(pte_t *t , size_t index)83 void itsb_pte_copy(pte_t *t) 86 84 { 87 #if 088 85 as_t *as; 89 86 tsb_entry_t *tsb; 90 87 size_t entry; 91 88 92 ASSERT(index <= 1);93 94 89 as = t->as; 95 entry = ( (t->page >> MMU_PAGE_WIDTH) + index) & TSB_INDEX_MASK;96 ASSERT(entry < ITSB_ENTRY_COUNT);97 tsb = & as->arch.itsb[entry];90 entry = (t->page >> MMU_PAGE_WIDTH) & TSB_INDEX_MASK; 91 ASSERT(entry < TSB_ENTRY_COUNT); 92 tsb = &((tsb_entry_t *) PA2KA(as->arch.tsb_description.tsb_base))[entry]; 98 93 99 94 /* … … 103 98 */ 104 99 105 tsb->tag.invalid = true; /* invalidate the entry 106 * (tag target has this 107 * set to 0) */ 100 tsb->data.v = false; 108 101 109 102 write_barrier(); 110 103 111 tsb->tag.context = as->asid;112 /* the shift is bigger than PAGE_WIDTH, do not bother with index */113 104 tsb->tag.va_tag = t->page >> VA_TAG_PAGE_SHIFT; 105 114 106 tsb->data.value = 0; 107 tsb->data.nfo = false; 108 tsb->data.ra = t->frame >> MMU_FRAME_WIDTH; 109 tsb->data.ie = false; 110 tsb->data.e = false; 111 tsb->data.cp = t->c; /* cp as cache in phys.-idxed, c as cacheable */ 112 tsb->data.cv = false; 113 tsb->data.p = t->k; /* p as privileged, k as kernel */ 114 tsb->data.x = true; 115 tsb->data.w = false; 115 116 tsb->data.size = PAGESIZE_8K; 116 tsb->data.pfn = (t->frame >> MMU_FRAME_WIDTH) + index;117 tsb->data.cp = t->c; /* cp as cache in phys.-idxed, c as cacheable */118 tsb->data.p = t->k; /* p as privileged, k as kernel */119 tsb->data.v = t->p; /* v as valid, p as present */120 117 121 118 write_barrier(); 122 119 123 tsb->tag.invalid = false; /* mark the entry as valid */ 124 #endif 120 tsb->data.v = t->p; /* v as valid, p as present */ 125 121 } 126 122 … … 128 124 * 129 125 * @param t Software PTE. 130 * @param index Zero if lower 8K-subpage, one if higher 8K-subpage.131 126 * @param ro If true, the mapping is copied read-only. 132 127 */ 133 void dtsb_pte_copy(pte_t *t, size_t index,bool ro)128 void dtsb_pte_copy(pte_t *t, bool ro) 134 129 { 135 #if 0136 130 as_t *as; 137 131 tsb_entry_t *tsb; 138 132 size_t entry; 139 140 ASSERT(index <= 1);141 133 142 134 as = t->as; 143 entry = ( (t->page >> MMU_PAGE_WIDTH) + index) & TSB_INDEX_MASK;144 ASSERT(entry < DTSB_ENTRY_COUNT);145 tsb = & as->arch.dtsb[entry];135 entry = (t->page >> MMU_PAGE_WIDTH) & TSB_INDEX_MASK; 136 ASSERT(entry < TSB_ENTRY_COUNT); 137 tsb = &((tsb_entry_t *) PA2KA(as->arch.tsb_description.tsb_base))[entry]; 146 138 147 139 /* … … 151 143 */ 152 144 153 tsb->tag.invalid = true; /* invalidate the entry 154 * (tag target has this 155 * set to 0) */ 145 tsb->data.v = false; 156 146 157 147 write_barrier(); 158 148 159 tsb->tag.context = as->asid;160 /* the shift is bigger than PAGE_WIDTH, do not bother with index */161 149 tsb->tag.va_tag = t->page >> VA_TAG_PAGE_SHIFT; 150 162 151 tsb->data.value = 0; 163 tsb->data.size = PAGESIZE_8K; 164 tsb->data.pfn = (t->frame >> MMU_FRAME_WIDTH) + index; 165 tsb->data.cp = t->c; 152 tsb->data.nfo = false; 153 tsb->data.ra = t->frame >> MMU_FRAME_WIDTH; 154 tsb->data.ie = false; 155 tsb->data.e = false; 156 tsb->data.cp = t->c; /* cp as cache in phys.-idxed, c as cacheable */ 166 157 #ifdef CONFIG_VIRT_IDX_DCACHE 167 158 tsb->data.cv = t->c; 168 159 #endif /* CONFIG_VIRT_IDX_DCACHE */ 169 tsb->data.p = t->k; /* p as privileged */ 160 tsb->data.p = t->k; /* p as privileged, k as kernel */ 161 tsb->data.x = true; 170 162 tsb->data.w = ro ? false : t->w; 171 tsb->data. v = t->p;163 tsb->data.size = PAGESIZE_8K; 172 164 173 165 write_barrier(); 174 166 175 tsb->tag.invalid = false; /* mark the entry as valid */ 176 #endif 167 tsb->data.v = t->p; /* v as valid, p as present */ 177 168 } 178 169 179 170 /** @} 180 171 */ 181
Note:
See TracChangeset
for help on using the changeset viewer.