On 04.10.20 21:00, Jan Kiszka wrote: > 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) { >
Nikhil, Lokesh, something like this should be easily implementable for v3 as well. I just don't have my setup running yet to quickly test the result (and I hope those tests will not require such a series for v3 as well ;) ). Jan -- Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux -- 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/1e845d73-64ce-92b1-aecd-a13505bd9830%40siemens.com.
