From owner-p4-projects@FreeBSD.ORG Wed Jan 3 20:26:48 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 094E416A529; Wed, 3 Jan 2007 20:26:48 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DA43E16A51C for ; Wed, 3 Jan 2007 20:26:47 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id CB95B13C44B for ; Wed, 3 Jan 2007 20:26:47 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id l03KQlXv060027 for ; Wed, 3 Jan 2007 20:26:47 GMT (envelope-from gonzo@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l03KQl3n060024 for perforce@freebsd.org; Wed, 3 Jan 2007 20:26:47 GMT (envelope-from gonzo@FreeBSD.org) Date: Wed, 3 Jan 2007 20:26:47 GMT Message-Id: <200701032026.l03KQl3n060024@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko To: Perforce Change Reviews Cc: Subject: PERFORCE change 112455 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jan 2007 20:26:48 -0000 http://perforce.freebsd.org/chv.cgi?CH=112455 Change 112455 by gonzo@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) {