Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Aravind Iddamsetty <aravind.iddamsetty@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: matthew.d.roper@intel.com
Subject: [Intel-xe] [PATCH 1/1] drm/xe: Fix stolen memory size calculation
Date: Sat, 10 Jun 2023 00:22:49 +0530	[thread overview]
Message-ID: <20230609185249.2032370-2-aravind.iddamsetty@intel.com> (raw)
In-Reply-To: <20230609185249.2032370-1-aravind.iddamsetty@intel.com>

The stolen memory base should be derived from GSMBASE or
FLAT_CCS_BASE_ADDR when flat ccs is applicable.

Fixes: acf067c2f5a5 ("drm/xe: Implement stolen memory.")

Signed-off-by: Aravind Iddamsetty <aravind.iddamsetty@intel.com>
---
 drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c b/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
index 21ecc734f10a..29ce69bf8200 100644
--- a/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
+++ b/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
@@ -54,7 +54,6 @@ bool xe_ttm_stolen_cpu_access_needs_ggtt(struct xe_device *xe)
 static s64 detect_bar2_dgfx(struct xe_device *xe, struct xe_ttm_stolen_mgr *mgr)
 {
 	struct xe_tile *tile = xe_device_get_root_tile(xe);
-	struct xe_gt *mmio = xe_root_mmio_gt(xe);
 	struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
 	u64 stolen_size;
 	u64 tile_offset;
@@ -66,12 +65,12 @@ static s64 detect_bar2_dgfx(struct xe_device *xe, struct xe_ttm_stolen_mgr *mgr)
 		return 0;
 	}
 
-	/* Use DSM base address instead for stolen memory */
-	mgr->stolen_base = (xe_mmio_read64(mmio, DSMBASE) & BDSM_MASK) - tile_offset;
+	/* stolen base should be at end of usable vram */
+	mgr->stolen_base = vram_size;
 	if (drm_WARN_ON(&xe->drm, tile_size < mgr->stolen_base))
 		return 0;
 
-	stolen_size = tile_size - mgr->stolen_base;
+	stolen_size = tile_size - vram_size;
 
 	/* Verify usage fits in the actual resource available */
 	if (mgr->stolen_base + stolen_size <= pci_resource_len(pdev, GEN12_LMEM_BAR))
-- 
2.25.1


  reply	other threads:[~2023-06-09 18:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 18:52 [Intel-xe] [PATCH 0/1] Fix stolen memory size calculation Aravind Iddamsetty
2023-06-09 18:52 ` Aravind Iddamsetty [this message]
2023-06-12 14:29   ` [Intel-xe] [PATCH 1/1] drm/xe: " Ruhl, Michael J
2023-06-12 15:04     ` Iddamsetty, Aravind
2023-06-12 15:55       ` Matthew Auld
2023-06-12 16:57         ` Ruhl, Michael J
2023-06-09 19:12 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
2023-06-09 19:12 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-06-09 19:13 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-06-09 19:17 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-06-09 19:17 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-06-09 19:19 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-06-09 19:53 ` [Intel-xe] ○ CI.BAT: info " 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=20230609185249.2032370-2-aravind.iddamsetty@intel.com \
    --to=aravind.iddamsetty@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.d.roper@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox