[CI 33/42] drm/xe/svm: Get drm device from drm memory region
Oak Zeng
oak.zeng at intel.com
Thu Jun 13 04:24:20 UTC 2024
Implement a function xe_mem_region_to_device to
get the drm device which has a specific mem region
Cc: Thomas Hellström <thomas.hellstrom at linux.intel.com>
Cc: Matthew Brost <matthew.brost at intel.com>
Cc: Brian Welty <brian.welty at intel.com>
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>
Signed-off-by: Oak Zeng <oak.zeng at intel.com>
---
drivers/gpu/drm/xe/xe_device.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_device.h b/drivers/gpu/drm/xe/xe_device.h
index bb07f5669dbb..bae8ebeda20c 100644
--- a/drivers/gpu/drm/xe/xe_device.h
+++ b/drivers/gpu/drm/xe/xe_device.h
@@ -9,6 +9,7 @@
#include <drm/drm_util.h>
#include "xe_device_types.h"
+#include "xe_tile.h"
static inline struct xe_device *to_xe_device(const struct drm_device *dev)
{
@@ -170,4 +171,11 @@ static inline bool xe_device_wedged(struct xe_device *xe)
void xe_device_declare_wedged(struct xe_device *xe);
+static inline struct drm_device *xe_mem_region_to_device(struct drm_mem_region *mr)
+{
+ struct xe_mem_region *xe_mr = container_of(mr, struct xe_mem_region, drm_mr);
+ struct xe_tile *tile = xe_mem_region_to_tile(xe_mr);
+
+ return &tile->xe->drm;
+}
#endif
--
2.26.3
More information about the Intel-xe
mailing list