Skip to content

Commit 35ec712

Browse files
committed
drm/i915/pc8: Add parent interface for PC8 forcewake tricks
We use forcewake to prevent the SoC from actually entering PC8 while performing the PC8 disable sequence. Hide that behind a new parent interface to eliminate the naked forcewake/uncore usage from the display power code. v2: Mark the interface optional and warn if someone calls it when not provided (Jani) Include the header to make sure the extern declaration matches the definition (Jani) v3: Rebase due to shuffling Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patch.msgid.link/20251218182052.18756-1-ville.syrjala@linux.intel.com
1 parent 9236cf0 commit 35ec712

8 files changed

Lines changed: 76 additions & 4 deletions

File tree

drivers/gpu/drm/i915/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ i915-$(CONFIG_PERF_EVENTS) += \
7676

7777
# core display adaptation
7878
i915-y += \
79+
i915_display_pc8.o \
7980
i915_hdcp_gsc.o \
8081
i915_panic.o
8182

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,10 +1339,10 @@ static void hsw_restore_lcpll(struct intel_display *display)
13391339
return;
13401340

13411341
/*
1342-
* Make sure we're not on PC8 state before disabling PC8, otherwise
1343-
* we'll hang the machine. To prevent PC8 state, just enable force_wake.
1342+
* Make sure we're not on PC8 state before disabling
1343+
* PC8, otherwise we'll hang the machine.
13441344
*/
1345-
intel_uncore_forcewake_get(&dev_priv->uncore, FORCEWAKE_ALL);
1345+
intel_parent_pc8_block(display);
13461346

13471347
if (val & LCPLL_POWER_DOWN_ALLOW) {
13481348
val &= ~LCPLL_POWER_DOWN_ALLOW;
@@ -1372,7 +1372,7 @@ static void hsw_restore_lcpll(struct intel_display *display)
13721372
"Switching back to LCPLL failed\n");
13731373
}
13741374

1375-
intel_uncore_forcewake_put(&dev_priv->uncore, FORCEWAKE_ALL);
1375+
intel_parent_pc8_unblock(display);
13761376

13771377
intel_update_cdclk(display);
13781378
intel_cdclk_dump_config(display, &display->cdclk.hw, "Current CDCLK");

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,23 @@ void intel_parent_panic_finish(struct intel_display *display, struct intel_panic
7575
display->parent->panic->finish(panic);
7676
}
7777

78+
/* pc8 */
79+
void intel_parent_pc8_block(struct intel_display *display)
80+
{
81+
if (drm_WARN_ON_ONCE(display->drm, !display->parent->pc8))
82+
return;
83+
84+
display->parent->pc8->block(display->drm);
85+
}
86+
87+
void intel_parent_pc8_unblock(struct intel_display *display)
88+
{
89+
if (drm_WARN_ON_ONCE(display->drm, !display->parent->pc8))
90+
return;
91+
92+
display->parent->pc8->unblock(display->drm);
93+
}
94+
7895
/* rps */
7996
bool intel_parent_rps_available(struct intel_display *display)
8097
{

drivers/gpu/drm/i915/display/intel_parent.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ struct intel_panic *intel_parent_panic_alloc(struct intel_display *display);
3232
int intel_parent_panic_setup(struct intel_display *display, struct intel_panic *panic, struct drm_scanout_buffer *sb);
3333
void intel_parent_panic_finish(struct intel_display *display, struct intel_panic *panic);
3434

35+
/* pc8 */
36+
void intel_parent_pc8_block(struct intel_display *display);
37+
void intel_parent_pc8_unblock(struct intel_display *display);
38+
3539
/* rps */
3640
bool intel_parent_rps_available(struct intel_display *display);
3741
void intel_parent_rps_boost_if_not_started(struct intel_display *display, struct dma_fence *fence);
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// SPDX-License-Identifier: MIT
2+
/*
3+
* Copyright 2025, Intel Corporation.
4+
*/
5+
6+
#include <drm/drm_print.h>
7+
#include <drm/intel/display_parent_interface.h>
8+
9+
#include "i915_display_pc8.h"
10+
#include "i915_drv.h"
11+
#include "intel_uncore.h"
12+
13+
static void i915_display_pc8_block(struct drm_device *drm)
14+
{
15+
struct intel_uncore *uncore = &to_i915(drm)->uncore;
16+
17+
/* to prevent PC8 state, just enable force_wake */
18+
intel_uncore_forcewake_get(uncore, FORCEWAKE_ALL);
19+
}
20+
21+
static void i915_display_pc8_unblock(struct drm_device *drm)
22+
{
23+
struct intel_uncore *uncore = &to_i915(drm)->uncore;
24+
25+
intel_uncore_forcewake_put(uncore, FORCEWAKE_ALL);
26+
}
27+
28+
const struct intel_display_pc8_interface i915_display_pc8_interface = {
29+
.block = i915_display_pc8_block,
30+
.unblock = i915_display_pc8_unblock,
31+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* SPDX-License-Identifier: MIT */
2+
/* Copyright © 2025 Intel Corporation */
3+
4+
#ifndef __I915_DISPLAY_PC8_H__
5+
#define __I915_DISPLAY_PC8_H__
6+
7+
extern const struct intel_display_pc8_interface i915_display_pc8_interface;
8+
9+
#endif /* __I915_DISPLAY_PC8_H__ */

drivers/gpu/drm/i915/i915_driver.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
#include "pxp/intel_pxp_pm.h"
9090

9191
#include "i915_debugfs.h"
92+
#include "i915_display_pc8.h"
9293
#include "i915_driver.h"
9394
#include "i915_drm_client.h"
9495
#include "i915_drv.h"
@@ -765,6 +766,7 @@ static const struct intel_display_parent_interface parent = {
765766
.hdcp = &i915_display_hdcp_interface,
766767
.irq = &i915_display_irq_interface,
767768
.panic = &i915_display_panic_interface,
769+
.pc8 = &i915_display_pc8_interface,
768770
.rpm = &i915_display_rpm_interface,
769771
.rps = &i915_display_rps_interface,
770772
.stolen = &i915_display_stolen_interface,

include/drm/intel/display_parent_interface.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ struct intel_display_panic_interface {
3636
void (*finish)(struct intel_panic *panic);
3737
};
3838

39+
struct intel_display_pc8_interface {
40+
void (*block)(struct drm_device *drm);
41+
void (*unblock)(struct drm_device *drm);
42+
};
43+
3944
struct intel_display_rpm_interface {
4045
struct ref_tracker *(*get)(const struct drm_device *drm);
4146
struct ref_tracker *(*get_raw)(const struct drm_device *drm);
@@ -96,6 +101,9 @@ struct intel_display_parent_interface {
96101
/** @panic: Panic interface */
97102
const struct intel_display_panic_interface *panic;
98103

104+
/** @pc8: PC8 interface. Optional. */
105+
const struct intel_display_pc8_interface *pc8;
106+
99107
/** @rpm: Runtime PM functions */
100108
const struct intel_display_rpm_interface *rpm;
101109

0 commit comments

Comments
 (0)