Skip to content

Commit 651e7d4

Browse files
committed
drm/i915: replace IS_GEN and friends with GRAPHICS_VER
This was done by the following semantic patch: @@ expression i915; @@ - INTEL_GEN(i915) + GRAPHICS_VER(i915) @@ expression i915; expression E; @@ - INTEL_GEN(i915) >= E + GRAPHICS_VER(i915) >= E @@ expression dev_priv; expression E; @@ - !IS_GEN(dev_priv, E) + GRAPHICS_VER(dev_priv) != E @@ expression dev_priv; expression E; @@ - IS_GEN(dev_priv, E) + GRAPHICS_VER(dev_priv) == E @@ expression dev_priv; expression from, until; @@ - IS_GEN_RANGE(dev_priv, from, until) + IS_GRAPHICS_VER(dev_priv, from, until) @def@ expression E; identifier id =~ "^gen$"; @@ - id = GRAPHICS_VER(E) + ver = GRAPHICS_VER(E) @@ identifier def.id; @@ - id + ver It also takes care of renaming the variable we assign to GRAPHICS_VER() so to use "ver" rather than "gen". Signed-off-by: Lucas De Marchi <[email protected]> Reviewed-by: Matt Roper <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 07960a4 commit 651e7d4

24 files changed

+191
-191
lines changed

drivers/gpu/drm/i915/i915_cmd_parser.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -946,8 +946,8 @@ int intel_engine_init_cmd_parser(struct intel_engine_cs *engine)
946946
int cmd_table_count;
947947
int ret;
948948

949-
if (!IS_GEN(engine->i915, 7) && !(IS_GEN(engine->i915, 9) &&
950-
engine->class == COPY_ENGINE_CLASS))
949+
if (GRAPHICS_VER(engine->i915) != 7 && !(GRAPHICS_VER(engine->i915) == 9 &&
950+
engine->class == COPY_ENGINE_CLASS))
951951
return 0;
952952

953953
switch (engine->class) {
@@ -977,7 +977,7 @@ int intel_engine_init_cmd_parser(struct intel_engine_cs *engine)
977977
break;
978978
case COPY_ENGINE_CLASS:
979979
engine->get_cmd_length_mask = gen7_blt_get_cmd_length_mask;
980-
if (IS_GEN(engine->i915, 9)) {
980+
if (GRAPHICS_VER(engine->i915) == 9) {
981981
cmd_tables = gen9_blt_cmd_table;
982982
cmd_table_count = ARRAY_SIZE(gen9_blt_cmd_table);
983983
engine->get_cmd_length_mask =
@@ -993,7 +993,7 @@ int intel_engine_init_cmd_parser(struct intel_engine_cs *engine)
993993
cmd_table_count = ARRAY_SIZE(gen7_blt_cmd_table);
994994
}
995995

996-
if (IS_GEN(engine->i915, 9)) {
996+
if (GRAPHICS_VER(engine->i915) == 9) {
997997
engine->reg_tables = gen9_blt_reg_tables;
998998
engine->reg_table_count =
999999
ARRAY_SIZE(gen9_blt_reg_tables);
@@ -1521,7 +1521,7 @@ int intel_engine_cmd_parser(struct intel_engine_cs *engine,
15211521
if (IS_HASWELL(engine->i915))
15221522
flags = MI_BATCH_NON_SECURE_HSW;
15231523

1524-
GEM_BUG_ON(!IS_GEN_RANGE(engine->i915, 6, 7));
1524+
GEM_BUG_ON(!IS_GRAPHICS_VER(engine->i915, 6, 7));
15251525
__gen6_emit_bb_start(batch_end,
15261526
batch_addr,
15271527
flags);

drivers/gpu/drm/i915/i915_debugfs.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ static int i915_frequency_info(struct seq_file *m, void *unused)
361361

362362
wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm);
363363

364-
if (IS_GEN(dev_priv, 5)) {
364+
if (GRAPHICS_VER(dev_priv) == 5) {
365365
u16 rgvswctl = intel_uncore_read16(uncore, MEMSWCTL);
366366
u16 rgvstat = intel_uncore_read16(uncore, MEMSTAT_ILK);
367367

@@ -408,7 +408,7 @@ static int i915_frequency_info(struct seq_file *m, void *unused)
408408
seq_printf(m,
409409
"efficient (RPe) frequency: %d MHz\n",
410410
intel_gpu_freq(rps, rps->efficient_freq));
411-
} else if (INTEL_GEN(dev_priv) >= 6) {
411+
} else if (GRAPHICS_VER(dev_priv) >= 6) {
412412
u32 rp_state_limits;
413413
u32 gt_perf_status;
414414
u32 rp_state_cap;
@@ -432,7 +432,7 @@ static int i915_frequency_info(struct seq_file *m, void *unused)
432432
intel_uncore_forcewake_get(&dev_priv->uncore, FORCEWAKE_ALL);
433433

434434
reqf = intel_uncore_read(&dev_priv->uncore, GEN6_RPNSWREQ);
435-
if (INTEL_GEN(dev_priv) >= 9)
435+
if (GRAPHICS_VER(dev_priv) >= 9)
436436
reqf >>= 23;
437437
else {
438438
reqf &= ~GEN6_TURBO_DISABLE;
@@ -458,7 +458,7 @@ static int i915_frequency_info(struct seq_file *m, void *unused)
458458

459459
intel_uncore_forcewake_put(&dev_priv->uncore, FORCEWAKE_ALL);
460460

461-
if (INTEL_GEN(dev_priv) >= 11) {
461+
if (GRAPHICS_VER(dev_priv) >= 11) {
462462
pm_ier = intel_uncore_read(&dev_priv->uncore, GEN11_GPM_WGBOXPERF_INTR_ENABLE);
463463
pm_imr = intel_uncore_read(&dev_priv->uncore, GEN11_GPM_WGBOXPERF_INTR_MASK);
464464
/*
@@ -467,7 +467,7 @@ static int i915_frequency_info(struct seq_file *m, void *unused)
467467
*/
468468
pm_isr = 0;
469469
pm_iir = 0;
470-
} else if (INTEL_GEN(dev_priv) >= 8) {
470+
} else if (GRAPHICS_VER(dev_priv) >= 8) {
471471
pm_ier = intel_uncore_read(&dev_priv->uncore, GEN8_GT_IER(2));
472472
pm_imr = intel_uncore_read(&dev_priv->uncore, GEN8_GT_IMR(2));
473473
pm_isr = intel_uncore_read(&dev_priv->uncore, GEN8_GT_ISR(2));
@@ -490,14 +490,14 @@ static int i915_frequency_info(struct seq_file *m, void *unused)
490490

491491
seq_printf(m, "PM IER=0x%08x IMR=0x%08x, MASK=0x%08x\n",
492492
pm_ier, pm_imr, pm_mask);
493-
if (INTEL_GEN(dev_priv) <= 10)
493+
if (GRAPHICS_VER(dev_priv) <= 10)
494494
seq_printf(m, "PM ISR=0x%08x IIR=0x%08x\n",
495495
pm_isr, pm_iir);
496496
seq_printf(m, "pm_intrmsk_mbz: 0x%08x\n",
497497
rps->pm_intrmsk_mbz);
498498
seq_printf(m, "GT_PERF_STATUS: 0x%08x\n", gt_perf_status);
499499
seq_printf(m, "Render p-state ratio: %d\n",
500-
(gt_perf_status & (INTEL_GEN(dev_priv) >= 9 ? 0x1ff00 : 0xff00)) >> 8);
500+
(gt_perf_status & (GRAPHICS_VER(dev_priv) >= 9 ? 0x1ff00 : 0xff00)) >> 8);
501501
seq_printf(m, "Render p-state VID: %d\n",
502502
gt_perf_status & 0xff);
503503
seq_printf(m, "Render p-state limit: %d\n",
@@ -538,20 +538,20 @@ static int i915_frequency_info(struct seq_file *m, void *unused)
538538
max_freq = (IS_GEN9_LP(dev_priv) ? rp_state_cap >> 0 :
539539
rp_state_cap >> 16) & 0xff;
540540
max_freq *= (IS_GEN9_BC(dev_priv) ||
541-
INTEL_GEN(dev_priv) >= 10 ? GEN9_FREQ_SCALER : 1);
541+
GRAPHICS_VER(dev_priv) >= 10 ? GEN9_FREQ_SCALER : 1);
542542
seq_printf(m, "Lowest (RPN) frequency: %dMHz\n",
543543
intel_gpu_freq(rps, max_freq));
544544

545545
max_freq = (rp_state_cap & 0xff00) >> 8;
546546
max_freq *= (IS_GEN9_BC(dev_priv) ||
547-
INTEL_GEN(dev_priv) >= 10 ? GEN9_FREQ_SCALER : 1);
547+
GRAPHICS_VER(dev_priv) >= 10 ? GEN9_FREQ_SCALER : 1);
548548
seq_printf(m, "Nominal (RP1) frequency: %dMHz\n",
549549
intel_gpu_freq(rps, max_freq));
550550

551551
max_freq = (IS_GEN9_LP(dev_priv) ? rp_state_cap >> 16 :
552552
rp_state_cap >> 0) & 0xff;
553553
max_freq *= (IS_GEN9_BC(dev_priv) ||
554-
INTEL_GEN(dev_priv) >= 10 ? GEN9_FREQ_SCALER : 1);
554+
GRAPHICS_VER(dev_priv) >= 10 ? GEN9_FREQ_SCALER : 1);
555555
seq_printf(m, "Max non-overclocked (RP0) frequency: %dMHz\n",
556556
intel_gpu_freq(rps, max_freq));
557557
seq_printf(m, "Max overclocked frequency: %dMHz\n",
@@ -622,12 +622,12 @@ static int i915_swizzle_info(struct seq_file *m, void *data)
622622
seq_puts(m, "L-shaped memory detected\n");
623623

624624
/* On BDW+, swizzling is not used. See detect_bit_6_swizzle() */
625-
if (INTEL_GEN(dev_priv) >= 8 || IS_VALLEYVIEW(dev_priv))
625+
if (GRAPHICS_VER(dev_priv) >= 8 || IS_VALLEYVIEW(dev_priv))
626626
return 0;
627627

628628
wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm);
629629

630-
if (IS_GEN_RANGE(dev_priv, 3, 4)) {
630+
if (IS_GRAPHICS_VER(dev_priv, 3, 4)) {
631631
seq_printf(m, "DDC = 0x%08x\n",
632632
intel_uncore_read(uncore, DCC));
633633
seq_printf(m, "DDC2 = 0x%08x\n",
@@ -645,7 +645,7 @@ static int i915_swizzle_info(struct seq_file *m, void *data)
645645
intel_uncore_read(uncore, MAD_DIMM_C2));
646646
seq_printf(m, "TILECTL = 0x%08x\n",
647647
intel_uncore_read(uncore, TILECTL));
648-
if (INTEL_GEN(dev_priv) >= 8)
648+
if (GRAPHICS_VER(dev_priv) >= 8)
649649
seq_printf(m, "GAMTARBMODE = 0x%08x\n",
650650
intel_uncore_read(uncore, GAMTARBMODE));
651651
else
@@ -956,7 +956,7 @@ static int i915_forcewake_open(struct inode *inode, struct file *file)
956956

957957
atomic_inc(&gt->user_wakeref);
958958
intel_gt_pm_get(gt);
959-
if (INTEL_GEN(i915) >= 6)
959+
if (GRAPHICS_VER(i915) >= 6)
960960
intel_uncore_forcewake_user_get(gt->uncore);
961961

962962
return 0;
@@ -967,7 +967,7 @@ static int i915_forcewake_release(struct inode *inode, struct file *file)
967967
struct drm_i915_private *i915 = inode->i_private;
968968
struct intel_gt *gt = &i915->gt;
969969

970-
if (INTEL_GEN(i915) >= 6)
970+
if (GRAPHICS_VER(i915) >= 6)
971971
intel_uncore_forcewake_user_put(&i915->uncore);
972972
intel_gt_pm_put(gt);
973973
atomic_dec(&gt->user_wakeref);

drivers/gpu/drm/i915/i915_drv.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,12 @@ static int i915_get_bridge_dev(struct drm_i915_private *dev_priv)
106106
static int
107107
intel_alloc_mchbar_resource(struct drm_i915_private *dev_priv)
108108
{
109-
int reg = INTEL_GEN(dev_priv) >= 4 ? MCHBAR_I965 : MCHBAR_I915;
109+
int reg = GRAPHICS_VER(dev_priv) >= 4 ? MCHBAR_I965 : MCHBAR_I915;
110110
u32 temp_lo, temp_hi = 0;
111111
u64 mchbar_addr;
112112
int ret;
113113

114-
if (INTEL_GEN(dev_priv) >= 4)
114+
if (GRAPHICS_VER(dev_priv) >= 4)
115115
pci_read_config_dword(dev_priv->bridge_dev, reg + 4, &temp_hi);
116116
pci_read_config_dword(dev_priv->bridge_dev, reg, &temp_lo);
117117
mchbar_addr = ((u64)temp_hi << 32) | temp_lo;
@@ -138,7 +138,7 @@ intel_alloc_mchbar_resource(struct drm_i915_private *dev_priv)
138138
return ret;
139139
}
140140

141-
if (INTEL_GEN(dev_priv) >= 4)
141+
if (GRAPHICS_VER(dev_priv) >= 4)
142142
pci_write_config_dword(dev_priv->bridge_dev, reg + 4,
143143
upper_32_bits(dev_priv->mch_res.start));
144144

@@ -151,7 +151,7 @@ intel_alloc_mchbar_resource(struct drm_i915_private *dev_priv)
151151
static void
152152
intel_setup_mchbar(struct drm_i915_private *dev_priv)
153153
{
154-
int mchbar_reg = INTEL_GEN(dev_priv) >= 4 ? MCHBAR_I965 : MCHBAR_I915;
154+
int mchbar_reg = GRAPHICS_VER(dev_priv) >= 4 ? MCHBAR_I965 : MCHBAR_I915;
155155
u32 temp;
156156
bool enabled;
157157

@@ -190,7 +190,7 @@ intel_setup_mchbar(struct drm_i915_private *dev_priv)
190190
static void
191191
intel_teardown_mchbar(struct drm_i915_private *dev_priv)
192192
{
193-
int mchbar_reg = INTEL_GEN(dev_priv) >= 4 ? MCHBAR_I965 : MCHBAR_I915;
193+
int mchbar_reg = GRAPHICS_VER(dev_priv) >= 4 ? MCHBAR_I965 : MCHBAR_I915;
194194

195195
if (dev_priv->mchbar_need_disable) {
196196
if (IS_I915G(dev_priv) || IS_I915GM(dev_priv)) {
@@ -475,7 +475,7 @@ static int i915_set_dma_info(struct drm_i915_private *i915)
475475
goto mask_err;
476476

477477
/* overlay on gen2 is broken and can't address above 1G */
478-
if (IS_GEN(i915, 2))
478+
if (GRAPHICS_VER(i915) == 2)
479479
mask_size = 30;
480480

481481
/*
@@ -601,7 +601,7 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
601601
* device. The kernel then disables that interrupt source and so
602602
* prevents the other device from working properly.
603603
*/
604-
if (INTEL_GEN(dev_priv) >= 5) {
604+
if (GRAPHICS_VER(dev_priv) >= 5) {
605605
if (pci_enable_msi(pdev) < 0)
606606
drm_dbg(&dev_priv->drm, "can't enable MSI");
607607
}
@@ -729,7 +729,7 @@ static void i915_welcome_messages(struct drm_i915_private *dev_priv)
729729
intel_platform_name(INTEL_INFO(dev_priv)->platform),
730730
intel_subplatform(RUNTIME_INFO(dev_priv),
731731
INTEL_INFO(dev_priv)->platform),
732-
INTEL_GEN(dev_priv));
732+
GRAPHICS_VER(dev_priv));
733733

734734
intel_device_info_print_static(INTEL_INFO(dev_priv), &p);
735735
intel_device_info_print_runtime(RUNTIME_INFO(dev_priv), &p);
@@ -803,7 +803,7 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
803803
*/
804804
#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
805805
if (IS_ENABLED(CONFIG_DRM_I915_UNSTABLE_FAKE_LMEM)) {
806-
if (INTEL_GEN(i915) >= 9 && i915_selftest.live < 0 &&
806+
if (GRAPHICS_VER(i915) >= 9 && i915_selftest.live < 0 &&
807807
i915->params.fake_lmem_start) {
808808
mkwrite_device_info(i915)->memory_regions =
809809
REGION_SMEM | REGION_LMEM | REGION_STOLEN_SMEM;
@@ -1182,7 +1182,7 @@ static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
11821182
* Fujitsu FSC S7110
11831183
* Acer Aspire 1830T
11841184
*/
1185-
if (!(hibernation && INTEL_GEN(dev_priv) < 6))
1185+
if (!(hibernation && GRAPHICS_VER(dev_priv) < 6))
11861186
pci_set_power_state(pdev, PCI_D3hot);
11871187

11881188
out:

drivers/gpu/drm/i915/i915_gem.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
432432
/* PREAD is disallowed for all platforms after TGL-LP. This also
433433
* covers all platforms with local memory.
434434
*/
435-
if (INTEL_GEN(i915) >= 12 && !IS_TIGERLAKE(i915))
435+
if (GRAPHICS_VER(i915) >= 12 && !IS_TIGERLAKE(i915))
436436
return -EOPNOTSUPP;
437437

438438
if (args->size == 0)
@@ -712,7 +712,7 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
712712
/* PWRITE is disallowed for all platforms after TGL-LP. This also
713713
* covers all platforms with local memory.
714714
*/
715-
if (INTEL_GEN(i915) >= 12 && !IS_TIGERLAKE(i915))
715+
if (GRAPHICS_VER(i915) >= 12 && !IS_TIGERLAKE(i915))
716716
return -EOPNOTSUPP;
717717

718718
if (args->size == 0)

0 commit comments

Comments
 (0)