Skip to content

Commit 3f2f20d

Browse files
author
Andi Shyti
committed
drm/i915/guc: Use the new gt_to_guc() wrapper
Get the guc reference from the gt using the gt_to_guc() helper. Signed-off-by: Andi Shyti <[email protected]> Reviewed-by: Nirmoy Das <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 01b2b8c commit 3f2f20d

File tree

9 files changed

+28
-27
lines changed

9 files changed

+28
-27
lines changed

drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ static int gsc_fw_load_prepare(struct intel_gsc_uc *gsc)
298298
memcpy_toio(gsc->local_vaddr, src, gsc->fw.size);
299299
memset_io(gsc->local_vaddr + gsc->fw.size, 0, gsc->local->size - gsc->fw.size);
300300

301-
intel_guc_write_barrier(&gt->uc.guc);
301+
intel_guc_write_barrier(gt_to_guc(gt));
302302

303303
i915_gem_object_unpin_map(gsc->fw.obj);
304304

@@ -351,7 +351,7 @@ static int gsc_fw_query_compatibility_version(struct intel_gsc_uc *gsc)
351351
void *vaddr;
352352
int err;
353353

354-
err = intel_guc_allocate_and_map_vma(&gt->uc.guc, GSC_VER_PKT_SZ * 2,
354+
err = intel_guc_allocate_and_map_vma(gt_to_guc(gt), GSC_VER_PKT_SZ * 2,
355355
&vma, &vaddr);
356356
if (err) {
357357
gt_err(gt, "failed to allocate vma for GSC version query\n");

drivers/gpu/drm/i915/gt/uc/intel_gsc_proxy.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,8 @@ static int proxy_channel_alloc(struct intel_gsc_uc *gsc)
358358
void *vaddr;
359359
int err;
360360

361-
err = intel_guc_allocate_and_map_vma(&gt->uc.guc, GSC_PROXY_CHANNEL_SIZE,
361+
err = intel_guc_allocate_and_map_vma(gt_to_guc(gt),
362+
GSC_PROXY_CHANNEL_SIZE,
362363
&vma, &vaddr);
363364
if (err)
364365
return err;

drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ u32 intel_guc_engine_usage_offset(struct intel_guc *guc)
961961

962962
struct iosys_map intel_guc_engine_usage_record_map(struct intel_engine_cs *engine)
963963
{
964-
struct intel_guc *guc = &engine->gt->uc.guc;
964+
struct intel_guc *guc = gt_to_guc(engine->gt);
965965
u8 guc_class = engine_class_to_guc_class(engine->class);
966966
size_t offset = offsetof(struct __guc_ads_blob,
967967
engine_usage.engines[guc_class][ilog2(engine->logical_mask)]);

drivers/gpu/drm/i915/gt/uc/intel_guc_capture.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,7 @@ int intel_guc_capture_print_engine_node(struct drm_i915_error_state_buf *ebuf,
14411441
if (!cap || !ee->engine)
14421442
return -ENODEV;
14431443

1444-
guc = &ee->engine->gt->uc.guc;
1444+
guc = gt_to_guc(ee->engine->gt);
14451445

14461446
i915_error_printf(ebuf, "global --- GuC Error Capture on %s command stream:\n",
14471447
ee->engine->name);
@@ -1543,7 +1543,7 @@ bool intel_guc_capture_is_matching_engine(struct intel_gt *gt,
15431543
if (!gt || !ce || !engine)
15441544
return false;
15451545

1546-
guc = &gt->uc.guc;
1546+
guc = gt_to_guc(gt);
15471547
if (!guc->capture)
15481548
return false;
15491549

@@ -1573,7 +1573,7 @@ void intel_guc_capture_get_matching_node(struct intel_gt *gt,
15731573
if (!gt || !ee || !ce)
15741574
return;
15751575

1576-
guc = &gt->uc.guc;
1576+
guc = gt_to_guc(gt);
15771577
if (!guc->capture)
15781578
return;
15791579

drivers/gpu/drm/i915/gt/uc/intel_guc_hwconfig.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ static bool has_table(struct drm_i915_private *i915)
111111
static int guc_hwconfig_init(struct intel_gt *gt)
112112
{
113113
struct intel_hwconfig *hwconfig = &gt->info.hwconfig;
114-
struct intel_guc *guc = &gt->uc.guc;
114+
struct intel_guc *guc = gt_to_guc(gt);
115115
int ret;
116116

117117
if (!has_table(gt->i915))

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ static inline void set_context_guc_id_invalid(struct intel_context *ce)
398398

399399
static inline struct intel_guc *ce_to_guc(struct intel_context *ce)
400400
{
401-
return &ce->engine->gt->uc.guc;
401+
return gt_to_guc(ce->engine->gt);
402402
}
403403

404404
static inline struct i915_priolist *to_priolist(struct rb_node *rb)
@@ -1246,7 +1246,7 @@ static void __get_engine_usage_record(struct intel_engine_cs *engine,
12461246
static void guc_update_engine_gt_clks(struct intel_engine_cs *engine)
12471247
{
12481248
struct intel_engine_guc_stats *stats = &engine->stats.guc;
1249-
struct intel_guc *guc = &engine->gt->uc.guc;
1249+
struct intel_guc *guc = gt_to_guc(engine->gt);
12501250
u32 last_switch, ctx_id, total;
12511251

12521252
lockdep_assert_held(&guc->timestamp.lock);
@@ -1311,7 +1311,7 @@ static ktime_t guc_engine_busyness(struct intel_engine_cs *engine, ktime_t *now)
13111311
struct intel_engine_guc_stats stats_saved, *stats = &engine->stats.guc;
13121312
struct i915_gpu_error *gpu_error = &engine->i915->gpu_error;
13131313
struct intel_gt *gt = engine->gt;
1314-
struct intel_guc *guc = &gt->uc.guc;
1314+
struct intel_guc *guc = gt_to_guc(gt);
13151315
u64 total, gt_stamp_saved;
13161316
unsigned long flags;
13171317
u32 reset_count;
@@ -1576,7 +1576,7 @@ static void guc_fini_engine_stats(struct intel_guc *guc)
15761576

15771577
void intel_guc_busyness_park(struct intel_gt *gt)
15781578
{
1579-
struct intel_guc *guc = &gt->uc.guc;
1579+
struct intel_guc *guc = gt_to_guc(gt);
15801580

15811581
if (!guc_submission_initialized(guc))
15821582
return;
@@ -1603,7 +1603,7 @@ void intel_guc_busyness_park(struct intel_gt *gt)
16031603

16041604
void intel_guc_busyness_unpark(struct intel_gt *gt)
16051605
{
1606-
struct intel_guc *guc = &gt->uc.guc;
1606+
struct intel_guc *guc = gt_to_guc(gt);
16071607
unsigned long flags;
16081608
ktime_t unused;
16091609

@@ -2194,7 +2194,7 @@ static bool need_tasklet(struct intel_guc *guc, struct i915_request *rq)
21942194
static void guc_submit_request(struct i915_request *rq)
21952195
{
21962196
struct i915_sched_engine *sched_engine = rq->engine->sched_engine;
2197-
struct intel_guc *guc = &rq->engine->gt->uc.guc;
2197+
struct intel_guc *guc = gt_to_guc(rq->engine->gt);
21982198
unsigned long flags;
21992199

22002200
/* Will be called from irq-context when using foreign fences. */
@@ -2660,7 +2660,7 @@ static int __guc_context_set_context_policies(struct intel_guc *guc,
26602660
static int guc_context_policy_init_v70(struct intel_context *ce, bool loop)
26612661
{
26622662
struct intel_engine_cs *engine = ce->engine;
2663-
struct intel_guc *guc = &engine->gt->uc.guc;
2663+
struct intel_guc *guc = gt_to_guc(engine->gt);
26642664
struct context_policy policy;
26652665
u32 execution_quantum;
26662666
u32 preemption_timeout;
@@ -2736,7 +2736,7 @@ static u32 map_guc_prio_to_lrc_desc_prio(u8 prio)
27362736
static void prepare_context_registration_info_v69(struct intel_context *ce)
27372737
{
27382738
struct intel_engine_cs *engine = ce->engine;
2739-
struct intel_guc *guc = &engine->gt->uc.guc;
2739+
struct intel_guc *guc = gt_to_guc(engine->gt);
27402740
u32 ctx_id = ce->guc_id.id;
27412741
struct guc_lrc_desc_v69 *desc;
27422742
struct intel_context *child;
@@ -2805,7 +2805,7 @@ static void prepare_context_registration_info_v70(struct intel_context *ce,
28052805
struct guc_ctxt_registration_info *info)
28062806
{
28072807
struct intel_engine_cs *engine = ce->engine;
2808-
struct intel_guc *guc = &engine->gt->uc.guc;
2808+
struct intel_guc *guc = gt_to_guc(engine->gt);
28092809
u32 ctx_id = ce->guc_id.id;
28102810

28112811
GEM_BUG_ON(!engine->mask);
@@ -2868,7 +2868,7 @@ static int try_context_registration(struct intel_context *ce, bool loop)
28682868
{
28692869
struct intel_engine_cs *engine = ce->engine;
28702870
struct intel_runtime_pm *runtime_pm = engine->uncore->rpm;
2871-
struct intel_guc *guc = &engine->gt->uc.guc;
2871+
struct intel_guc *guc = gt_to_guc(engine->gt);
28722872
intel_wakeref_t wakeref;
28732873
u32 ctx_id = ce->guc_id.id;
28742874
bool context_registered;
@@ -4549,7 +4549,7 @@ static void guc_sched_engine_destroy(struct kref *kref)
45494549
int intel_guc_submission_setup(struct intel_engine_cs *engine)
45504550
{
45514551
struct drm_i915_private *i915 = engine->i915;
4552-
struct intel_guc *guc = &engine->gt->uc.guc;
4552+
struct intel_guc *guc = gt_to_guc(engine->gt);
45534553

45544554
/*
45554555
* The setup relies on several assumptions (e.g. irqs always enabled)
@@ -5308,7 +5308,7 @@ int intel_guc_engine_failure_process_msg(struct intel_guc *guc,
53085308

53095309
void intel_guc_find_hung_context(struct intel_engine_cs *engine)
53105310
{
5311-
struct intel_guc *guc = &engine->gt->uc.guc;
5311+
struct intel_guc *guc = gt_to_guc(engine->gt);
53125312
struct intel_context *ce;
53135313
struct i915_request *rq;
53145314
unsigned long index;
@@ -5370,7 +5370,7 @@ void intel_guc_dump_active_requests(struct intel_engine_cs *engine,
53705370
struct i915_request *hung_rq,
53715371
struct drm_printer *m)
53725372
{
5373-
struct intel_guc *guc = &engine->gt->uc.guc;
5373+
struct intel_guc *guc = gt_to_guc(engine->gt);
53745374
struct intel_context *ce;
53755375
unsigned long index;
53765376
unsigned long flags;
@@ -5822,7 +5822,7 @@ guc_create_virtual(struct intel_engine_cs **siblings, unsigned int count,
58225822
if (!ve)
58235823
return ERR_PTR(-ENOMEM);
58245824

5825-
guc = &siblings[0]->gt->uc.guc;
5825+
guc = gt_to_guc(siblings[0]->gt);
58265826

58275827
ve->base.i915 = siblings[0]->i915;
58285828
ve->base.gt = siblings[0]->gt;

drivers/gpu/drm/i915/gt/uc/intel_huc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ int intel_huc_init(struct intel_huc *huc)
385385
if (HAS_ENGINE(gt, GSC0)) {
386386
struct i915_vma *vma;
387387

388-
vma = intel_guc_allocate_vma(&gt->uc.guc, PXP43_HUC_AUTH_INOUT_SIZE * 2);
388+
vma = intel_guc_allocate_vma(gt_to_guc(gt), PXP43_HUC_AUTH_INOUT_SIZE * 2);
389389
if (IS_ERR(vma)) {
390390
err = PTR_ERR(vma);
391391
huc_info(huc, "Failed to allocate heci pkt\n");
@@ -540,7 +540,7 @@ int intel_huc_wait_for_auth_complete(struct intel_huc *huc,
540540
int intel_huc_auth(struct intel_huc *huc, enum intel_huc_authentication_type type)
541541
{
542542
struct intel_gt *gt = huc_to_gt(huc);
543-
struct intel_guc *guc = &gt->uc.guc;
543+
struct intel_guc *guc = gt_to_guc(gt);
544544
int ret;
545545

546546
if (!intel_uc_fw_is_loaded(&huc->fw))

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ static int try_firmware_load(struct intel_uc_fw *uc_fw, const struct firmware **
807807
static int check_mtl_huc_guc_compatibility(struct intel_gt *gt,
808808
struct intel_uc_fw_file *huc_selected)
809809
{
810-
struct intel_uc_fw_file *guc_selected = &gt->uc.guc.fw.file_selected;
810+
struct intel_uc_fw_file *guc_selected = &gt_to_guc(gt)->fw.file_selected;
811811
struct intel_uc_fw_ver *huc_ver = &huc_selected->ver;
812812
struct intel_uc_fw_ver *guc_ver = &guc_selected->ver;
813813
bool new_huc, new_guc;
@@ -1209,7 +1209,7 @@ static int uc_fw_rsa_data_create(struct intel_uc_fw *uc_fw)
12091209
* since its GGTT offset will be GuC accessible.
12101210
*/
12111211
GEM_BUG_ON(uc_fw->rsa_size > PAGE_SIZE);
1212-
vma = intel_guc_allocate_vma(&gt->uc.guc, PAGE_SIZE);
1212+
vma = intel_guc_allocate_vma(gt_to_guc(gt), PAGE_SIZE);
12131213
if (IS_ERR(vma))
12141214
return PTR_ERR(vma);
12151215

drivers/gpu/drm/i915/gt/uc/selftest_guc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static int intel_guc_scrub_ctbs(void *arg)
144144
static int intel_guc_steal_guc_ids(void *arg)
145145
{
146146
struct intel_gt *gt = arg;
147-
struct intel_guc *guc = &gt->uc.guc;
147+
struct intel_guc *guc = gt_to_guc(gt);
148148
int ret, sv, context_index = 0;
149149
intel_wakeref_t wakeref;
150150
struct intel_engine_cs *engine;

0 commit comments

Comments
 (0)