Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 1/2] drm/xe: Add functions to convert regular address to canonical address and back
@ 2024-01-30 13:56 José Roberto de Souza
  2024-01-30 13:56 ` [PATCH v4 2/2] drm/xe: Add batch buffer addresses to devcoredump José Roberto de Souza
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: José Roberto de Souza @ 2024-01-30 13:56 UTC (permalink / raw)
  To: intel-xe; +Cc: Jani Nikula, Rodrigo Vivi, Maarten Lankhorst, Matt Roper

Some instructions requires canonical address like
MI_BATCH_BUFFER_START(UMDs must call xe_exec with a canonical address
for Xe2+).

So here adding functions to convert regular address to canonical
address and back, the first user of this functions will be added
in the next patch.

v3:
- inline removed
- rename highest_address_bit_get() to ppgtt_msb_get()

v4:
- use xe->info.va_bits instead of xe->info.dma_mask_size

BSpec: 47626
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Maarten Lankhorst <dev@lankhorst.se>
Cc: Stuart Summers <stuart.summers@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
---
 drivers/gpu/drm/xe/xe_device.c | 10 ++++++++++
 drivers/gpu/drm/xe/xe_device.h |  3 +++
 2 files changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
index 6faa7865b1aab..8e8567e06f0bc 100644
--- a/drivers/gpu/drm/xe/xe_device.c
+++ b/drivers/gpu/drm/xe/xe_device.c
@@ -747,3 +747,13 @@ void xe_device_snapshot_print(struct xe_device *xe, struct drm_printer *p)
 		drm_printf(p, "\tCS reference clock: %u\n", gt->info.reference_clock);
 	}
 }
+
+u64 xe_device_canonicalize_addr(struct xe_device *xe, u64 address)
+{
+	return sign_extend64(address, xe->info.va_bits - 1);
+}
+
+u64 xe_device_uncanonicalize_addr(struct xe_device *xe, u64 address)
+{
+	return address & GENMASK_ULL(xe->info.va_bits - 1, 0);
+}
diff --git a/drivers/gpu/drm/xe/xe_device.h b/drivers/gpu/drm/xe/xe_device.h
index 270124da1e00e..462f59e902b12 100644
--- a/drivers/gpu/drm/xe/xe_device.h
+++ b/drivers/gpu/drm/xe/xe_device.h
@@ -177,4 +177,7 @@ u32 xe_device_ccs_bytes(struct xe_device *xe, u64 size);
 
 void xe_device_snapshot_print(struct xe_device *xe, struct drm_printer *p);
 
+u64 xe_device_canonicalize_addr(struct xe_device *xe, u64 address);
+u64 xe_device_uncanonicalize_addr(struct xe_device *xe, u64 address);
+
 #endif
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-01-30 15:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-30 13:56 [PATCH v4 1/2] drm/xe: Add functions to convert regular address to canonical address and back José Roberto de Souza
2024-01-30 13:56 ` [PATCH v4 2/2] drm/xe: Add batch buffer addresses to devcoredump José Roberto de Souza
2024-01-30 14:51 ` ✓ CI.Patch_applied: success for series starting with [v4,1/2] drm/xe: Add functions to convert regular address to canonical address and back Patchwork
2024-01-30 14:51 ` ✓ CI.checkpatch: " Patchwork
2024-01-30 14:52 ` ✓ CI.KUnit: " Patchwork
2024-01-30 14:59 ` ✓ CI.Build: " Patchwork
2024-01-30 15:00 ` ✓ CI.Hooks: " Patchwork
2024-01-30 15:01 ` ✓ CI.checksparse: " Patchwork
2024-01-30 15:46 ` ✓ CI.BAT: " Patchwork
2024-01-30 15:47 ` [PATCH v4 1/2] " Matt Roper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox