Skip to content

Commit 5582f3c

Browse files
committed
Merge tag 'drm-intel-next-fixes-2023-02-17' of git://anongit.freedesktop.org/drm/drm-intel into drm-next
drm/i915 fixes for the v6.3 merge window: - Fix eDP+DSI dual panel systems - Fix system suspend when fbdev isn't initialized - Fix memory leaks in scatterlist - Fix some MCR register annotations - Fix documentation build warnings Signed-off-by: Dave Airlie <[email protected]> From: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents fec67d1 + 8038510 commit 5582f3c

File tree

9 files changed

+107
-43
lines changed

9 files changed

+107
-43
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2043,7 +2043,8 @@ void icl_dsi_init(struct drm_i915_private *dev_priv)
20432043
/* attach connector to encoder */
20442044
intel_connector_attach_encoder(intel_connector, encoder);
20452045

2046-
intel_bios_init_panel_late(dev_priv, &intel_connector->panel, NULL, NULL);
2046+
encoder->devdata = intel_bios_encoder_data_lookup(dev_priv, port);
2047+
intel_bios_init_panel_late(dev_priv, &intel_connector->panel, encoder->devdata, NULL);
20472048

20482049
mutex_lock(&dev_priv->drm.mode_config.mutex);
20492050
intel_panel_add_vbt_lfp_fixed_mode(intel_connector);

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

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,6 +1431,30 @@ bxt_setup_backlight(struct intel_connector *connector, enum pipe unused)
14311431
return 0;
14321432
}
14331433

1434+
static int cnp_num_backlight_controllers(struct drm_i915_private *i915)
1435+
{
1436+
if (INTEL_PCH_TYPE(i915) >= PCH_DG1)
1437+
return 1;
1438+
1439+
if (INTEL_PCH_TYPE(i915) >= PCH_ICP)
1440+
return 2;
1441+
1442+
return 1;
1443+
}
1444+
1445+
static bool cnp_backlight_controller_is_valid(struct drm_i915_private *i915, int controller)
1446+
{
1447+
if (controller < 0 || controller >= cnp_num_backlight_controllers(i915))
1448+
return false;
1449+
1450+
if (controller == 1 &&
1451+
INTEL_PCH_TYPE(i915) >= PCH_ICP &&
1452+
INTEL_PCH_TYPE(i915) < PCH_MTP)
1453+
return intel_de_read(i915, SOUTH_CHICKEN1) & ICP_SECOND_PPS_IO_SELECT;
1454+
1455+
return true;
1456+
}
1457+
14341458
static int
14351459
cnp_setup_backlight(struct intel_connector *connector, enum pipe unused)
14361460
{
@@ -1440,10 +1464,14 @@ cnp_setup_backlight(struct intel_connector *connector, enum pipe unused)
14401464

14411465
/*
14421466
* CNP has the BXT implementation of backlight, but with only one
1443-
* controller. TODO: ICP has multiple controllers but we only use
1444-
* controller 0 for now.
1467+
* controller. ICP+ can have two controllers, depending on pin muxing.
14451468
*/
1446-
panel->backlight.controller = 0;
1469+
panel->backlight.controller = connector->panel.vbt.backlight.controller;
1470+
if (!cnp_backlight_controller_is_valid(i915, panel->backlight.controller)) {
1471+
drm_dbg_kms(&i915->drm, "Invalid backlight controller %d, assuming 0\n",
1472+
panel->backlight.controller);
1473+
panel->backlight.controller = 0;
1474+
}
14471475

14481476
pwm_ctl = intel_de_read(i915,
14491477
BXT_BLC_PWM_CTL(panel->backlight.controller));

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

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,7 @@ parse_lfp_backlight(struct drm_i915_private *i915,
10331033
}
10341034

10351035
panel->vbt.backlight.type = INTEL_BACKLIGHT_DISPLAY_DDI;
1036+
panel->vbt.backlight.controller = 0;
10361037
if (i915->display.vbt.version >= 191) {
10371038
size_t exp_size;
10381039

@@ -2467,6 +2468,22 @@ static enum port dvo_port_to_port(struct drm_i915_private *i915,
24672468
dvo_port);
24682469
}
24692470

2471+
static enum port
2472+
dsi_dvo_port_to_port(struct drm_i915_private *i915, u8 dvo_port)
2473+
{
2474+
switch (dvo_port) {
2475+
case DVO_PORT_MIPIA:
2476+
return PORT_A;
2477+
case DVO_PORT_MIPIC:
2478+
if (DISPLAY_VER(i915) >= 11)
2479+
return PORT_B;
2480+
else
2481+
return PORT_C;
2482+
default:
2483+
return PORT_NONE;
2484+
}
2485+
}
2486+
24702487
static int parse_bdb_230_dp_max_link_rate(const int vbt_max_link_rate)
24712488
{
24722489
switch (vbt_max_link_rate) {
@@ -2577,6 +2594,12 @@ intel_bios_encoder_supports_edp(const struct intel_bios_encoder_data *devdata)
25772594
devdata->child.device_type & DEVICE_TYPE_INTERNAL_CONNECTOR;
25782595
}
25792596

2597+
static bool
2598+
intel_bios_encoder_supports_dsi(const struct intel_bios_encoder_data *devdata)
2599+
{
2600+
return devdata->child.device_type & DEVICE_TYPE_MIPI_OUTPUT;
2601+
}
2602+
25802603
static int _intel_bios_hdmi_level_shift(const struct intel_bios_encoder_data *devdata)
25812604
{
25822605
if (!devdata || devdata->i915->display.vbt.version < 158)
@@ -2627,21 +2650,22 @@ static void print_ddi_port(const struct intel_bios_encoder_data *devdata,
26272650
{
26282651
struct drm_i915_private *i915 = devdata->i915;
26292652
const struct child_device_config *child = &devdata->child;
2630-
bool is_dvi, is_hdmi, is_dp, is_edp, is_crt, supports_typec_usb, supports_tbt;
2653+
bool is_dvi, is_hdmi, is_dp, is_edp, is_dsi, is_crt, supports_typec_usb, supports_tbt;
26312654
int dp_boost_level, dp_max_link_rate, hdmi_boost_level, hdmi_level_shift, max_tmds_clock;
26322655

26332656
is_dvi = intel_bios_encoder_supports_dvi(devdata);
26342657
is_dp = intel_bios_encoder_supports_dp(devdata);
26352658
is_crt = intel_bios_encoder_supports_crt(devdata);
26362659
is_hdmi = intel_bios_encoder_supports_hdmi(devdata);
26372660
is_edp = intel_bios_encoder_supports_edp(devdata);
2661+
is_dsi = intel_bios_encoder_supports_dsi(devdata);
26382662

26392663
supports_typec_usb = intel_bios_encoder_supports_typec_usb(devdata);
26402664
supports_tbt = intel_bios_encoder_supports_tbt(devdata);
26412665

26422666
drm_dbg_kms(&i915->drm,
2643-
"Port %c VBT info: CRT:%d DVI:%d HDMI:%d DP:%d eDP:%d LSPCON:%d USB-Type-C:%d TBT:%d DSC:%d\n",
2644-
port_name(port), is_crt, is_dvi, is_hdmi, is_dp, is_edp,
2667+
"Port %c VBT info: CRT:%d DVI:%d HDMI:%d DP:%d eDP:%d DSI:%d LSPCON:%d USB-Type-C:%d TBT:%d DSC:%d\n",
2668+
port_name(port), is_crt, is_dvi, is_hdmi, is_dp, is_edp, is_dsi,
26452669
HAS_LSPCON(i915) && child->lspcon,
26462670
supports_typec_usb, supports_tbt,
26472671
devdata->dsc != NULL);
@@ -2694,6 +2718,8 @@ static void parse_ddi_port(struct intel_bios_encoder_data *devdata)
26942718
enum port port;
26952719

26962720
port = dvo_port_to_port(i915, child->dvo_port);
2721+
if (port == PORT_NONE && DISPLAY_VER(i915) >= 11)
2722+
port = dsi_dvo_port_to_port(i915, child->dvo_port);
26972723
if (port == PORT_NONE)
26982724
return;
26992725

@@ -3442,19 +3468,16 @@ bool intel_bios_is_dsi_present(struct drm_i915_private *i915,
34423468

34433469
dvo_port = child->dvo_port;
34443470

3445-
if (dvo_port == DVO_PORT_MIPIA ||
3446-
(dvo_port == DVO_PORT_MIPIB && DISPLAY_VER(i915) >= 11) ||
3447-
(dvo_port == DVO_PORT_MIPIC && DISPLAY_VER(i915) < 11)) {
3448-
if (port)
3449-
*port = dvo_port - DVO_PORT_MIPIA;
3450-
return true;
3451-
} else if (dvo_port == DVO_PORT_MIPIB ||
3452-
dvo_port == DVO_PORT_MIPIC ||
3453-
dvo_port == DVO_PORT_MIPID) {
3471+
if (dsi_dvo_port_to_port(i915, dvo_port) == PORT_NONE) {
34543472
drm_dbg_kms(&i915->drm,
34553473
"VBT has unsupported DSI port %c\n",
34563474
port_name(dvo_port - DVO_PORT_MIPIA));
3475+
continue;
34573476
}
3477+
3478+
if (port)
3479+
*port = dsi_dvo_port_to_port(i915, dvo_port);
3480+
return true;
34583481
}
34593482

34603483
return false;
@@ -3539,7 +3562,7 @@ bool intel_bios_get_dsc_params(struct intel_encoder *encoder,
35393562
if (!(child->device_type & DEVICE_TYPE_MIPI_OUTPUT))
35403563
continue;
35413564

3542-
if (child->dvo_port - DVO_PORT_MIPIA == encoder->port) {
3565+
if (dsi_dvo_port_to_port(i915, child->dvo_port) == encoder->port) {
35433566
if (!devdata->dsc)
35443567
return false;
35453568

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,13 @@ void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous
620620
struct intel_fbdev *ifbdev = dev_priv->display.fbdev.fbdev;
621621
struct fb_info *info;
622622

623-
if (!ifbdev || !ifbdev->vma)
623+
if (!ifbdev)
624+
return;
625+
626+
if (drm_WARN_ON(&dev_priv->drm, !HAS_DISPLAY(dev_priv)))
627+
return;
628+
629+
if (!ifbdev->vma)
624630
goto set_suspend;
625631

626632
info = ifbdev->helper.info;

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -686,10 +686,7 @@
686686
#define GEN6_RSTCTL _MMIO(0x9420)
687687

688688
#define GEN7_MISCCPCTL _MMIO(0x9424)
689-
#define GEN7_DOP_CLOCK_GATE_ENABLE (1 << 0)
690-
691-
#define GEN8_MISCCPCTL MCR_REG(0x9424)
692-
#define GEN8_DOP_CLOCK_GATE_ENABLE REG_BIT(0)
689+
#define GEN7_DOP_CLOCK_GATE_ENABLE REG_BIT(0)
693690
#define GEN12_DOP_CLOCK_GATE_RENDER_ENABLE REG_BIT(1)
694691
#define GEN8_DOP_CLOCK_GATE_CFCLK_ENABLE (1 << 2)
695692
#define GEN8_DOP_CLOCK_GATE_GUC_ENABLE (1 << 4)
@@ -979,7 +976,7 @@
979976
#define GEN7_WA_FOR_GEN7_L3_CONTROL 0x3C47FF8C
980977
#define GEN7_L3AGDIS (1 << 19)
981978

982-
#define XEHPC_LNCFMISCCFGREG0 _MMIO(0xb01c)
979+
#define XEHPC_LNCFMISCCFGREG0 MCR_REG(0xb01c)
983980
#define XEHPC_HOSTCACHEEN REG_BIT(1)
984981
#define XEHPC_OVRLSCCC REG_BIT(0)
985982

@@ -1042,7 +1039,7 @@
10421039
#define XEHP_L3SCQREG7 MCR_REG(0xb188)
10431040
#define BLEND_FILL_CACHING_OPT_DIS REG_BIT(3)
10441041

1045-
#define XEHPC_L3SCRUB _MMIO(0xb18c)
1042+
#define XEHPC_L3SCRUB MCR_REG(0xb18c)
10461043
#define SCRUB_CL_DWNGRADE_SHARED REG_BIT(12)
10471044
#define SCRUB_RATE_PER_BANK_MASK REG_GENMASK(2, 0)
10481045
#define SCRUB_RATE_4B_PER_CLK REG_FIELD_PREP(SCRUB_RATE_PER_BANK_MASK, 0x6)

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

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* creation to have a "primed golden context", i.e. a context image that
3131
* already contains the changes needed to all the registers.
3232
*
33-
* Context workarounds should be implemented in the *_ctx_workarounds_init()
33+
* Context workarounds should be implemented in the \*_ctx_workarounds_init()
3434
* variants respective to the targeted platforms.
3535
*
3636
* - Engine workarounds: the list of these WAs is applied whenever the specific
@@ -55,7 +55,7 @@
5555
* - GT workarounds: the list of these WAs is applied whenever these registers
5656
* revert to their default values: on GPU reset, suspend/resume [1]_, etc.
5757
*
58-
* GT workarounds should be implemented in the *_gt_workarounds_init()
58+
* GT workarounds should be implemented in the \*_gt_workarounds_init()
5959
* variants respective to the targeted platforms.
6060
*
6161
* - Register whitelist: some workarounds need to be implemented in userspace,
@@ -64,7 +64,7 @@
6464
* this is just a special case of a MMIO workaround (as we write the list of
6565
* these to/be-whitelisted registers to some special HW registers).
6666
*
67-
* Register whitelisting should be done in the *_whitelist_build() variants
67+
* Register whitelisting should be done in the \*_whitelist_build() variants
6868
* respective to the targeted platforms.
6969
*
7070
* - Workaround batchbuffers: buffers that get executed automatically by the
@@ -240,6 +240,12 @@ wa_write(struct i915_wa_list *wal, i915_reg_t reg, u32 set)
240240
wa_write_clr_set(wal, reg, ~0, set);
241241
}
242242

243+
static void
244+
wa_mcr_write(struct i915_wa_list *wal, i915_mcr_reg_t reg, u32 set)
245+
{
246+
wa_mcr_write_clr_set(wal, reg, ~0, set);
247+
}
248+
243249
static void
244250
wa_write_or(struct i915_wa_list *wal, i915_reg_t reg, u32 set)
245251
{
@@ -1676,7 +1682,7 @@ dg2_gt_workarounds_init(struct intel_gt *gt, struct i915_wa_list *wal)
16761682
wa_mcr_write_or(wal, XEHP_SQCM, EN_32B_ACCESS);
16771683

16781684
/* Wa_14015795083 */
1679-
wa_mcr_write_clr(wal, GEN8_MISCCPCTL, GEN12_DOP_CLOCK_GATE_RENDER_ENABLE);
1685+
wa_write_clr(wal, GEN7_MISCCPCTL, GEN12_DOP_CLOCK_GATE_RENDER_ENABLE);
16801686

16811687
/* Wa_18018781329 */
16821688
wa_mcr_write_or(wal, RENDER_MOD_CTRL, FORCE_MISS_FTLB);
@@ -1695,7 +1701,7 @@ pvc_gt_workarounds_init(struct intel_gt *gt, struct i915_wa_list *wal)
16951701
pvc_init_mcr(gt, wal);
16961702

16971703
/* Wa_14015795083 */
1698-
wa_mcr_write_clr(wal, GEN8_MISCCPCTL, GEN12_DOP_CLOCK_GATE_RENDER_ENABLE);
1704+
wa_write_clr(wal, GEN7_MISCCPCTL, GEN12_DOP_CLOCK_GATE_RENDER_ENABLE);
16991705

17001706
/* Wa_18018781329 */
17011707
wa_mcr_write_or(wal, RENDER_MOD_CTRL, FORCE_MISS_FTLB);
@@ -2970,9 +2976,9 @@ add_render_compute_tuning_settings(struct drm_i915_private *i915,
29702976
struct i915_wa_list *wal)
29712977
{
29722978
if (IS_PONTEVECCHIO(i915)) {
2973-
wa_write(wal, XEHPC_L3SCRUB,
2974-
SCRUB_CL_DWNGRADE_SHARED | SCRUB_RATE_4B_PER_CLK);
2975-
wa_masked_en(wal, XEHPC_LNCFMISCCFGREG0, XEHPC_HOSTCACHEEN);
2979+
wa_mcr_write(wal, XEHPC_L3SCRUB,
2980+
SCRUB_CL_DWNGRADE_SHARED | SCRUB_RATE_4B_PER_CLK);
2981+
wa_mcr_masked_en(wal, XEHPC_LNCFMISCCFGREG0, XEHPC_HOSTCACHEEN);
29762982
}
29772983

29782984
if (IS_DG2(i915)) {
@@ -3062,7 +3068,7 @@ general_render_compute_wa_init(struct intel_engine_cs *engine, struct i915_wa_li
30623068

30633069
if (IS_PONTEVECCHIO(i915)) {
30643070
/* Wa_16016694945 */
3065-
wa_masked_en(wal, XEHPC_LNCFMISCCFGREG0, XEHPC_OVRLSCCC);
3071+
wa_mcr_masked_en(wal, XEHPC_LNCFMISCCFGREG0, XEHPC_OVRLSCCC);
30663072
}
30673073

30683074
if (IS_XEHPSDV(i915)) {

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ static void guc_prepare_xfer(struct intel_gt *gt)
3939

4040
if (GRAPHICS_VER(uncore->i915) == 9) {
4141
/* DOP Clock Gating Enable for GuC clocks */
42-
intel_gt_mcr_multicast_write(gt, GEN8_MISCCPCTL,
43-
GEN8_DOP_CLOCK_GATE_GUC_ENABLE |
44-
intel_gt_mcr_read_any(gt, GEN8_MISCCPCTL));
42+
intel_uncore_rmw(uncore, GEN7_MISCCPCTL, 0,
43+
GEN8_DOP_CLOCK_GATE_GUC_ENABLE);
4544

4645
/* allows for 5us (in 10ns units) before GT can go to RC6 */
4746
intel_uncore_write(uncore, GUC_ARAT_C6DIS, 0x1FF);

drivers/gpu/drm/i915/i915_scatterlist.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,10 @@ struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *node,
9898
st = &rsgt->table;
9999
/* restricted by sg_alloc_table */
100100
if (WARN_ON(overflows_type(DIV_ROUND_UP_ULL(node->size, segment_pages),
101-
unsigned int)))
101+
unsigned int))) {
102+
i915_refct_sgt_put(rsgt);
102103
return ERR_PTR(-E2BIG);
104+
}
103105

104106
if (sg_alloc_table(st, DIV_ROUND_UP_ULL(node->size, segment_pages),
105107
GFP_KERNEL)) {
@@ -183,8 +185,10 @@ struct i915_refct_sgt *i915_rsgt_from_buddy_resource(struct ttm_resource *res,
183185
i915_refct_sgt_init(rsgt, size);
184186
st = &rsgt->table;
185187
/* restricted by sg_alloc_table */
186-
if (WARN_ON(overflows_type(PFN_UP(res->size), unsigned int)))
188+
if (WARN_ON(overflows_type(PFN_UP(res->size), unsigned int))) {
189+
i915_refct_sgt_put(rsgt);
187190
return ERR_PTR(-E2BIG);
191+
}
188192

189193
if (sg_alloc_table(st, PFN_UP(res->size), GFP_KERNEL)) {
190194
i915_refct_sgt_put(rsgt);

drivers/gpu/drm/i915/intel_pm.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4300,8 +4300,8 @@ static void gen8_set_l3sqc_credits(struct drm_i915_private *dev_priv,
43004300
u32 val;
43014301

43024302
/* WaTempDisableDOPClkGating:bdw */
4303-
misccpctl = intel_gt_mcr_multicast_rmw(to_gt(dev_priv), GEN8_MISCCPCTL,
4304-
GEN8_DOP_CLOCK_GATE_ENABLE, 0);
4303+
misccpctl = intel_uncore_rmw(&dev_priv->uncore, GEN7_MISCCPCTL,
4304+
GEN7_DOP_CLOCK_GATE_ENABLE, 0);
43054305

43064306
val = intel_gt_mcr_read_any(to_gt(dev_priv), GEN8_L3SQCREG1);
43074307
val &= ~L3_PRIO_CREDITS_MASK;
@@ -4315,7 +4315,7 @@ static void gen8_set_l3sqc_credits(struct drm_i915_private *dev_priv,
43154315
*/
43164316
intel_gt_mcr_read_any(to_gt(dev_priv), GEN8_L3SQCREG1);
43174317
udelay(1);
4318-
intel_gt_mcr_multicast_write(to_gt(dev_priv), GEN8_MISCCPCTL, misccpctl);
4318+
intel_uncore_write(&dev_priv->uncore, GEN7_MISCCPCTL, misccpctl);
43194319
}
43204320

43214321
static void icl_init_clock_gating(struct drm_i915_private *dev_priv)
@@ -4466,8 +4466,8 @@ static void skl_init_clock_gating(struct drm_i915_private *dev_priv)
44664466
gen9_init_clock_gating(dev_priv);
44674467

44684468
/* WaDisableDopClockGating:skl */
4469-
intel_gt_mcr_multicast_rmw(to_gt(dev_priv), GEN8_MISCCPCTL,
4470-
GEN8_DOP_CLOCK_GATE_ENABLE, 0);
4469+
intel_uncore_rmw(&dev_priv->uncore, GEN7_MISCCPCTL,
4470+
GEN7_DOP_CLOCK_GATE_ENABLE, 0);
44714471

44724472
/* WAC6entrylatency:skl */
44734473
intel_uncore_rmw(&dev_priv->uncore, FBC_LLC_READ_CTRL, 0, FBC_LLC_FULLY_OPEN);

0 commit comments

Comments
 (0)