On Sun, May 05, 2024 at 08:52:32PM -0700, Nicolin Chen wrote: > On Tue, Apr 30, 2024 at 09:17:58PM -0300, Jason Gunthorpe wrote: > > On Tue, Apr 30, 2024 at 11:58:44AM -0700, Nicolin Chen wrote: > > > Otherwise, there has to be a get_suported_cmdq callback so batch > > > or its callers can avoid adding unsupported commands at the first > > > place. > > > > If you really feel strongly the invalidation could be split into > > S1/S2/S1_VM groupings that align with the feature bits and that could > > be passed down from one step above. But I don't think the complexity > > is really needed. It is better to deal with it through the feature > > mechanism. > > Hmm, I tried following your design by passing in a CMD_TYPE_xxx > to the tegra241_cmdqv_get_cmdq(), but I found a little painful > to accommodate these two cases: > 1. TLBI_NH_ASID is issued via arm_smmu_cmdq_issue_cmdlist(), so > we should not mark it as CMD_TYPE_ALL. Yet, this function is > used by other commands too. So, either we pass in a type from > higher callers, or simply check the opcode in that function. Yes, you'd have to pass in the type there too, which makes it more ugly. > So, it feels to me that checking against the opcode is still a > straightforward solution. And what I ended up with is somewhat > similar to this v6, yet this time it only checks at batch init > call as your design does. Well, the only downside is that the commands have to be same in a batch, but maybe that is OK anyhow. Don't forget to take the hunks that fix the queue as well. Jason