--- old/usr/src/uts/common/Makefile.files	2015-11-06 21:07:26.481002218 -0500
+++ new/usr/src/uts/common/Makefile.files	2015-11-06 21:07:26.485889432 -0500
@@ -402,7 +402,6 @@
 		xdr.o		\
 		xdr_array.o	\
 		xdr_refer.o	\
-		xhat.o		\
 		zone.o
 
 #
--- old/usr/src/uts/common/os/watchpoint.c	2015-11-06 21:07:26.633186392 -0500
+++ new/usr/src/uts/common/os/watchpoint.c	2015-11-06 21:07:26.636747158 -0500
@@ -24,8 +24,6 @@
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <sys/types.h>
 #include <sys/t_lock.h>
 #include <sys/param.h>
@@ -182,11 +180,7 @@
 	/*
 	 * 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
@@ -196,7 +190,6 @@
 	 */
 
 	mutex_enter(&p->p_maplock);
-	AS_LOCK_ENTER(as, &as->a_lock, RW_READER);
 
 	tpw.wp_vaddr = (caddr_t)((uintptr_t)addr & (uintptr_t)PAGEMASK);
 	if ((pwp = avl_find(&as->a_wpage, &tpw, &where)) == NULL)
@@ -231,11 +224,6 @@
 			 * 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, &as->a_lock);
 				mutex_exit(&p->p_maplock);
 				if (holdwatch() != 0) {
 					/*
@@ -246,7 +234,6 @@
 					goto startover;
 				}
 				mutex_enter(&p->p_maplock);
-				AS_LOCK_ENTER(as, &as->a_lock, RW_READER);
 			}
 			p->p_mapcnt++;
 		}
@@ -306,7 +293,6 @@
 			uint_t oprot;
 			int err, retrycnt = 0;
 
-			AS_LOCK_EXIT(as, &as->a_lock);
 			AS_LOCK_ENTER(as, &as->a_lock, RW_WRITER);
 		retry:
 			seg = as_segat(as, addr);
@@ -321,8 +307,7 @@
 				}
 			}
 			AS_LOCK_EXIT(as, &as->a_lock);
-		} else
-			AS_LOCK_EXIT(as, &as->a_lock);
+		}
 
 		/*
 		 * When all pages are mapped back to their normal state,
@@ -339,11 +324,8 @@
 				mutex_enter(&p->p_maplock);
 			}
 		}
-
-		AS_LOCK_ENTER(as, &as->a_lock, RW_READER);
 	}
 
-	AS_LOCK_EXIT(as, &as->a_lock);
 	mutex_exit(&p->p_maplock);
 
 	return (rv);
@@ -436,7 +418,6 @@
 
 
 
-/* Must be called with as lock held */
 int
 pr_is_watchpage_as(caddr_t addr, enum seg_rw rw, struct as *as)
 {
@@ -499,17 +480,11 @@
 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, &as->a_lock, RW_READER);
-	rv = pr_is_watchpage_as(addr, rw, as);
-	AS_LOCK_EXIT(as, &as->a_lock);
-
-	return (rv);
+	return (pr_is_watchpage_as(addr, rw, as));
 }
 
 
--- old/usr/src/uts/common/vm/as.h	2015-11-06 21:07:26.775388901 -0500
+++ new/usr/src/uts/common/vm/as.h	2015-11-06 21:07:26.779808117 -0500
@@ -125,7 +125,6 @@
 	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 @@
 #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)	\
--- old/usr/src/uts/common/vm/seg_spt.c	2015-11-06 21:07:26.888591901 -0500
+++ new/usr/src/uts/common/vm/seg_spt.c	2015-11-06 21:07:26.892728454 -0500
@@ -1924,27 +1924,17 @@
 				    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 @@
 				    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);
 			}
 
 			/*
--- old/usr/src/uts/common/vm/seg_vn.c	2015-11-06 21:07:27.064251353 -0500
+++ new/usr/src/uts/common/vm/seg_vn.c	2015-11-06 21:07:27.070588332 -0500
@@ -3856,7 +3856,6 @@
 	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 @@
 		/* 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_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 @@
 			 * 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 @@
 					ierr = -1;
 					break;
 				}
-				if (szc != 0 && !xhat && !upgrdfail) {
+				if (szc != 0 && !upgrdfail) {
 					segvn_faultvnmpss_align_err5++;
 				}
 				SEGVN_VMSTAT_FLTVNPAGES(34);
--- old/usr/src/uts/common/vm/vm_as.c	2015-11-06 21:07:27.452923741 -0500
+++ new/usr/src/uts/common/vm/vm_as.c	2015-11-06 21:07:27.456652445 -0500
@@ -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->a_hat = hat_alloc(as);	/* create hat for default system mmu */
 	AS_LOCK_EXIT(as, &as->a_lock);
 
-	as->a_xhat = NULL;
-
 	return (as);
 }
 
@@ -687,7 +684,7 @@
 {
 	struct hat *hat = as->a_hat;
 	struct seg *seg, *next;
-	int called = 0;
+	boolean_t free_started = B_FALSE;
 
 top:
 	/*
@@ -699,17 +696,12 @@
 	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, &as->a_lock, 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 @@
 		}
 	}
 	hat_free_end(hat);
-	if (as->a_xhat != NULL)
-		xhat_free_end_all(as);
 	AS_LOCK_EXIT(as, &as->a_lock);
 
 	/* /proc stuff */
@@ -794,14 +784,6 @@
 
 	AS_LOCK_ENTER(newas, &newas->a_lock, 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 @@
 		if (newseg == NULL) {
 			AS_LOCK_EXIT(newas, &newas->a_lock);
 			as_setwatch(as);
-			mutex_enter(&as->a_contents);
-			AS_CLRBUSY(as);
-			mutex_exit(&as->a_contents);
 			AS_LOCK_EXIT(as, &as->a_lock);
 			as_free(newas);
 			return (-1);
@@ -829,9 +808,6 @@
 			 * 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, &as->a_lock);
 			seg_free(newseg);
 			AS_LOCK_EXIT(newas, &newas->a_lock);
@@ -843,18 +819,10 @@
 	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, &newas->a_lock);
 
 	as_setwatch(as);
-	mutex_enter(&as->a_contents);
-	AS_CLRBUSY(as);
-	mutex_exit(&as->a_contents);
 	AS_LOCK_EXIT(as, &as->a_lock);
 	if (error != 0) {
 		as_free(newas);
@@ -880,57 +848,44 @@
 	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 @@
 	 */
 	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, &as->a_lock, 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->a_lock);
-			AS_LOCK_ENTER(as, &as->a_lock, RW_WRITER);
-		}
 
 		seg = as_segat(as, raddr);
 		if (seg == NULL) {
 			AS_LOCK_EXIT(as, &as->a_lock);
-			if ((lwp != NULL) && (!is_xhat))
+			if (lwp != NULL)
 				lwp->lwp_nostop--;
 			return (FC_NOMAP);
 		}
@@ -1004,35 +939,9 @@
 		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 @@
 	}
 	if (as_lock_held)
 		AS_LOCK_EXIT(as, &as->a_lock);
-	if ((lwp != NULL) && (!is_xhat))
+	if (lwp != NULL)
 		lwp->lwp_nostop--;
 
 	/*
@@ -2166,12 +2075,6 @@
 
 	AS_LOCK_ENTER(as, &as->a_lock, 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 @@
 	 * 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
--- old/usr/src/uts/common/vm/vm_rm.c	2015-11-06 21:07:27.649169222 -0500
+++ new/usr/src/uts/common/vm/vm_rm.c	2015-11-06 21:07:27.653291743 -0500
@@ -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)
--- old/usr/src/uts/common/vm/xhat.c	2015-11-06 21:07:27.818106949 -0500
+++ /dev/null	2015-11-06 21:07:27.000000000 -0500
@@ -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);
-}
--- old/usr/src/uts/common/vm/xhat.h	2015-11-06 21:07:27.854569439 -0500
+++ /dev/null	2015-11-06 21:07:27.000000000 -0500
@@ -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 */
--- old/usr/src/uts/sfmmu/vm/hat_sfmmu.c	2015-11-06 21:07:27.896385742 -0500
+++ new/usr/src/uts/sfmmu/vm/hat_sfmmu.c	2015-11-06 21:07:27.902991326 -0500
@@ -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 @@
 	}
 #endif
 
-	(void) xhat_init();
-
 	uhme_hash_pa = va_to_pa(uhme_hash);
 	khme_hash_pa = va_to_pa(khme_hash);
 
@@ -1539,7 +1536,6 @@
 	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 @@
 {
 	ASSERT(AS_WRITE_HELD(sfmmup->sfmmu_as, &sfmmup->sfmmu_as->a_lock));
 	ASSERT(sfmmup != ksfmmup);
-	ASSERT(sfmmup->sfmmu_xhat_provider == NULL);
 
 	sfmmup->sfmmu_free = 1;
 	if (sfmmup->sfmmu_scdp != NULL) {
@@ -1934,7 +1929,6 @@
 {
 	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 @@
 void
 hat_swapin(struct hat *hat)
 {
-	ASSERT(hat->sfmmu_xhat_provider == NULL);
 }
 
 /*
@@ -2008,7 +2001,6 @@
 	};			/* free list of TSBs */
 	struct free_tsb *freelist, *last, *next;
 
-	ASSERT(sfmmup->sfmmu_xhat_provider == NULL);
 	SFMMU_STAT(sf_swapout);
 
 	/*
@@ -2032,8 +2024,6 @@
 		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 @@
 	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 @@
 	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 @@
 		    (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, &hat->sfmmu_as->a_lock));
 
@@ -2296,11 +2277,6 @@
 
 	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) ||
@@ -2447,8 +2423,7 @@
 	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;
@@ -2483,12 +2458,6 @@
 	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);
 
@@ -3971,7 +3940,6 @@
 	caddr_t endaddr;
 
 	ASSERT(sfmmup != NULL);
-	ASSERT(sfmmup->sfmmu_xhat_provider == NULL);
 
 	ASSERT((sfmmup == ksfmmup) ||
 	    AS_LOCK_HELD(sfmmup->sfmmu_as, &sfmmup->sfmmu_as->a_lock));
@@ -4056,7 +4024,6 @@
 	}
 
 	ASSERT(sfmmup != NULL);
-	ASSERT(sfmmup->sfmmu_xhat_provider == NULL);
 	ASSERT(sfmmup != ksfmmup);
 
 	srdp = sfmmup->sfmmu_srdp;
@@ -4768,7 +4735,6 @@
 	tte_t tte;
 
 	ASSERT(sfmmup != NULL);
-	ASSERT(sfmmup->sfmmu_xhat_provider == NULL);
 
 	ASSERT((sfmmup == ksfmmup) ||
 	    AS_LOCK_HELD(sfmmup->sfmmu_as, &sfmmup->sfmmu_as->a_lock));
@@ -4793,8 +4759,6 @@
 {
 	tte_t tte;
 
-	ASSERT(sfmmup->sfmmu_xhat_provider == NULL);
-
 	if (sfmmup == ksfmmup) {
 		if (sfmmu_vatopfn(addr, sfmmup, &tte) == PFN_INVALID) {
 			return (-1);
@@ -4814,8 +4778,6 @@
 {
 	tte_t tte;
 
-	ASSERT(sfmmup->sfmmu_xhat_provider == NULL);
-
 	if (sfmmup == ksfmmup) {
 		if (sfmmu_vatopfn(addr, sfmmup, &tte) == PFN_INVALID) {
 			tte.ll = 0;
@@ -4839,19 +4801,7 @@
 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);
 }
@@ -4863,19 +4813,7 @@
 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);
 }
@@ -4886,19 +4824,7 @@
 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);
 }
@@ -5251,19 +5177,7 @@
 	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);
 
@@ -5698,20 +5612,7 @@
 	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, &sfmmup->sfmmu_as->a_lock));
@@ -5988,10 +5889,6 @@
 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);
 }
 
@@ -6331,7 +6228,6 @@
 	caddr_t endaddr;
 	cpuset_t cpuset;
 
-	ASSERT(sfmmup->sfmmu_xhat_provider == NULL);
 	ASSERT((sfmmup == ksfmmup) ||
 	    AS_LOCK_HELD(sfmmup->sfmmu_as, &sfmmup->sfmmu_as->a_lock));
 	ASSERT((len & MMU_PAGEOFFSET) == 0);
@@ -7138,14 +7034,11 @@
 #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);
 
@@ -7177,16 +7070,6 @@
 		}
 
 		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
@@ -7223,7 +7106,7 @@
 	 * 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
@@ -7258,22 +7141,11 @@
 			}
 		}
 
-		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);
 }
 
@@ -7554,8 +7426,6 @@
 		 * 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;
@@ -7715,12 +7585,6 @@
 	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);
 
@@ -7985,8 +7849,6 @@
 	 * the as lock.
 	 */
 
-	ASSERT(hat->sfmmu_xhat_provider == NULL);
-
 	if (hat == ksfmmup) {
 		if (IS_KMEM_VA_LARGEPAGE(addr)) {
 			ASSERT(segkmem_lpszc > 0);
@@ -8170,7 +8032,6 @@
 hat_map(struct hat *hat, caddr_t addr, size_t len, uint_t flags)
 {
 	ASSERT(hat != NULL);
-	ASSERT(hat->sfmmu_xhat_provider == NULL);
 }
 
 /*
@@ -8263,14 +8124,6 @@
 		}
 
 		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;
 		}
@@ -8385,10 +8238,6 @@
 			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);
 		}
@@ -8516,8 +8365,6 @@
 	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);
@@ -8537,8 +8384,6 @@
 {
 	hatlock_t	*hatlockp;
 
-	ASSERT(hat->sfmmu_xhat_provider == NULL);
-
 	hatlockp = sfmmu_hat_enter(hat);
 	hat->sfmmu_rmstat++;
 	sfmmu_hat_exit(hatlockp);
@@ -8550,8 +8395,6 @@
 {
 	hatlock_t	*hatlockp;
 
-	ASSERT(hat->sfmmu_xhat_provider == NULL);
-
 	hatlockp = sfmmu_hat_enter(hat);
 	hat->sfmmu_rmstat--;
 	sfmmu_hat_exit(hatlockp);
@@ -8653,8 +8496,6 @@
 	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
@@ -8866,19 +8707,7 @@
 	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,
@@ -9332,8 +9161,6 @@
 		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));
@@ -9360,8 +9187,6 @@
 		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);
 	}
@@ -9509,8 +9334,6 @@
 			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));
@@ -9658,9 +9481,6 @@
 			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);
@@ -13408,7 +13228,6 @@
 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);
 }
 
@@ -13443,8 +13262,6 @@
 		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.
@@ -14029,7 +13846,6 @@
 		return (HAT_INVALID_REGION_COOKIE);
 	}
 
-	ASSERT(sfmmup->sfmmu_xhat_provider == NULL);
 	ASSERT(sfmmup != ksfmmup);
 	ASSERT(AS_WRITE_HELD(sfmmup->sfmmu_as, &sfmmup->sfmmu_as->a_lock));
 	ASSERT(srdp->srd_refcnt > 0);
@@ -14336,12 +14152,6 @@
 	ASSERT(!(rgnp->rgn_flags & SFMMU_REGION_FREE));
 	ASSERT(AS_LOCK_HELD(sfmmup->sfmmu_as, &sfmmup->sfmmu_as->a_lock));
 
-	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;
--- old/usr/src/uts/sfmmu/vm/hat_sfmmu.h	2015-11-06 21:07:28.412984685 -0500
+++ new/usr/src/uts/sfmmu/vm/hat_sfmmu.h	2015-11-06 21:07:28.417244150 -0500
@@ -659,12 +659,9 @@
  * 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 @@
  * 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 @@
 };
 
 #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_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 *);
--- old/usr/src/uts/sfmmu/vm/xhat_sfmmu.c	2015-11-06 21:07:28.574447662 -0500
+++ /dev/null	2015-11-06 21:07:28.000000000 -0500
@@ -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);
-}
--- old/usr/src/uts/sfmmu/vm/xhat_sfmmu.h	2015-11-06 21:07:28.610545722 -0500
+++ /dev/null	2015-11-06 21:07:28.000000000 -0500
@@ -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 */
--- old/usr/src/uts/sun4u/Makefile.files	2015-11-06 21:07:28.647329239 -0500
+++ new/usr/src/uts/sun4u/Makefile.files	2015-11-06 21:07:28.651242070 -0500
@@ -64,7 +64,6 @@
 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
--- old/usr/src/uts/sun4u/vm/mach_kpm.c	2015-11-06 21:07:28.756237915 -0500
+++ new/usr/src/uts/sun4u/vm/mach_kpm.c	2015-11-06 21:07:28.760583009 -0500
@@ -1684,8 +1684,6 @@
 		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 @@
 		if (IS_PAHME(sfhmep))
 			continue;
 		hmeblkp = sfmmu_hmetohblk(sfhmep);
-		if (hmeblkp->hblk_xhat_bit)
-			continue;
 		(void) sfmmu_pageunload(pp, sfhmep, TTE8K);
 	}
 
--- old/usr/src/uts/sun4v/Makefile.files	2015-11-06 21:07:28.908716791 -0500
+++ new/usr/src/uts/sun4v/Makefile.files	2015-11-06 21:07:28.913128914 -0500
@@ -81,7 +81,6 @@
 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
