On Tue, Oct 15, 2024 at 03:00:10PM +0000, Pranjal Shrivastava wrote: > On Tue, Oct 15, 2024 at 09:47:23AM -0300, Jason Gunthorpe wrote: > > On Tue, Oct 15, 2024 at 08:13:28AM +0000, Pranjal Shrivastava wrote: > > > > > Umm.. this was specific for rmr not a generic thing. I'd suggest to > > > avoid meddling with the STEs directly for acheiving bypass. Playing > > > with the iommu domain type could be neater. Perhaps, modify the > > > ops->def_domain_type to return an appropriate domain? > > > > Yeah, that is the expected way, to force the def_domain_type to > > IDENTITY and refuse to attach a PAGING/BLOCKED domain. > > > > If this is a common thing we could have the core code take on more of > > the job. > > Yes! I've seen the IOMMU being bypassed at multiple places, primarily > for performance, people like bypassing the iommu for "trusted" devices. > A few examples that are publically accessible: Qcomm SoCs [1], [2]. > Seems like Qualcomm have a DT property `qcomm-s1-bypass` to achieve > something similar. It is not good to encode policy in the kernel in this way. If the device works then it should be permitted to be non-identity, even if it is slow. I suppose things are done this way because the policy can't be changed once the drivers are bound, so this has to be decided early boot and so it is easiest path... But it does suggest to me that the DT encoding is more an indication "device is really slow with translation". Once I was looking at the idea of pulling all the identity stuff out of the drivers since alot of it is mostly device specific quirks/etc. It could then be marked as mandatory/performance and that could help understanding alot. Jason