Changeset View
Changeset View
Standalone View
Standalone View
sys/arm64/arm64/pmap.c
Show First 20 Lines • Show All 3,512 Lines • ▼ Show 20 Lines | if (((newl2 & (~ATTR_MASK | ATTR_AF)) & L2_OFFSET) != ATTR_AF) { | ||||
atomic_add_long(&pmap_l2_p_failures, 1); | atomic_add_long(&pmap_l2_p_failures, 1); | ||||
CTR2(KTR_PMAP, "pmap_promote_l2: failure for va %#lx" | CTR2(KTR_PMAP, "pmap_promote_l2: failure for va %#lx" | ||||
" in pmap %p", va, pmap); | " in pmap %p", va, pmap); | ||||
return; | return; | ||||
} | } | ||||
if ((newl2 & (ATTR_S1_AP_RW_BIT | ATTR_SW_DBM)) == | if ((newl2 & (ATTR_S1_AP_RW_BIT | ATTR_SW_DBM)) == | ||||
(ATTR_S1_AP(ATTR_S1_AP_RO) | ATTR_SW_DBM)) { | (ATTR_S1_AP(ATTR_S1_AP_RO) | ATTR_SW_DBM)) { | ||||
if (!atomic_fcmpset_64(l2, &newl2, newl2 & ~ATTR_SW_DBM)) | /* | ||||
* When the mapping is clean, i.e., ATTR_S1_AP_RO is set, | |||||
* ATTR_SW_DBM can be cleared without a TLB invalidation. | |||||
*/ | |||||
if (!atomic_fcmpset_64(firstl3, &newl2, newl2 & ~ATTR_SW_DBM)) | |||||
goto setl2; | goto setl2; | ||||
newl2 &= ~ATTR_SW_DBM; | newl2 &= ~ATTR_SW_DBM; | ||||
} | } | ||||
pa = newl2 + L2_SIZE - PAGE_SIZE; | pa = newl2 + L2_SIZE - PAGE_SIZE; | ||||
for (l3 = firstl3 + NL3PG - 1; l3 > firstl3; l3--) { | for (l3 = firstl3 + NL3PG - 1; l3 > firstl3; l3--) { | ||||
oldl3 = pmap_load(l3); | oldl3 = pmap_load(l3); | ||||
setl3: | setl3: | ||||
if ((oldl3 & (ATTR_S1_AP_RW_BIT | ATTR_SW_DBM)) == | if ((oldl3 & (ATTR_S1_AP_RW_BIT | ATTR_SW_DBM)) == | ||||
(ATTR_S1_AP(ATTR_S1_AP_RO) | ATTR_SW_DBM)) { | (ATTR_S1_AP(ATTR_S1_AP_RO) | ATTR_SW_DBM)) { | ||||
/* | |||||
* When the mapping is clean, i.e., ATTR_S1_AP_RO is | |||||
* set, ATTR_SW_DBM can be cleared without a TLB | |||||
* invalidation. | |||||
*/ | |||||
if (!atomic_fcmpset_64(l3, &oldl3, oldl3 & | if (!atomic_fcmpset_64(l3, &oldl3, oldl3 & | ||||
~ATTR_SW_DBM)) | ~ATTR_SW_DBM)) | ||||
goto setl3; | goto setl3; | ||||
oldl3 &= ~ATTR_SW_DBM; | oldl3 &= ~ATTR_SW_DBM; | ||||
} | } | ||||
if (oldl3 != pa) { | if (oldl3 != pa) { | ||||
atomic_add_long(&pmap_l2_p_failures, 1); | atomic_add_long(&pmap_l2_p_failures, 1); | ||||
CTR2(KTR_PMAP, "pmap_promote_l2: failure for va %#lx" | CTR2(KTR_PMAP, "pmap_promote_l2: failure for va %#lx" | ||||
▲ Show 20 Lines • Show All 3,481 Lines • Show Last 20 Lines |