Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [RFC 1/4] drm/pagemap: Add helper to access backing devmem allocation
Date: Fri, 18 Sep 2026 14:04:32 -0700	[thread overview]
Message-ID: <aq2nYIz4FHC0GP+z@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20260916112828.2528881-7-himal.prasad.ghimiray@intel.com>

On Wed, Sep 16, 2026 at 04:58:30PM +0530, Himal Prasad Ghimiray wrote:
> drm_pagemap_zdd is private, so add drm_pagemap_page_to_devmem() to let
> callers get the drm_pagemap_devmem backing a device-private/coherent
> page. Add a NULL stub for !CONFIG_ZONE_DEVICE.
> 
> Cc: Matthew Brost <matthew.brost@intel.com>

Reviewed-by: Matthew Brost <matthew.brost@intel.com>

> Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
> ---
>  drivers/gpu/drm/drm_pagemap.c | 15 +++++++++++++++
>  include/drm/drm_pagemap.h     |  7 +++++++
>  2 files changed, 22 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_pagemap.c b/drivers/gpu/drm/drm_pagemap.c
> index 892b325fa99b..fc1a2825c807 100644
> --- a/drivers/gpu/drm/drm_pagemap.c
> +++ b/drivers/gpu/drm/drm_pagemap.c
> @@ -1432,6 +1432,21 @@ struct drm_pagemap *drm_pagemap_page_to_dpagemap(struct page *page)
>  }
>  EXPORT_SYMBOL_GPL(drm_pagemap_page_to_dpagemap);
>  
> +/**
> + * drm_pagemap_page_to_devmem() - Return the devmem allocation backing a page
> + * @page: The struct page.
> + *
> + * Return: The &drm_pagemap_devmem backing @page. Undefined if @page was not
> + * populated from a &drm_pagemap.
> + */
> +struct drm_pagemap_devmem *drm_pagemap_page_to_devmem(struct page *page)
> +{
> +	struct drm_pagemap_zdd *zdd = drm_pagemap_page_zone_device_data(page);
> +
> +	return zdd->devmem_allocation;
> +}
> +EXPORT_SYMBOL_GPL(drm_pagemap_page_to_devmem);
> +
>  /**
>   * drm_pagemap_populate_mm() - Populate a virtual range with device memory pages
>   * @dpagemap: Pointer to the drm_pagemap managing the device memory
> diff --git a/include/drm/drm_pagemap.h b/include/drm/drm_pagemap.h
> index 95eb4b66b057..376d7d400c8e 100644
> --- a/include/drm/drm_pagemap.h
> +++ b/include/drm/drm_pagemap.h
> @@ -257,6 +257,8 @@ struct drm_pagemap *drm_pagemap_create(struct drm_device *drm,
>  
>  struct drm_pagemap *drm_pagemap_page_to_dpagemap(struct page *page);
>  
> +struct drm_pagemap_devmem *drm_pagemap_page_to_devmem(struct page *page);
> +
>  void drm_pagemap_put(struct drm_pagemap *dpagemap);
>  
>  #else
> @@ -266,6 +268,11 @@ static inline struct drm_pagemap *drm_pagemap_page_to_dpagemap(struct page *page
>  	return NULL;
>  }
>  
> +static inline struct drm_pagemap_devmem *drm_pagemap_page_to_devmem(struct page *page)
> +{
> +	return NULL;
> +}
> +
>  static inline void drm_pagemap_put(struct drm_pagemap *dpagemap)
>  {
>  }
> -- 
> 2.43.0
> 

  reply	other threads:[~2026-09-18 21:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 11:28 [RFC 0/4] Refresh TTM LRU on SVM prefetch Himal Prasad Ghimiray
2026-09-16 11:28 ` [RFC 1/4] drm/pagemap: Add helper to access backing devmem allocation Himal Prasad Ghimiray
2026-09-18 21:04   ` Matthew Brost [this message]
2026-09-16 11:28 ` [RFC 2/4] drm/gpusvm: Add devmem callback to get_pages Himal Prasad Ghimiray
2026-09-16 11:36   ` sashiko-bot
2026-09-18 21:24     ` Matthew Brost
2026-09-21  8:34       ` Ghimiray, Himal Prasad
2026-09-16 11:28 ` [RFC 3/4] drm/xe: Bump prefetch BO LRU via GPUSVM devmem callback Himal Prasad Ghimiray
2026-09-16 11:36   ` sashiko-bot
2026-09-18 21:02     ` Matthew Brost
2026-09-21  8:35       ` Ghimiray, Himal Prasad
2026-09-16 11:28 ` [RFC 4/4] drm/xe: Bump prefetch BO LRU for already-valid ranges Himal Prasad Ghimiray
2026-09-16 11:33   ` sashiko-bot
2026-09-18 21:28     ` Matthew Brost
2026-09-21  8:35       ` Ghimiray, Himal Prasad
2026-09-16 11:32 ` ✗ CI.KUnit: failure for Refresh TTM LRU on SVM prefetch 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=aq2nYIz4FHC0GP+z@gsse-cloud1.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=himal.prasad.ghimiray@intel.com \
    --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