Duplicating these helpers in almost every .c file is a bad idea.
Define them as inlines in .h file to allow proper reuse.
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
u8 engine_instance;
};
-static struct xe_gt *
-guc_to_gt(struct xe_guc *guc)
-{
- return container_of(guc, struct xe_gt, uc.guc);
-}
-
static bool access_is_atomic(enum access_type access_type)
{
return access_type == ACCESS_TYPE_ATOMIC;
#define TLB_TIMEOUT (HZ / 4)
-static struct xe_gt *
-guc_to_gt(struct xe_guc *guc)
-{
- return container_of(guc, struct xe_gt, uc.guc);
-}
-
static void xe_gt_tlb_fence_timeout(struct work_struct *work)
{
struct xe_gt *gt = container_of(work, struct xe_gt,
#include "xe_wa.h"
#include "xe_wopcm.h"
-static struct xe_gt *
-guc_to_gt(struct xe_guc *guc)
-{
- return container_of(guc, struct xe_gt, uc.guc);
-}
-
-static struct xe_device *
-guc_to_xe(struct xe_guc *guc)
-{
- return gt_to_xe(guc_to_gt(guc));
-}
-
/* GuC addresses above GUC_GGTT_TOP also don't map through the GTT */
#define GUC_GGTT_TOP 0xFEE00000
static u32 guc_bo_ggtt_addr(struct xe_guc *guc,
#ifndef _XE_GUC_H_
#define _XE_GUC_H_
+#include "xe_gt.h"
#include "xe_guc_types.h"
#include "xe_hw_engine_types.h"
#include "xe_macros.h"
}
}
+static inline struct xe_gt *guc_to_gt(struct xe_guc *guc)
+{
+ return container_of(guc, struct xe_gt, uc.guc);
+}
+
+static inline struct xe_device *guc_to_xe(struct xe_guc *guc)
+{
+ return gt_to_xe(guc_to_gt(guc));
+}
+
#endif
#include "xe_guc_log.h"
#include "xe_macros.h"
-static struct xe_gt *
-guc_to_gt(struct xe_guc *guc)
-{
- return container_of(guc, struct xe_gt, uc.guc);
-}
-
-static struct xe_device *
-guc_to_xe(struct xe_guc *guc)
-{
- return gt_to_xe(guc_to_gt(guc));
-}
-
static struct xe_guc *node_to_guc(struct drm_info_node *node)
{
return node->info_ent->data;
#include "xe_guc.h"
#include "xe_map.h"
-static struct xe_gt *
-guc_to_gt(struct xe_guc *guc)
-{
- return container_of(guc, struct xe_gt, uc.guc);
-}
-
-static struct xe_device *
-guc_to_xe(struct xe_guc *guc)
-{
- return gt_to_xe(guc_to_gt(guc));
-}
-
static int send_get_hwconfig(struct xe_guc *guc, u32 ggtt_addr, u32 size)
{
u32 action[] = {
#include "xe_trace.h"
#include "xe_vm.h"
-static struct xe_gt *
-guc_to_gt(struct xe_guc *guc)
-{
- return container_of(guc, struct xe_gt, uc.guc);
-}
-
-static struct xe_device *
-guc_to_xe(struct xe_guc *guc)
-{
- return gt_to_xe(guc_to_gt(guc));
-}
-
static struct xe_guc *
exec_queue_to_guc(struct xe_exec_queue *q)
{