[igt-dev] [PATCH i-g-t 2/2] lib/xe_query: fix vram_if_possible()

Matthew Auld matthew.auld at intel.com
Tue Apr 4 12:00:42 UTC 2023


It looks like this is meant to return the per-GT VRAM bit of the passed
in GT. Currently this just returns the mask for all GTs. i.e if we ask
for gt1 we still get back the region mask for all GTs.

Reported-by: Gwan-gyeong Mun <gwan-gyeong.mun at intel.com>
Signed-off-by: Matthew Auld <matthew.auld at intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Matthew Brost <matthew.brost at intel.com>
---
 lib/xe/xe_query.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/lib/xe/xe_query.c b/lib/xe/xe_query.c
index 253164d6b..5856255bf 100644
--- a/lib/xe/xe_query.c
+++ b/lib/xe/xe_query.c
@@ -393,11 +393,7 @@ uint64_t vram_memory(int fd, int gt)
  */
 uint64_t vram_if_possible(int fd, int gt)
 {
-	uint64_t regions = all_memory_regions(fd);
-	uint64_t system_memory = regions & 0x1;
-	uint64_t vram = regions & (~0x1);
-
-	return vram ? vram : system_memory;
+	return vram_memory(fd, gt) ?: 0x1;
 }
 
 /**
-- 
2.39.2



More information about the igt-dev mailing list