drivers/gpu/drm/i915/gt/intel_gt.h

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/gt/intel_gt.h

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/i915/gt/intel_gt.h
Extension
.h
Size
7277 bytes
Lines
217
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

#ifndef __INTEL_GT__
#define __INTEL_GT__

#include "intel_engine_types.h"
#include "intel_gt_types.h"
#include "intel_reset.h"

struct drm_i915_private;
struct drm_printer;

/*
 * Check that the GT is a graphics GT and has an IP version within the
 * specified range (inclusive).
 */
#define IS_GFX_GT_IP_RANGE(gt, from, until) ( \
	BUILD_BUG_ON_ZERO((from) < IP_VER(2, 0)) + \
	BUILD_BUG_ON_ZERO((until) < (from)) + \
	((gt)->type != GT_MEDIA && \
	 GRAPHICS_VER_FULL((gt)->i915) >= (from) && \
	 GRAPHICS_VER_FULL((gt)->i915) <= (until)))

/*
 * Check that the GT is a media GT and has an IP version within the
 * specified range (inclusive).
 *
 * Only usable on platforms with a standalone media design (i.e., IP version 13
 * and higher).
 */
#define IS_MEDIA_GT_IP_RANGE(gt, from, until) ( \
	BUILD_BUG_ON_ZERO((from) < IP_VER(13, 0)) + \
	BUILD_BUG_ON_ZERO((until) < (from)) + \
	((gt) && (gt)->type == GT_MEDIA && \
	 MEDIA_VER_FULL((gt)->i915) >= (from) && \
	 MEDIA_VER_FULL((gt)->i915) <= (until)))

/*
 * Check that the GT is a graphics GT with a specific IP version and has
 * a stepping in the range [from, until).  The lower stepping bound is
 * inclusive, the upper bound is exclusive.  The most common use-case of this
 * macro is for checking bounds for workarounds, which usually have a stepping
 * ("from") at which the hardware issue is first present and another stepping
 * ("until") at which a hardware fix is present and the software workaround is
 * no longer necessary.  E.g.,
 *
 *    IS_GFX_GT_IP_STEP(gt, IP_VER(12, 70), STEP_A0, STEP_B0)
 *    IS_GFX_GT_IP_STEP(gt, IP_VER(12, 71), STEP_B1, STEP_FOREVER)
 *
 * "STEP_FOREVER" can be passed as "until" for workarounds that have no upper
 * stepping bound for the specified IP version.
 */
#define IS_GFX_GT_IP_STEP(gt, ipver, from, until) ( \
	BUILD_BUG_ON_ZERO((until) <= (from)) + \
	(IS_GFX_GT_IP_RANGE((gt), (ipver), (ipver)) && \
	 IS_GRAPHICS_STEP((gt)->i915, (from), (until))))

/*
 * Check that the GT is a media GT with a specific IP version and has
 * a stepping in the range [from, until).  The lower stepping bound is
 * inclusive, the upper bound is exclusive.  The most common use-case of this
 * macro is for checking bounds for workarounds, which usually have a stepping
 * ("from") at which the hardware issue is first present and another stepping
 * ("until") at which a hardware fix is present and the software workaround is
 * no longer necessary.  "STEP_FOREVER" can be passed as "until" for
 * workarounds that have no upper stepping bound for the specified IP version.
 *
 * This macro may only be used to match on platforms that have a standalone
 * media design (i.e., media version 13 or higher).
 */
#define IS_MEDIA_GT_IP_STEP(gt, ipver, from, until) ( \
	BUILD_BUG_ON_ZERO((until) <= (from)) + \
	(IS_MEDIA_GT_IP_RANGE((gt), (ipver), (ipver)) && \
	 IS_MEDIA_STEP((gt)->i915, (from), (until))))

#define GT_TRACE(gt, fmt, ...) do {					\
	const struct intel_gt *gt__ __maybe_unused = (gt);		\
	GEM_TRACE("%s " fmt, dev_name(gt__->i915->drm.dev),		\
		  ##__VA_ARGS__);					\
} while (0)

static inline bool gt_is_root(struct intel_gt *gt)
{
	return !gt->info.id;
}

bool intel_gt_needs_wa_16018031267(struct intel_gt *gt);
bool intel_gt_needs_wa_22016122933(struct intel_gt *gt);

#define NEEDS_FASTCOLOR_BLT_WABB(engine) ( \
	intel_gt_needs_wa_16018031267(engine->gt) && \
	engine->class == COPY_ENGINE_CLASS && engine->instance == 0)

Annotation

Implementation Notes