Re: [Intel-gfx] [PATCH] drm-buf: Add debug option
From: Chris Wilson <hidden>
Date: 2021-01-15 08:26:34
Also in:
dri-devel, intel-gfx
Quoting Daniel Vetter (2021-01-14 09:47:40)
On Thu, Jan 14, 2021 at 09:45:37AM +0000, Chris Wilson wrote:quoted
Quoting Daniel Vetter (2021-01-14 09:30:32)quoted
On Thu, Jan 14, 2021 at 10:23 AM Chris Wilson [off-list ref] wrote:quoted
The only other problem I see with the implementation is that there's nothing that says that each dmabuf->ops->map_dma_buf() returns a new sg_table, so we may end up undoing the xor. Or should each dma-buf return a fresh dma-mapping for iommu isolation?Maybe I screwed it up, but that's why I extracted the little helpers: We scramble when we get the sgtable from exporter, and unscramble before we pass it back. dma-buf.c does some caching and will hand back the same sgtable, but for that case we don't re-scramble.The attachment is only mapped once, but there can be more than one attachment, and the backend could return the same sg_table for each mapping. Conceivably, it could return its own private sg_table where it wants to maintain the struct page. Seems like just adding a sentence to @map_dma_buf to clarify that each call should return a new sg_table will suffice.Ah yes good point, will augment (once CI stops being angry at me).
Fwiw, with a quick explanation of "don't do this" in the docs, Reviewed-by: Chris Wilson <redacted> -Chris