All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: "Piórkowski, Piotr" <piotr.piorkowski@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v1 2/2] drm/xe: Move VRAM manager to struct xe_vram_region
Date: Fri, 31 Jan 2025 05:37:42 -0500	[thread overview]
Message-ID: <Z5yn9oxNNd0jeD1j@intel.com> (raw)
In-Reply-To: <20250131100913.659082-3-piotr.piorkowski@intel.com>

On Fri, Jan 31, 2025 at 11:09:13AM +0100, Piórkowski, Piotr wrote:
> From: Piotr Piórkowski <piotr.piorkowski@intel.com>
> 
> VRAM manager is related directly to struct xe_vram_region so it
> should be inside this structure.
> Let's move the VRAM to struct xe_vram_region.
> 
> Signed-off-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_device_types.h       | 5 ++---
>  drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c | 2 +-
>  drivers/gpu/drm/xe/xe_tile.c               | 6 +++---
>  3 files changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h
> index c7c285c6a6c9..a4d998add4c3 100644
> --- a/drivers/gpu/drm/xe/xe_device_types.h
> +++ b/drivers/gpu/drm/xe/xe_device_types.h
> @@ -104,6 +104,8 @@ struct xe_vram_region {
>  	resource_size_t actual_physical_size;
>  	/** @mapping: pointer to VRAM mappable space */
>  	void __iomem *mapping;
> +	/** @vram_mgr: VRAM TTM manager */
> +	struct xe_ttm_vram_mgr *vram_mgr;
>  };
>  
>  /**
> @@ -198,9 +200,6 @@ struct xe_tile {
>  		 */
>  		struct xe_vram_region vram;
>  
> -		/** @mem.vram_mgr: VRAM TTM manager */
> -		struct xe_ttm_vram_mgr *vram_mgr;
> -
>  		/** @mem.ggtt: Global graphics translation table */
>  		struct xe_ggtt *ggtt;
>  
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> index b1d994d65589..98e443faabdc 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> @@ -1560,7 +1560,7 @@ static u64 pf_query_free_lmem(struct xe_gt *gt)
>  {
>  	struct xe_tile *tile = gt->tile;
>  
> -	return xe_ttm_vram_get_avail(&tile->mem.vram_mgr->manager);
> +	return xe_ttm_vram_get_avail(&tile->mem.vram.vram_mgr->manager);

I like your series, but I didn't like how this ended here
vram vram
manager manager

Then I went to see if there was something we could do about the
xe_ttm_vram_mgr itself, but then I noticed it has pointer to
xe_vram_region inside it and I disliked this double pointer now.

So, if we really want to take this path we probably need a bigger
refactor, or this can bring more confusion then help.

>  }
>  
>  static u64 pf_query_max_lmem(struct xe_gt *gt)
> diff --git a/drivers/gpu/drm/xe/xe_tile.c b/drivers/gpu/drm/xe/xe_tile.c
> index 2825553b568f..b13a0ec7c296 100644
> --- a/drivers/gpu/drm/xe/xe_tile.c
> +++ b/drivers/gpu/drm/xe/xe_tile.c
> @@ -94,8 +94,8 @@ static int xe_tile_alloc(struct xe_tile *tile)
>  		return -ENOMEM;
>  	tile->mem.ggtt->tile = tile;
>  
> -	tile->mem.vram_mgr = drmm_kzalloc(drm, sizeof(*tile->mem.vram_mgr), GFP_KERNEL);
> -	if (!tile->mem.vram_mgr)
> +	tile->mem.vram.vram_mgr = drmm_kzalloc(drm, sizeof(*tile->mem.vram.vram_mgr), GFP_KERNEL);
> +	if (!tile->mem.vram.vram_mgr)
>  		return -ENOMEM;
>  
>  	return 0;
> @@ -139,7 +139,7 @@ static int tile_ttm_mgr_init(struct xe_tile *tile)
>  	int err;
>  
>  	if (tile->mem.vram.usable_size) {
> -		err = xe_ttm_vram_mgr_init(tile, tile->mem.vram_mgr);
> +		err = xe_ttm_vram_mgr_init(tile, tile->mem.vram.vram_mgr);
>  		if (err)
>  			return err;
>  		xe->info.mem_region_mask |= BIT(tile->id) << 1;
> -- 
> 2.34.1
> 

  reply	other threads:[~2025-01-31 10:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-31 10:09 [PATCH v1 0/2] Cleaning up code related to VRAM regions and its initialization - part 1 Piórkowski, Piotr
2025-01-31 10:09 ` [PATCH v1 1/2] drm/xe: Rename struct xe_mem_region to struct xe_vram_region Piórkowski, Piotr
2025-01-31 10:09 ` [PATCH v1 2/2] drm/xe: Move VRAM manager " Piórkowski, Piotr
2025-01-31 10:37   ` Rodrigo Vivi [this message]
2025-01-31 10:59     ` Piotr Piórkowski
2025-01-31 10:14 ` ✓ CI.Patch_applied: success for Cleaning up code related to VRAM regions and its initialization - part 1 Patchwork
2025-01-31 10:15 ` ✓ CI.checkpatch: " Patchwork
2025-01-31 10:16 ` ✓ CI.KUnit: " Patchwork
2025-01-31 10:32 ` ✓ CI.Build: " Patchwork
2025-01-31 10:35 ` ✓ CI.Hooks: " Patchwork
2025-01-31 10:36 ` ✓ CI.checksparse: " Patchwork
2025-01-31 10:55 ` ✓ Xe.CI.BAT: " Patchwork
2025-01-31 14:48 ` ✗ Xe.CI.Full: failure " 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=Z5yn9oxNNd0jeD1j@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=piotr.piorkowski@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.