diff options
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> | 2016-01-06 16:12:32 -0500 |
---|---|---|
committer | Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org> | 2016-01-16 19:06:38 +0100 |
commit | 0d5ae8c1274da6a6c74059317942eea625104946 (patch) | |
tree | 9b3b22f44a6baa223c7438a7e143442d645749b0 /usr/src/uts/sfmmu | |
parent | 8c04a1fa3f7d569d48fe9b5342d0bd4c533179b9 (diff) | |
download | illumos-joyent-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>
Diffstat (limited to 'usr/src/uts/sfmmu')
-rw-r--r-- | usr/src/uts/sfmmu/vm/hat_sfmmu.c | 210 | ||||
-rw-r--r-- | usr/src/uts/sfmmu/vm/hat_sfmmu.h | 14 | ||||
-rw-r--r-- | usr/src/uts/sfmmu/vm/xhat_sfmmu.c | 240 | ||||
-rw-r--r-- | usr/src/uts/sfmmu/vm/xhat_sfmmu.h | 94 |
4 files changed, 11 insertions, 547 deletions
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 */ |