PERFORCE change 112455 for review
Oleksandr Tymoshenko
gonzo at FreeBSD.org
Wed Jan 3 12:26:48 PST 2007
http://perforce.freebsd.org/chv.cgi?CH=112455
Change 112455 by gonzo at gonzo_hq on 2007/01/03 20:26:14
o Extend TLB API with two new calls:
- tlb_invalidate_nonwired: should be used instead of
tlb_invalidate_all after TLB bootstrap. We should keep
first entry valid since it maps thread's kernel stack.
- tlb_invalidate_userland is just a stub now, but it should
do dirty work for ASID generation change: invalidate all
userland translations for running processes which got their
ASID from previous generation and since it is supposed to be
called in the moment of change - all userland mappings are
the subject to be invalidate.
Affected files ...
.. //depot/projects/mips2/src/sys/mips/include/tlb.h#7 edit
.. //depot/projects/mips2/src/sys/mips/mips/tlb.c#11 edit
Differences ...
==== //depot/projects/mips2/src/sys/mips/include/tlb.h#7 (text+ko) ====
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $P4: //depot/projects/mips2/src/sys/mips/include/tlb.h#6 $
+ * $P4: //depot/projects/mips2/src/sys/mips/include/tlb.h#7 $
*/
#ifndef _MACHINE_TLB_H_
@@ -38,6 +38,8 @@
void tlb_bootstrap(vm_size_t, vm_offset_t (*)(vm_size_t));
void tlb_enter(pmap_t, vm_offset_t, vm_paddr_t, pt_entry_t);
void tlb_invalidate_all(void);
+void tlb_invalidate_userland(void);
+void tlb_invalidate_nonwired(void);
void tlb_invalidate_one(int);
void tlb_invalidate_page(vm_offset_t, uint32_t);
void tlb_modified(pmap_t, void *);
==== //depot/projects/mips2/src/sys/mips/mips/tlb.c#11 (text+ko) ====
@@ -90,9 +90,6 @@
kptsize = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) >> PAGE_SHIFT;
kptmap = (pt_entry_t *) (*ptalloc)(kptsize * sizeof (pt_entry_t));
- /*
- * XXMIPS: Check format sting.
- */
printf("Kernel page table maps %jd %dK pages and is %ldK\n",
(uintmax_t) pages,
PAGE_SIZE / 1024,
@@ -142,6 +139,7 @@
if ((bits & PG_V) == 0)
panic("pmap %p entering invalid mapping for va %lx to pa %lx [%lx]",
pmap, (u_long)va, (u_long)pa, (u_long)bits);
+
*pte &= PG_G;
*pte |= (MIPS_PA_TO_PFN(pa) << MIPS_PFN_SHIFT) | bits;
*pte |= PG_C_UNCACHED;
@@ -200,18 +198,50 @@
mips_tlbwi();
}
+/*
+ * Invalidate all entries of TLB. Should be used only during initialization.
+ */
void
tlb_invalidate_all(void)
{
u_long asid;
int i;
+ asid = mips_rd_entryhi();
+ for (i = 0; i < mips_num_tlb_entries; i++)
+ tlb_invalidate_one(i);
+ mips_wr_entryhi(asid);
+}
+/*
+ * Invalidate non-wired entries of TLB. For generic use during system
+ * life cycle.
+ */
+void
+tlb_invalidate_nonwired(void)
+{
+ u_long asid;
+ int i;
asid = mips_rd_entryhi();
- for (i = 0; i < mips_num_tlb_entries; i++)
+ for (i = mips_rd_wired(); i < mips_num_tlb_entries; i++)
tlb_invalidate_one(i);
mips_wr_entryhi(asid);
}
+/*
+ * Invalidate all entries of TLB without Global bit set.
+ * This routine supposedd to be used when new ASID generation
+ * is on it's way
+ */
+void
+tlb_invalidate_userland(void)
+{
+ /*
+ * XXXMIPS: There should be loop through all TLB table which
+ * invalidates all entries with Global bit not set.
+ */
+ tlb_invalidate_nonwired();
+}
+
void
tlb_invalidate_one(int i)
{
More information about the p4-projects
mailing list