[igt-dev] [PATCH i-g-t 1/3] lib/xe_query: Add xe_for_each_mem_region iterator
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Fri Mar 31 09:16:58 UTC 2023
Add iterator useful for tests which wants to exercise all memory regions.
Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
lib/xe/xe_query.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/xe/xe_query.h b/lib/xe/xe_query.h
index 3a00ecd1c2..fddd05cf73 100644
--- a/lib/xe/xe_query.h
+++ b/lib/xe/xe_query.h
@@ -69,6 +69,10 @@ struct xe_device {
#define xe_for_each_gt(__fd, __gt) \
for (__gt = 0; __gt < xe_number_gt(__fd); ++__gt)
+#define xe_for_each_mem_region(__fd, __memreg, __r) \
+ for (uint64_t __i = 0; __i < igt_fls(__memreg); __i++) \
+ for_if(__r = (__memreg & (1ull << __i)))
+
#define XE_IS_CLASS_SYSMEM(__region) ((__region)->mem_class == XE_MEM_REGION_CLASS_SYSMEM)
#define XE_IS_CLASS_VRAM(__region) ((__region)->mem_class == XE_MEM_REGION_CLASS_VRAM)
--
2.34.1
More information about the igt-dev
mailing list