PERFORCE change 100336 for review
John Birrell
jb at FreeBSD.org
Fri Jun 30 05:26:59 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=100336
Change 100336 by jb at jb_freebsd2 on 2006/06/30 05:26:02
Integrate sun4v_stable
Affected files ...
.. //depot/projects/dtrace/src/sys/sun4v/conf/GENERIC#2 integrate
.. //depot/projects/dtrace/src/sys/sun4v/sun4v/exception.S#2 integrate
.. //depot/projects/dtrace/src/sys/sun4v/sun4v/pmap.c#2 integrate
Differences ...
==== //depot/projects/dtrace/src/sys/sun4v/conf/GENERIC#2 (text+ko) ====
@@ -136,7 +136,7 @@
# Serial (COM) ports
#device sab # Siemens SAB82532 based serial ports
-device uart # Multi-uart driver
+#device uart # Multi-uart driver
#device puc # Multi-channel uarts
# Parallel port
==== //depot/projects/dtrace/src/sys/sun4v/sun4v/exception.S#2 (text+ko) ====
@@ -46,7 +46,6 @@
#include <machine/hypervisorvar.h>
#include <machine/errata.h>
-
#include "assym.s"
#include <machine/mmu.h>
==== //depot/projects/dtrace/src/sys/sun4v/sun4v/pmap.c#2 (text+ko) ====
@@ -186,6 +186,7 @@
static void pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t m);
static void pmap_remove_entry(struct pmap *pmap, vm_page_t m, vm_offset_t va);
static void pmap_remove_tte(pmap_t pmap, tte_t tte_data, vm_offset_t va);
+static void pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot);
void pmap_set_ctx_panic(uint64_t error, vm_paddr_t tsb_ra, pmap_t pmap);
@@ -383,7 +384,7 @@
{
pmap_t pmap, oldpmap;
int context, err;
- DPRINTF("activating pmap for %d\n", td->td_tid);
+ int err;
critical_enter();
pmap = vmspace_pmap(td->td_proc->p_vmspace);
@@ -404,6 +405,8 @@
context = pmap->pm_context;
if (pmap->pm_context != 0)
if ((err = hv_set_ctxnon0(1, pmap->pm_tsb_ra)) != H_EOK)
+ panic("failed to set TSB 0x%lx - context == %ld\n",
+ pmap->pm_tsb_ra, pmap->pm_context);
panic("failed to set TSB 0x%lx - context == %d\n",
pmap->pm_tsb_ra, context);
stxa(MMU_CID_S, ASI_MMU_CONTEXTID, context);
@@ -999,9 +1002,49 @@
}
-vm_page_t
-pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
- vm_page_t mpte)
+/*
+ * Maps a sequence of resident pages belonging to the same object.
+ * The sequence begins with the given page m_start. This page is
+ * mapped at the given virtual address start. Each subsequent page is
+ * mapped at a virtual address that is offset from start by the same
+ * amount as the page is offset from m_start within the object. The
+ * last page in the sequence is the page with the largest offset from
+ * m_start that can be mapped at a virtual address less than the given
+ * virtual address end. Not every virtual page between start and end
+ * is mapped; only those for which a resident page exists with the
+ * corresponding offset from m_start are mapped.
+ */
+void
+pmap_enter_object(pmap_t pmap, vm_offset_t start, vm_offset_t end,
+ vm_page_t m_start, vm_prot_t prot)
+{
+ vm_page_t m, mpte;
+ vm_pindex_t diff, psize;
+
+ VM_OBJECT_LOCK_ASSERT(m_start->object, MA_OWNED);
+ psize = atop(end - start);
+ mpte = NULL;
+ m = m_start;
+ PMAP_LOCK(pmap);
+ while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) {
+ pmap_enter_quick_locked(pmap, start + ptoa(diff), m,
+ prot);
+ m = TAILQ_NEXT(m, listq);
+ }
+ PMAP_UNLOCK(pmap);
+}
+
+void
+pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot)
+{
+ PMAP_LOCK(pmap);
+ pmap_enter_quick_locked(pmap, va, m, prot);
+ PMAP_UNLOCK(pmap);
+
+}
+
+static void
+pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot)
{
tte_t tte_data;
@@ -1009,14 +1052,10 @@
if (pmap->pm_context)
KDPRINTF("pmap_enter_quick(ctx=0x%lx va=%lx, pa=0x%lx prot=%x)\n",
pmap->pm_context, va, VM_PAGE_TO_PHYS(m), prot);
-
- mtx_assert(&vm_page_queue_mtx, MA_OWNED);
- VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);
- PMAP_LOCK(pmap);
-
+ PMAP_LOCK_ASSERT(pmap, MA_OWNED);
if (tte_hash_lookup(pmap->pm_hash, va))
- goto done;
+ return;
tte_data = VM_PAGE_TO_PHYS(m);
/*
@@ -1038,10 +1077,7 @@
tte_data |= TTE_KERNEL_MINFLAGS;
tte_hash_insert(pmap->pm_hash, va, tte_data | TTE_MINFLAGS);
-done:
- PMAP_UNLOCK(pmap);
- return (0);
}
/*
More information about the p4-projects
mailing list