Provide a callback for supports_interconnects() to indicate to the dma-buf core and to the exporter that Xe supports interconnects. Note that Xe would support IOV interconnect only if the buffer is located in VRAM region.
Cc: Jason Gunthorpe jgg@nvidia.com Cc: Christian Koenig christian.koenig@amd.com Cc: Sumit Semwal sumit.semwal@linaro.org Cc: Thomas Hellström thomas.hellstrom@linux.intel.com Cc: Simona Vetter simona.vetter@ffwll.ch Signed-off-by: Vivek Kasireddy vivek.kasireddy@intel.com --- drivers/gpu/drm/xe/xe_dma_buf.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/xe_dma_buf.c b/drivers/gpu/drm/xe/xe_dma_buf.c index a7d67725c3ee..4a1aa47efbc6 100644 --- a/drivers/gpu/drm/xe/xe_dma_buf.c +++ b/drivers/gpu/drm/xe/xe_dma_buf.c @@ -13,6 +13,7 @@ #include <drm/drm_prime.h> #include <drm/ttm/ttm_tt.h>
+#include "regs/xe_bars.h" #include "tests/xe_test.h" #include "xe_bo.h" #include "xe_device.h" @@ -274,9 +275,23 @@ static void xe_dma_buf_move_notify(struct dma_buf_attachment *attach) XE_WARN_ON(xe_bo_evict(bo, exec)); }
+static bool +xe_dma_buf_supports_interconnects(struct dma_buf_attachment *attach, + const struct dma_buf_interconnect_match *exp, + unsigned int exp_ics) +{ + const struct dma_buf_interconnect_match supports_ics[] = { + MATCH_INTERCONNECT(iov_interconnect, attach->dev, LMEM_BAR), + }; + + return dma_buf_match_interconnects(attach, exp, exp_ics, supports_ics, + ARRAY_SIZE(supports_ics)); +} + static const struct dma_buf_attach_ops xe_dma_buf_attach_ops = { .allow_peer2peer = true, - .move_notify = xe_dma_buf_move_notify + .move_notify = xe_dma_buf_move_notify, + .supports_interconnects = xe_dma_buf_supports_interconnects, };
#if IS_ENABLED(CONFIG_DRM_XE_KUNIT_TEST)