31
31
#define FORCEWAKE_ACK_TIMEOUT_MS 50
32
32
#define GT_FIFO_TIMEOUT_MS 10
33
33
34
- #define __raw_posting_read (dev_priv__ , reg__ ) (void)__raw_i915_read32((dev_priv__ ), (reg__))
34
+ #define __raw_posting_read (uncore__ , reg__ ) (void)__raw_i915_read32((uncore__ ), (reg__))
35
35
36
36
static const char * const forcewake_domain_names [] = {
37
37
"render" ,
@@ -275,23 +275,23 @@ fw_domains_reset(struct intel_uncore *uncore,
275
275
fw_domain_reset (d );
276
276
}
277
277
278
- static inline u32 gt_thread_status (struct drm_i915_private * dev_priv )
278
+ static inline u32 gt_thread_status (struct intel_uncore * uncore )
279
279
{
280
280
u32 val ;
281
281
282
- val = __raw_i915_read32 (dev_priv , GEN6_GT_THREAD_STATUS_REG );
282
+ val = __raw_i915_read32 (uncore , GEN6_GT_THREAD_STATUS_REG );
283
283
val &= GEN6_GT_THREAD_STATUS_CORE_MASK ;
284
284
285
285
return val ;
286
286
}
287
287
288
- static void __gen6_gt_wait_for_thread_c0 (struct drm_i915_private * dev_priv )
288
+ static void __gen6_gt_wait_for_thread_c0 (struct intel_uncore * uncore )
289
289
{
290
290
/*
291
291
* w/a for a sporadic read returning 0 by waiting for the GT
292
292
* thread to wake up.
293
293
*/
294
- WARN_ONCE (wait_for_atomic_us (gt_thread_status (dev_priv ) == 0 , 5000 ),
294
+ WARN_ONCE (wait_for_atomic_us (gt_thread_status (uncore ) == 0 , 5000 ),
295
295
"GT thread status wait timed out\n" );
296
296
}
297
297
@@ -301,30 +301,29 @@ static void fw_domains_get_with_thread_status(struct intel_uncore *uncore,
301
301
fw_domains_get (uncore , fw_domains );
302
302
303
303
/* WaRsForcewakeWaitTC0:snb,ivb,hsw,bdw,vlv */
304
- __gen6_gt_wait_for_thread_c0 (uncore_to_i915 ( uncore ) );
304
+ __gen6_gt_wait_for_thread_c0 (uncore );
305
305
}
306
306
307
- static inline u32 fifo_free_entries (struct drm_i915_private * dev_priv )
307
+ static inline u32 fifo_free_entries (struct intel_uncore * uncore )
308
308
{
309
- u32 count = __raw_i915_read32 (dev_priv , GTFIFOCTL );
309
+ u32 count = __raw_i915_read32 (uncore , GTFIFOCTL );
310
310
311
311
return count & GT_FIFO_FREE_ENTRIES_MASK ;
312
312
}
313
313
314
- static void __gen6_gt_wait_for_fifo (struct drm_i915_private * dev_priv )
314
+ static void __gen6_gt_wait_for_fifo (struct intel_uncore * uncore )
315
315
{
316
- struct intel_uncore * uncore = & dev_priv -> uncore ;
317
316
u32 n ;
318
317
319
318
/* On VLV, FIFO will be shared by both SW and HW.
320
319
* So, we need to read the FREE_ENTRIES everytime */
321
- if (IS_VALLEYVIEW (dev_priv ))
322
- n = fifo_free_entries (dev_priv );
320
+ if (IS_VALLEYVIEW (uncore_to_i915 ( uncore ) ))
321
+ n = fifo_free_entries (uncore );
323
322
else
324
323
n = uncore -> fifo_count ;
325
324
326
325
if (n <= GT_FIFO_NUM_RESERVED_ENTRIES ) {
327
- if (wait_for_atomic ((n = fifo_free_entries (dev_priv )) >
326
+ if (wait_for_atomic ((n = fifo_free_entries (uncore )) >
328
327
GT_FIFO_NUM_RESERVED_ENTRIES ,
329
328
GT_FIFO_TIMEOUT_MS )) {
330
329
DRM_DEBUG ("GT_FIFO timeout, entries: %u\n" , n );
@@ -452,7 +451,7 @@ static void intel_uncore_edram_detect(struct drm_i915_private *dev_priv)
452
451
if (IS_HASWELL (dev_priv ) ||
453
452
IS_BROADWELL (dev_priv ) ||
454
453
INTEL_GEN (dev_priv ) >= 9 ) {
455
- dev_priv -> edram_cap = __raw_i915_read32 (dev_priv ,
454
+ dev_priv -> edram_cap = __raw_i915_read32 (& dev_priv -> uncore ,
456
455
HSW_EDRAM_CAP );
457
456
458
457
/* NB: We can't write IDICR yet because we do not have gt funcs
@@ -467,43 +466,43 @@ static void intel_uncore_edram_detect(struct drm_i915_private *dev_priv)
467
466
}
468
467
469
468
static bool
470
- fpga_check_for_unclaimed_mmio (struct drm_i915_private * dev_priv )
469
+ fpga_check_for_unclaimed_mmio (struct intel_uncore * uncore )
471
470
{
472
471
u32 dbg ;
473
472
474
- dbg = __raw_i915_read32 (dev_priv , FPGA_DBG );
473
+ dbg = __raw_i915_read32 (uncore , FPGA_DBG );
475
474
if (likely (!(dbg & FPGA_DBG_RM_NOCLAIM )))
476
475
return false;
477
476
478
- __raw_i915_write32 (dev_priv , FPGA_DBG , FPGA_DBG_RM_NOCLAIM );
477
+ __raw_i915_write32 (uncore , FPGA_DBG , FPGA_DBG_RM_NOCLAIM );
479
478
480
479
return true;
481
480
}
482
481
483
482
static bool
484
- vlv_check_for_unclaimed_mmio (struct drm_i915_private * dev_priv )
483
+ vlv_check_for_unclaimed_mmio (struct intel_uncore * uncore )
485
484
{
486
485
u32 cer ;
487
486
488
- cer = __raw_i915_read32 (dev_priv , CLAIM_ER );
487
+ cer = __raw_i915_read32 (uncore , CLAIM_ER );
489
488
if (likely (!(cer & (CLAIM_ER_OVERFLOW | CLAIM_ER_CTR_MASK ))))
490
489
return false;
491
490
492
- __raw_i915_write32 (dev_priv , CLAIM_ER , CLAIM_ER_CLR );
491
+ __raw_i915_write32 (uncore , CLAIM_ER , CLAIM_ER_CLR );
493
492
494
493
return true;
495
494
}
496
495
497
496
static bool
498
- gen6_check_for_fifo_debug (struct drm_i915_private * dev_priv )
497
+ gen6_check_for_fifo_debug (struct intel_uncore * uncore )
499
498
{
500
499
u32 fifodbg ;
501
500
502
- fifodbg = __raw_i915_read32 (dev_priv , GTFIFODBG );
501
+ fifodbg = __raw_i915_read32 (uncore , GTFIFODBG );
503
502
504
503
if (unlikely (fifodbg )) {
505
504
DRM_DEBUG_DRIVER ("GTFIFODBG = 0x08%x\n" , fifodbg );
506
- __raw_i915_write32 (dev_priv , GTFIFODBG , fifodbg );
505
+ __raw_i915_write32 (uncore , GTFIFODBG , fifodbg );
507
506
}
508
507
509
508
return fifodbg ;
@@ -512,16 +511,17 @@ gen6_check_for_fifo_debug(struct drm_i915_private *dev_priv)
512
511
static bool
513
512
check_for_unclaimed_mmio (struct drm_i915_private * dev_priv )
514
513
{
514
+ struct intel_uncore * uncore = & dev_priv -> uncore ;
515
515
bool ret = false;
516
516
517
517
if (HAS_FPGA_DBG_UNCLAIMED (dev_priv ))
518
- ret |= fpga_check_for_unclaimed_mmio (dev_priv );
518
+ ret |= fpga_check_for_unclaimed_mmio (uncore );
519
519
520
520
if (IS_VALLEYVIEW (dev_priv ) || IS_CHERRYVIEW (dev_priv ))
521
- ret |= vlv_check_for_unclaimed_mmio (dev_priv );
521
+ ret |= vlv_check_for_unclaimed_mmio (uncore );
522
522
523
523
if (IS_GEN_RANGE (dev_priv , 6 , 7 ))
524
- ret |= gen6_check_for_fifo_debug (dev_priv );
524
+ ret |= gen6_check_for_fifo_debug (uncore );
525
525
526
526
return ret ;
527
527
}
@@ -537,8 +537,8 @@ static void __intel_uncore_early_sanitize(struct intel_uncore *uncore,
537
537
538
538
/* WaDisableShadowRegForCpd:chv */
539
539
if (IS_CHERRYVIEW (i915 )) {
540
- __raw_i915_write32 (i915 , GTFIFOCTL ,
541
- __raw_i915_read32 (i915 , GTFIFOCTL ) |
540
+ __raw_i915_write32 (uncore , GTFIFOCTL ,
541
+ __raw_i915_read32 (uncore , GTFIFOCTL ) |
542
542
GT_FIFO_CTL_BLOCK_ALL_POLICY_STALL |
543
543
GT_FIFO_CTL_RC6_POLICY_STALL );
544
544
}
@@ -550,7 +550,7 @@ static void __intel_uncore_early_sanitize(struct intel_uncore *uncore,
550
550
uncore -> funcs .force_wake_get (uncore , restore_forcewake );
551
551
552
552
if (IS_GEN_RANGE (i915 , 6 , 7 ))
553
- uncore -> fifo_count = fifo_free_entries (i915 );
553
+ uncore -> fifo_count = fifo_free_entries (uncore );
554
554
spin_unlock_irq (& uncore -> lock );
555
555
}
556
556
iosf_mbi_punit_release ();
@@ -1063,12 +1063,12 @@ static const struct intel_forcewake_range __gen11_fw_ranges[] = {
1063
1063
};
1064
1064
1065
1065
static void
1066
- ilk_dummy_write (struct drm_i915_private * dev_priv )
1066
+ ilk_dummy_write (struct intel_uncore * uncore )
1067
1067
{
1068
1068
/* WaIssueDummyWriteToWakeupFromRC6:ilk Issue a dummy write to wake up
1069
1069
* the chip from rc6 before touching it for real. MI_MODE is masked,
1070
1070
* hence harmless to write 0 into. */
1071
- __raw_i915_write32 (dev_priv , MI_MODE , 0 );
1071
+ __raw_i915_write32 (uncore , MI_MODE , 0 );
1072
1072
}
1073
1073
1074
1074
static void
@@ -1098,6 +1098,7 @@ unclaimed_reg_debug(struct drm_i915_private *dev_priv,
1098
1098
}
1099
1099
1100
1100
#define GEN2_READ_HEADER (x ) \
1101
+ struct intel_uncore *uncore = &dev_priv->uncore; \
1101
1102
u##x val = 0; \
1102
1103
assert_rpm_wakelock_held(dev_priv);
1103
1104
@@ -1109,16 +1110,16 @@ unclaimed_reg_debug(struct drm_i915_private *dev_priv,
1109
1110
static u##x \
1110
1111
gen2_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \
1111
1112
GEN2_READ_HEADER(x); \
1112
- val = __raw_i915_read##x(dev_priv , reg); \
1113
+ val = __raw_i915_read##x(uncore , reg); \
1113
1114
GEN2_READ_FOOTER; \
1114
1115
}
1115
1116
1116
1117
#define __gen5_read (x ) \
1117
1118
static u##x \
1118
1119
gen5_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) { \
1119
1120
GEN2_READ_HEADER(x); \
1120
- ilk_dummy_write(dev_priv ); \
1121
- val = __raw_i915_read##x(dev_priv , reg); \
1121
+ ilk_dummy_write(uncore ); \
1122
+ val = __raw_i915_read##x(uncore , reg); \
1122
1123
GEN2_READ_FOOTER; \
1123
1124
}
1124
1125
@@ -1188,7 +1189,7 @@ func##_read##x(struct drm_i915_private *dev_priv, i915_reg_t reg, bool trace) {
1188
1189
fw_engine = __##func##_reg_read_fw_domains(uncore, offset); \
1189
1190
if (fw_engine) \
1190
1191
__force_wake_auto(uncore, fw_engine); \
1191
- val = __raw_i915_read##x(dev_priv , reg); \
1192
+ val = __raw_i915_read##x(uncore , reg); \
1192
1193
GEN6_READ_FOOTER; \
1193
1194
}
1194
1195
#define __gen6_read (x ) __gen_read(gen6, x)
@@ -1215,6 +1216,7 @@ __gen6_read(64)
1215
1216
#undef GEN6_READ_HEADER
1216
1217
1217
1218
#define GEN2_WRITE_HEADER \
1219
+ struct intel_uncore *uncore = &dev_priv->uncore; \
1218
1220
trace_i915_reg_rw(true, reg, val, sizeof(val), trace); \
1219
1221
assert_rpm_wakelock_held(dev_priv); \
1220
1222
@@ -1224,16 +1226,16 @@ __gen6_read(64)
1224
1226
static void \
1225
1227
gen2_write##x(struct drm_i915_private *dev_priv, i915_reg_t reg, u##x val, bool trace) { \
1226
1228
GEN2_WRITE_HEADER; \
1227
- __raw_i915_write##x(dev_priv , reg, val); \
1229
+ __raw_i915_write##x(uncore , reg, val); \
1228
1230
GEN2_WRITE_FOOTER; \
1229
1231
}
1230
1232
1231
1233
#define __gen5_write (x ) \
1232
1234
static void \
1233
1235
gen5_write##x(struct drm_i915_private *dev_priv, i915_reg_t reg, u##x val, bool trace) { \
1234
1236
GEN2_WRITE_HEADER; \
1235
- ilk_dummy_write(dev_priv ); \
1236
- __raw_i915_write##x(dev_priv , reg, val); \
1237
+ ilk_dummy_write(uncore ); \
1238
+ __raw_i915_write##x(uncore , reg, val); \
1237
1239
GEN2_WRITE_FOOTER; \
1238
1240
}
1239
1241
@@ -1268,8 +1270,8 @@ static void \
1268
1270
gen6_write##x(struct drm_i915_private *dev_priv, i915_reg_t reg, u##x val, bool trace) { \
1269
1271
GEN6_WRITE_HEADER; \
1270
1272
if (NEEDS_FORCE_WAKE(offset)) \
1271
- __gen6_gt_wait_for_fifo(dev_priv ); \
1272
- __raw_i915_write##x(dev_priv , reg, val); \
1273
+ __gen6_gt_wait_for_fifo(uncore ); \
1274
+ __raw_i915_write##x(uncore , reg, val); \
1273
1275
GEN6_WRITE_FOOTER; \
1274
1276
}
1275
1277
@@ -1281,7 +1283,7 @@ func##_write##x(struct drm_i915_private *dev_priv, i915_reg_t reg, u##x val, boo
1281
1283
fw_engine = __##func##_reg_write_fw_domains(uncore, offset); \
1282
1284
if (fw_engine) \
1283
1285
__force_wake_auto(uncore, fw_engine); \
1284
- __raw_i915_write##x(dev_priv , reg, val); \
1286
+ __raw_i915_write##x(uncore , reg, val); \
1285
1287
GEN6_WRITE_FOOTER; \
1286
1288
}
1287
1289
#define __gen8_write (x ) __gen_write(gen8, x)
@@ -1468,15 +1470,15 @@ static void intel_uncore_fw_domains_init(struct intel_uncore *uncore)
1468
1470
* before the ecobus check.
1469
1471
*/
1470
1472
1471
- __raw_i915_write32 (i915 , FORCEWAKE , 0 );
1472
- __raw_posting_read (i915 , ECOBUS );
1473
+ __raw_i915_write32 (uncore , FORCEWAKE , 0 );
1474
+ __raw_posting_read (uncore , ECOBUS );
1473
1475
1474
1476
fw_domain_init (uncore , FW_DOMAIN_ID_RENDER ,
1475
1477
FORCEWAKE_MT , FORCEWAKE_MT_ACK );
1476
1478
1477
1479
spin_lock_irq (& uncore -> lock );
1478
1480
fw_domains_get_with_thread_status (uncore , FORCEWAKE_RENDER );
1479
- ecobus = __raw_i915_read32 (i915 , ECOBUS );
1481
+ ecobus = __raw_i915_read32 (uncore , ECOBUS );
1480
1482
fw_domains_put (uncore , FORCEWAKE_RENDER );
1481
1483
spin_unlock_irq (& uncore -> lock );
1482
1484
0 commit comments