Skip to content

Commit 0b336ec

Browse files
committed
Merge tag 'drm-intel-next-fixes-2023-11-08' of git://anongit.freedesktop.org/drm/drm-intel into drm-next
drm/i915 fixes for v6.7-rc1: - Fix null dereference when perf interface is not available - Fix a -Wstringop-overflow warning - Fix a -Wformat-truncation warning in intel_tc_port_init - Flush WC GGTT only on required platforms - Fix MTL HBR3 rate support on C10 phy and eDP - Fix MTL notify_guc for multi-GT - Bump GLK CDCLK frequency when driving multiple pipes - Fix potential spectre vulnerability Signed-off-by: Daniel Vetter <[email protected]> From: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 9ccde17 + 9506fba commit 0b336ec

File tree

8 files changed

+65
-36
lines changed

8 files changed

+65
-36
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2750,6 +2750,18 @@ static int intel_compute_min_cdclk(struct intel_cdclk_state *cdclk_state)
27502750
for_each_pipe(dev_priv, pipe)
27512751
min_cdclk = max(cdclk_state->min_cdclk[pipe], min_cdclk);
27522752

2753+
/*
2754+
* Avoid glk_force_audio_cdclk() causing excessive screen
2755+
* blinking when multiple pipes are active by making sure
2756+
* CDCLK frequency is always high enough for audio. With a
2757+
* single active pipe we can always change CDCLK frequency
2758+
* by changing the cd2x divider (see glk_cdclk_table[]) and
2759+
* thus a full modeset won't be needed then.
2760+
*/
2761+
if (IS_GEMINILAKE(dev_priv) && cdclk_state->active_pipes &&
2762+
!is_power_of_2(cdclk_state->active_pipes))
2763+
min_cdclk = max(2 * 96000, min_cdclk);
2764+
27532765
if (min_cdclk > dev_priv->display.cdclk.max_cdclk_freq) {
27542766
drm_dbg_kms(&dev_priv->drm,
27552767
"required cdclk (%d kHz) exceeds max (%d kHz)\n",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ static int mtl_max_source_rate(struct intel_dp *intel_dp)
430430
enum phy phy = intel_port_to_phy(i915, dig_port->base.port);
431431

432432
if (intel_is_c10phy(i915, phy))
433-
return intel_dp_is_edp(intel_dp) ? 675000 : 810000;
433+
return 810000;
434434

435435
return 2000000;
436436
}

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ struct intel_tc_port {
5858
struct delayed_work link_reset_work;
5959
int link_refcount;
6060
bool legacy_port:1;
61-
char port_name[8];
61+
const char *port_name;
6262
enum tc_port_mode mode;
6363
enum tc_port_mode init_mode;
6464
enum phy_fia phy_fia;
@@ -1875,8 +1875,12 @@ int intel_tc_port_init(struct intel_digital_port *dig_port, bool is_legacy)
18751875
else
18761876
tc->phy_ops = &icl_tc_phy_ops;
18771877

1878-
snprintf(tc->port_name, sizeof(tc->port_name),
1879-
"%c/TC#%d", port_name(port), tc_port + 1);
1878+
tc->port_name = kasprintf(GFP_KERNEL, "%c/TC#%d", port_name(port),
1879+
tc_port + 1);
1880+
if (!tc->port_name) {
1881+
kfree(tc);
1882+
return -ENOMEM;
1883+
}
18801884

18811885
mutex_init(&tc->lock);
18821886
/* TODO: Combine the two works */
@@ -1897,6 +1901,7 @@ void intel_tc_port_cleanup(struct intel_digital_port *dig_port)
18971901
{
18981902
intel_tc_port_suspend(dig_port);
18991903

1904+
kfree(dig_port->tc->port_name);
19001905
kfree(dig_port->tc);
19011906
dig_port->tc = NULL;
19021907
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,7 @@ static int set_proto_ctx_sseu(struct drm_i915_file_private *fpriv,
844844
if (idx >= pc->num_user_engines)
845845
return -EINVAL;
846846

847+
idx = array_index_nospec(idx, pc->num_user_engines);
847848
pe = &pc->user_engines[idx];
848849

849850
/* Only render engine supports RPCS configuration. */

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

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,34 @@ void gen6_ggtt_invalidate(struct i915_ggtt *ggtt)
195195
spin_unlock_irq(&uncore->lock);
196196
}
197197

198+
static bool needs_wc_ggtt_mapping(struct drm_i915_private *i915)
199+
{
200+
/*
201+
* On BXT+/ICL+ writes larger than 64 bit to the GTT pagetable range
202+
* will be dropped. For WC mappings in general we have 64 byte burst
203+
* writes when the WC buffer is flushed, so we can't use it, but have to
204+
* resort to an uncached mapping. The WC issue is easily caught by the
205+
* readback check when writing GTT PTE entries.
206+
*/
207+
if (!IS_GEN9_LP(i915) && GRAPHICS_VER(i915) < 11)
208+
return true;
209+
210+
return false;
211+
}
212+
198213
static void gen8_ggtt_invalidate(struct i915_ggtt *ggtt)
199214
{
200215
struct intel_uncore *uncore = ggtt->vm.gt->uncore;
201216

202217
/*
203218
* Note that as an uncached mmio write, this will flush the
204219
* WCB of the writes into the GGTT before it triggers the invalidate.
220+
*
221+
* Only perform this when GGTT is mapped as WC, see ggtt_probe_common().
205222
*/
206-
intel_uncore_write_fw(uncore, GFX_FLSH_CNTL_GEN6, GFX_FLSH_CNTL_EN);
223+
if (needs_wc_ggtt_mapping(ggtt->vm.i915))
224+
intel_uncore_write_fw(uncore, GFX_FLSH_CNTL_GEN6,
225+
GFX_FLSH_CNTL_EN);
207226
}
208227

209228
static void guc_ggtt_ct_invalidate(struct intel_gt *gt)
@@ -1140,17 +1159,11 @@ static int ggtt_probe_common(struct i915_ggtt *ggtt, u64 size)
11401159
GEM_WARN_ON(pci_resource_len(pdev, GEN4_GTTMMADR_BAR) != gen6_gttmmadr_size(i915));
11411160
phys_addr = pci_resource_start(pdev, GEN4_GTTMMADR_BAR) + gen6_gttadr_offset(i915);
11421161

1143-
/*
1144-
* On BXT+/ICL+ writes larger than 64 bit to the GTT pagetable range
1145-
* will be dropped. For WC mappings in general we have 64 byte burst
1146-
* writes when the WC buffer is flushed, so we can't use it, but have to
1147-
* resort to an uncached mapping. The WC issue is easily caught by the
1148-
* readback check when writing GTT PTE entries.
1149-
*/
1150-
if (IS_GEN9_LP(i915) || GRAPHICS_VER(i915) >= 11)
1151-
ggtt->gsm = ioremap(phys_addr, size);
1152-
else
1162+
if (needs_wc_ggtt_mapping(i915))
11531163
ggtt->gsm = ioremap_wc(phys_addr, size);
1164+
else
1165+
ggtt->gsm = ioremap(phys_addr, size);
1166+
11541167
if (!ggtt->gsm) {
11551168
drm_err(&i915->drm, "Failed to map the ggtt page table\n");
11561169
return -ENOMEM;

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -581,19 +581,23 @@ static void __intel_rc6_disable(struct intel_rc6 *rc6)
581581

582582
static void rc6_res_reg_init(struct intel_rc6 *rc6)
583583
{
584-
memset(rc6->res_reg, INVALID_MMIO_REG.reg, sizeof(rc6->res_reg));
584+
i915_reg_t res_reg[INTEL_RC6_RES_MAX] = {
585+
[0 ... INTEL_RC6_RES_MAX - 1] = INVALID_MMIO_REG,
586+
};
585587

586588
switch (rc6_to_gt(rc6)->type) {
587589
case GT_MEDIA:
588-
rc6->res_reg[INTEL_RC6_RES_RC6] = MTL_MEDIA_MC6;
590+
res_reg[INTEL_RC6_RES_RC6] = MTL_MEDIA_MC6;
589591
break;
590592
default:
591-
rc6->res_reg[INTEL_RC6_RES_RC6_LOCKED] = GEN6_GT_GFX_RC6_LOCKED;
592-
rc6->res_reg[INTEL_RC6_RES_RC6] = GEN6_GT_GFX_RC6;
593-
rc6->res_reg[INTEL_RC6_RES_RC6p] = GEN6_GT_GFX_RC6p;
594-
rc6->res_reg[INTEL_RC6_RES_RC6pp] = GEN6_GT_GFX_RC6pp;
593+
res_reg[INTEL_RC6_RES_RC6_LOCKED] = GEN6_GT_GFX_RC6_LOCKED;
594+
res_reg[INTEL_RC6_RES_RC6] = GEN6_GT_GFX_RC6;
595+
res_reg[INTEL_RC6_RES_RC6p] = GEN6_GT_GFX_RC6p;
596+
res_reg[INTEL_RC6_RES_RC6pp] = GEN6_GT_GFX_RC6pp;
595597
break;
596598
}
599+
600+
memcpy(rc6->res_reg, res_reg, sizeof(res_reg));
597601
}
598602

599603
void intel_rc6_init(struct intel_rc6 *rc6)

drivers/gpu/drm/i915/i915_debugfs_params.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,13 @@ static int i915_param_int_open(struct inode *inode, struct file *file)
3838

3939
static int notify_guc(struct drm_i915_private *i915)
4040
{
41-
int ret = 0;
41+
struct intel_gt *gt;
42+
int i, ret = 0;
4243

43-
if (intel_uc_uses_guc_submission(&to_gt(i915)->uc))
44-
ret = intel_guc_global_policies_update(&to_gt(i915)->uc.guc);
44+
for_each_gt(gt, i915, i) {
45+
if (intel_uc_uses_guc_submission(&gt->uc))
46+
ret = intel_guc_global_policies_update(&gt->uc.guc);
47+
}
4548

4649
return ret;
4750
}

drivers/gpu/drm/i915/i915_perf.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4227,11 +4227,8 @@ int i915_perf_open_ioctl(struct drm_device *dev, void *data,
42274227
u32 known_open_flags;
42284228
int ret;
42294229

4230-
if (!perf->i915) {
4231-
drm_dbg(&perf->i915->drm,
4232-
"i915 perf interface not available for this system\n");
4230+
if (!perf->i915)
42334231
return -ENOTSUPP;
4234-
}
42354232

42364233
known_open_flags = I915_PERF_FLAG_FD_CLOEXEC |
42374234
I915_PERF_FLAG_FD_NONBLOCK |
@@ -4607,11 +4604,8 @@ int i915_perf_add_config_ioctl(struct drm_device *dev, void *data,
46074604
struct i915_oa_reg *regs;
46084605
int err, id;
46094606

4610-
if (!perf->i915) {
4611-
drm_dbg(&perf->i915->drm,
4612-
"i915 perf interface not available for this system\n");
4607+
if (!perf->i915)
46134608
return -ENOTSUPP;
4614-
}
46154609

46164610
if (!perf->metrics_kobj) {
46174611
drm_dbg(&perf->i915->drm,
@@ -4773,11 +4767,8 @@ int i915_perf_remove_config_ioctl(struct drm_device *dev, void *data,
47734767
struct i915_oa_config *oa_config;
47744768
int ret;
47754769

4776-
if (!perf->i915) {
4777-
drm_dbg(&perf->i915->drm,
4778-
"i915 perf interface not available for this system\n");
4770+
if (!perf->i915)
47794771
return -ENOTSUPP;
4780-
}
47814772

47824773
if (i915_perf_stream_paranoid && !perfmon_capable()) {
47834774
drm_dbg(&perf->i915->drm,

0 commit comments

Comments
 (0)