@@ -43,7 +43,7 @@ static int i915_capabilities(struct seq_file *m, void *data)
const struct intel_device_info *info = INTEL_INFO(dev_priv);
struct drm_printer p = drm_seq_file_printer(m);
- seq_printf(m, "gen: %d\n", INTEL_GEN(dev_priv));
+ seq_printf(m, "gen: %d\n", INTEL_INFO(dev_priv)->gen);
seq_printf(m, "platform: %s\n", intel_platform_name(info->platform));
seq_printf(m, "pch: %d\n", INTEL_PCH_TYPE(dev_priv));
@@ -2354,7 +2354,6 @@ intel_info(const struct drm_i915_private *dev_priv)
#define INTEL_INFO(dev_priv) intel_info((dev_priv))
#define DRIVER_CAPS(dev_priv) (&(dev_priv)->caps)
-#define INTEL_GEN(dev_priv) ((dev_priv)->info.gen)
#define INTEL_DEVID(dev_priv) ((dev_priv)->info.device_id)
#define REVID_FOREVER 0xff
@@ -261,7 +261,7 @@ struct i915_execbuffer {
struct drm_mm_node node; /** temporary GTT binding */
unsigned long vaddr; /** Current kmap address */
unsigned long page; /** Currently mapped page index */
- unsigned int gen; /** Cached value of INTEL_GEN */
+ unsigned int gen; /** Cached value of device_info */
bool use_64bit_reloc : 1;
bool has_llc : 1;
bool has_fence : 1;
@@ -907,7 +907,7 @@ static void reloc_cache_init(struct reloc_cache *cache,
cache->page = -1;
cache->vaddr = 0;
/* Must be a variable in the struct to allow GCC to unroll. */
- cache->gen = INTEL_GEN(i915);
+ cache->gen = INTEL_INFO(i915)->gen;
cache->has_llc = HAS_LLC(i915);
cache->use_64bit_reloc = HAS_64BIT_RELOC(i915);
cache->has_fence = cache->gen < 4;
@@ -45,7 +45,7 @@ render_state_get_rodata(const struct intel_engine_cs *engine)
if (engine->id != RCS)
return NULL;
- switch (INTEL_GEN(engine->i915)) {
+ switch (INTEL_INFO(engine->i915)->gen) {
case 6:
return &gen6_null_state;
case 7:
@@ -404,7 +404,7 @@ int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
reserved_base = stolen_top;
reserved_size = 0;
- switch (INTEL_GEN(dev_priv)) {
+ switch (INTEL_INFO(dev_priv)->gen) {
case 2:
case 3:
break;
@@ -1718,7 +1718,7 @@ static void i915_error_capture_msg(struct drm_i915_private *dev_priv,
len = scnprintf(error->error_msg, sizeof(error->error_msg),
"GPU HANG: ecode %d:%d:0x%08x",
- INTEL_GEN(dev_priv), engine_id, ecode);
+ INTEL_INFO(dev_priv)->gen, engine_id, ecode);
if (engine_id != -1 && error->engine[engine_id].context.pid)
len += scnprintf(error->error_msg + len,
@@ -1236,7 +1236,7 @@ static int oa_get_render_ctx_id(struct i915_perf_stream *stream)
if (IS_ERR(ce))
return PTR_ERR(ce);
- switch (INTEL_GEN(i915)) {
+ switch (INTEL_INFO(i915)->gen) {
case 7: {
/*
* On Haswell we don't do any post processing of the reports
@@ -1292,7 +1292,7 @@ static int oa_get_render_ctx_id(struct i915_perf_stream *stream)
}
default:
- MISSING_CASE(INTEL_GEN(i915));
+ MISSING_CASE(INTEL_INFO(i915)->gen);
}
DRM_DEBUG_DRIVER("filtering on ctx_id=0x%x ctx_id_mask=0x%x\n",
@@ -389,7 +389,7 @@ parse_sdvo_panel_data(struct drm_i915_private *dev_priv,
static int intel_bios_ssc_frequency(struct drm_i915_private *dev_priv,
bool alternate)
{
- switch (INTEL_GEN(dev_priv)) {
+ switch (INTEL_INFO(dev_priv)->gen) {
case 2:
return alternate ? 66667 : 48000;
case 3:
@@ -5039,7 +5039,7 @@ bool intel_digital_port_connected(struct intel_encoder *encoder)
else if (GT_GEN(dev_priv, 5))
return ilk_digital_port_connected(encoder);
- MISSING_CASE(INTEL_GEN(dev_priv));
+ MISSING_CASE(INTEL_INFO(dev_priv)->gen);
return false;
}
@@ -195,9 +195,9 @@ __intel_engine_context_size(struct drm_i915_private *dev_priv, u8 class)
switch (class) {
case RENDER_CLASS:
- switch (INTEL_GEN(dev_priv)) {
+ switch (INTEL_INFO(dev_priv)->gen) {
default:
- MISSING_CASE(INTEL_GEN(dev_priv));
+ MISSING_CASE(INTEL_INFO(dev_priv)->gen);
return DEFAULT_LR_CONTEXT_RENDER_SIZE;
case 11:
return GEN11_LR_CONTEXT_RENDER_SIZE;
@@ -245,7 +245,7 @@ static u32 __engine_mmio_base(struct drm_i915_private *i915,
int i;
for (i = 0; i < MAX_MMIO_BASES; i++)
- if (INTEL_GEN(i915) >= bases[i].gen)
+ if (INTEL_INFO(i915)->gen >= bases[i].gen)
break;
GEM_BUG_ON(i == MAX_MMIO_BASES);
@@ -891,7 +891,7 @@ void intel_engine_get_instdone(struct intel_engine_cs *engine,
memset(instdone, 0, sizeof(*instdone));
- switch (INTEL_GEN(dev_priv)) {
+ switch (INTEL_INFO(dev_priv)->gen) {
default:
instdone->instdone = I915_READ(RING_INSTDONE(mmio_base));
@@ -1189,7 +1189,7 @@ void intel_engine_lost_context(struct intel_engine_cs *engine)
bool intel_engine_can_store_dword(struct intel_engine_cs *engine)
{
- switch (INTEL_GEN(engine->i915)) {
+ switch (INTEL_INFO(engine->i915)->gen) {
case 2:
return false; /* uses physical not virtual addresses */
case 3:
@@ -1518,7 +1518,7 @@ static int intel_init_workaround_bb(struct intel_engine_cs *engine)
if (GEM_DEBUG_WARN_ON(engine->id != RCS))
return -EINVAL;
- switch (INTEL_GEN(engine->i915)) {
+ switch (INTEL_INFO(engine->i915)->gen) {
case 11:
return 0;
case 10:
@@ -1534,7 +1534,7 @@ static int intel_init_workaround_bb(struct intel_engine_cs *engine)
wa_bb_fn[1] = NULL;
break;
default:
- MISSING_CASE(INTEL_GEN(engine->i915));
+ MISSING_CASE(INTEL_INFO(engine->i915)->gen);
return 0;
}
@@ -2436,9 +2436,9 @@ static u32 intel_lr_indirect_ctx_offset(struct intel_engine_cs *engine)
{
u32 indirect_ctx_offset;
- switch (INTEL_GEN(engine->i915)) {
+ switch (INTEL_INFO(engine->i915)->gen) {
default:
- MISSING_CASE(INTEL_GEN(engine->i915));
+ MISSING_CASE(INTEL_INFO(engine->i915)->gen);
/* fall through */
case 11:
indirect_ctx_offset =
@@ -538,7 +538,7 @@ int intel_ctx_workarounds_init(struct drm_i915_private *dev_priv)
else if (IS_ICELAKE(dev_priv))
err = icl_ctx_workarounds_init(dev_priv);
else
- MISSING_CASE(INTEL_GEN(dev_priv));
+ MISSING_CASE(INTEL_INFO(dev_priv)->gen);
if (err)
return err;
@@ -937,7 +937,7 @@ void intel_gt_workarounds_apply(struct drm_i915_private *dev_priv)
else if (IS_ICELAKE(dev_priv))
icl_gt_workarounds_apply(dev_priv);
else
- MISSING_CASE(INTEL_GEN(dev_priv));
+ MISSING_CASE(INTEL_INFO(dev_priv)->gen);
}
struct whitelist {
@@ -1054,7 +1054,7 @@ static struct whitelist *whitelist_build(struct intel_engine_cs *engine,
else if (IS_ICELAKE(i915))
icl_whitelist_build(w);
else
- MISSING_CASE(INTEL_GEN(i915));
+ MISSING_CASE(INTEL_INFO(i915)->gen);
return w;
}
@@ -893,7 +893,7 @@ static struct i915_vma *
gpu_write_dw(struct i915_vma *vma, u64 offset, u32 val)
{
struct drm_i915_private *i915 = vma->vm->i915;
- const int gen = INTEL_GEN(i915);
+ const int gen = INTEL_INFO(i915)->gen;
unsigned int count = vma->size >> PAGE_SHIFT;
struct drm_i915_gem_object *obj;
struct i915_vma *batch;
@@ -253,7 +253,7 @@ static struct i915_vma *
gpu_fill_dw(struct i915_vma *vma, u64 offset, unsigned long count, u32 value)
{
struct drm_i915_gem_object *obj;
- const int gen = INTEL_GEN(vma->vm->i915);
+ const int gen = INTEL_INFO(vma->vm->i915)->gen;
unsigned long n, size;
u32 *cmd;
int err;
@@ -564,7 +564,7 @@ static struct i915_vma *recursive_batch(struct drm_i915_private *i915)
struct i915_address_space *vm =
ctx->ppgtt ? &ctx->ppgtt->vm : &i915->ggtt.vm;
struct drm_i915_gem_object *obj;
- const int gen = INTEL_GEN(i915);
+ const int gen = INTEL_INFO(i915)->gen;
struct i915_vma *vma;
u32 *cmd;
int err;
After all the conversion to prefer using GT_GEN() and GT_GEN_RANGE() macros, let's remove INTEL_GEN() because a) it only returns the GT gen and b) leaving it there makes it too easy for people using it as they shouldn't. There are some cases in which is ok to get the gen field, like debug messages, switch and missing cases etc. For those, let's use the slightly more verbose route through INTEL_INFO(). This was generated with: @@ expression E; @@ - INTEL_GEN(E) + INTEL_INFO(E)->gen Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> --- drivers/gpu/drm/i915/i915_debugfs.c | 2 +- drivers/gpu/drm/i915/i915_drv.h | 1 - drivers/gpu/drm/i915/i915_gem_execbuffer.c | 4 ++-- drivers/gpu/drm/i915/i915_gem_render_state.c | 2 +- drivers/gpu/drm/i915/i915_gem_stolen.c | 2 +- drivers/gpu/drm/i915/i915_gpu_error.c | 2 +- drivers/gpu/drm/i915/i915_perf.c | 4 ++-- drivers/gpu/drm/i915/intel_bios.c | 2 +- drivers/gpu/drm/i915/intel_dp.c | 2 +- drivers/gpu/drm/i915/intel_engine_cs.c | 10 +++++----- drivers/gpu/drm/i915/intel_lrc.c | 8 ++++---- drivers/gpu/drm/i915/intel_workarounds.c | 6 +++--- drivers/gpu/drm/i915/selftests/huge_pages.c | 2 +- drivers/gpu/drm/i915/selftests/i915_gem_context.c | 2 +- drivers/gpu/drm/i915/selftests/i915_request.c | 2 +- 15 files changed, 25 insertions(+), 26 deletions(-)