summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosef 'Jeff' Sipek <jeffpc@josefsipek.net>2016-01-06 16:12:32 -0500
committerHans Rosenfeld <rosenfeld@grumpf.hope-2000.org>2016-01-16 19:06:38 +0100
commit0d5ae8c1274da6a6c74059317942eea625104946 (patch)
tree9b3b22f44a6baa223c7438a7e143442d645749b0
parent8c04a1fa3f7d569d48fe9b5342d0bd4c533179b9 (diff)
downloadillumos-gate-0d5ae8c1274da6a6c74059317942eea625104946.tar.gz
6345 remove xhat support
Reviewed by: Dan McDonald <danmcd@omniti.com> Reviewed by: Garrett D'Amore <garrett@damore.org> Approved by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
-rw-r--r--usr/src/uts/common/Makefile.files1
-rw-r--r--usr/src/uts/common/os/watchpoint.c29
-rw-r--r--usr/src/uts/common/vm/as.h5
-rw-r--r--usr/src/uts/common/vm/seg_spt.c61
-rw-r--r--usr/src/uts/common/vm/seg_vn.c31
-rw-r--r--usr/src/uts/common/vm/vm_as.c175
-rw-r--r--usr/src/uts/common/vm/vm_rm.c2
-rw-r--r--usr/src/uts/common/vm/xhat.c555
-rw-r--r--usr/src/uts/common/vm/xhat.h208
-rw-r--r--usr/src/uts/sfmmu/vm/hat_sfmmu.c210
-rw-r--r--usr/src/uts/sfmmu/vm/hat_sfmmu.h14
-rw-r--r--usr/src/uts/sfmmu/vm/xhat_sfmmu.c240
-rw-r--r--usr/src/uts/sfmmu/vm/xhat_sfmmu.h94
-rw-r--r--usr/src/uts/sun4u/Makefile.files1
-rw-r--r--usr/src/uts/sun4u/vm/mach_kpm.c4
-rw-r--r--usr/src/uts/sun4v/Makefile.files1
16 files changed, 76 insertions, 1555 deletions
diff --git a/usr/src/uts/common/Makefile.files b/usr/src/uts/common/Makefile.files
index e0530c886f..030e2df374 100644
--- a/usr/src/uts/common/Makefile.files
+++ b/usr/src/uts/common/Makefile.files
@@ -402,7 +402,6 @@ GENUNIX_OBJS += \
xdr.o \
xdr_array.o \
xdr_refer.o \
- xhat.o \
zone.o
#
diff --git a/usr/src/uts/common/os/watchpoint.c b/usr/src/uts/common/os/watchpoint.c
index 9704b44e30..2a43089451 100644
--- a/usr/src/uts/common/os/watchpoint.c
+++ b/usr/src/uts/common/os/watchpoint.c
@@ -180,11 +180,7 @@ startover:
/*
* as->a_wpage can only be changed while the process is totally stopped.
* Don't grab p_lock here. Holding p_lock while grabbing the address
- * space lock leads to deadlocks with the clock thread. Note that if an
- * as_fault() is servicing a fault to a watched page on behalf of an
- * XHAT provider, watchpoint will be temporarily cleared (and wp_prot
- * will be set to wp_oprot). Since this is done while holding as writer
- * lock, we need to grab as lock (reader lock is good enough).
+ * space lock leads to deadlocks with the clock thread.
*
* p_maplock prevents simultaneous execution of this function. Under
* normal circumstances, holdwatch() will stop all other threads, so the
@@ -194,7 +190,6 @@ startover:
*/
mutex_enter(&p->p_maplock);
- AS_LOCK_ENTER(as, RW_READER);
tpw.wp_vaddr = (caddr_t)((uintptr_t)addr & (uintptr_t)PAGEMASK);
if ((pwp = avl_find(&as->a_wpage, &tpw, &where)) == NULL)
@@ -229,11 +224,6 @@ startover:
* all other lwps are held in the kernel.
*/
if (p->p_mapcnt == 0) {
- /*
- * Release as lock while in holdwatch()
- * in case other threads need to grab it.
- */
- AS_LOCK_EXIT(as);
mutex_exit(&p->p_maplock);
if (holdwatch() != 0) {
/*
@@ -244,7 +234,6 @@ startover:
goto startover;
}
mutex_enter(&p->p_maplock);
- AS_LOCK_ENTER(as, RW_READER);
}
p->p_mapcnt++;
}
@@ -304,7 +293,6 @@ startover:
uint_t oprot;
int err, retrycnt = 0;
- AS_LOCK_EXIT(as);
AS_LOCK_ENTER(as, RW_WRITER);
retry:
seg = as_segat(as, addr);
@@ -319,8 +307,7 @@ startover:
}
}
AS_LOCK_EXIT(as);
- } else
- AS_LOCK_EXIT(as);
+ }
/*
* When all pages are mapped back to their normal state,
@@ -337,11 +324,8 @@ startover:
mutex_enter(&p->p_maplock);
}
}
-
- AS_LOCK_ENTER(as, RW_READER);
}
- AS_LOCK_EXIT(as);
mutex_exit(&p->p_maplock);
return (rv);
@@ -434,7 +418,6 @@ setallwatch(void)
-/* Must be called with as lock held */
int
pr_is_watchpage_as(caddr_t addr, enum seg_rw rw, struct as *as)
{
@@ -497,17 +480,11 @@ int
pr_is_watchpage(caddr_t addr, enum seg_rw rw)
{
struct as *as = curproc->p_as;
- int rv;
if ((as == &kas) || avl_numnodes(&as->a_wpage) == 0)
return (0);
- /* Grab the lock because of XHAT (see comment in pr_mappage()) */
- AS_LOCK_ENTER(as, RW_READER);
- rv = pr_is_watchpage_as(addr, rw, as);
- AS_LOCK_EXIT(as);
-
- return (rv);
+ return (pr_is_watchpage_as(addr, rw, as));
}
diff --git a/usr/src/uts/common/vm/as.h b/usr/src/uts/common/vm/as.h
index 22ceb82fae..e910db1ddc 100644
--- a/usr/src/uts/common/vm/as.h
+++ b/usr/src/uts/common/vm/as.h
@@ -125,7 +125,6 @@ struct as {
vnode_t **a_objectdir; /* object directory (procfs) */
size_t a_sizedir; /* size of object directory */
struct as_callback *a_callbacks; /* callback list */
- void *a_xhat; /* list of xhat providers */
proc_t *a_proc; /* back pointer to proc */
size_t a_resvsize; /* size of reserved part of address space */
};
@@ -135,24 +134,20 @@ struct as {
#define AS_UNMAPWAIT 0x20
#define AS_NEEDSPURGE 0x10 /* mostly for seg_nf, see as_purge() */
#define AS_NOUNMAPWAIT 0x02
-#define AS_BUSY 0x01 /* needed by XHAT framework */
#define AS_ISPGLCK(as) ((as)->a_flags & AS_PAGLCK)
#define AS_ISCLAIMGAP(as) ((as)->a_flags & AS_CLAIMGAP)
#define AS_ISUNMAPWAIT(as) ((as)->a_flags & AS_UNMAPWAIT)
-#define AS_ISBUSY(as) ((as)->a_flags & AS_BUSY)
#define AS_ISNOUNMAPWAIT(as) ((as)->a_flags & AS_NOUNMAPWAIT)
#define AS_SETPGLCK(as) ((as)->a_flags |= AS_PAGLCK)
#define AS_SETCLAIMGAP(as) ((as)->a_flags |= AS_CLAIMGAP)
#define AS_SETUNMAPWAIT(as) ((as)->a_flags |= AS_UNMAPWAIT)
-#define AS_SETBUSY(as) ((as)->a_flags |= AS_BUSY)
#define AS_SETNOUNMAPWAIT(as) ((as)->a_flags |= AS_NOUNMAPWAIT)
#define AS_CLRPGLCK(as) ((as)->a_flags &= ~AS_PAGLCK)
#define AS_CLRCLAIMGAP(as) ((as)->a_flags &= ~AS_CLAIMGAP)
#define AS_CLRUNMAPWAIT(as) ((as)->a_flags &= ~AS_UNMAPWAIT)
-#define AS_CLRBUSY(as) ((as)->a_flags &= ~AS_BUSY)
#define AS_CLRNOUNMAPWAIT(as) ((as)->a_flags &= ~AS_NOUNMAPWAIT)
#define AS_TYPE_64BIT(as) \
diff --git a/usr/src/uts/common/vm/seg_spt.c b/usr/src/uts/common/vm/seg_spt.c
index ded3ed49e3..1573e1726b 100644
--- a/usr/src/uts/common/vm/seg_spt.c
+++ b/usr/src/uts/common/vm/seg_spt.c
@@ -1924,27 +1924,17 @@ segspt_dismfault(struct hat *hat, struct seg *seg, caddr_t addr,
HAT_LOAD_LOCK | HAT_LOAD_SHARE);
}
} else {
- if (hat == seg->s_as->a_hat) {
+ /*
+ * Migrate pages marked for migration
+ */
+ if (lgrp_optimizations())
+ page_migrate(seg, shm_addr, ppa, npages);
- /*
- * Migrate pages marked for migration
- */
- if (lgrp_optimizations())
- page_migrate(seg, shm_addr, ppa,
- npages);
-
- /* CPU HAT */
- for (; pidx < npages;
- a += pgsz, pidx += pgcnt) {
- hat_memload_array(sptseg->s_as->a_hat,
- a, pgsz, &ppa[pidx],
- sptd->spt_prot,
- HAT_LOAD_SHARE);
- }
- } else {
- /* XHAT. Pass real address */
- hat_memload_array(hat, shm_addr,
- size, ppa, sptd->spt_prot, HAT_LOAD_SHARE);
+ for (; pidx < npages; a += pgsz, pidx += pgcnt) {
+ hat_memload_array(sptseg->s_as->a_hat,
+ a, pgsz, &ppa[pidx],
+ sptd->spt_prot,
+ HAT_LOAD_SHARE);
}
/*
@@ -2184,28 +2174,17 @@ segspt_shmfault(struct hat *hat, struct seg *seg, caddr_t addr,
HAT_LOAD_LOCK | HAT_LOAD_SHARE);
}
} else {
- if (hat == seg->s_as->a_hat) {
+ /*
+ * Migrate pages marked for migration.
+ */
+ if (lgrp_optimizations())
+ page_migrate(seg, shm_addr, ppa, npages);
- /*
- * Migrate pages marked for migration.
- */
- if (lgrp_optimizations())
- page_migrate(seg, shm_addr, ppa,
- npages);
-
- /* CPU HAT */
- for (; pidx < npages;
- a += pgsz, pidx += pgcnt) {
- sz = MIN(pgsz, ptob(npages - pidx));
- hat_memload_array(sptseg->s_as->a_hat,
- a, sz, &ppa[pidx],
- sptd->spt_prot, HAT_LOAD_SHARE);
- }
- } else {
- /* XHAT. Pass real address */
- hat_memload_array(hat, shm_addr,
- ptob(npages), ppa, sptd->spt_prot,
- HAT_LOAD_SHARE);
+ for (; pidx < npages; a += pgsz, pidx += pgcnt) {
+ sz = MIN(pgsz, ptob(npages - pidx));
+ hat_memload_array(sptseg->s_as->a_hat,
+ a, sz, &ppa[pidx],
+ sptd->spt_prot, HAT_LOAD_SHARE);
}
/*
diff --git a/usr/src/uts/common/vm/seg_vn.c b/usr/src/uts/common/vm/seg_vn.c
index 7ec20713d9..0c0b1b2692 100644
--- a/usr/src/uts/common/vm/seg_vn.c
+++ b/usr/src/uts/common/vm/seg_vn.c
@@ -3856,7 +3856,6 @@ segvn_fault_vnodepages(struct hat *hat, struct seg *seg, caddr_t lpgaddr,
int alloc_failed = 0;
int adjszc_chk;
struct vattr va;
- int xhat = 0;
page_t *pplist;
pfn_t pfn;
int physcontig;
@@ -3906,10 +3905,6 @@ segvn_fault_vnodepages(struct hat *hat, struct seg *seg, caddr_t lpgaddr,
/* caller has already done segment level protection check. */
}
- if (seg->s_as->a_hat != hat) {
- xhat = 1;
- }
-
if (rw == S_WRITE && segtype == MAP_PRIVATE) {
SEGVN_VMSTAT_FLTVNPAGES(2);
arw = S_READ;
@@ -4265,25 +4260,9 @@ segvn_fault_vnodepages(struct hat *hat, struct seg *seg, caddr_t lpgaddr,
}
SEGVN_UPDATE_MODBITS(ppa, pages, rw,
prot, vpprot);
- if (!xhat) {
- hat_memload_array_region(hat, a, pgsz,
- ppa, prot & vpprot, hat_flag,
- svd->rcookie);
- } else {
- /*
- * avoid large xhat mappings to FS
- * pages so that hat_page_demote()
- * doesn't need to check for xhat
- * large mappings.
- * Don't use regions with xhats.
- */
- for (i = 0; i < pages; i++) {
- hat_memload(hat,
- a + (i << PAGESHIFT),
- ppa[i], prot & vpprot,
- hat_flag);
- }
- }
+ hat_memload_array_region(hat, a, pgsz,
+ ppa, prot & vpprot, hat_flag,
+ svd->rcookie);
if (!(hat_flag & HAT_LOAD_LOCK)) {
for (i = 0; i < pages; i++) {
@@ -4337,7 +4316,7 @@ segvn_fault_vnodepages(struct hat *hat, struct seg *seg, caddr_t lpgaddr,
* check if we should use smallest mapping size.
*/
upgrdfail = 0;
- if (szc == 0 || xhat ||
+ if (szc == 0 ||
(pszc >= szc &&
!IS_P2ALIGNED(pfn, pages)) ||
(pszc < szc &&
@@ -4369,7 +4348,7 @@ segvn_fault_vnodepages(struct hat *hat, struct seg *seg, caddr_t lpgaddr,
ierr = -1;
break;
}
- if (szc != 0 && !xhat && !upgrdfail) {
+ if (szc != 0 && !upgrdfail) {
segvn_faultvnmpss_align_err5++;
}
SEGVN_VMSTAT_FLTVNPAGES(34);
diff --git a/usr/src/uts/common/vm/vm_as.c b/usr/src/uts/common/vm/vm_as.c
index d20bdbf804..bb5a96eb0f 100644
--- a/usr/src/uts/common/vm/vm_as.c
+++ b/usr/src/uts/common/vm/vm_as.c
@@ -59,7 +59,6 @@
#include <sys/vtrace.h>
#include <vm/hat.h>
-#include <vm/xhat.h>
#include <vm/as.h>
#include <vm/seg.h>
#include <vm/seg_vn.h>
@@ -671,8 +670,6 @@ as_alloc(void)
as->a_hat = hat_alloc(as); /* create hat for default system mmu */
AS_LOCK_EXIT(as);
- as->a_xhat = NULL;
-
return (as);
}
@@ -687,7 +684,7 @@ as_free(struct as *as)
{
struct hat *hat = as->a_hat;
struct seg *seg, *next;
- int called = 0;
+ boolean_t free_started = B_FALSE;
top:
/*
@@ -699,17 +696,12 @@ top:
while (as->a_callbacks && as_do_callbacks(as, AS_ALL_EVENT, 0, 0))
;
- /* This will prevent new XHATs from attaching to as */
- if (!called)
- AS_SETBUSY(as);
mutex_exit(&as->a_contents);
AS_LOCK_ENTER(as, RW_WRITER);
- if (!called) {
- called = 1;
+ if (!free_started) {
+ free_started = B_TRUE;
hat_free_start(hat);
- if (as->a_xhat != NULL)
- xhat_free_start_all(as);
}
for (seg = AS_SEGFIRST(as); seg != NULL; seg = next) {
int err;
@@ -759,8 +751,6 @@ retry:
}
}
hat_free_end(hat);
- if (as->a_xhat != NULL)
- xhat_free_end_all(as);
AS_LOCK_EXIT(as);
/* /proc stuff */
@@ -794,14 +784,6 @@ as_dup(struct as *as, struct proc *forkedproc)
AS_LOCK_ENTER(newas, RW_WRITER);
- /* This will prevent new XHATs from attaching */
- mutex_enter(&as->a_contents);
- AS_SETBUSY(as);
- mutex_exit(&as->a_contents);
- mutex_enter(&newas->a_contents);
- AS_SETBUSY(newas);
- mutex_exit(&newas->a_contents);
-
(void) hat_dup(as->a_hat, newas->a_hat, NULL, 0, HAT_DUP_SRD);
for (seg = AS_SEGFIRST(as); seg != NULL; seg = AS_SEGNEXT(as, seg)) {
@@ -815,9 +797,6 @@ as_dup(struct as *as, struct proc *forkedproc)
if (newseg == NULL) {
AS_LOCK_EXIT(newas);
as_setwatch(as);
- mutex_enter(&as->a_contents);
- AS_CLRBUSY(as);
- mutex_exit(&as->a_contents);
AS_LOCK_EXIT(as);
as_free(newas);
return (-1);
@@ -829,9 +808,6 @@ as_dup(struct as *as, struct proc *forkedproc)
* completely; i.e. it has no ops.
*/
as_setwatch(as);
- mutex_enter(&as->a_contents);
- AS_CLRBUSY(as);
- mutex_exit(&as->a_contents);
AS_LOCK_EXIT(as);
seg_free(newseg);
AS_LOCK_EXIT(newas);
@@ -843,18 +819,10 @@ as_dup(struct as *as, struct proc *forkedproc)
newas->a_resvsize = as->a_resvsize - purgesize;
error = hat_dup(as->a_hat, newas->a_hat, NULL, 0, HAT_DUP_ALL);
- if (as->a_xhat != NULL)
- error |= xhat_dup_all(as, newas, NULL, 0, HAT_DUP_ALL);
- mutex_enter(&newas->a_contents);
- AS_CLRBUSY(newas);
- mutex_exit(&newas->a_contents);
AS_LOCK_EXIT(newas);
as_setwatch(as);
- mutex_enter(&as->a_contents);
- AS_CLRBUSY(as);
- mutex_exit(&as->a_contents);
AS_LOCK_EXIT(as);
if (error != 0) {
as_free(newas);
@@ -880,57 +848,44 @@ as_fault(struct hat *hat, struct as *as, caddr_t addr, size_t size,
struct seg *segsav;
int as_lock_held;
klwp_t *lwp = ttolwp(curthread);
- int is_xhat = 0;
- int holding_wpage = 0;
- extern struct seg_ops segdev_ops;
- if (as->a_hat != hat) {
- /* This must be an XHAT then */
- is_xhat = 1;
-
- if ((type != F_INVAL) || (as == &kas))
- return (FC_NOSUPPORT);
- }
-
retry:
- if (!is_xhat) {
- /*
- * Indicate that the lwp is not to be stopped while waiting
- * for a pagefault. This is to avoid deadlock while debugging
- * a process via /proc over NFS (in particular).
- */
- if (lwp != NULL)
- lwp->lwp_nostop++;
+ /*
+ * Indicate that the lwp is not to be stopped while waiting for a
+ * pagefault. This is to avoid deadlock while debugging a process
+ * via /proc over NFS (in particular).
+ */
+ if (lwp != NULL)
+ lwp->lwp_nostop++;
- /*
- * same length must be used when we softlock and softunlock.
- * We don't support softunlocking lengths less than
- * the original length when there is largepage support.
- * See seg_dev.c for more comments.
- */
- switch (type) {
+ /*
+ * same length must be used when we softlock and softunlock. We
+ * don't support softunlocking lengths less than the original length
+ * when there is largepage support. See seg_dev.c for more
+ * comments.
+ */
+ switch (type) {
- case F_SOFTLOCK:
- CPU_STATS_ADD_K(vm, softlock, 1);
- break;
+ case F_SOFTLOCK:
+ CPU_STATS_ADD_K(vm, softlock, 1);
+ break;
- case F_SOFTUNLOCK:
- break;
+ case F_SOFTUNLOCK:
+ break;
- case F_PROT:
- CPU_STATS_ADD_K(vm, prot_fault, 1);
- break;
+ case F_PROT:
+ CPU_STATS_ADD_K(vm, prot_fault, 1);
+ break;
- case F_INVAL:
- CPU_STATS_ENTER_K();
- CPU_STATS_ADDQ(CPU, vm, as_fault, 1);
- if (as == &kas)
- CPU_STATS_ADDQ(CPU, vm, kernel_asflt, 1);
- CPU_STATS_EXIT_K();
- break;
- }
+ case F_INVAL:
+ CPU_STATS_ENTER_K();
+ CPU_STATS_ADDQ(CPU, vm, as_fault, 1);
+ if (as == &kas)
+ CPU_STATS_ADDQ(CPU, vm, kernel_asflt, 1);
+ CPU_STATS_EXIT_K();
+ break;
}
/* Kernel probe */
@@ -952,35 +907,15 @@ retry:
*/
if (as == &kas && segkmap && segkmap->s_base <= raddr &&
raddr + size < segkmap->s_base + segkmap->s_size) {
- /*
- * if (as==&kas), this can't be XHAT: we've already returned
- * FC_NOSUPPORT.
- */
seg = segkmap;
as_lock_held = 0;
} else {
AS_LOCK_ENTER(as, RW_READER);
- if (is_xhat && avl_numnodes(&as->a_wpage) != 0) {
- /*
- * Grab and hold the writers' lock on the as
- * if the fault is to a watched page.
- * This will keep CPUs from "peeking" at the
- * address range while we're temporarily boosting
- * the permissions for the XHAT device to
- * resolve the fault in the segment layer.
- *
- * We could check whether faulted address
- * is within a watched page and only then grab
- * the writer lock, but this is simpler.
- */
- AS_LOCK_EXIT(as);
- AS_LOCK_ENTER(as, RW_WRITER);
- }
seg = as_segat(as, raddr);
if (seg == NULL) {
AS_LOCK_EXIT(as);
- if ((lwp != NULL) && (!is_xhat))
+ if (lwp != NULL)
lwp->lwp_nostop--;
return (FC_NOMAP);
}
@@ -1004,35 +939,9 @@ retry:
else
ssize = rsize;
- if (!is_xhat || (seg->s_ops != &segdev_ops)) {
-
- if (is_xhat && avl_numnodes(&as->a_wpage) != 0 &&
- pr_is_watchpage_as(raddr, rw, as)) {
- /*
- * Handle watch pages. If we're faulting on a
- * watched page from an X-hat, we have to
- * restore the original permissions while we
- * handle the fault.
- */
- as_clearwatch(as);
- holding_wpage = 1;
- }
-
- res = SEGOP_FAULT(hat, seg, raddr, ssize, type, rw);
-
- /* Restore watchpoints */
- if (holding_wpage) {
- as_setwatch(as);
- holding_wpage = 0;
- }
-
- if (res != 0)
- break;
- } else {
- /* XHAT does not support seg_dev */
- res = FC_NOSUPPORT;
+ res = SEGOP_FAULT(hat, seg, raddr, ssize, type, rw);
+ if (res != 0)
break;
- }
}
/*
@@ -1061,7 +970,7 @@ retry:
}
if (as_lock_held)
AS_LOCK_EXIT(as);
- if ((lwp != NULL) && (!is_xhat))
+ if (lwp != NULL)
lwp->lwp_nostop--;
/*
@@ -2166,12 +2075,6 @@ as_swapout(struct as *as)
AS_LOCK_ENTER(as, RW_READER);
- /* Prevent XHATs from attaching */
- mutex_enter(&as->a_contents);
- AS_SETBUSY(as);
- mutex_exit(&as->a_contents);
-
-
/*
* Free all mapping resources associated with the address
* space. The segment-level swapout routines capitalize
@@ -2179,12 +2082,6 @@ as_swapout(struct as *as)
* unmapped here.
*/
hat_swapout(as->a_hat);
- if (as->a_xhat != NULL)
- xhat_swapout_all(as);
-
- mutex_enter(&as->a_contents);
- AS_CLRBUSY(as);
- mutex_exit(&as->a_contents);
/*
* Call the swapout routines of all segments in the address
diff --git a/usr/src/uts/common/vm/vm_rm.c b/usr/src/uts/common/vm/vm_rm.c
index e0500874b6..315939d59c 100644
--- a/usr/src/uts/common/vm/vm_rm.c
+++ b/usr/src/uts/common/vm/vm_rm.c
@@ -65,7 +65,7 @@
* physical page is present and the hardware translation is missing;
* and it can overestimate the rss, eg, if there are active
* translations to a frame buffer with page structs.
- * Also, it does not take sharing and XHATs into account.
+ * Also, it does not take sharing into account.
*/
size_t
rm_asrss(as)
diff --git a/usr/src/uts/common/vm/xhat.c b/usr/src/uts/common/vm/xhat.c
deleted file mode 100644
index 255ca1eb67..0000000000
--- a/usr/src/uts/common/vm/xhat.c
+++ /dev/null
@@ -1,555 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-
-#include <sys/types.h>
-#include <sys/cmn_err.h>
-#include <sys/mman.h>
-#include <sys/systm.h>
-#include <vm/xhat.h>
-#include <vm/page.h>
-#include <vm/as.h>
-
-int xhat_debug = 0;
-
-krwlock_t xhat_provider_rwlock;
-xhat_provider_t *xhat_provider = NULL;
-
-void
-xhat_init()
-{
- rw_init(&xhat_provider_rwlock, NULL, RW_DEFAULT, NULL);
-}
-
-
-
-int
-xhat_provider_register(xhat_provider_t *provider)
-{
- /* strlen("_cache") = 7 */
- char cache_name[XHAT_CACHE_NAMELEN + 7];
-
-
- if (provider->xhat_provider_version != XHAT_PROVIDER_VERSION) {
- cmn_err(CE_WARN, "XHAT provider version mismatch");
- return (-1);
- }
-
- if ((XHAT_POPS(provider)->xhat_alloc == NULL) ||
- (XHAT_POPS(provider)->xhat_free == NULL)) {
- cmn_err(CE_WARN, "Malformed XHAT provider");
- return (-1);
- }
-
- /* Allocate kmem_cache which will manage xhat blocks */
- provider->xblkcache->free_blks = NULL;
- (void) strncpy(cache_name, provider->xhat_provider_name,
- XHAT_CACHE_NAMELEN);
- (void) strcat(cache_name, "_cache");
- provider->xblkcache->cache = kmem_cache_create(cache_name,
- provider->xhat_provider_blk_size, 0, NULL, NULL,
- provider->xblkcache->reclaim,
- (void *)provider, NULL, 0);
- if (provider->xblkcache->cache == NULL) {
- cmn_err(CE_WARN, "Failed to allocate cache for %s",
- provider->xhat_provider_name);
- return (-1);
- }
-
- mutex_init(&provider->xblkcache->lock, NULL, MUTEX_DEFAULT, NULL);
-
-
- /* Insert provider in the global list */
- rw_enter(&xhat_provider_rwlock, RW_WRITER);
- provider->next = xhat_provider;
- provider->prev = NULL;
- if (xhat_provider)
- xhat_provider->prev = provider;
- xhat_provider = provider;
- xhat_provider->xhat_provider_refcnt = 0;
- rw_exit(&xhat_provider_rwlock);
- return (0);
-}
-
-
-
-int
-xhat_provider_unregister(xhat_provider_t *provider)
-{
- if (provider->xhat_provider_version != XHAT_PROVIDER_VERSION)
- return (-1);
-
- rw_enter(&xhat_provider_rwlock, RW_WRITER);
-
- if (provider->xhat_provider_refcnt) {
- rw_exit(&xhat_provider_rwlock);
- return (-1);
- }
-
- if (provider->next)
- provider->next->prev = provider->prev;
- if (provider->prev)
- provider->prev->next = provider->next;
- else
- xhat_provider = provider->next;
- provider->prev = NULL;
- provider->next = NULL;
- rw_exit(&xhat_provider_rwlock);
-
- /* Free all xblks that are sitting on free_blks list */
- provider->xblkcache->reclaim(provider);
-
- kmem_cache_destroy(provider->xblkcache->cache);
-
- return (0);
-}
-
-
-
-/* Attaches an XHAT to the address space */
-int
-xhat_attach_xhat(xhat_provider_t *provider, struct as *as,
- struct xhat **xhatp, void *arg)
-{
- struct xhat *xh;
-
-
-
- xh = XHAT_POPS(provider)->xhat_alloc(arg);
- if (xh == NULL) {
- *xhatp = NULL;
- return (XH_PRVDR);
- }
-
- mutex_init(&xh->xhat_lock, NULL, MUTEX_DEFAULT, NULL);
- xh->xhat_provider = provider;
-
- rw_enter(&xhat_provider_rwlock, RW_WRITER);
- provider->xhat_provider_refcnt++;
- rw_exit(&xhat_provider_rwlock);
-
- mutex_enter(&as->a_contents);
-
- /* Is address space busy (being freed, dup'd or swapped)? */
- if (AS_ISBUSY(as)) {
- mutex_exit(&as->a_contents);
- XHAT_POPS(provider)->xhat_free(xh);
-
- rw_enter(&xhat_provider_rwlock, RW_WRITER);
- provider->xhat_provider_refcnt--;
- rw_exit(&xhat_provider_rwlock);
-
- *xhatp = NULL;
- return (XH_ASBUSY);
- }
-
- xh->xhat_as = as;
- xh->xhat_refcnt = 0;
- xh->holder = NULL;
- xh->arg = arg;
- xh->next = (struct xhat *)as->a_xhat;
- if (xh->next)
- xh->next->prev = xh;
- as->a_xhat = xh;
- mutex_exit(&as->a_contents);
- *xhatp = xh;
- return (0);
-}
-
-
-int
-xhat_detach_xhat(xhat_provider_t *provider, struct as *as)
-{
- struct xhat *xh;
-
-
- mutex_enter(&as->a_contents);
-
- for (xh = (struct xhat *)as->a_xhat; xh != NULL; xh = xh->next)
- if (xh->xhat_provider == provider) {
-
-
- if (xh->holder != NULL) {
- /*
- * The address space is being freed,
- * dup'd or swapped out.
- * If we are the thread which doing one
- * of those operations, we can go ahead
- * and free up the XHAT.
- * Otherwise, return.
- */
- if (xh->holder != curthread) {
- mutex_exit(&as->a_contents);
- return (XH_ASBUSY);
- } else
- xhat_hat_rele(xh);
- }
-
- if (xh->xhat_refcnt > 0) {
- /*
- * There are still "users" of the XHAT.
- * This may be either because the caller
- * forgot to free something up (which is a bug)
- * or because xhat_op_all() is in progress.
- * Since we are not allowing any of
- * xhat_op_all's ops to call xhat_detach_xhat(),
- * This can only be some other thread. It
- * may want to wait a bit and retry.
- */
-
-
- /* Restore the hold on the XHAT */
- if (xh->holder == curthread)
- xhat_hat_hold(xh);
-
- mutex_exit(&as->a_contents);
- return (XH_XHHELD);
- }
-
- rw_enter(&xhat_provider_rwlock, RW_WRITER);
- provider->xhat_provider_refcnt--;
- rw_exit(&xhat_provider_rwlock);
-
- if (xh->next)
- xh->next->prev = xh->prev;
- if (xh->prev)
- xh->prev->next = xh->next;
- else
- as->a_xhat = (void *) xh->next;
- mutex_exit(&as->a_contents);
-
- XHAT_POPS(provider)->xhat_free(xh);
-
- return (0);
- }
- mutex_exit(&as->a_contents);
- return (XH_NOTATTCHD);
-}
-
-void
-xhat_hat_hold(struct xhat *xhat)
-{
- mutex_enter(&xhat->xhat_lock);
- xhat->xhat_refcnt++;
- mutex_exit(&xhat->xhat_lock);
-}
-
-void
-xhat_hat_rele(struct xhat *xhat)
-{
- mutex_enter(&xhat->xhat_lock);
- xhat->xhat_refcnt--;
- ASSERT(xhat->xhat_refcnt >= 0);
- mutex_exit(&xhat->xhat_lock);
-}
-
-
-int
-xhat_hat_holders(struct xhat *xhat)
-{
- return (xhat->xhat_refcnt);
-}
-
-
-/*
- * Assumes that address space is already locked
- * and that AS_FREE is set for as->a_flags.
- */
-void
-xhat_free_start_all(struct as *as)
-{
- struct xhat *xh, *xh_nxt;
-
-
- ASSERT(AS_ISBUSY(as));
-
- mutex_enter(&as->a_contents);
- xh = (struct xhat *)as->a_xhat;
-
- /*
- * Simply calling xhat_hat_hold() won't work because we will
- * not be able to succeed in xhat_detach_xhat(), which may
- * get called from here. We need to know _who_ the holder is.
- */
- if (xh != NULL) {
- xhat_hat_hold(xh);
- ASSERT(xh->holder == NULL);
- xh->holder = curthread;
- }
-
- while (xh != NULL) {
-
- xh_nxt = xh->next;
- if (xh_nxt != NULL) {
- ASSERT(xh_nxt->holder == NULL);
- xhat_hat_hold(xh_nxt);
- xh_nxt->holder = curthread;
- }
-
- mutex_exit(&as->a_contents);
-
- XHAT_FREE_START(xh);
-
- mutex_enter(&as->a_contents);
-
- xh = xh_nxt;
- }
-
- mutex_exit(&as->a_contents);
-}
-
-
-
-/*
- * Assumes that address space is already locked.
- * Since xhat_free_start_all() must have been called
- * earlier, for all XHATs holder is set to curthread.
- * Also, since AS_BUSY is set for as->a_flags, no new
- * XHATs could have been added.
- */
-void
-xhat_free_end_all(struct as *as)
-{
-
- struct xhat *xh, *xh_nxt;
-
- ASSERT(AS_ISBUSY(as));
-
- mutex_enter(&as->a_contents);
- xh = (struct xhat *)as->a_xhat;
-
-
- while (xh != NULL) {
-
- ASSERT(xh->holder == curthread);
-
- xh_nxt = xh->next;
-
- mutex_exit(&as->a_contents);
-
- XHAT_FREE_END(xh);
-
- mutex_enter(&as->a_contents);
-
- xh = xh_nxt;
- }
-
- mutex_exit(&as->a_contents);
-}
-
-
-/* Assumes that address space is already locked */
-
-/* ARGSUSED */
-int
-xhat_dup_all(struct as *as, struct as *newas, caddr_t addr, size_t len,
- uint_t flag)
-{
- /* This is not supported. Should we return some sort of error? */
-
- ASSERT(AS_ISBUSY(as));
-
- return (0);
-}
-
-
-/* Assumes that address space is already locked */
-void
-xhat_swapout_all(struct as *as)
-{
- struct xhat *xh, *xh_nxt;
-
-
- ASSERT(AS_ISBUSY(as));
-
- mutex_enter(&as->a_contents);
- xh = (struct xhat *)as->a_xhat;
-
- if (xh != NULL) {
- xhat_hat_hold(xh);
- ASSERT(xh->holder == NULL);
- xh->holder = curthread;
- }
-
-
- while (xh != NULL) {
-
- xh_nxt = xh->next;
- if (xh_nxt != NULL) {
- ASSERT(xh_nxt->holder == NULL);
- xhat_hat_hold(xh_nxt);
- xh_nxt->holder = curthread;
- }
-
- mutex_exit(&as->a_contents);
-
- XHAT_SWAPOUT(xh);
-
- mutex_enter(&as->a_contents);
-
- /*
- * If the xh is still there (i.e. swapout did not
- * destroy it), clear the holder field.
- * xh_nxt->prev couldn't have been changed in xhat_attach_xhat()
- * because AS_BUSY is set. xhat_detach_xhat() also couldn't
- * have modified it because (holder != NULL).
- * If there is only one XHAT, just see if a_xhat still
- * points to us.
- */
- if (((xh_nxt != NULL) && (xh_nxt->prev == xh)) ||
- ((as->a_xhat != NULL) && (as->a_xhat == xh))) {
- xhat_hat_rele(xh);
- xh->holder = NULL;
- }
-
- xh = xh_nxt;
- }
-
- mutex_exit(&as->a_contents);
-}
-
-
-
-
-/*
- * In the following routines, the appropriate xhat_op
- * should never attempt to call xhat_detach_xhat(): it will
- * never succeed since the XHAT is held.
- */
-
-
-#define XHAT_UNLOAD_CALLBACK_OP (0)
-#define XHAT_SETATTR_OP (1)
-#define XHAT_CLRATTR_OP (2)
-#define XHAT_CHGATTR_OP (3)
-#define XHAT_CHGPROT_OP (4)
-#define XHAT_UNSHARE_OP (5)
-
-
-static void
-xhat_op_all(int op, struct as *as, caddr_t addr,
- size_t len, uint_t flags, void *ptr)
-{
- struct xhat *xh, *xh_nxt;
-
- mutex_enter(&as->a_contents);
- xh = (struct xhat *)as->a_xhat;
-
- while (xh != NULL) {
-
- xhat_hat_hold(xh);
-
- xh_nxt = xh->next;
- if (xh_nxt != NULL)
- xhat_hat_hold(xh_nxt);
-
- mutex_exit(&as->a_contents);
-
- switch (op) {
- case XHAT_UNLOAD_CALLBACK_OP:
- XHAT_UNLOAD_CALLBACK(xh, addr,
- len, flags, (hat_callback_t *)ptr);
- break;
- case XHAT_SETATTR_OP:
- XHAT_SETATTR(xh, addr, len, flags);
- break;
- case XHAT_CLRATTR_OP:
- XHAT_CLRATTR(xh, addr, len, flags);
- break;
- case XHAT_CHGATTR_OP:
- XHAT_CHGATTR(xh, addr, len, flags);
- break;
- case XHAT_CHGPROT_OP:
- XHAT_CHGPROT(xh, addr, len, flags);
- break;
- case XHAT_UNSHARE_OP:
- XHAT_UNSHARE(xh, addr, len);
- break;
- default:
- panic("Unknown op %d in xhat_op_all", op);
- }
-
- mutex_enter(&as->a_contents);
-
- /*
- * Both pointers are still valid because both
- * XHATs are held.
- */
- xhat_hat_rele(xh);
- if (xh_nxt != NULL)
- xhat_hat_rele(xh_nxt);
- xh = xh_nxt;
- }
-
- mutex_exit(&as->a_contents);
-}
-
-
-
-void
-xhat_unload_callback_all(struct as *as, caddr_t addr, size_t len, uint_t flags,
- hat_callback_t *callback)
-{
- xhat_op_all(XHAT_UNLOAD_CALLBACK_OP, as, addr, len, flags, callback);
-}
-
-
-void
-xhat_setattr_all(struct as *as, caddr_t addr, size_t len, uint_t attr)
-{
- xhat_op_all(XHAT_SETATTR_OP, as, addr, len, attr, NULL);
-}
-
-
-
-void
-xhat_clrattr_all(struct as *as, caddr_t addr, size_t len, uint_t attr)
-{
- xhat_op_all(XHAT_CLRATTR_OP, as, addr, len, attr, NULL);
-}
-
-
-void
-xhat_chgattr_all(struct as *as, caddr_t addr, size_t len, uint_t attr)
-{
- xhat_op_all(XHAT_CHGATTR_OP, as, addr, len, attr, NULL);
-}
-
-
-void
-xhat_chgprot_all(struct as *as, caddr_t addr, size_t len, uint_t prot)
-{
- xhat_op_all(XHAT_CHGPROT_OP, as, addr, len, prot, NULL);
-}
-
-
-void
-xhat_unshare_all(struct as *as, caddr_t addr, size_t len)
-{
- xhat_op_all(XHAT_UNSHARE_OP, as, addr, len, 0, NULL);
-}
diff --git a/usr/src/uts/common/vm/xhat.h b/usr/src/uts/common/vm/xhat.h
deleted file mode 100644
index 808262f2c9..0000000000
--- a/usr/src/uts/common/vm/xhat.h
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#ifndef _VM_XHAT_H
-#define _VM_XHAT_H
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _ASM
-
-#include <sys/types.h>
-#include <vm/page.h>
-#include <sys/kmem.h>
-
-struct xhat;
-struct xhat_hme_blk;
-
-struct xhat_ops {
- struct xhat *(*xhat_alloc)(void *);
- void (*xhat_free)(struct xhat *);
- void (*xhat_free_start)(struct xhat *);
- void (*xhat_free_end)(struct xhat *);
- int (*xhat_dup)(struct xhat *, struct xhat *, caddr_t,
- size_t, uint_t);
- void (*xhat_swapin)(struct xhat *);
- void (*xhat_swapout)(struct xhat *);
- void (*xhat_memload)(struct xhat *, caddr_t, struct page *,
- uint_t, uint_t);
- void (*xhat_memload_array)(struct xhat *, caddr_t, size_t,
- struct page **, uint_t, uint_t);
- void (*xhat_devload)(struct xhat *, caddr_t, size_t, pfn_t,
- uint_t, int);
- void (*xhat_unload)(struct xhat *, caddr_t, size_t, uint_t);
- void (*xhat_unload_callback)(struct xhat *, caddr_t, size_t,
- uint_t, hat_callback_t *);
- void (*xhat_setattr)(struct xhat *, caddr_t, size_t, uint_t);
- void (*xhat_clrattr)(struct xhat *, caddr_t, size_t, uint_t);
- void (*xhat_chgattr)(struct xhat *, caddr_t, size_t, uint_t);
- void (*xhat_unshare)(struct xhat *, caddr_t, size_t);
- void (*xhat_chgprot)(struct xhat *, caddr_t, size_t, uint_t);
- int (*xhat_pageunload)(struct xhat *, struct page *, uint_t,
- void *);
-};
-
-
-#define XHAT_POPS(_p) (_p)->xhat_provider_ops
-#define XHAT_PROPS(_h) XHAT_POPS(((struct xhat *)(_h))->xhat_provider)
-#define XHAT_HOPS(hat, func, args) \
- { \
- if (XHAT_PROPS(hat)-> /* */ func) \
- XHAT_PROPS(hat)-> /* */ func /* */ args; \
- }
-
-#define XHAT_FREE_START(a) \
- XHAT_HOPS(a, xhat_free_start, ((struct xhat *)(a)))
-#define XHAT_FREE_END(a) \
- XHAT_HOPS(a, xhat_free_end, ((struct xhat *)(a)))
-#define XHAT_DUP(a, b, c, d, e) \
- ((XHAT_PROPS(a)->xhat_dup == NULL) ? (0) : \
- XHAT_PROPS(a)->xhat_dup((struct xhat *)(a), \
- (struct xhat *)(b), c, d, e))
-#define XHAT_SWAPIN(a) \
- XHAT_HOPS(a, xhat_swapin, ((struct xhat *)(a)))
-#define XHAT_SWAPOUT(a) \
- XHAT_HOPS(a, xhat_swapout, ((struct xhat *)(a)))
-#define XHAT_MEMLOAD(a, b, c, d, e) \
- XHAT_HOPS(a, xhat_memload, ((struct xhat *)(a), b, c, d, e))
-#define XHAT_MEMLOAD_ARRAY(a, b, c, d, e, f) \
- XHAT_HOPS(a, xhat_memload_array, ((struct xhat *)(a), b, c, d, e, f))
-#define XHAT_DEVLOAD(a, b, c, d, e, f) \
- XHAT_HOPS(a, xhat_devload, ((struct xhat *)(a), b, c, d, e, f))
-#define XHAT_UNLOAD(a, b, c, d) \
- XHAT_HOPS(a, xhat_unload, ((struct xhat *)(a), b, c, d))
-#define XHAT_UNLOAD_CALLBACK(a, b, c, d, e) \
- XHAT_HOPS(a, xhat_unload_callback, ((struct xhat *)(a), b, c, d, e))
-#define XHAT_SETATTR(a, b, c, d) \
- XHAT_HOPS(a, xhat_setattr, ((struct xhat *)(a), b, c, d))
-#define XHAT_CLRATTR(a, b, c, d) \
- XHAT_HOPS(a, xhat_clrattr, ((struct xhat *)(a), b, c, d))
-#define XHAT_CHGATTR(a, b, c, d) \
- XHAT_HOPS(a, xhat_chgattr, ((struct xhat *)(a), b, c, d))
-#define XHAT_UNSHARE(a, b, c) \
- XHAT_HOPS(a, xhat_unshare, ((struct xhat *)(a), b, c))
-#define XHAT_CHGPROT(a, b, c, d) \
- XHAT_HOPS(a, xhat_chgprot, ((struct xhat *)(a), b, c, d))
-#define XHAT_PAGEUNLOAD(a, b, c, d) \
- ((XHAT_PROPS(a)->xhat_pageunload == NULL) ? (0) : \
- XHAT_PROPS(a)->xhat_pageunload((struct xhat *)(a), b, c, d))
-
-
-
-#define XHAT_PROVIDER_VERSION 1
-
-/*
- * Provider name will be appended with "_cache"
- * when initializing kmem cache.
- * The resulting sring must be less than
- * KMEM_CACHE_NAMELEN
- */
-#define XHAT_CACHE_NAMELEN 24
-
-typedef struct xblk_cache {
- kmutex_t lock;
- kmem_cache_t *cache;
- void *free_blks;
- void (*reclaim)(void *);
-} xblk_cache_t;
-
-typedef struct xhat_provider {
- int xhat_provider_version;
- int xhat_provider_refcnt;
- struct xhat_provider *next;
- struct xhat_provider *prev;
- char xhat_provider_name[XHAT_CACHE_NAMELEN];
- xblk_cache_t *xblkcache;
- struct xhat_ops *xhat_provider_ops;
- int xhat_provider_blk_size;
-} xhat_provider_t;
-
-/*
- * The xhat structure is protected by xhat_lock.
- * A particular xhat implementation is a extension of the
- * xhat structure and may contain its own lock(s) to
- * protect those additional fields.
- * The xhat structure is never allocated directly.
- * Instead its allocation is provided by the hat implementation.
- * The xhat provider ops xhat_alloc/xhat_free are used to
- * alloc/free a implementation dependant xhat structure.
- */
-struct xhat {
- xhat_provider_t *xhat_provider;
- struct as *xhat_as;
- void *arg;
- struct xhat *prev;
- struct xhat *next;
- kmutex_t xhat_lock;
- int xhat_refcnt;
- kthread_t *holder;
-};
-
-
-/* Error codes */
-#define XH_PRVDR (1) /* Provider-specific error */
-#define XH_ASBUSY (2) /* Address space is busy */
-#define XH_XHHELD (3) /* XHAT is being held */
-#define XH_NOTATTCHD (4) /* Provider is not attached to as */
-
-
-int xhat_provider_register(xhat_provider_t *);
-int xhat_provider_unregister(xhat_provider_t *);
-void xhat_init(void);
-int xhat_attach_xhat(xhat_provider_t *, struct as *, struct xhat **,
- void *);
-int xhat_detach_xhat(xhat_provider_t *, struct as *);
-pfn_t xhat_insert_xhatblk(page_t *, struct xhat *, void **);
-int xhat_delete_xhatblk(void *, int);
-void xhat_hat_hold(struct xhat *);
-void xhat_hat_rele(struct xhat *);
-int xhat_hat_holders(struct xhat *);
-
-void xhat_free_start_all(struct as *);
-void xhat_free_end_all(struct as *);
-int xhat_dup_all(struct as *, struct as *, caddr_t, size_t, uint_t);
-void xhat_swapout_all(struct as *);
-void xhat_unload_callback_all(struct as *, caddr_t, size_t, uint_t,
- hat_callback_t *);
-void xhat_setattr_all(struct as *, caddr_t, size_t, uint_t);
-void xhat_clrattr_all(struct as *, caddr_t, size_t, uint_t);
-void xhat_chgattr_all(struct as *, caddr_t, size_t, uint_t);
-void xhat_chgprot_all(struct as *, caddr_t, size_t, uint_t);
-void xhat_unshare_all(struct as *, caddr_t, size_t);
-
-
-#endif /* _ASM */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _VM_XHAT_H */
diff --git a/usr/src/uts/sfmmu/vm/hat_sfmmu.c b/usr/src/uts/sfmmu/vm/hat_sfmmu.c
index 8e1c3838d3..36d857b2a5 100644
--- a/usr/src/uts/sfmmu/vm/hat_sfmmu.c
+++ b/usr/src/uts/sfmmu/vm/hat_sfmmu.c
@@ -81,7 +81,6 @@
#include <sys/mem_config.h>
#include <sys/mem_cage.h>
#include <vm/vm_dep.h>
-#include <vm/xhat_sfmmu.h>
#include <sys/fpu/fpusystm.h>
#include <vm/mach_kpm.h>
#include <sys/callb.h>
@@ -1350,8 +1349,6 @@ hat_init(void)
}
#endif
- (void) xhat_init();
-
uhme_hash_pa = va_to_pa(uhme_hash);
khme_hash_pa = va_to_pa(khme_hash);
@@ -1539,7 +1536,6 @@ hat_alloc(struct as *as)
sfmmup->sfmmu_free = 0;
sfmmup->sfmmu_rmstat = 0;
sfmmup->sfmmu_clrbin = sfmmup->sfmmu_clrstart;
- sfmmup->sfmmu_xhat_provider = NULL;
cv_init(&sfmmup->sfmmu_tsb_cv, NULL, CV_DEFAULT, NULL);
sfmmup->sfmmu_srdp = NULL;
SF_RGNMAP_ZERO(sfmmup->sfmmu_region_map);
@@ -1919,7 +1915,6 @@ hat_free_start(struct hat *sfmmup)
{
ASSERT(AS_WRITE_HELD(sfmmup->sfmmu_as));
ASSERT(sfmmup != ksfmmup);
- ASSERT(sfmmup->sfmmu_xhat_provider == NULL);
sfmmup->sfmmu_free = 1;
if (sfmmup->sfmmu_scdp != NULL) {
@@ -1934,7 +1929,6 @@ hat_free_end(struct hat *sfmmup)
{
int i;
- ASSERT(sfmmup->sfmmu_xhat_provider == NULL);
ASSERT(sfmmup->sfmmu_free == 1);
ASSERT(sfmmup->sfmmu_ttecnt[TTE8K] == 0);
ASSERT(sfmmup->sfmmu_ttecnt[TTE64K] == 0);
@@ -1983,7 +1977,6 @@ hat_free_end(struct hat *sfmmup)
void
hat_swapin(struct hat *hat)
{
- ASSERT(hat->sfmmu_xhat_provider == NULL);
}
/*
@@ -2008,7 +2001,6 @@ hat_swapout(struct hat *sfmmup)
}; /* free list of TSBs */
struct free_tsb *freelist, *last, *next;
- ASSERT(sfmmup->sfmmu_xhat_provider == NULL);
SFMMU_STAT(sf_swapout);
/*
@@ -2032,8 +2024,6 @@ hat_swapout(struct hat *sfmmup)
pr_hblk = NULL;
while (hmeblkp) {
- ASSERT(!hmeblkp->hblk_xhat_bit);
-
if ((hmeblkp->hblk_tag.htag_id == sfmmup) &&
!hmeblkp->hblk_shw_bit && !hmeblkp->hblk_lckcnt) {
ASSERT(!hmeblkp->hblk_shared);
@@ -2135,7 +2125,6 @@ hat_dup(struct hat *hat, struct hat *newhat, caddr_t addr, size_t len,
int i;
extern uint_t get_color_start(struct as *);
- ASSERT(hat->sfmmu_xhat_provider == NULL);
ASSERT((flag == 0) || (flag == HAT_DUP_ALL) || (flag == HAT_DUP_COW) ||
(flag == HAT_DUP_SRD));
ASSERT(hat != ksfmmup);
@@ -2205,8 +2194,7 @@ hat_memload_region(struct hat *hat, caddr_t addr, struct page *pp,
uint_t attr, uint_t flags, hat_region_cookie_t rcookie)
{
uint_t rid;
- if (rcookie == HAT_INVALID_REGION_COOKIE ||
- hat->sfmmu_xhat_provider != NULL) {
+ if (rcookie == HAT_INVALID_REGION_COOKIE) {
hat_do_memload(hat, addr, pp, attr, flags,
SFMMU_INVALID_SHMERID);
return;
@@ -2240,13 +2228,6 @@ hat_do_memload(struct hat *hat, caddr_t addr, struct page *pp,
(void *)pp);
}
- if (hat->sfmmu_xhat_provider) {
- /* no regions for xhats */
- ASSERT(!SFMMU_IS_SHMERID_VALID(rid));
- XHAT_MEMLOAD(hat, addr, pp, attr, flags);
- return;
- }
-
ASSERT((hat == ksfmmup) || AS_LOCK_HELD(hat->sfmmu_as));
if (flags & ~SFMMU_LOAD_ALLFLAG)
@@ -2295,11 +2276,6 @@ hat_devload(struct hat *hat, caddr_t addr, size_t len, pfn_t pfn,
ASSERT(hat != NULL);
- if (hat->sfmmu_xhat_provider) {
- XHAT_DEVLOAD(hat, addr, len, pfn, attr, flags);
- return;
- }
-
ASSERT(!(flags & ~SFMMU_LOAD_ALLFLAG));
ASSERT(!(attr & ~SFMMU_LOAD_ALLATTR));
ASSERT((hat == ksfmmup) || AS_LOCK_HELD(hat->sfmmu_as));
@@ -2445,8 +2421,7 @@ hat_memload_array_region(struct hat *hat, caddr_t addr, size_t len,
hat_region_cookie_t rcookie)
{
uint_t rid;
- if (rcookie == HAT_INVALID_REGION_COOKIE ||
- hat->sfmmu_xhat_provider != NULL) {
+ if (rcookie == HAT_INVALID_REGION_COOKIE) {
hat_do_memload_array(hat, addr, len, pps, attr, flags,
SFMMU_INVALID_SHMERID);
return;
@@ -2481,12 +2456,6 @@ hat_do_memload_array(struct hat *hat, caddr_t addr, size_t len,
ASSERT(!((uintptr_t)addr & MMU_PAGEOFFSET));
SFMMU_VALIDATE_HMERID(hat, rid, addr, len);
- if (hat->sfmmu_xhat_provider) {
- ASSERT(!SFMMU_IS_SHMERID_VALID(rid));
- XHAT_MEMLOAD_ARRAY(hat, addr, len, pps, attr, flags);
- return;
- }
-
if (hat->sfmmu_rmstat)
hat_resvstat(len, hat->sfmmu_as, addr);
@@ -3969,7 +3938,6 @@ hat_unlock(struct hat *sfmmup, caddr_t addr, size_t len)
caddr_t endaddr;
ASSERT(sfmmup != NULL);
- ASSERT(sfmmup->sfmmu_xhat_provider == NULL);
ASSERT((sfmmup == ksfmmup) || AS_LOCK_HELD(sfmmup->sfmmu_as));
ASSERT((len & MMU_PAGEOFFSET) == 0);
@@ -4053,7 +4021,6 @@ hat_unlock_region(struct hat *sfmmup, caddr_t addr, size_t len,
}
ASSERT(sfmmup != NULL);
- ASSERT(sfmmup->sfmmu_xhat_provider == NULL);
ASSERT(sfmmup != ksfmmup);
srdp = sfmmup->sfmmu_srdp;
@@ -4765,7 +4732,6 @@ hat_probe(struct hat *sfmmup, caddr_t addr)
tte_t tte;
ASSERT(sfmmup != NULL);
- ASSERT(sfmmup->sfmmu_xhat_provider == NULL);
ASSERT((sfmmup == ksfmmup) || AS_LOCK_HELD(sfmmup->sfmmu_as));
@@ -4789,8 +4755,6 @@ hat_getpagesize(struct hat *sfmmup, caddr_t addr)
{
tte_t tte;
- ASSERT(sfmmup->sfmmu_xhat_provider == NULL);
-
if (sfmmup == ksfmmup) {
if (sfmmu_vatopfn(addr, sfmmup, &tte) == PFN_INVALID) {
return (-1);
@@ -4810,8 +4774,6 @@ hat_getattr(struct hat *sfmmup, caddr_t addr, uint_t *attr)
{
tte_t tte;
- ASSERT(sfmmup->sfmmu_xhat_provider == NULL);
-
if (sfmmup == ksfmmup) {
if (sfmmu_vatopfn(addr, sfmmup, &tte) == PFN_INVALID) {
tte.ll = 0;
@@ -4835,19 +4797,7 @@ hat_getattr(struct hat *sfmmup, caddr_t addr, uint_t *attr)
void
hat_setattr(struct hat *hat, caddr_t addr, size_t len, uint_t attr)
{
- if (hat->sfmmu_xhat_provider) {
- XHAT_SETATTR(hat, addr, len, attr);
- return;
- } else {
- /*
- * This must be a CPU HAT. If the address space has
- * XHATs attached, change attributes for all of them,
- * just in case
- */
- ASSERT(hat->sfmmu_as != NULL);
- if (hat->sfmmu_as->a_xhat != NULL)
- xhat_setattr_all(hat->sfmmu_as, addr, len, attr);
- }
+ ASSERT(hat->sfmmu_as != NULL);
sfmmu_chgattr(hat, addr, len, attr, SFMMU_SETATTR);
}
@@ -4859,19 +4809,7 @@ hat_setattr(struct hat *hat, caddr_t addr, size_t len, uint_t attr)
void
hat_chgattr(struct hat *hat, caddr_t addr, size_t len, uint_t attr)
{
- if (hat->sfmmu_xhat_provider) {
- XHAT_CHGATTR(hat, addr, len, attr);
- return;
- } else {
- /*
- * This must be a CPU HAT. If the address space has
- * XHATs attached, change attributes for all of them,
- * just in case
- */
- ASSERT(hat->sfmmu_as != NULL);
- if (hat->sfmmu_as->a_xhat != NULL)
- xhat_chgattr_all(hat->sfmmu_as, addr, len, attr);
- }
+ ASSERT(hat->sfmmu_as != NULL);
sfmmu_chgattr(hat, addr, len, attr, SFMMU_CHGATTR);
}
@@ -4882,19 +4820,7 @@ hat_chgattr(struct hat *hat, caddr_t addr, size_t len, uint_t attr)
void
hat_clrattr(struct hat *hat, caddr_t addr, size_t len, uint_t attr)
{
- if (hat->sfmmu_xhat_provider) {
- XHAT_CLRATTR(hat, addr, len, attr);
- return;
- } else {
- /*
- * This must be a CPU HAT. If the address space has
- * XHATs attached, change attributes for all of them,
- * just in case
- */
- ASSERT(hat->sfmmu_as != NULL);
- if (hat->sfmmu_as->a_xhat != NULL)
- xhat_clrattr_all(hat->sfmmu_as, addr, len, attr);
- }
+ ASSERT(hat->sfmmu_as != NULL);
sfmmu_chgattr(hat, addr, len, attr, SFMMU_CLRATTR);
}
@@ -5246,19 +5172,7 @@ hat_chgprot(struct hat *sfmmup, caddr_t addr, size_t len, uint_t vprot)
ASSERT((len & MMU_PAGEOFFSET) == 0);
ASSERT(((uintptr_t)addr & MMU_PAGEOFFSET) == 0);
- if (sfmmup->sfmmu_xhat_provider) {
- XHAT_CHGPROT(sfmmup, addr, len, vprot);
- return;
- } else {
- /*
- * This must be a CPU HAT. If the address space has
- * XHATs attached, change attributes for all of them,
- * just in case
- */
- ASSERT(sfmmup->sfmmu_as != NULL);
- if (sfmmup->sfmmu_as->a_xhat != NULL)
- xhat_chgprot_all(sfmmup->sfmmu_as, addr, len, vprot);
- }
+ ASSERT(sfmmup->sfmmu_as != NULL);
CPUSET_ZERO(cpuset);
@@ -5693,20 +5607,7 @@ hat_unload_callback(
int issegkmap = ISSEGKMAP(sfmmup, addr);
demap_range_t dmr, *dmrp;
- if (sfmmup->sfmmu_xhat_provider) {
- XHAT_UNLOAD_CALLBACK(sfmmup, addr, len, flags, callback);
- return;
- } else {
- /*
- * This must be a CPU HAT. If the address space has
- * XHATs attached, unload the mappings for all of them,
- * just in case
- */
- ASSERT(sfmmup->sfmmu_as != NULL);
- if (sfmmup->sfmmu_as->a_xhat != NULL)
- xhat_unload_callback_all(sfmmup->sfmmu_as, addr,
- len, flags, callback);
- }
+ ASSERT(sfmmup->sfmmu_as != NULL);
ASSERT((sfmmup == ksfmmup) || (flags & HAT_UNLOAD_OTHER) || \
AS_LOCK_HELD(sfmmup->sfmmu_as));
@@ -5983,10 +5884,6 @@ hat_unload_callback(
void
hat_unload(struct hat *sfmmup, caddr_t addr, size_t len, uint_t flags)
{
- if (sfmmup->sfmmu_xhat_provider) {
- XHAT_UNLOAD(sfmmup, addr, len, flags);
- return;
- }
hat_unload_callback(sfmmup, addr, len, flags, NULL);
}
@@ -6326,7 +6223,6 @@ hat_sync(struct hat *sfmmup, caddr_t addr, size_t len, uint_t clearflag)
caddr_t endaddr;
cpuset_t cpuset;
- ASSERT(sfmmup->sfmmu_xhat_provider == NULL);
ASSERT((sfmmup == ksfmmup) || AS_LOCK_HELD(sfmmup->sfmmu_as));
ASSERT((len & MMU_PAGEOFFSET) == 0);
ASSERT((clearflag == HAT_SYNC_DONTZERO) ||
@@ -7132,14 +7028,11 @@ hat_pageunload(struct page *pp, uint_t forceflag)
#endif
cpuset_t cpuset, tset;
int index, cons;
- int xhme_blks;
int pa_hments;
ASSERT(PAGE_EXCL(pp));
-retry_xhat:
tmphme = NULL;
- xhme_blks = 0;
pa_hments = 0;
CPUSET_ZERO(cpuset);
@@ -7171,16 +7064,6 @@ retry:
}
hmeblkp = sfmmu_hmetohblk(sfhme);
- if (hmeblkp->hblk_xhat_bit) {
- struct xhat_hme_blk *xblk =
- (struct xhat_hme_blk *)hmeblkp;
-
- (void) XHAT_PAGEUNLOAD(xblk->xhat_hme_blk_hat,
- pp, forceflag, XBLK2PROVBLK(xblk));
-
- xhme_blks = 1;
- continue;
- }
/*
* If there are kernel mappings don't unload them, they will
@@ -7217,7 +7100,7 @@ retry:
* we were called from hat_page_relocate() in which case we
* leave the locked mappings which will be suspended later.
*/
- ASSERT(!PP_ISMAPPED(origpp) || xhme_blks || pa_hments ||
+ ASSERT(!PP_ISMAPPED(origpp) || pa_hments ||
(forceflag == SFMMU_KERNEL_RELOC));
#ifdef VAC
@@ -7252,22 +7135,11 @@ retry:
}
}
- ASSERT(!PP_ISMAPPED(origpp) || xhme_blks);
+ ASSERT(!PP_ISMAPPED(origpp));
}
sfmmu_mlist_exit(pml);
- /*
- * XHAT may not have finished unloading pages
- * because some other thread was waiting for
- * mlist lock and XHAT_PAGEUNLOAD let it do
- * the job.
- */
- if (xhme_blks) {
- pp = origpp;
- goto retry_xhat;
- }
-
return (0);
}
@@ -7548,8 +7420,6 @@ retry:
* reach the range we are seeking, just ignore it.
*/
hmeblkp = sfmmu_hmetohblk(sfhme);
- if (hmeblkp->hblk_xhat_bit)
- continue;
if (hme_size(sfhme) < cons)
continue;
@@ -7709,12 +7579,6 @@ retry:
sfmmu_copytte(&sfhme->hme_tte, &tte);
if (TTE_IS_VALID(&tte) && TTE_IS_WRITABLE(&tte)) {
hmeblkp = sfmmu_hmetohblk(sfhme);
-
- /*
- * xhat mappings should never be to a VMODSORT page.
- */
- ASSERT(hmeblkp->hblk_xhat_bit == 0);
-
sfmmup = hblktosfmmu(hmeblkp);
addr = tte_to_vaddr(hmeblkp, tte);
@@ -7979,8 +7843,6 @@ hat_getpfnum(struct hat *hat, caddr_t addr)
* the as lock.
*/
- ASSERT(hat->sfmmu_xhat_provider == NULL);
-
if (hat == ksfmmup) {
if (IS_KMEM_VA_LARGEPAGE(addr)) {
ASSERT(segkmem_lpszc > 0);
@@ -8164,7 +8026,6 @@ void
hat_map(struct hat *hat, caddr_t addr, size_t len, uint_t flags)
{
ASSERT(hat != NULL);
- ASSERT(hat->sfmmu_xhat_provider == NULL);
}
/*
@@ -8257,14 +8118,6 @@ again:
}
hmeblkp = sfmmu_hmetohblk(sfhme);
- if (hmeblkp->hblk_xhat_bit) {
- cnt++;
- if (cnt > sh_thresh) {
- sfmmu_mlist_exit(pml);
- return (1);
- }
- continue;
- }
if (hme_size(sfhme) != sz) {
continue;
}
@@ -8379,10 +8232,6 @@ hat_page_demote(page_t *pp)
if (hme_size(sfhme) != sz) {
continue;
}
- if (hmeblkp->hblk_xhat_bit) {
- cmn_err(CE_PANIC,
- "hat_page_demote: xhat hmeblk");
- }
tset = sfmmu_pageunload(rootpp, sfhme, sz);
CPUSET_OR(cpuset, tset);
}
@@ -8510,8 +8359,6 @@ hat_get_mapped_size(struct hat *hat)
if (hat == NULL)
return (0);
- ASSERT(hat->sfmmu_xhat_provider == NULL);
-
for (i = 0; i < mmu_page_sizes; i++)
assize += ((pgcnt_t)hat->sfmmu_ttecnt[i] +
(pgcnt_t)hat->sfmmu_scdrttecnt[i]) * TTEBYTES(i);
@@ -8531,8 +8378,6 @@ hat_stats_enable(struct hat *hat)
{
hatlock_t *hatlockp;
- ASSERT(hat->sfmmu_xhat_provider == NULL);
-
hatlockp = sfmmu_hat_enter(hat);
hat->sfmmu_rmstat++;
sfmmu_hat_exit(hatlockp);
@@ -8544,8 +8389,6 @@ hat_stats_disable(struct hat *hat)
{
hatlock_t *hatlockp;
- ASSERT(hat->sfmmu_xhat_provider == NULL);
-
hatlockp = sfmmu_hat_enter(hat);
hat->sfmmu_rmstat--;
sfmmu_hat_exit(hatlockp);
@@ -8647,8 +8490,6 @@ hat_share(struct hat *sfmmup, caddr_t addr,
if (!ISM_ALIGNED(ismshift, len))
return (EINVAL);
- ASSERT(sfmmup->sfmmu_xhat_provider == NULL);
-
/*
* Allocate ism_ment for the ism_hat's mapping list, and an
* ism map blk in case we need one. We must do our
@@ -8860,19 +8701,7 @@ hat_unshare(struct hat *sfmmup, caddr_t addr, size_t len, uint_t ismszc)
ASSERT(sfmmup != NULL);
ASSERT(sfmmup != ksfmmup);
- if (sfmmup->sfmmu_xhat_provider) {
- XHAT_UNSHARE(sfmmup, addr, len);
- return;
- } else {
- /*
- * This must be a CPU HAT. If the address space has
- * XHATs attached, inform all XHATs that ISM segment
- * is going away
- */
- ASSERT(sfmmup->sfmmu_as != NULL);
- if (sfmmup->sfmmu_as->a_xhat != NULL)
- xhat_unshare_all(sfmmup->sfmmu_as, addr, len);
- }
+ ASSERT(sfmmup->sfmmu_as != NULL);
/*
* Make sure that during the entire time ISM mappings are removed,
@@ -9326,8 +9155,6 @@ sfmmu_vac_conflict(struct hat *hat, caddr_t addr, page_t *pp)
if (IS_PAHME(sfhmep))
continue;
hmeblkp = sfmmu_hmetohblk(sfhmep);
- if (hmeblkp->hblk_xhat_bit)
- continue;
tmphat = hblktosfmmu(hmeblkp);
sfmmu_copytte(&sfhmep->hme_tte, &tte);
ASSERT(TTE_IS_VALID(&tte));
@@ -9354,8 +9181,6 @@ sfmmu_vac_conflict(struct hat *hat, caddr_t addr, page_t *pp)
if (IS_PAHME(sfhmep))
continue;
hmeblkp = sfmmu_hmetohblk(sfhmep);
- if (hmeblkp->hblk_xhat_bit)
- continue;
ASSERT(!hmeblkp->hblk_shared);
(void) sfmmu_pageunload(pp, sfhmep, TTE8K);
}
@@ -9503,8 +9328,6 @@ tst_tnc(page_t *pp, pgcnt_t npages)
if (IS_PAHME(sfhme))
continue;
hmeblkp = sfmmu_hmetohblk(sfhme);
- if (hmeblkp->hblk_xhat_bit)
- continue;
sfmmu_copytte(&sfhme->hme_tte, &tte);
ASSERT(TTE_IS_VALID(&tte));
@@ -9652,9 +9475,6 @@ sfmmu_page_cache(page_t *pp, int flags, int cache_flush_flag, int bcolor)
continue;
hmeblkp = sfmmu_hmetohblk(sfhme);
- if (hmeblkp->hblk_xhat_bit)
- continue;
-
sfmmu_copytte(&sfhme->hme_tte, &tte);
ASSERT(TTE_IS_VALID(&tte));
vaddr = tte_to_vaddr(hmeblkp, tte);
@@ -13402,7 +13222,6 @@ faultcode_t
hat_softlock(struct hat *hat, caddr_t addr, size_t *lenp, page_t **ppp,
uint_t flags)
{
- ASSERT(hat->sfmmu_xhat_provider == NULL);
return (FC_NOSUPPORT);
}
@@ -13437,8 +13256,6 @@ sfmmu_rm_large_mappings(page_t *pp, int ttesz)
if (IS_PAHME(sfhmep))
continue;
hmeblkp = sfmmu_hmetohblk(sfhmep);
- if (hmeblkp->hblk_xhat_bit)
- continue;
if (hme_size(sfhmep) == ttesz) {
/*
* another mapping of the same size. don't clear index.
@@ -14023,7 +13840,6 @@ hat_join_region(struct hat *sfmmup,
return (HAT_INVALID_REGION_COOKIE);
}
- ASSERT(sfmmup->sfmmu_xhat_provider == NULL);
ASSERT(sfmmup != ksfmmup);
ASSERT(AS_WRITE_HELD(sfmmup->sfmmu_as));
ASSERT(srdp->srd_refcnt > 0);
@@ -14330,12 +14146,6 @@ hat_leave_region(struct hat *sfmmup, hat_region_cookie_t rcookie, uint_t flags)
ASSERT(!(rgnp->rgn_flags & SFMMU_REGION_FREE));
ASSERT(AS_LOCK_HELD(sfmmup->sfmmu_as));
- ASSERT(sfmmup->sfmmu_xhat_provider == NULL);
- if (r_type == SFMMU_REGION_HME && sfmmup->sfmmu_as->a_xhat != NULL) {
- xhat_unload_callback_all(sfmmup->sfmmu_as, rgnp->rgn_saddr,
- rgnp->rgn_size, 0, NULL);
- }
-
if (sfmmup->sfmmu_free) {
ulong_t rttecnt;
r_pgszc = rgnp->rgn_pgszc;
diff --git a/usr/src/uts/sfmmu/vm/hat_sfmmu.h b/usr/src/uts/sfmmu/vm/hat_sfmmu.h
index 6798fb0c55..86f2bb538e 100644
--- a/usr/src/uts/sfmmu/vm/hat_sfmmu.h
+++ b/usr/src/uts/sfmmu/vm/hat_sfmmu.h
@@ -659,12 +659,9 @@ typedef struct sfmmu_ctx {
* mappings will potentially be undersized. To compensate for the potential
* underaccounting in this case we always add 1/4 of the region size to the 8K
* ttecnt.
- *
- * Note that sfmmu_xhat_provider MUST be the first element.
*/
struct hat {
- void *sfmmu_xhat_provider; /* NULL for CPU hat */
cpuset_t sfmmu_cpusran; /* cpu bit mask for efficient xcalls */
struct as *sfmmu_as; /* as this hat provides mapping for */
/* per pgsz private ttecnt + shme rgns ttecnt for rgns not in SCD */
@@ -1241,16 +1238,11 @@ struct hblk_lockcnt_audit {
* the counts can be high and there are not enough bits in the tte. When
* physio is fixed to not lock the translations we should be able to move
* the lock cnt back to the tte. See bug id 1198554.
- *
- * Note that xhat_hme_blk's layout follows this structure: hme_blk_misc
- * and sf_hment are at the same offsets in both structures. Whenever
- * hme_blk is changed, xhat_hme_blk may need to be updated as well.
*/
struct hme_blk_misc {
- uint_t notused:25;
+ uint_t notused:26;
uint_t shared_bit:1; /* set for SRD shared hmeblk */
- uint_t xhat_bit:1; /* set for an xhat hme_blk */
uint_t shadow_bit:1; /* set for a shadow hme_blk */
uint_t nucleus_bit:1; /* set for a nucleus hme_blk */
uint_t ttesize:3; /* contains ttesz of hmeblk */
@@ -1290,7 +1282,6 @@ struct hme_blk {
};
#define hblk_shared hblk_misc.shared_bit
-#define hblk_xhat_bit hblk_misc.xhat_bit
#define hblk_shw_bit hblk_misc.shadow_bit
#define hblk_nuc_bit hblk_misc.nucleus_bit
#define hblk_ttesz hblk_misc.ttesize
@@ -2315,9 +2306,6 @@ extern int sfmmu_get_addrvcolor(caddr_t);
extern int sfmmu_hat_lock_held(sfmmu_t *);
extern int sfmmu_alloc_ctx(sfmmu_t *, int, struct cpu *, int);
-/*
- * Functions exported to xhat_sfmmu.c
- */
extern kmutex_t *sfmmu_mlist_enter(page_t *);
extern void sfmmu_mlist_exit(kmutex_t *);
extern int sfmmu_mlist_held(struct page *);
diff --git a/usr/src/uts/sfmmu/vm/xhat_sfmmu.c b/usr/src/uts/sfmmu/vm/xhat_sfmmu.c
deleted file mode 100644
index 3643438191..0000000000
--- a/usr/src/uts/sfmmu/vm/xhat_sfmmu.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-
-#include <sys/types.h>
-#include <sys/cmn_err.h>
-#include <sys/mman.h>
-#include <vm/hat_sfmmu.h>
-#include <vm/xhat.h>
-#include <vm/xhat_sfmmu.h>
-#include <vm/page.h>
-#include <vm/as.h>
-
-
-
-/*
- * Allocates a block that includes both struct xhat and
- * provider-specific data.
- */
-struct xhat_hme_blk *
-xhat_alloc_xhatblk(struct xhat *xhat)
-{
- struct xhat_hme_blk *xblk;
- xblk_cache_t *xblkcache = xhat->xhat_provider->xblkcache;
-
-
-
- mutex_enter(&xblkcache->lock);
- if (xblkcache->free_blks) {
- xblk = (struct xhat_hme_blk *)
- sfmmu_hmetohblk(xblkcache->free_blks);
-
- /*
- * Since we are always walking the list in the
- * forward direction, we don't update prev pointers
- */
- xblkcache->free_blks = xblk->xblk_hme[0].hme_next;
- mutex_exit(&xblkcache->lock);
- } else {
- mutex_exit(&xblkcache->lock);
- xblk = kmem_cache_alloc(xblkcache->cache, KM_SLEEP);
- }
-
- return (xblk);
-}
-
-
-/*
- * Return the block to free_blks pool. The memory will
- * be freed in the reclaim routine.
- */
-void
-xhat_free_xhatblk(struct xhat_hme_blk *xblk)
-{
- xblk_cache_t *xblkcache = xblk->xhat_hme_blk_hat->
- xhat_provider->xblkcache;
-
-
- mutex_enter(&xblkcache->lock);
- xblk->xblk_hme[0].hme_next = xblkcache->free_blks;
- xblkcache->free_blks = &xblk->xblk_hme[0];
- mutex_exit(&xblkcache->lock);
-}
-
-
-/*
- * Ran by kmem reaper thread. Also called when
- * provider unregisters
- */
-void
-xhat_xblkcache_reclaim(void *arg)
-{
- xhat_provider_t *provider = (xhat_provider_t *)arg;
- struct sf_hment *sfhme;
- struct xhat_hme_blk *xblk;
- xblk_cache_t *xblkcache;
-
- if (provider == NULL)
- cmn_err(CE_PANIC, "xhat_xblkcache_reclaim() is passed NULL");
-
- xblkcache = provider->xblkcache;
-
-
- while (xblkcache->free_blks != NULL) {
-
- /*
- * Put free blocks on a separate list
- * and free free_blks pointer.
- */
- mutex_enter(&xblkcache->lock);
- sfhme = xblkcache->free_blks;
- xblkcache->free_blks = NULL;
- mutex_exit(&xblkcache->lock);
-
- while (sfhme != NULL) {
- xblk = (struct xhat_hme_blk *)sfmmu_hmetohblk(sfhme);
- ASSERT(xblk->xhat_hme_blk_misc.xhat_bit == 1);
- sfhme = sfhme->hme_next;
- kmem_cache_free(xblkcache->cache, xblk);
- }
- }
-}
-
-
-
-
-/*
- * Insert the xhat block (or, more precisely, the sf_hment)
- * into page's p_mapping list.
- */
-pfn_t
-xhat_insert_xhatblk(page_t *pp, struct xhat *xhat, void **blk)
-{
- kmutex_t *pml;
- pfn_t pfn;
- struct xhat_hme_blk *xblk;
-
-
-
- xblk = xhat_alloc_xhatblk(xhat);
- if (xblk == NULL)
- return (0);
-
- /* Add a "user" to the XHAT */
- xhat_hat_hold(xhat);
-
- xblk->xhat_hme_blk_hat = xhat;
- xblk->xhat_hme_blk_misc.xhat_bit = 1;
-
- pml = sfmmu_mlist_enter(pp);
-
-
- /* Insert at the head of p_mapping list */
- xblk->xblk_hme[0].hme_prev = NULL;
- xblk->xblk_hme[0].hme_next = pp->p_mapping;
- xblk->xblk_hme[0].hme_page = pp;
-
- /* Only one tte per xhat_hme_blk, at least for now */
- xblk->xblk_hme[0].hme_tte.tte_hmenum = 0;
-
- if (pp->p_mapping) {
- ((struct sf_hment *)(pp->p_mapping))->hme_prev =
- &(xblk->xblk_hme[0]);
- ASSERT(pp->p_share > 0);
- } else {
- /* EMPTY */
- ASSERT(pp->p_share == 0);
- }
- pp->p_mapping = &(xblk->xblk_hme[0]);
-
- /*
- * Update number of mappings.
- */
- pp->p_share++;
- pfn = pp->p_pagenum;
-
- sfmmu_mlist_exit(pml);
-
- *blk = XBLK2PROVBLK(xblk);
-
- return (pfn);
-}
-
-
-/*
- * mlist_locked indicates whether the mapping list
- * is locked. If provider did not lock it himself, the
- * only time it is locked in HAT layer is in
- * hat_pageunload().
- */
-int
-xhat_delete_xhatblk(void *blk, int mlist_locked)
-{
- struct xhat_hme_blk *xblk = PROVBLK2XBLK(blk);
- page_t *pp = xblk->xblk_hme[0].hme_page;
- kmutex_t *pml;
-
-
- ASSERT(pp != NULL);
- ASSERT(pp->p_share > 0);
-
- if (!mlist_locked)
- pml = sfmmu_mlist_enter(pp);
- else
- ASSERT(sfmmu_mlist_held(pp));
-
- pp->p_share--;
-
- if (xblk->xblk_hme[0].hme_prev) {
- ASSERT(pp->p_mapping != &(xblk->xblk_hme[0]));
- ASSERT(xblk->xblk_hme[0].hme_prev->hme_page == pp);
- xblk->xblk_hme[0].hme_prev->hme_next =
- xblk->xblk_hme[0].hme_next;
- } else {
- ASSERT(pp->p_mapping == &(xblk->xblk_hme[0]));
- pp->p_mapping = xblk->xblk_hme[0].hme_next;
- ASSERT((pp->p_mapping == NULL) ?
- (pp->p_share == 0) : 1);
- }
-
- if (xblk->xblk_hme->hme_next) {
- ASSERT(xblk->xblk_hme[0].hme_next->hme_page == pp);
- xblk->xblk_hme[0].hme_next->hme_prev =
- xblk->xblk_hme[0].hme_prev;
- }
-
- if (!mlist_locked)
- sfmmu_mlist_exit(pml);
-
- xhat_hat_rele(xblk->xhat_hme_blk_hat);
- xhat_free_xhatblk(xblk);
-
-
- return (0);
-}
diff --git a/usr/src/uts/sfmmu/vm/xhat_sfmmu.h b/usr/src/uts/sfmmu/vm/xhat_sfmmu.h
deleted file mode 100644
index cbe4129366..0000000000
--- a/usr/src/uts/sfmmu/vm/xhat_sfmmu.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#ifndef _XHAT_SFMMU_H
-#define _XHAT_SFMMU_H
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _ASM
-
-#include <sys/types.h>
-#include <sys/sysmacros.h>
-#include <vm/hat_sfmmu.h>
-#include <vm/page.h>
-#include <vm/xhat.h>
-
-struct xhat;
-struct xhat_hme_blk;
-
-
-/*
- * Pads to align xhat_hme_blk's xhat_hme_blk_misc
- * and with xblk_hme with corresponding fields in
- * those of hme_blk.
- */
-#define XHAT_PADHI (offsetof(struct hme_blk, hblk_misc) - \
- sizeof (struct xhat *))
-
-#define XHAT_PADLO (offsetof(struct hme_blk, hblk_hme[0]) - \
- (offsetof(struct hme_blk, hblk_misc) + \
- sizeof (struct hme_blk_misc)))
-
-/*
- * This (or, rather, xblk_hme[] member of the structure) is
- * what gets put on page's p_mappings list.
- */
-struct xhat_hme_blk {
- struct xhat *xhat_hme_blk_hat;
- char xblk_pad1[XHAT_PADHI];
- struct hme_blk_misc xhat_hme_blk_misc;
- char xblk_pad2[XHAT_PADLO];
- struct sf_hment xblk_hme[1];
-};
-
-/*
- * Convert pointers between xhat_hme_blk and provider's
- * block (these two blocks are always allocated adjacent to
- * each other).
- */
-#define XBLK2PROVBLK(xblk) ((void *)(((struct xhat_hme_blk *)(xblk)) + 1))
-#define PROVBLK2XBLK(pblk) (((struct xhat_hme_blk *)(pblk)) - 1)
-
-
-
-void xhat_xblkcache_reclaim(void *);
-
-
-
-#endif /* _ASM */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _XHAT_SFMMU_H */
diff --git a/usr/src/uts/sun4u/Makefile.files b/usr/src/uts/sun4u/Makefile.files
index ece838c2be..5cfcd6025f 100644
--- a/usr/src/uts/sun4u/Makefile.files
+++ b/usr/src/uts/sun4u/Makefile.files
@@ -64,7 +64,6 @@ CORE_OBJS += memscrub_asm.o
CORE_OBJS += ppage.o
CORE_OBJS += sfmmu_kdi.o
CORE_OBJS += swtch.o
-CORE_OBJS += xhat_sfmmu.o
#
# Some objects must be linked at the front of the image (or
diff --git a/usr/src/uts/sun4u/vm/mach_kpm.c b/usr/src/uts/sun4u/vm/mach_kpm.c
index 9e68deff56..caf1bcac57 100644
--- a/usr/src/uts/sun4u/vm/mach_kpm.c
+++ b/usr/src/uts/sun4u/vm/mach_kpm.c
@@ -1684,8 +1684,6 @@ sfmmu_kpm_vac_conflict(page_t *pp, caddr_t vaddr)
if (IS_PAHME(sfhmep))
continue;
hmeblkp = sfmmu_hmetohblk(sfhmep);
- if (hmeblkp->hblk_xhat_bit)
- continue;
tmphat = hblktosfmmu(hmeblkp);
sfmmu_copytte(&sfhmep->hme_tte, &tte);
ASSERT(TTE_IS_VALID(&tte));
@@ -1709,8 +1707,6 @@ sfmmu_kpm_vac_conflict(page_t *pp, caddr_t vaddr)
if (IS_PAHME(sfhmep))
continue;
hmeblkp = sfmmu_hmetohblk(sfhmep);
- if (hmeblkp->hblk_xhat_bit)
- continue;
(void) sfmmu_pageunload(pp, sfhmep, TTE8K);
}
diff --git a/usr/src/uts/sun4v/Makefile.files b/usr/src/uts/sun4v/Makefile.files
index b297e976e0..66565f9c4f 100644
--- a/usr/src/uts/sun4v/Makefile.files
+++ b/usr/src/uts/sun4v/Makefile.files
@@ -81,7 +81,6 @@ CORE_OBJS += sfmmu_kdi.o
CORE_OBJS += suspend.o
CORE_OBJS += swtch.o
CORE_OBJS += wdt.o
-CORE_OBJS += xhat_sfmmu.o
CORE_OBJS += mdesc_diff.o
CORE_OBJS += mdesc_findname.o