From: Matthew Brost <matthew.brost@intel.com>
To: Maarten Lankhorst <dev@lankhorst.se>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 2/2] drm/xe: Copy cpu_caching when importing DMA-BUF.
Date: Thu, 20 Mar 2025 17:23:11 -0700 [thread overview]
Message-ID: <Z9yxb4APx5W/eu0e@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20250320211519.632432-2-dev@lankhorst.se>
On Thu, Mar 20, 2025 at 10:15:19PM +0100, Maarten Lankhorst wrote:
> When testing xe with P2PDMA DMA-BUF import,
> VM_BIND was failing because cpu_caching was not set.
>
> Set cpu_caching if available from another xe driver,
> to allow uncached VM_BIND on imported DMA-BUF.
>
> Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> ---
> drivers/gpu/drm/xe/xe_dma_buf.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_dma_buf.c b/drivers/gpu/drm/xe/xe_dma_buf.c
> index c5b95470fa324..9b1813e65e0a4 100644
> --- a/drivers/gpu/drm/xe/xe_dma_buf.c
> +++ b/drivers/gpu/drm/xe/xe_dma_buf.c
> @@ -266,12 +266,12 @@ struct drm_gem_object *xe_gem_prime_import(struct drm_device *dev,
> const struct dma_buf_attach_ops *attach_ops;
> struct dma_buf_attachment *attach;
> struct drm_gem_object *obj;
> - struct xe_bo *bo;
> + struct xe_bo *bo, *foreign_bo = NULL;
>
> - if (dma_buf->ops == &xe_dmabuf_ops) {
> + if (dma_buf->ops == &xe_dmabuf_ops &&
> + !XE_TEST_ONLY(test && test->force_different_devices)) {
> obj = dma_buf->priv;
> - if (obj->dev == dev &&
> - !XE_TEST_ONLY(test && test->force_different_devices)) {
> + if (obj->dev == dev) {
> /*
> * Importing dmabuf exported from out own gem increases
> * refcount on gem itself instead of f_count of dmabuf.
> @@ -279,6 +279,8 @@ struct drm_gem_object *xe_gem_prime_import(struct drm_device *dev,
> drm_gem_object_get(obj);
> return obj;
> }
> +
> + foreign_bo = gem_to_xe_bo(obj);
> }
>
> /*
> @@ -310,6 +312,9 @@ struct drm_gem_object *xe_gem_prime_import(struct drm_device *dev,
>
> get_dma_buf(dma_buf);
> obj->import_attach = attach;
> + if (foreign_bo)
> + bo->cpu_caching = foreign_bo->cpu_caching;
> +
> return obj;
>
> out_err:
> --
> 2.45.2
>
next prev parent reply other threads:[~2025-03-21 0:22 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-20 21:15 [PATCH 1/2] drm/xe: Remove extra spaces in xe_vm.c Maarten Lankhorst
2025-03-20 21:15 ` [PATCH 2/2] drm/xe: Copy cpu_caching when importing DMA-BUF Maarten Lankhorst
2025-03-21 0:23 ` Matthew Brost [this message]
2025-03-21 10:23 ` Thomas Hellström
2025-03-25 8:10 ` Maarten Lankhorst
2025-03-20 21:45 ` [PATCH 1/2] drm/xe: Remove extra spaces in xe_vm.c Matthew Brost
2025-03-20 22:01 ` ✓ CI.Patch_applied: success for series starting with [1/2] " Patchwork
2025-03-20 22:01 ` ✗ CI.checkpatch: warning " Patchwork
2025-03-20 22:02 ` ✓ CI.KUnit: success " Patchwork
2025-03-20 22:19 ` ✓ CI.Build: " Patchwork
2025-03-20 22:21 ` ✓ CI.Hooks: " Patchwork
2025-03-20 22:30 ` ✓ CI.checksparse: " Patchwork
2025-03-21 5:43 ` ✓ Xe.CI.BAT: " Patchwork
2025-03-25 8:55 ` ✓ CI.Patch_applied: success for series starting with [1/2] drm/xe: Remove extra spaces in xe_vm.c (rev2) Patchwork
2025-03-25 8:55 ` ✗ CI.checkpatch: warning " Patchwork
2025-03-25 8:56 ` ✓ CI.KUnit: success " Patchwork
2025-03-25 9:13 ` ✓ CI.Build: " Patchwork
2025-03-25 9:15 ` ✓ CI.Hooks: " Patchwork
2025-03-25 9:16 ` ✓ CI.checksparse: " Patchwork
2025-03-25 9:37 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-03-25 10:41 ` Maarten Lankhorst
2025-03-25 13:41 ` Matthew Auld
2025-03-25 19:05 ` Thomas Hellström
2025-03-26 17:51 ` Matthew Auld
2025-03-25 15:12 ` ✗ Xe.CI.Full: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z9yxb4APx5W/eu0e@lstrano-desk.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=dev@lankhorst.se \
--cc=intel-xe@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox