[igt-dev] [i-g-t] lib/intel_aux_pgtable: Add XE support for pagetable mapping

Bhanuprakash Modem bhanuprakash.modem at intel.com
Mon Oct 30 16:08:04 UTC 2023


For XE device, use XE specific APIs to map pagetable.

Cc: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
 lib/intel_aux_pgtable.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/intel_aux_pgtable.c b/lib/intel_aux_pgtable.c
index 7c7952134..3cbb0e26f 100644
--- a/lib/intel_aux_pgtable.c
+++ b/lib/intel_aux_pgtable.c
@@ -9,6 +9,7 @@
 #include "ioctl_wrappers.h"
 
 #include "i915/gem_mman.h"
+#include "xe/xe_ioctl.h"
 
 #define BITMASK(e, s)		((~0ULL << (s)) & \
 				 (~0ULL >> (BITS_PER_LONG_LONG - 1 - (e))))
@@ -371,10 +372,13 @@ pgt_populate_entries_for_buf(struct pgtable *pgt,
 	}
 }
 
-static void pgt_map(int i915, struct pgtable *pgt)
+static void pgt_map(int drm_fd, struct pgtable *pgt)
 {
-	pgt->ptr = gem_mmap__device_coherent(i915, pgt->buf->handle, 0,
-					     pgt->size, PROT_READ | PROT_WRITE);
+	pgt->ptr = is_i915_device(drm_fd) ?
+			gem_mmap__device_coherent(drm_fd, pgt->buf->handle, 0,
+						  pgt->size, PROT_READ | PROT_WRITE):
+			xe_bo_mmap_ext(drm_fd, pgt->buf->handle,
+				       pgt->size, PROT_READ | PROT_WRITE);
 }
 
 static void pgt_unmap(struct pgtable *pgt)
-- 
2.40.0



More information about the igt-dev mailing list