From: Jan Kiszka <[email protected]> If we stole a StreamID from the root cell, which happens implicitly by adjusting the matching SMR, make sure to return it on cell destruction.
Signed-off-by: Jan Kiszka <[email protected]> --- hypervisor/arch/arm64/smmu.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/hypervisor/arch/arm64/smmu.c b/hypervisor/arch/arm64/smmu.c index 347ce223..fa583745 100644 --- a/hypervisor/arch/arm64/smmu.c +++ b/hypervisor/arch/arm64/smmu.c @@ -454,6 +454,25 @@ static int arm_smmu_cell_init(struct cell *cell) return 0; } +static bool arm_smmu_return_sid_to_root_cell(struct arm_smmu_device *smmu, + unsigned int sid, int idx) +{ + unsigned int root_sid, n; + + for_each_stream_id(root_sid, root_cell.config, n) { + if (sid == root_sid) { + printk("Assigning StreamID 0x%x to cell \"%s\"\n", + sid, root_cell.config->name); + + /* We just need to update S2CR, SMR can stay as is. */ + arm_smmu_write_s2cr(smmu, idx, S2CR_TYPE_TRANS, + root_cell.config->id); + return true; + } + } + return false; +} + static void arm_smmu_cell_exit(struct cell *cell) { int id = cell->config->id; @@ -468,7 +487,8 @@ static void arm_smmu_cell_exit(struct cell *cell) for_each_smmu(smmu, dev) { for_each_stream_id(sid, cell->config, n) { idx = arm_smmu_find_sme(sid, smmu); - if (idx < 0) + if (idx < 0 || + arm_smmu_return_sid_to_root_cell(smmu, sid, idx)) continue; if (smmu->smrs) { -- 2.26.2 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jailhouse-dev/e3c5120102eaaf1a1c7244265329812c8d0c702b.1602664150.git.jan.kiszka%40siemens.com.
