1667 sfmmu_cache_flush(pp->p_pagenum, PP_GET_VCOLOR(pp));
1668 PP_SET_VCOLOR(pp, vcolor);
1669 return;
1670 }
1671
1672 /*
1673 * If we get here we have a vac conflict with a current hme
1674 * mapping. This must have been established by forcing a wrong
1675 * colored mapping, e.g. by using mmap(2) with MAP_FIXED.
1676 */
1677
1678 /*
1679 * Check if any mapping is in same as or if it is locked
1680 * since in that case we need to uncache.
1681 */
1682 for (sfhmep = pp->p_mapping; sfhmep; sfhmep = tmphme) {
1683 tmphme = sfhmep->hme_next;
1684 if (IS_PAHME(sfhmep))
1685 continue;
1686 hmeblkp = sfmmu_hmetohblk(sfhmep);
1687 if (hmeblkp->hblk_xhat_bit)
1688 continue;
1689 tmphat = hblktosfmmu(hmeblkp);
1690 sfmmu_copytte(&sfhmep->hme_tte, &tte);
1691 ASSERT(TTE_IS_VALID(&tte));
1692 if ((tmphat == ksfmmup) || hmeblkp->hblk_lckcnt) {
1693 /*
1694 * We have an uncache conflict
1695 */
1696 SFMMU_STAT(sf_uncache_conflict);
1697 sfmmu_page_cache_array(pp, HAT_TMPNC, CACHE_FLUSH, 1);
1698 return;
1699 }
1700 }
1701
1702 /*
1703 * We have an unload conflict
1704 */
1705 SFMMU_STAT(sf_unload_conflict);
1706
1707 for (sfhmep = pp->p_mapping; sfhmep; sfhmep = tmphme) {
1708 tmphme = sfhmep->hme_next;
1709 if (IS_PAHME(sfhmep))
1710 continue;
1711 hmeblkp = sfmmu_hmetohblk(sfhmep);
1712 if (hmeblkp->hblk_xhat_bit)
1713 continue;
1714 (void) sfmmu_pageunload(pp, sfhmep, TTE8K);
1715 }
1716
1717 /*
1718 * Unloads only does tlb flushes so we need to flush the
1719 * dcache vcolor here.
1720 */
1721 sfmmu_cache_flush(pp->p_pagenum, PP_GET_VCOLOR(pp));
1722 PP_SET_VCOLOR(pp, vcolor);
1723 }
1724
1725 /*
1726 * Remove all kpm mappings using kpme's for pp and check that
1727 * all kpm mappings (w/ and w/o kpme's) are gone.
1728 */
1729 void
1730 sfmmu_kpm_pageunload(page_t *pp)
1731 {
1732 caddr_t vaddr;
1733 struct kpme *kpme, *nkpme;
|
1667 sfmmu_cache_flush(pp->p_pagenum, PP_GET_VCOLOR(pp));
1668 PP_SET_VCOLOR(pp, vcolor);
1669 return;
1670 }
1671
1672 /*
1673 * If we get here we have a vac conflict with a current hme
1674 * mapping. This must have been established by forcing a wrong
1675 * colored mapping, e.g. by using mmap(2) with MAP_FIXED.
1676 */
1677
1678 /*
1679 * Check if any mapping is in same as or if it is locked
1680 * since in that case we need to uncache.
1681 */
1682 for (sfhmep = pp->p_mapping; sfhmep; sfhmep = tmphme) {
1683 tmphme = sfhmep->hme_next;
1684 if (IS_PAHME(sfhmep))
1685 continue;
1686 hmeblkp = sfmmu_hmetohblk(sfhmep);
1687 tmphat = hblktosfmmu(hmeblkp);
1688 sfmmu_copytte(&sfhmep->hme_tte, &tte);
1689 ASSERT(TTE_IS_VALID(&tte));
1690 if ((tmphat == ksfmmup) || hmeblkp->hblk_lckcnt) {
1691 /*
1692 * We have an uncache conflict
1693 */
1694 SFMMU_STAT(sf_uncache_conflict);
1695 sfmmu_page_cache_array(pp, HAT_TMPNC, CACHE_FLUSH, 1);
1696 return;
1697 }
1698 }
1699
1700 /*
1701 * We have an unload conflict
1702 */
1703 SFMMU_STAT(sf_unload_conflict);
1704
1705 for (sfhmep = pp->p_mapping; sfhmep; sfhmep = tmphme) {
1706 tmphme = sfhmep->hme_next;
1707 if (IS_PAHME(sfhmep))
1708 continue;
1709 hmeblkp = sfmmu_hmetohblk(sfhmep);
1710 (void) sfmmu_pageunload(pp, sfhmep, TTE8K);
1711 }
1712
1713 /*
1714 * Unloads only does tlb flushes so we need to flush the
1715 * dcache vcolor here.
1716 */
1717 sfmmu_cache_flush(pp->p_pagenum, PP_GET_VCOLOR(pp));
1718 PP_SET_VCOLOR(pp, vcolor);
1719 }
1720
1721 /*
1722 * Remove all kpm mappings using kpme's for pp and check that
1723 * all kpm mappings (w/ and w/o kpme's) are gone.
1724 */
1725 void
1726 sfmmu_kpm_pageunload(page_t *pp)
1727 {
1728 caddr_t vaddr;
1729 struct kpme *kpme, *nkpme;
|