SMMU: supporting deletion on stream ID caps

Providing support to delete stream ID caps and remove any assigned
context banks to deleted stream ID caps.

Signed-off-by: Oliver Scott <Oliver.Scott@data61.csiro.au>
This commit is contained in:
Qian Ge 2020-01-22 15:01:43 +11:00 committed by Oliver Scott
parent 1ef6e6c724
commit 69c9f55f4d
3 changed files with 26 additions and 5 deletions

View file

@ -31,4 +31,5 @@ exception_t decodeARMCBInvocation(word_t label, unsigned int length, cptr_t cptr
cte_t *srcSlot, cap_t cap, extra_caps_t extraCaps,
bool_t call, word_t *buffer);
exception_t smmu_delete_cb(cap_t cap);
exception_t smmu_delete_sid(cap_t cap);

View file

@ -168,8 +168,8 @@ finaliseCap_ret_t Arch_finaliseCap(cap_t cap, bool_t final)
}
#ifdef CONFIG_ARM_SMMU
if (cap_page_upper_directory_cap_get_capPGDMappedCB(cap) != CB_INVALID) {
smmu_cb_disable(cap_page_upper_directory_cap_get_capPGDMappedCB(cap),
cap_page_upper_directory_cap_get_capPUDMappedASID(cap));
smmu_cb_disable(cap_page_upper_directory_cap_get_capPUDMappedCB(cap),
cap_page_upper_directory_cap_get_capPUDMappedASID(cap));
}
#endif
#else
@ -221,6 +221,12 @@ finaliseCap_ret_t Arch_finaliseCap(cap_t cap, bool_t final)
if (final) {
smmu_delete_cb(cap);
}
break;
case cap_sid_cap:
if (final) {
smmu_delete_sid(cap);
}
break;
#endif
}

View file

@ -148,6 +148,19 @@ exception_t decodeARMSIDInvocation(word_t label, unsigned int length, cptr_t cpt
}
}
exception_t smmu_delete_sid(cap_t cap)
{
word_t sid = cap_sid_cap_get_capSID(cap);
cte_t *cbAssignSlot = smmuStateSIDNode + sid;
exception_t status = EXCEPTION_NONE;
/*deleting the assigned context bank cap if exsits*/
if (unlikely(cap_get_capType(cbAssignSlot->cap) == cap_cb_cap)) {
status = cteDelete(cbAssignSlot, true);
}
smmuStateSIDTable[sid] = false;
return status;
}
exception_t decodeARMCBControlInvocation(word_t label, unsigned int length, cptr_t cptr,
cte_t *srcSlot, cap_t cap, extra_caps_t extraCaps,
bool_t call, word_t *buffer) {
@ -291,17 +304,18 @@ exception_t decodeARMCBInvocation(word_t label, unsigned int length, cptr_t cptr
}
}
exception_t smmu_delete_cb(cap_t cap)
exception_t smmu_delete_cb(cap_t cap)
{
word_t cb;
word_t cb = cap_cb_cap_get_capCB(cap);
cte_t *cbSlot;
exception_t status = EXCEPTION_NONE;
/*deleting assigned vspace root if exists*/
if (unlikely(checkARMCBVspace(cap) == EXCEPTION_NONE)) {
cb = cap_cb_cap_get_capCB(cap);
cbSlot = smmuStateCBNode + cb;
status = cteDelete(cbSlot, true);
}
smmuStateCBTable[cb] = false;
return status;
}
#endif