From owner-p4-projects@FreeBSD.ORG Tue Aug 5 21:27:00 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id DD1881065682; Tue, 5 Aug 2008 21:26:59 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FDD2106567D for ; Tue, 5 Aug 2008 21:26:59 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 8C76D8FC1A for ; Tue, 5 Aug 2008 21:26:59 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.2/8.14.2) with ESMTP id m75LQxqO068290 for ; Tue, 5 Aug 2008 21:26:59 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.2/8.14.1/Submit) id m75LQxRl068288 for perforce@freebsd.org; Tue, 5 Aug 2008 21:26:59 GMT (envelope-from jhb@freebsd.org) Date: Tue, 5 Aug 2008 21:26:59 GMT Message-Id: <200808052126.m75LQxRl068288@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 146731 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: Tue, 05 Aug 2008 21:27:00 -0000 http://perforce.freebsd.org/chv.cgi?CH=146731 Change 146731 by jhb@jhb_mutex on 2008/08/05 21:26:01 IFC @146728 Affected files ... .. //depot/projects/smpng/sys/amd64/amd64/pmap.c#84 integrate .. //depot/projects/smpng/sys/amd64/conf/GENERIC#65 integrate .. //depot/projects/smpng/sys/amd64/conf/NOTES#44 integrate .. //depot/projects/smpng/sys/amd64/include/param.h#20 integrate .. //depot/projects/smpng/sys/amd64/include/pmap.h#30 integrate .. //depot/projects/smpng/sys/arm/arm/db_interface.c#8 integrate .. //depot/projects/smpng/sys/arm/arm/elf_trampoline.c#17 integrate .. //depot/projects/smpng/sys/arm/arm/intr.c#20 integrate .. //depot/projects/smpng/sys/arm/arm/swtch.S#17 integrate .. //depot/projects/smpng/sys/arm/arm/vm_machdep.c#28 integrate .. //depot/projects/smpng/sys/arm/at91/at91_twi.c#11 integrate .. //depot/projects/smpng/sys/arm/at91/uart_dev_at91usart.c#14 integrate .. //depot/projects/smpng/sys/arm/conf/AVILA#8 integrate .. //depot/projects/smpng/sys/arm/conf/KB920X#10 integrate .. //depot/projects/smpng/sys/arm/conf/NSLU#1 branch .. //depot/projects/smpng/sys/arm/conf/NSLU.hints#1 branch .. //depot/projects/smpng/sys/arm/include/db_machdep.h#6 integrate .. //depot/projects/smpng/sys/arm/xscale/ixp425/ixp425_iic.c#3 integrate .. //depot/projects/smpng/sys/boot/common/misc.c#4 integrate .. //depot/projects/smpng/sys/boot/forth/loader.conf#52 integrate .. //depot/projects/smpng/sys/boot/i386/libi386/devicename.c#7 integrate .. //depot/projects/smpng/sys/cam/cam_xpt.c#50 integrate .. //depot/projects/smpng/sys/conf/Makefile.arm#31 integrate .. //depot/projects/smpng/sys/conf/NOTES#152 integrate .. //depot/projects/smpng/sys/contrib/pf/net/pf.c#28 integrate .. //depot/projects/smpng/sys/ddb/db_run.c#11 integrate .. //depot/projects/smpng/sys/dev/acpica/acpi.c#106 integrate .. //depot/projects/smpng/sys/dev/agp/agp_i810.c#4 integrate .. //depot/projects/smpng/sys/dev/bktr/bktr_i2c.c#12 integrate .. //depot/projects/smpng/sys/dev/ciss/ciss.c#57 integrate .. //depot/projects/smpng/sys/dev/ciss/cissreg.h#13 integrate .. //depot/projects/smpng/sys/dev/cxgb/ulp/tom/cxgb_l2t.c#2 integrate .. //depot/projects/smpng/sys/dev/cxgb/ulp/tom/cxgb_listen.c#4 integrate .. //depot/projects/smpng/sys/dev/cxgb/ulp/tom/cxgb_tcp_offload.c#2 integrate .. //depot/projects/smpng/sys/dev/cxgb/ulp/tom/cxgb_tom_sysctl.c#4 integrate .. //depot/projects/smpng/sys/dev/ie/if_ie.c#17 integrate .. //depot/projects/smpng/sys/dev/ie/if_ie_isa.c#8 integrate .. //depot/projects/smpng/sys/dev/ie/if_ievar.h#5 integrate .. //depot/projects/smpng/sys/dev/iicbus/ad7418.c#2 integrate .. //depot/projects/smpng/sys/dev/iicbus/ds1339.c#2 integrate .. //depot/projects/smpng/sys/dev/iicbus/icee.c#3 integrate .. //depot/projects/smpng/sys/dev/iicbus/if_ic.c#17 integrate .. //depot/projects/smpng/sys/dev/iicbus/iic.c#15 integrate .. //depot/projects/smpng/sys/dev/iicbus/iicbb.c#9 integrate .. //depot/projects/smpng/sys/dev/iicbus/iicbus.c#11 integrate .. //depot/projects/smpng/sys/dev/iicbus/iicbus.h#5 integrate .. //depot/projects/smpng/sys/dev/iicbus/iiconf.c#7 integrate .. //depot/projects/smpng/sys/dev/iicbus/iicsmb.c#8 integrate .. //depot/projects/smpng/sys/dev/nvram/nvram.c#3 integrate .. //depot/projects/smpng/sys/dev/pccard/pccarddevs#60 integrate .. //depot/projects/smpng/sys/dev/pcf/envctrl.c#7 integrate .. //depot/projects/smpng/sys/dev/pcf/pcf.c#2 integrate .. //depot/projects/smpng/sys/dev/pcf/pcf_ebus.c#7 integrate .. //depot/projects/smpng/sys/dev/pcf/pcf_isa.c#6 integrate .. //depot/projects/smpng/sys/dev/pcf/pcfvar.h#4 integrate .. //depot/projects/smpng/sys/dev/pci/pci.c#98 integrate .. //depot/projects/smpng/sys/dev/ppbus/lpbb.c#7 integrate .. //depot/projects/smpng/sys/dev/re/if_re.c#62 integrate .. //depot/projects/smpng/sys/dev/snc/dp83932.c#18 integrate .. //depot/projects/smpng/sys/dev/snc/dp83932var.h#8 integrate .. //depot/projects/smpng/sys/dev/snc/if_snc.c#6 integrate .. //depot/projects/smpng/sys/dev/snc/if_snc_cbus.c#7 integrate .. //depot/projects/smpng/sys/dev/snc/if_snc_pccard.c#11 integrate .. //depot/projects/smpng/sys/dev/syscons/syscons.c#64 integrate .. //depot/projects/smpng/sys/dev/usb/uipaq.c#4 integrate .. //depot/projects/smpng/sys/dev/usb/usbdevs#113 integrate .. //depot/projects/smpng/sys/dev/wi/if_wi.c#90 integrate .. //depot/projects/smpng/sys/dev/wi/if_wi_pccard.c#39 integrate .. //depot/projects/smpng/sys/dev/wi/if_wi_pci.c#25 integrate .. //depot/projects/smpng/sys/dev/wi/if_wireg.h#23 integrate .. //depot/projects/smpng/sys/i386/conf/GENERIC#96 integrate .. //depot/projects/smpng/sys/i386/conf/NOTES#133 integrate .. //depot/projects/smpng/sys/i386/i386/mp_machdep.c#113 integrate .. //depot/projects/smpng/sys/i386/i386/pmap.c#126 integrate .. //depot/projects/smpng/sys/i386/include/pmap.h#40 integrate .. //depot/projects/smpng/sys/kern/kern_condvar.c#51 integrate .. //depot/projects/smpng/sys/kern/kern_kthread.c#22 integrate .. //depot/projects/smpng/sys/kern/kern_lock.c#69 integrate .. //depot/projects/smpng/sys/kern/kern_sig.c#140 integrate .. //depot/projects/smpng/sys/kern/kern_sx.c#54 integrate .. //depot/projects/smpng/sys/kern/kern_synch.c#123 integrate .. //depot/projects/smpng/sys/kern/kern_thread.c#108 integrate .. //depot/projects/smpng/sys/kern/kern_timeout.c#42 integrate .. //depot/projects/smpng/sys/kern/link_elf.c#47 integrate .. //depot/projects/smpng/sys/kern/link_elf_obj.c#21 integrate .. //depot/projects/smpng/sys/kern/subr_sleepqueue.c#42 integrate .. //depot/projects/smpng/sys/kern/tty_pts.c#9 integrate .. //depot/projects/smpng/sys/kern/tty_pty.c#53 integrate .. //depot/projects/smpng/sys/kern/vfs_vnops.c#84 integrate .. //depot/projects/smpng/sys/mips/mips/machdep.c#2 integrate .. //depot/projects/smpng/sys/mips/mips/tick.c#2 integrate .. //depot/projects/smpng/sys/modules/Makefile#146 integrate .. //depot/projects/smpng/sys/modules/netgraph/Makefile#27 integrate .. //depot/projects/smpng/sys/modules/netgraph/bluetooth/Makefile#5 integrate .. //depot/projects/smpng/sys/net/bpf.c#77 integrate .. //depot/projects/smpng/sys/net/bpfdesc.h#21 integrate .. //depot/projects/smpng/sys/net/if_loop.c#46 integrate .. //depot/projects/smpng/sys/net/if_media.h#24 integrate .. //depot/projects/smpng/sys/net80211/ieee80211_dfs.c#2 integrate .. //depot/projects/smpng/sys/net80211/ieee80211_freebsd.c#14 integrate .. //depot/projects/smpng/sys/net80211/ieee80211_ht.c#4 integrate .. //depot/projects/smpng/sys/net80211/ieee80211_input.c#41 integrate .. //depot/projects/smpng/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c#21 integrate .. //depot/projects/smpng/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c#21 integrate .. //depot/projects/smpng/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c#18 integrate .. //depot/projects/smpng/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c#17 integrate .. //depot/projects/smpng/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c#2 integrate .. //depot/projects/smpng/sys/netinet/ip_fw2.c#92 integrate .. //depot/projects/smpng/sys/netipsec/key.c#23 integrate .. //depot/projects/smpng/sys/pc98/conf/GENERIC#76 integrate .. //depot/projects/smpng/sys/pc98/conf/NOTES#62 integrate .. //depot/projects/smpng/sys/pci/if_rlreg.h#43 integrate .. //depot/projects/smpng/sys/pci/viapm.c#17 integrate .. //depot/projects/smpng/sys/powerpc/conf/GENERIC#49 integrate .. //depot/projects/smpng/sys/security/mac_biba/mac_biba.c#51 integrate .. //depot/projects/smpng/sys/security/mac_bsdextended/mac_bsdextended.c#27 integrate .. //depot/projects/smpng/sys/security/mac_lomac/mac_lomac.c#39 integrate .. //depot/projects/smpng/sys/security/mac_mls/mac_mls.c#45 integrate .. //depot/projects/smpng/sys/security/mac_partition/mac_partition.c#15 integrate .. //depot/projects/smpng/sys/sparc64/conf/GENERIC#83 integrate .. //depot/projects/smpng/sys/sun4v/conf/GENERIC#10 integrate .. //depot/projects/smpng/sys/sys/callout.h#14 integrate .. //depot/projects/smpng/sys/sys/elf_common.h#12 integrate .. //depot/projects/smpng/sys/sys/proc.h#187 integrate .. //depot/projects/smpng/sys/sys/sleepqueue.h#15 integrate .. //depot/projects/smpng/sys/sys/sockbuf.h#2 integrate .. //depot/projects/smpng/sys/sys/socketvar.h#62 integrate .. //depot/projects/smpng/sys/ufs/ufs/quota.h#14 integrate .. //depot/projects/smpng/sys/ufs/ufs/ufs_quota.c#41 integrate .. //depot/projects/smpng/sys/ufs/ufs/ufsmount.h#17 integrate .. //depot/projects/smpng/sys/vm/vm_glue.c#67 integrate .. //depot/projects/smpng/sys/vm/vm_mmap.c#68 integrate .. //depot/projects/smpng/sys/vm/vm_object.c#101 integrate .. //depot/projects/smpng/sys/vm/vm_pageout.c#66 integrate .. //depot/projects/smpng/sys/vm/vm_zeroidle.c#39 integrate Differences ... ==== //depot/projects/smpng/sys/amd64/amd64/pmap.c#84 (text+ko) ==== @@ -77,7 +77,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.639 2008/07/31 04:42:42 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.643 2008/08/04 08:04:09 alc Exp $"); /* * Manages physical address maps. @@ -222,6 +222,8 @@ static int pmap_pvh_wired_mappings(struct md_page *pvh, int count); static boolean_t pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va); +static boolean_t pmap_demote_pdpe(pmap_t pmap, pdp_entry_t *pdpe, + vm_offset_t va); static boolean_t pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot); static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, @@ -229,10 +231,13 @@ static void pmap_fill_ptp(pt_entry_t *firstpte, pt_entry_t newpte); static void pmap_insert_pt_page(pmap_t pmap, vm_page_t mpte); static boolean_t pmap_is_modified_pvh(struct md_page *pvh); +static void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode); static vm_page_t pmap_lookup_pt_page(pmap_t pmap, vm_offset_t va); +static void pmap_pde_attr(pd_entry_t *pde, int cache_bits); static void pmap_promote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va); static boolean_t pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t sva, vm_prot_t prot); +static void pmap_pte_attr(pt_entry_t *pte, int cache_bits); static int pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offset_t sva, vm_page_t *free); static int pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, @@ -739,7 +744,14 @@ SYSCTL_ULONG(_vm_pmap_pde, OID_AUTO, promotions, CTLFLAG_RD, &pmap_pde_promotions, 0, "2MB page promotions"); +SYSCTL_NODE(_vm_pmap, OID_AUTO, pdpe, CTLFLAG_RD, 0, + "1GB page mapping counters"); + +static u_long pmap_pdpe_demotions; +SYSCTL_ULONG(_vm_pmap_pdpe, OID_AUTO, demotions, CTLFLAG_RD, + &pmap_pdpe_demotions, 0, "1GB page demotions"); + /*************************************************** * Low level helper routines..... ***************************************************/ @@ -1082,7 +1094,7 @@ pte_store(pte, pa | PG_RW | PG_V | PG_G); } -PMAP_INLINE void +static __inline void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode) { pt_entry_t *pte; @@ -4250,27 +4262,24 @@ /* Adjust the cache mode for a 4KB page mapped via a PTE. */ static __inline void -pmap_pte_attr(vm_offset_t va, int mode) +pmap_pte_attr(pt_entry_t *pte, int cache_bits) { - pt_entry_t *pte; u_int opte, npte; - pte = vtopte(va); - /* * The cache mode bits are all in the low 32-bits of the * PTE, so we can just spin on updating the low 32-bits. */ do { opte = *(u_int *)pte; - npte = opte & ~(PG_PTE_PAT | PG_NC_PCD | PG_NC_PWT); - npte |= pmap_cache_bits(mode, 0); + npte = opte & ~PG_PTE_CACHE; + npte |= cache_bits; } while (npte != opte && !atomic_cmpset_int((u_int *)pte, opte, npte)); } /* Adjust the cache mode for a 2MB page mapped via a PDE. */ static __inline void -pmap_pde_attr(pd_entry_t *pde, int mode) +pmap_pde_attr(pd_entry_t *pde, int cache_bits) { u_int opde, npde; @@ -4280,8 +4289,8 @@ */ do { opde = *(u_int *)pde; - npde = opde & ~(PG_PDE_PAT | PG_NC_PCD | PG_NC_PWT); - npde |= pmap_cache_bits(mode, 1); + npde = opde & ~PG_PDE_CACHE; + npde |= cache_bits; } while (npde != opde && !atomic_cmpset_int((u_int *)pde, opde, npde)); } @@ -4297,11 +4306,14 @@ vm_offset_t va, tmpva, offset; /* - * If this fits within the direct map window and use WB caching - * mode, use the direct map. + * If the specified range of physical addresses fits within the direct + * map window, use the direct map. */ - if (pa < dmaplimit && (pa + size) < dmaplimit && mode == PAT_WRITE_BACK) - return ((void *)PHYS_TO_DMAP(pa)); + if (pa < dmaplimit && pa + size < dmaplimit) { + va = PHYS_TO_DMAP(pa); + if (!pmap_change_attr(va, size, mode)) + return ((void *)va); + } offset = pa & PAGE_MASK; size = roundup(offset + size, PAGE_SIZE); va = kmem_alloc_nofault(kernel_map, size); @@ -4350,6 +4362,60 @@ kmem_free(kernel_map, base, size); } +/* + * Tries to demote a 1GB page mapping. + */ +static boolean_t +pmap_demote_pdpe(pmap_t pmap, pdp_entry_t *pdpe, vm_offset_t va) +{ + pdp_entry_t newpdpe, oldpdpe; + pd_entry_t *firstpde, newpde, *pde; + vm_paddr_t mpdepa; + vm_page_t mpde; + + PMAP_LOCK_ASSERT(pmap, MA_OWNED); + oldpdpe = *pdpe; + KASSERT((oldpdpe & (PG_PS | PG_V)) == (PG_PS | PG_V), + ("pmap_demote_pdpe: oldpdpe is missing PG_PS and/or PG_V")); + if ((mpde = vm_page_alloc(NULL, va >> PDPSHIFT, VM_ALLOC_INTERRUPT | + VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { + CTR2(KTR_PMAP, "pmap_demote_pdpe: failure for va %#lx" + " in pmap %p", va, pmap); + return (FALSE); + } + mpdepa = VM_PAGE_TO_PHYS(mpde); + firstpde = (pd_entry_t *)PHYS_TO_DMAP(mpdepa); + newpdpe = mpdepa | PG_M | PG_A | (oldpdpe & PG_U) | PG_RW | PG_V; + KASSERT((oldpdpe & PG_A) != 0, + ("pmap_demote_pdpe: oldpdpe is missing PG_A")); + KASSERT((oldpdpe & (PG_M | PG_RW)) != PG_RW, + ("pmap_demote_pdpe: oldpdpe is missing PG_M")); + newpde = oldpdpe; + + /* + * Initialize the page directory page. + */ + for (pde = firstpde; pde < firstpde + NPDEPG; pde++) { + *pde = newpde; + newpde += NBPDR; + } + + /* + * Demote the mapping. + */ + *pdpe = newpdpe; + + /* + * Invalidate a stale recursive mapping of the page directory page. + */ + pmap_invalidate_page(pmap, (vm_offset_t)vtopde(va)); + + pmap_pdpe_demotions++; + CTR2(KTR_PMAP, "pmap_demote_pdpe: success for va %#lx" + " in pmap %p", va, pmap); + return (TRUE); +} + int pmap_change_attr(vm_offset_t va, vm_size_t size, int mode) { @@ -4357,6 +4423,8 @@ pdp_entry_t *pdpe; pd_entry_t *pde; pt_entry_t *pte; + int cache_bits_pte, cache_bits_pde; + boolean_t changed; base = trunc_page(va); offset = va & PAGE_MASK; @@ -4369,6 +4437,9 @@ if (base < DMAP_MIN_ADDRESS) return (EINVAL); + cache_bits_pde = cache_bits_pte = -1; + changed = FALSE; + /* * Pages that aren't mapped aren't supported. Also break down 2MB pages * into 4KB pages if required. @@ -4376,10 +4447,38 @@ PMAP_LOCK(kernel_pmap); for (tmpva = base; tmpva < base + size; ) { pdpe = pmap_pdpe(kernel_pmap, tmpva); - if (*pdpe == 0 || (*pdpe & PG_PS)) { + if (*pdpe == 0) { PMAP_UNLOCK(kernel_pmap); return (EINVAL); } + if (*pdpe & PG_PS) { + /* + * If the current 1GB page already has the required + * memory type, then we need not demote this page. Just + * increment tmpva to the next 1GB page frame. + */ + if (cache_bits_pde < 0) + cache_bits_pde = pmap_cache_bits(mode, 1); + if ((*pdpe & PG_PDE_CACHE) == cache_bits_pde) { + tmpva = trunc_1gpage(tmpva) + NBPDP; + continue; + } + + /* + * If the current offset aligns with a 1GB page frame + * and there is at least 1GB left within the range, then + * we need not break down this page into 2MB pages. + */ + if ((tmpva & PDPMASK) == 0 && + tmpva + PDPMASK < base + size) { + tmpva += NBPDP; + continue; + } + if (!pmap_demote_pdpe(kernel_pmap, pdpe, tmpva)) { + PMAP_UNLOCK(kernel_pmap); + return (ENOMEM); + } + } pde = pmap_pdpe_to_pde(pdpe, tmpva); if (*pde == 0) { PMAP_UNLOCK(kernel_pmap); @@ -4387,6 +4486,18 @@ } if (*pde & PG_PS) { /* + * If the current 2MB page already has the required + * memory type, then we need not demote this page. Just + * increment tmpva to the next 2MB page frame. + */ + if (cache_bits_pde < 0) + cache_bits_pde = pmap_cache_bits(mode, 1); + if ((*pde & PG_PDE_CACHE) == cache_bits_pde) { + tmpva = trunc_2mpage(tmpva) + NBPDR; + continue; + } + + /* * If the current offset aligns with a 2MB page frame * and there is at least 2MB left within the range, then * we need not break down this page into 4KB pages. @@ -4412,27 +4523,52 @@ /* * Ok, all the pages exist, so run through them updating their - * cache mode. + * cache mode if required. */ - for (tmpva = base; size > 0; ) { - pde = pmap_pde(kernel_pmap, tmpva); + for (tmpva = base; tmpva < base + size; ) { + pdpe = pmap_pdpe(kernel_pmap, tmpva); + if (*pdpe & PG_PS) { + if (cache_bits_pde < 0) + cache_bits_pde = pmap_cache_bits(mode, 1); + if ((*pdpe & PG_PDE_CACHE) != cache_bits_pde) { + pmap_pde_attr(pdpe, cache_bits_pde); + if (!changed) + changed = TRUE; + } + tmpva = trunc_1gpage(tmpva) + NBPDP; + continue; + } + pde = pmap_pdpe_to_pde(pdpe, tmpva); if (*pde & PG_PS) { - pmap_pde_attr(pde, mode); - tmpva += NBPDR; - size -= NBPDR; + if (cache_bits_pde < 0) + cache_bits_pde = pmap_cache_bits(mode, 1); + if ((*pde & PG_PDE_CACHE) != cache_bits_pde) { + pmap_pde_attr(pde, cache_bits_pde); + if (!changed) + changed = TRUE; + } + tmpva = trunc_2mpage(tmpva) + NBPDR; } else { - pmap_pte_attr(tmpva, mode); + if (cache_bits_pte < 0) + cache_bits_pte = pmap_cache_bits(mode, 0); + pte = vtopte(tmpva); + if ((*pte & PG_PTE_CACHE) != cache_bits_pte) { + pmap_pte_attr(pte, cache_bits_pte); + if (!changed) + changed = TRUE; + } tmpva += PAGE_SIZE; - size -= PAGE_SIZE; } } /* - * Flush CPU caches to make sure any data isn't cached that shouldn't - * be, etc. - */ - pmap_invalidate_range(kernel_pmap, base, tmpva); - pmap_invalidate_cache(); + * Flush CPU caches if required to make sure any data isn't cached that + * shouldn't be, etc. + */ + if (changed) { + pmap_invalidate_range(kernel_pmap, base, tmpva); + pmap_invalidate_cache(); + } return (0); } ==== //depot/projects/smpng/sys/amd64/conf/GENERIC#65 (text+ko) ==== @@ -16,7 +16,7 @@ # If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # -# $FreeBSD: src/sys/amd64/conf/GENERIC,v 1.505 2008/07/30 22:27:38 jfv Exp $ +# $FreeBSD: src/sys/amd64/conf/GENERIC,v 1.506 2008/08/03 10:32:17 ed Exp $ cpu HAMMER ident GENERIC @@ -256,8 +256,6 @@ device loop # Network loopback device random # Entropy device device ether # Ethernet support -device sl # Kernel SLIP -device ppp # Kernel PPP device tun # Packet tunnel. device pty # Pseudo-ttys (telnet etc) device md # Memory "disks" @@ -290,7 +288,6 @@ device ucom # Generic com ttys device uark # Technologies ARK3116 based serial adapters device ubsa # Belkin F5U103 and compatible serial adapters -device ubser # BWCT console serial adapters device uftdi # For FTDI usb serial adapters device uipaq # Some WinCE based devices device uplcom # Prolific PL-2303 serial adapters ==== //depot/projects/smpng/sys/amd64/conf/NOTES#44 (text+ko) ==== @@ -4,7 +4,7 @@ # This file contains machine dependent kernel configuration notes. For # machine independent notes, look in /sys/conf/NOTES. # -# $FreeBSD: src/sys/amd64/conf/NOTES,v 1.80 2008/05/26 10:39:52 bz Exp $ +# $FreeBSD: src/sys/amd64/conf/NOTES,v 1.81 2008/08/03 10:32:17 ed Exp $ # # @@ -95,44 +95,6 @@ ##################################################################### # MISCELLANEOUS DEVICES AND OPTIONS -# -# sio: serial ports (see sio(4)), including support for various -# PC Card devices, such as Modem and NICs -# -device sio -hint.sio.0.at="isa" -hint.sio.0.port="0x3F8" -hint.sio.0.flags="0x10" -hint.sio.0.irq="4" - -# `flags' specific to sio(4). -# 0x10 enable console support for this unit. Other console flags -# (if applicable) are ignored unless this is set. Enabling -# console support does not make the unit the preferred console. -# Boot with -h or set boot_serial=YES in the loader. For sio(4) -# specifically, the 0x20 flag can also be set (see above). -# Currently, at most one unit can have console support; the -# first one (in config file order) with this flag set is -# preferred. Setting this flag for sio0 gives the old behaviour. -# 0x20 force this unit to be the console (unless there is another -# higher priority console). This replaces the COMCONSOLE option. -# 0x40 reserve this unit for low level console operations. Do not -# access the device in any normal way. -# 0x80 use this port for serial line gdb support in ddb. Also known -# as debug port. -# PnP `flags' -# 0x1 disable probing of this device. Used to prevent your modem -# from being attached as a PnP modem. -# Other flags for sio that aren't documented in the man page. -# 0x20000 enable hardware RTS/CTS and larger FIFOs. Only works for -# ST16650A-compatible UARTs. - -# Options for sio: -options COM_ESP # Code for Hayes ESP. -options COM_MULTIPORT # Code for some cards with shared IRQs. -options CONSPEED=115200 # Speed for serial console - # (default 9600). - device speaker #Play IBM BASIC-style noises out your speaker hint.speaker.0.at="isa" hint.speaker.0.port="0x61" @@ -397,8 +359,6 @@ # ipmi: Intelligent Platform Management Interface # smbios: DMI/SMBIOS entry point # vpd: Vital Product Data kernel interface -# cy: Cyclades serial driver -# digi: Digiboard driver # asmc: Apple System Management Controller # Notes on the Specialix SI/XIO driver: @@ -407,17 +367,6 @@ # The Rev 2 host cards use a 32K chunk, on a 32K boundary. # The cards can use an IRQ of 11, 12 or 15. -device cy -options CY_PCI_FASTINTR # Use with cy_pci unless irq is shared -device digi -# BIOS & FEP/OS components of device digi. -device digi_CX -device digi_CX_PCI -device digi_EPCX -device digi_EPCX_PCI -device digi_Xe -device digi_Xem -device digi_Xr device ipmi # Parallel (8255 PPI) basic I/O (mode 0) port (e.g. Advantech PCL-724) device pbio ==== //depot/projects/smpng/sys/amd64/include/param.h#20 (text+ko) ==== @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)param.h 8.1 (Berkeley) 6/10/93 - * $FreeBSD: src/sys/amd64/include/param.h,v 1.22 2008/07/19 23:42:38 alc Exp $ + * $FreeBSD: src/sys/amd64/include/param.h,v 1.23 2008/08/01 04:55:38 alc Exp $ */ /* @@ -146,6 +146,7 @@ #define trunc_page(x) ((unsigned long)(x) & ~(PAGE_MASK)) #define trunc_2mpage(x) ((unsigned long)(x) & ~PDRMASK) #define round_2mpage(x) ((((unsigned long)(x)) + PDRMASK) & ~PDRMASK) +#define trunc_1gpage(x) ((unsigned long)(x) & ~PDPMASK) #define atop(x) ((unsigned long)(x) >> PAGE_SHIFT) #define ptoa(x) ((unsigned long)(x) << PAGE_SHIFT) ==== //depot/projects/smpng/sys/amd64/include/pmap.h#30 (text+ko) ==== @@ -39,7 +39,7 @@ * * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90 * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91 - * $FreeBSD: src/sys/amd64/include/pmap.h,v 1.146 2008/07/08 22:59:17 alc Exp $ + * $FreeBSD: src/sys/amd64/include/pmap.h,v 1.148 2008/08/04 08:04:09 alc Exp $ */ #ifndef _MACHINE_PMAP_H_ @@ -75,6 +75,10 @@ #define PG_PROT (PG_RW|PG_U) /* all protection bits . */ #define PG_N (PG_NC_PWT|PG_NC_PCD) /* Non-cacheable */ +/* Page level cache control fields used to determine the PAT type */ +#define PG_PDE_CACHE (PG_PDE_PAT | PG_NC_PWT | PG_NC_PCD) +#define PG_PTE_CACHE (PG_PTE_PAT | PG_NC_PWT | PG_NC_PCD) + /* * Promotion to a 2MB (PDE) page mapping requires that the corresponding 4KB * (PTE) page mappings have identical settings for the following fields: @@ -313,7 +317,6 @@ int pmap_change_attr(vm_offset_t, vm_size_t, int); void pmap_init_pat(void); void pmap_kenter(vm_offset_t va, vm_paddr_t pa); -void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode); void *pmap_kenter_temporary(vm_paddr_t pa, int i); vm_paddr_t pmap_kextract(vm_offset_t); void pmap_kremove(vm_offset_t); ==== //depot/projects/smpng/sys/arm/arm/db_interface.c#8 (text+ko) ==== @@ -35,7 +35,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/arm/arm/db_interface.c,v 1.7 2007/02/26 05:17:47 kevlo Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/arm/db_interface.c,v 1.9 2008/08/03 15:35:32 cognet Exp $"); #include "opt_ddb.h" #include @@ -294,9 +294,44 @@ u_int branch_taken(u_int insn, db_addr_t pc) { - u_int addr, nregs; + u_int addr, nregs, offset = 0; switch ((insn >> 24) & 0xf) { + case 0x2: /* add pc, reg1, #value */ + case 0x0: /* add pc, reg1, reg2, lsl #offset */ + addr = db_fetch_reg((insn >> 16) & 0xf); + if (((insn >> 16) & 0xf) == 15) + addr += 8; + if (insn & 0x0200000) { + offset = (insn >> 7) & 0x1e; + offset = (insn & 0xff) << (32 - offset) | + (insn & 0xff) >> offset; + } else { + + offset = db_fetch_reg(insn & 0x0f); + if ((insn & 0x0000ff0) != 0x00000000) { + if (insn & 0x10) + nregs = db_fetch_reg((insn >> 8) & 0xf); + else + nregs = (insn >> 7) & 0x1f; + switch ((insn >> 5) & 3) { + case 0: + /* lsl */ + offset = offset << nregs; + break; + case 1: + /* lsr */ + offset = offset >> nregs; + break; + default: + break; /* XXX */ + } + + } + return (addr + offset); + + } + case 0xa: /* b ... */ case 0xb: /* bl ... */ addr = ((insn << 2) & 0x03ffffff); @@ -311,6 +346,18 @@ case 0x1: /* mov pc, reg */ addr = db_fetch_reg(insn & 0xf); return (addr); + case 0x4: + case 0x5: /* ldr pc, [reg] */ + addr = db_fetch_reg((insn >> 16) & 0xf); + /* ldr pc, [reg, #offset] */ + if (insn & (1 << 24)) + offset = insn & 0xfff; + if (insn & 0x00800000) + addr += offset; + else + addr -= offset; + db_read_bytes(addr, 4, (char *)&addr); + return (addr); case 0x8: /* ldmxx reg, {..., pc} */ case 0x9: addr = db_fetch_reg((insn >> 16) & 0xf); ==== //depot/projects/smpng/sys/arm/arm/elf_trampoline.c#17 (text+ko) ==== @@ -23,7 +23,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/arm/arm/elf_trampoline.c,v 1.20 2008/04/04 17:35:24 raj Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/arm/elf_trampoline.c,v 1.21 2008/08/04 14:37:32 cognet Exp $"); #include #include #include @@ -33,8 +33,6 @@ #include #include -#include - /* * Since we are compiled outside of the normal kernel build process, we * need to include opt_global.h manually. ==== //depot/projects/smpng/sys/arm/arm/intr.c#20 (text+ko) ==== @@ -37,7 +37,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/arm/arm/intr.c,v 1.22 2008/04/20 23:29:06 cognet Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/arm/intr.c,v 1.23 2008/08/04 20:29:39 cognet Exp $"); #include #include #include @@ -107,11 +107,9 @@ arm_handler_execute(struct trapframe *frame, int irqnb) { struct intr_event *event; - struct thread *td = curthread; int i; PCPU_INC(cnt.v_intr); - td->td_intr_nesting_level++; while ((i = arm_get_next_irq()) != -1) { intrcnt[intrcnt_tab[i]]++; event = intr_events[i]; @@ -120,5 +118,4 @@ arm_mask_irq(i); } } - td->td_intr_nesting_level--; } ==== //depot/projects/smpng/sys/arm/arm/swtch.S#17 (text+ko) ==== @@ -83,7 +83,7 @@ #include #include #include -__FBSDID("$FreeBSD: src/sys/arm/arm/swtch.S,v 1.22 2008/02/05 10:22:33 raj Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/arm/swtch.S,v 1.23 2008/08/02 00:10:38 cognet Exp $"); /* @@ -257,6 +257,7 @@ strd r10, [r2, #(PCB_R10)] strd r12, [r2, #(PCB_R12)] #endif + str pc, [r2, #(PCB_PC)] /* * NOTE: We can now use r8-r13 until it is time to restore ==== //depot/projects/smpng/sys/arm/arm/vm_machdep.c#28 (text+ko) ==== @@ -41,7 +41,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/arm/arm/vm_machdep.c,v 1.36 2008/03/16 10:58:02 rwatson Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/arm/vm_machdep.c,v 1.37 2008/08/04 14:47:49 raj Exp $"); #include #include @@ -410,10 +410,9 @@ arm_remap_nocache(void *addr, vm_size_t size) { int i, j; - + size = round_page(size); - for (i = 0; i < MIN(ARM_NOCACHE_KVA_SIZE / (PAGE_SIZE * BITS_PER_INT), - ARM_TP_ADDRESS); i++) { + for (i = 0; i < ARM_NOCACHE_KVA_SIZE / PAGE_SIZE; i++) { if (!(arm_nocache_allocated[i / BITS_PER_INT] & (1 << (i % BITS_PER_INT)))) { for (j = i; j < i + (size / (PAGE_SIZE)); j++) @@ -424,8 +423,7 @@ break; } } - if (i < MIN(ARM_NOCACHE_KVA_SIZE / (PAGE_SIZE * BITS_PER_INT), - ARM_TP_ADDRESS)) { + if (i < ARM_NOCACHE_KVA_SIZE / PAGE_SIZE) { vm_offset_t tomap = arm_nocache_startaddr + i * PAGE_SIZE; void *ret = (void *)tomap; vm_paddr_t physaddr = vtophys((vm_offset_t)addr); @@ -438,6 +436,7 @@ } return (ret); } + return (NULL); } ==== //depot/projects/smpng/sys/arm/at91/at91_twi.c#11 (text) ==== @@ -23,7 +23,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/arm/at91/at91_twi.c,v 1.11 2008/05/28 14:35:15 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/at91/at91_twi.c,v 1.12 2008/08/04 20:46:15 jhb Exp $"); #include #include @@ -155,6 +155,8 @@ if (sc->iicbus && (rv = device_delete_child(dev, sc->iicbus)) != 0) return (rv); + AT91_TWI_LOCK_DESTROY(sc); + return (0); } @@ -211,6 +213,7 @@ status = RD4(sc, TWI_SR); if (status == 0) return; + AT91_TWI_LOCK(sc); sc->flags |= status & (TWI_SR_OVRE | TWI_SR_UNRE | TWI_SR_NACK); if (status & TWI_SR_RXRDY) sc->flags |= TWI_SR_RXRDY; @@ -220,6 +223,7 @@ sc->flags |= TWI_SR_TXCOMP; WR4(sc, TWI_IDR, status); wakeup(sc); + AT91_TWI_UNLOCK(sc); return; } @@ -230,6 +234,7 @@ int counter = 100000; uint32_t sr; + AT91_TWI_ASSERT_LOCKED(sc); while (!((sr = RD4(sc, TWI_SR)) & bit) && counter-- > 0 && !(sr & TWI_SR_NACK)) continue; @@ -247,6 +252,7 @@ int clk; sc = device_get_softc(dev); + AT91_TWI_LOCK(sc); if (oldaddr) *oldaddr = sc->twi_addr; sc->twi_addr = addr; @@ -275,6 +281,7 @@ WR4(sc, TWI_CR, TWI_CR_MSEN | TWI_CR_SVDIS); WR4(sc, TWI_CWGR, sc->cwgr); printf("setting cwgr to %#x\n", sc->cwgr); + AT91_TWI_UNLOCK(sc); return 0; } ==== //depot/projects/smpng/sys/arm/at91/uart_dev_at91usart.c#14 (text) ==== @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/arm/at91/uart_dev_at91usart.c,v 1.14 2008/05/04 23:29:37 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/at91/uart_dev_at91usart.c,v 1.15 2008/08/02 08:01:56 ed Exp $"); #include "opt_comconsole.h" @@ -510,15 +510,18 @@ if (sc->sc_sysdev != NULL && sc->sc_sysdev->type == UART_DEV_CONSOLE) { if ((kdb_brk = kdb_alt_break(key, &sc->sc_altbrk)) != 0) { - case KDB_REQ_DEBUGGER: - kdb_enter(KDB_WHY_BREAK, "Break sequence on console"); - break; - case KDB_REQ_PANIC: - kdb_panic("Panic sequence on console"); - break; - case KDB_REQ_REBOOT: - kdb_reboot(); - break; + switch (kdb_brk) { + case KDB_REQ_DEBUGGER: + kdb_enter(KDB_WHY_BREAK, + "Break sequence on console"); + break; + case KDB_REQ_PANIC: + kdb_panic("Panic sequence on console"); + break; + case KDB_REQ_REBOOT: + kdb_reboot(); + break; + } } } #endif ==== //depot/projects/smpng/sys/arm/conf/AVILA#8 (text+ko) ==== @@ -16,37 +16,37 @@ # If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # -# $FreeBSD: src/sys/arm/conf/AVILA,v 1.13 2008/04/21 10:09:54 phk Exp $ +# $FreeBSD: src/sys/arm/conf/AVILA,v 1.16 2008/08/02 22:53:43 imp Exp $ machine arm ident AVILA options PHYSADDR=0x10000000 -options KERNPHYSADDR=0x10200000 -options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm -options FLASHADDR=0x50000000 -options LOADERRAMADDR=0x00000000 +options KERNPHYSADDR=0x10200000 +options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm +options FLASHADDR=0x50000000 +options LOADERRAMADDR=0x00000000 +options STARTUP_PAGETABLE_ADDR=0x10000000 -options STARTUP_PAGETABLE_ADDR=0x10000000 include "../xscale/ixp425/std.avila" #To statically compile in device wiring instead of /boot/device.hints hints "AVILA.hints" #Default places to look for devices. makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols makeoptions CONF_CFLAGS=-mcpu=xscale -#options HZ=1000 -options HZ=100 -options DEVICE_POLLING +#options HZ=1000 +options HZ=100 +options DEVICE_POLLING # Debugging for use in -current -options KDB -#options GDB +options KDB +#options GDB options DDB #Enable the kernel debugger #options INVARIANTS #Enable calls of extra sanity checking #options INVARIANT_SUPPORT #Extra sanity checks of internal structures, required by INVARIANTS #options WITNESS #Enable checks to detect deadlocks and cycles #options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed -#options DIAGNOSTIC +#options DIAGNOSTIC options SCHED_4BSD #4BSD scheduler options INET #InterNETworking @@ -70,15 +70,15 @@ options SYSVSEM #SYSV-style semaphores options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions options KBD_INSTALL_CDEV # install a CDEV entry in /dev -options BOOTP -options BOOTP_NFSROOT -options BOOTP_NFSV3 -options BOOTP_WIRED_TO=npe0 -#options BOOTP_WIRED_TO=ath0 -#options BOOTP_WIRED_TO=rl0 -options BOOTP_COMPAT -#options PREEMPTION -#options VERBOSE_SYSINIT +options BOOTP +options BOOTP_NFSROOT +options BOOTP_NFSV3 +options BOOTP_WIRED_TO=npe0 +#options BOOTP_WIRED_TO=ath0 +#options BOOTP_WIRED_TO=rl0 +options BOOTP_COMPAT +#options PREEMPTION +#options VERBOSE_SYSINIT >>> TRUNCATED FOR MAIL (1000 lines) <<<