Skip to content

Commit 01b2b8c

Browse files
author
Andi Shyti
committed
drm/i915/gt: Create the gt_to_guc() wrapper
We already have guc_to_gt() and getting to guc from the GT it requires some mental effort. Add the gt_to_guc(). Given the reference to the "gt", the gt_to_guc() will return the pinter to the "guc". Update all the files under the gt/ directory. Signed-off-by: Andi Shyti <[email protected]> Reviewed-by: Nirmoy Das <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent db7bbd1 commit 01b2b8c

File tree

10 files changed

+25
-23
lines changed

10 files changed

+25
-23
lines changed

drivers/gpu/drm/i915/gt/intel_engine_cs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ u64 intel_clamp_preempt_timeout_ms(struct intel_engine_cs *engine, u64 value)
589589
* NB: The GuC API only supports 32bit values. However, the limit is further
590590
* reduced due to internal calculations which would otherwise overflow.
591591
*/
592-
if (intel_guc_submission_is_wanted(&engine->gt->uc.guc))
592+
if (intel_guc_submission_is_wanted(gt_to_guc(engine->gt)))
593593
value = min_t(u64, value, guc_policy_max_preempt_timeout_ms());
594594

595595
value = min_t(u64, value, jiffies_to_msecs(MAX_SCHEDULE_TIMEOUT));
@@ -610,7 +610,7 @@ u64 intel_clamp_timeslice_duration_ms(struct intel_engine_cs *engine, u64 value)
610610
* NB: The GuC API only supports 32bit values. However, the limit is further
611611
* reduced due to internal calculations which would otherwise overflow.
612612
*/
613-
if (intel_guc_submission_is_wanted(&engine->gt->uc.guc))
613+
if (intel_guc_submission_is_wanted(gt_to_guc(engine->gt)))
614614
value = min_t(u64, value, guc_policy_max_exec_quantum_ms());
615615

616616
value = min_t(u64, value, jiffies_to_msecs(MAX_SCHEDULE_TIMEOUT));

drivers/gpu/drm/i915/gt/intel_ggtt.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,8 @@ static void guc_ggtt_ct_invalidate(struct intel_gt *gt)
230230
struct intel_uncore *uncore = gt->uncore;
231231
intel_wakeref_t wakeref;
232232

233-
with_intel_runtime_pm_if_active(uncore->rpm, wakeref) {
234-
struct intel_guc *guc = &gt->uc.guc;
235-
236-
intel_guc_invalidate_tlb_guc(guc);
237-
}
233+
with_intel_runtime_pm_if_active(uncore->rpm, wakeref)
234+
intel_guc_invalidate_tlb_guc(gt_to_guc(gt));
238235
}
239236

240237
static void guc_ggtt_invalidate(struct i915_ggtt *ggtt)
@@ -245,7 +242,7 @@ static void guc_ggtt_invalidate(struct i915_ggtt *ggtt)
245242
gen8_ggtt_invalidate(ggtt);
246243

247244
list_for_each_entry(gt, &ggtt->gt_list, ggtt_link) {
248-
if (intel_guc_tlb_invalidation_is_available(&gt->uc.guc))
245+
if (intel_guc_tlb_invalidation_is_available(gt_to_guc(gt)))
249246
guc_ggtt_ct_invalidate(gt);
250247
else if (GRAPHICS_VER(i915) >= 12)
251248
intel_uncore_write_fw(gt->uncore,

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ static inline struct drm_i915_private *guc_to_i915(struct intel_guc *guc)
123123
return guc_to_gt(guc)->i915;
124124
}
125125

126+
static inline struct intel_guc *gt_to_guc(struct intel_gt *gt)
127+
{
128+
return &gt->uc.guc;
129+
}
130+
126131
void intel_gt_common_init_early(struct intel_gt *gt);
127132
int intel_root_gt_init_early(struct drm_i915_private *i915);
128133
int intel_gt_assign_ggtt(struct intel_gt *gt);

drivers/gpu/drm/i915/gt/intel_gt_irq.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ gen11_other_irq_handler(struct intel_gt *gt, const u8 instance,
6868
struct intel_gt *media_gt = gt->i915->media_gt;
6969

7070
if (instance == OTHER_GUC_INSTANCE)
71-
return guc_irq_handler(&gt->uc.guc, iir);
71+
return guc_irq_handler(gt_to_guc(gt), iir);
7272
if (instance == OTHER_MEDIA_GUC_INSTANCE && media_gt)
73-
return guc_irq_handler(&media_gt->uc.guc, iir);
73+
return guc_irq_handler(gt_to_guc(media_gt), iir);
7474

7575
if (instance == OTHER_GTPM_INSTANCE)
7676
return gen11_rps_irq_handler(&gt->rps, iir);
@@ -442,7 +442,7 @@ void gen8_gt_irq_handler(struct intel_gt *gt, u32 master_ctl)
442442
iir = raw_reg_read(regs, GEN8_GT_IIR(2));
443443
if (likely(iir)) {
444444
gen6_rps_irq_handler(&gt->rps, iir);
445-
guc_irq_handler(&gt->uc.guc, iir >> 16);
445+
guc_irq_handler(gt_to_guc(gt), iir >> 16);
446446
raw_reg_write(regs, GEN8_GT_IIR(2), iir);
447447
}
448448
}

drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ static bool rps_eval(void *data)
538538
{
539539
struct intel_gt *gt = data;
540540

541-
if (intel_guc_slpc_is_used(&gt->uc.guc))
541+
if (intel_guc_slpc_is_used(gt_to_guc(gt)))
542542
return false;
543543
else
544544
return HAS_RPS(gt->i915);

drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ static ssize_t slpc_ignore_eff_freq_show(struct kobject *kobj,
442442
char *buff)
443443
{
444444
struct intel_gt *gt = intel_gt_sysfs_get_drvdata(kobj, attr->attr.name);
445-
struct intel_guc_slpc *slpc = &gt->uc.guc.slpc;
445+
struct intel_guc_slpc *slpc = &gt_to_guc(gt)->slpc;
446446

447447
return sysfs_emit(buff, "%u\n", slpc->ignore_eff_freq);
448448
}
@@ -452,7 +452,7 @@ static ssize_t slpc_ignore_eff_freq_store(struct kobject *kobj,
452452
const char *buff, size_t count)
453453
{
454454
struct intel_gt *gt = intel_gt_sysfs_get_drvdata(kobj, attr->attr.name);
455-
struct intel_guc_slpc *slpc = &gt->uc.guc.slpc;
455+
struct intel_guc_slpc *slpc = &gt_to_guc(gt)->slpc;
456456
int err;
457457
u32 val;
458458

@@ -573,7 +573,7 @@ static ssize_t media_freq_factor_show(struct kobject *kobj,
573573
char *buff)
574574
{
575575
struct intel_gt *gt = intel_gt_sysfs_get_drvdata(kobj, attr->attr.name);
576-
struct intel_guc_slpc *slpc = &gt->uc.guc.slpc;
576+
struct intel_guc_slpc *slpc = &gt_to_guc(gt)->slpc;
577577
intel_wakeref_t wakeref;
578578
u32 mode;
579579

@@ -604,7 +604,7 @@ static ssize_t media_freq_factor_store(struct kobject *kobj,
604604
const char *buff, size_t count)
605605
{
606606
struct intel_gt *gt = intel_gt_sysfs_get_drvdata(kobj, attr->attr.name);
607-
struct intel_guc_slpc *slpc = &gt->uc.guc.slpc;
607+
struct intel_guc_slpc *slpc = &gt_to_guc(gt)->slpc;
608608
u32 factor, mode;
609609
int err;
610610

drivers/gpu/drm/i915/gt/intel_rc6.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static void gen11_rc6_enable(struct intel_rc6 *rc6)
109109
* thus allowing GuC to control RC6 entry/exit fully instead.
110110
* We will not set the HW ENABLE and EI bits
111111
*/
112-
if (!intel_guc_rc_enable(&gt->uc.guc))
112+
if (!intel_guc_rc_enable(gt_to_guc(gt)))
113113
rc6->ctl_enable = GEN6_RC_CTL_RC6_ENABLE;
114114
else
115115
rc6->ctl_enable =
@@ -569,7 +569,7 @@ static void __intel_rc6_disable(struct intel_rc6 *rc6)
569569
struct intel_gt *gt = rc6_to_gt(rc6);
570570

571571
/* Take control of RC6 back from GuC */
572-
intel_guc_rc_disable(&gt->uc.guc);
572+
intel_guc_rc_disable(gt_to_guc(gt));
573573

574574
intel_uncore_forcewake_get(uncore, FORCEWAKE_ALL);
575575
if (GRAPHICS_VER(i915) >= 9)

drivers/gpu/drm/i915/gt/intel_rps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static struct intel_guc_slpc *rps_to_slpc(struct intel_rps *rps)
5252
{
5353
struct intel_gt *gt = rps_to_gt(rps);
5454

55-
return &gt->uc.guc.slpc;
55+
return &gt_to_guc(gt)->slpc;
5656
}
5757

5858
static bool rps_uses_slpc(struct intel_rps *rps)

drivers/gpu/drm/i915/gt/intel_tlb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ void intel_gt_invalidate_tlb_full(struct intel_gt *gt, u32 seqno)
132132
return;
133133

134134
with_intel_gt_pm_if_awake(gt, wakeref) {
135-
struct intel_guc *guc = &gt->uc.guc;
135+
struct intel_guc *guc = gt_to_guc(gt);
136136

137137
mutex_lock(&gt->tlb.invalidate_lock);
138138
if (tlb_seqno_passed(gt, seqno))

drivers/gpu/drm/i915/gt/selftest_slpc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static int slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 freq)
5353
static int slpc_set_freq(struct intel_gt *gt, u32 freq)
5454
{
5555
int err;
56-
struct intel_guc_slpc *slpc = &gt->uc.guc.slpc;
56+
struct intel_guc_slpc *slpc = &gt_to_guc(gt)->slpc;
5757

5858
err = slpc_set_max_freq(slpc, freq);
5959
if (err) {
@@ -182,7 +182,7 @@ static int vary_min_freq(struct intel_guc_slpc *slpc, struct intel_rps *rps,
182182

183183
static int slpc_power(struct intel_gt *gt, struct intel_engine_cs *engine)
184184
{
185-
struct intel_guc_slpc *slpc = &gt->uc.guc.slpc;
185+
struct intel_guc_slpc *slpc = &gt_to_guc(gt)->slpc;
186186
struct {
187187
u64 power;
188188
int freq;
@@ -262,7 +262,7 @@ static int max_granted_freq(struct intel_guc_slpc *slpc, struct intel_rps *rps,
262262

263263
static int run_test(struct intel_gt *gt, int test_type)
264264
{
265-
struct intel_guc_slpc *slpc = &gt->uc.guc.slpc;
265+
struct intel_guc_slpc *slpc = &gt_to_guc(gt)->slpc;
266266
struct intel_rps *rps = &gt->rps;
267267
struct intel_engine_cs *engine;
268268
enum intel_engine_id id;

0 commit comments

Comments
 (0)