Skip to content

Commit 11654b3

Browse files
committed
Merge tag 'drm-intel-fixes-2021-09-16' of ssh://git.freedesktop.org/git/drm/drm-intel into drm-fixes
drm/i915 fixes for v5.15-rc2: - Propagate DP link training error returns - Use max link params for eDP 1.3 and earlier - Build warning fixes - Gem selftest fixes - Ensure wakeref is held before hardware access Signed-off-by: Dave Airlie <airlied@redhat.com> From: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/8735q4wsu7.fsf@intel.com
2 parents da4ce47 + 7889367 commit 11654b3

File tree

8 files changed

+42
-24
lines changed

8 files changed

+42
-24
lines changed

drivers/gpu/drm/i915/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ subdir-ccflags-y += $(call cc-disable-warning, missing-field-initializers)
1919
subdir-ccflags-y += $(call cc-disable-warning, unused-but-set-variable)
2020
# clang warnings
2121
subdir-ccflags-y += $(call cc-disable-warning, sign-compare)
22-
subdir-ccflags-y += $(call cc-disable-warning, sometimes-uninitialized)
2322
subdir-ccflags-y += $(call cc-disable-warning, initializer-overrides)
2423
subdir-ccflags-y += $(call cc-disable-warning, frame-address)
2524
subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror

drivers/gpu/drm/i915/display/intel_dp.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2445,11 +2445,14 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
24452445
*/
24462446
if (drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,
24472447
intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) ==
2448-
sizeof(intel_dp->edp_dpcd))
2448+
sizeof(intel_dp->edp_dpcd)) {
24492449
drm_dbg_kms(&dev_priv->drm, "eDP DPCD: %*ph\n",
24502450
(int)sizeof(intel_dp->edp_dpcd),
24512451
intel_dp->edp_dpcd);
24522452

2453+
intel_dp->use_max_params = intel_dp->edp_dpcd[0] < DP_EDP_14;
2454+
}
2455+
24532456
/*
24542457
* This has to be called after intel_dp->edp_dpcd is filled, PSR checks
24552458
* for SET_POWER_CAPABLE bit in intel_dp->edp_dpcd[1]

drivers/gpu/drm/i915/display/intel_dp_link_training.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ intel_dp_link_train_all_phys(struct intel_dp *intel_dp,
848848
}
849849

850850
if (ret)
851-
intel_dp_link_train_phy(intel_dp, crtc_state, DP_PHY_DPRX);
851+
ret = intel_dp_link_train_phy(intel_dp, crtc_state, DP_PHY_DPRX);
852852

853853
if (intel_dp->set_idle_link_train)
854854
intel_dp->set_idle_link_train(intel_dp, crtc_state);

drivers/gpu/drm/i915/gem/i915_gem_context.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,9 @@ void i915_gem_context_release(struct kref *ref)
986986
trace_i915_context_free(ctx);
987987
GEM_BUG_ON(!i915_gem_context_is_closed(ctx));
988988

989+
if (ctx->syncobj)
990+
drm_syncobj_put(ctx->syncobj);
991+
989992
mutex_destroy(&ctx->engines_mutex);
990993
mutex_destroy(&ctx->lut_mutex);
991994

@@ -1205,9 +1208,6 @@ static void context_close(struct i915_gem_context *ctx)
12051208
if (vm)
12061209
i915_vm_close(vm);
12071210

1208-
if (ctx->syncobj)
1209-
drm_syncobj_put(ctx->syncobj);
1210-
12111211
ctx->file_priv = ERR_PTR(-EBADF);
12121212

12131213
/*

drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ static int igt_dmabuf_import_self(void *arg)
5959
err = PTR_ERR(import);
6060
goto out_dmabuf;
6161
}
62+
import_obj = to_intel_bo(import);
6263

6364
if (import != &obj->base) {
6465
pr_err("i915_gem_prime_import created a new object!\n");
6566
err = -EINVAL;
6667
goto out_import;
6768
}
68-
import_obj = to_intel_bo(import);
6969

7070
i915_gem_object_lock(import_obj, NULL);
7171
err = __i915_gem_object_get_pages(import_obj);
@@ -128,6 +128,8 @@ static int igt_dmabuf_import_same_driver_lmem(void *arg)
128128
pr_err("i915_gem_prime_import failed with the wrong err=%ld\n",
129129
PTR_ERR(import));
130130
err = PTR_ERR(import);
131+
} else {
132+
err = 0;
131133
}
132134

133135
dma_buf_put(dmabuf);
@@ -176,15 +178,14 @@ static int igt_dmabuf_import_same_driver(struct drm_i915_private *i915,
176178
err = PTR_ERR(import);
177179
goto out_dmabuf;
178180
}
181+
import_obj = to_intel_bo(import);
179182

180183
if (import == &obj->base) {
181184
pr_err("i915_gem_prime_import reused gem object!\n");
182185
err = -EINVAL;
183186
goto out_import;
184187
}
185188

186-
import_obj = to_intel_bo(import);
187-
188189
i915_gem_object_lock(import_obj, NULL);
189190
err = __i915_gem_object_get_pages(import_obj);
190191
if (err) {

drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,20 @@ static enum i915_mmap_type default_mapping(struct drm_i915_private *i915)
581581
return I915_MMAP_TYPE_GTT;
582582
}
583583

584+
static struct drm_i915_gem_object *
585+
create_sys_or_internal(struct drm_i915_private *i915,
586+
unsigned long size)
587+
{
588+
if (HAS_LMEM(i915)) {
589+
struct intel_memory_region *sys_region =
590+
i915->mm.regions[INTEL_REGION_SMEM];
591+
592+
return __i915_gem_object_create_user(i915, size, &sys_region, 1);
593+
}
594+
595+
return i915_gem_object_create_internal(i915, size);
596+
}
597+
584598
static bool assert_mmap_offset(struct drm_i915_private *i915,
585599
unsigned long size,
586600
int expected)
@@ -589,7 +603,7 @@ static bool assert_mmap_offset(struct drm_i915_private *i915,
589603
u64 offset;
590604
int ret;
591605

592-
obj = i915_gem_object_create_internal(i915, size);
606+
obj = create_sys_or_internal(i915, size);
593607
if (IS_ERR(obj))
594608
return expected && expected == PTR_ERR(obj);
595609

@@ -633,6 +647,7 @@ static int igt_mmap_offset_exhaustion(void *arg)
633647
struct drm_mm_node *hole, *next;
634648
int loop, err = 0;
635649
u64 offset;
650+
int enospc = HAS_LMEM(i915) ? -ENXIO : -ENOSPC;
636651

637652
/* Disable background reaper */
638653
disable_retire_worker(i915);
@@ -683,14 +698,14 @@ static int igt_mmap_offset_exhaustion(void *arg)
683698
}
684699

685700
/* Too large */
686-
if (!assert_mmap_offset(i915, 2 * PAGE_SIZE, -ENOSPC)) {
701+
if (!assert_mmap_offset(i915, 2 * PAGE_SIZE, enospc)) {
687702
pr_err("Unexpectedly succeeded in inserting too large object into single page hole\n");
688703
err = -EINVAL;
689704
goto out;
690705
}
691706

692707
/* Fill the hole, further allocation attempts should then fail */
693-
obj = i915_gem_object_create_internal(i915, PAGE_SIZE);
708+
obj = create_sys_or_internal(i915, PAGE_SIZE);
694709
if (IS_ERR(obj)) {
695710
err = PTR_ERR(obj);
696711
pr_err("Unable to create object for reclaimed hole\n");
@@ -703,7 +718,7 @@ static int igt_mmap_offset_exhaustion(void *arg)
703718
goto err_obj;
704719
}
705720

706-
if (!assert_mmap_offset(i915, PAGE_SIZE, -ENOSPC)) {
721+
if (!assert_mmap_offset(i915, PAGE_SIZE, enospc)) {
707722
pr_err("Unexpectedly succeeded in inserting object into no holes!\n");
708723
err = -EINVAL;
709724
goto err_obj;
@@ -839,10 +854,9 @@ static int wc_check(struct drm_i915_gem_object *obj)
839854

840855
static bool can_mmap(struct drm_i915_gem_object *obj, enum i915_mmap_type type)
841856
{
842-
struct drm_i915_private *i915 = to_i915(obj->base.dev);
843857
bool no_map;
844858

845-
if (HAS_LMEM(i915))
859+
if (obj->ops->mmap_offset)
846860
return type == I915_MMAP_TYPE_FIXED;
847861
else if (type == I915_MMAP_TYPE_FIXED)
848862
return false;

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1973,8 +1973,14 @@ u32 intel_rps_read_actual_frequency(struct intel_rps *rps)
19731973
u32 intel_rps_read_punit_req(struct intel_rps *rps)
19741974
{
19751975
struct intel_uncore *uncore = rps_to_uncore(rps);
1976+
struct intel_runtime_pm *rpm = rps_to_uncore(rps)->rpm;
1977+
intel_wakeref_t wakeref;
1978+
u32 freq = 0;
19761979

1977-
return intel_uncore_read(uncore, GEN6_RPNSWREQ);
1980+
with_intel_runtime_pm_if_in_use(rpm, wakeref)
1981+
freq = intel_uncore_read(uncore, GEN6_RPNSWREQ);
1982+
1983+
return freq;
19781984
}
19791985

19801986
static u32 intel_rps_get_req(u32 pureq)

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,6 @@ void intel_uc_driver_remove(struct intel_uc *uc)
172172
__uc_free_load_err_log(uc);
173173
}
174174

175-
static inline bool guc_communication_enabled(struct intel_guc *guc)
176-
{
177-
return intel_guc_ct_enabled(&guc->ct);
178-
}
179-
180175
/*
181176
* Events triggered while CT buffers are disabled are logged in the SCRATCH_15
182177
* register using the same bits used in the CT message payload. Since our
@@ -210,7 +205,7 @@ static void guc_get_mmio_msg(struct intel_guc *guc)
210205
static void guc_handle_mmio_msg(struct intel_guc *guc)
211206
{
212207
/* we need communication to be enabled to reply to GuC */
213-
GEM_BUG_ON(!guc_communication_enabled(guc));
208+
GEM_BUG_ON(!intel_guc_ct_enabled(&guc->ct));
214209

215210
spin_lock_irq(&guc->irq_lock);
216211
if (guc->mmio_msg) {
@@ -226,7 +221,7 @@ static int guc_enable_communication(struct intel_guc *guc)
226221
struct drm_i915_private *i915 = gt->i915;
227222
int ret;
228223

229-
GEM_BUG_ON(guc_communication_enabled(guc));
224+
GEM_BUG_ON(intel_guc_ct_enabled(&guc->ct));
230225

231226
ret = i915_inject_probe_error(i915, -ENXIO);
232227
if (ret)
@@ -662,7 +657,7 @@ static int __uc_resume(struct intel_uc *uc, bool enable_communication)
662657
return 0;
663658

664659
/* Make sure we enable communication if and only if it's disabled */
665-
GEM_BUG_ON(enable_communication == guc_communication_enabled(guc));
660+
GEM_BUG_ON(enable_communication == intel_guc_ct_enabled(&guc->ct));
666661

667662
if (enable_communication)
668663
guc_enable_communication(guc);

0 commit comments

Comments
 (0)