Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+76 -4
+1
drivers/gpu/drm/i915/Makefile
··· 76 76 77 77 # core display adaptation 78 78 i915-y += \ 79 + i915_display_pc8.o \ 79 80 i915_hdcp_gsc.o \ 80 81 i915_panic.o 81 82
+4 -4
drivers/gpu/drm/i915/display/intel_display_power.c
··· 1339 1339 return; 1340 1340 1341 1341 /* 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. 1344 1344 */ 1345 - intel_uncore_forcewake_get(&dev_priv->uncore, FORCEWAKE_ALL); 1345 + intel_parent_pc8_block(display); 1346 1346 1347 1347 if (val & LCPLL_POWER_DOWN_ALLOW) { 1348 1348 val &= ~LCPLL_POWER_DOWN_ALLOW; ··· 1372 1372 "Switching back to LCPLL failed\n"); 1373 1373 } 1374 1374 1375 - intel_uncore_forcewake_put(&dev_priv->uncore, FORCEWAKE_ALL); 1375 + intel_parent_pc8_unblock(display); 1376 1376 1377 1377 intel_update_cdclk(display); 1378 1378 intel_cdclk_dump_config(display, &display->cdclk.hw, "Current CDCLK");
+17
drivers/gpu/drm/i915/display/intel_parent.c
··· 75 75 display->parent->panic->finish(panic); 76 76 } 77 77 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 + 78 95 /* rps */ 79 96 bool intel_parent_rps_available(struct intel_display *display) 80 97 {
+4
drivers/gpu/drm/i915/display/intel_parent.h
··· 32 32 int intel_parent_panic_setup(struct intel_display *display, struct intel_panic *panic, struct drm_scanout_buffer *sb); 33 33 void intel_parent_panic_finish(struct intel_display *display, struct intel_panic *panic); 34 34 35 + /* pc8 */ 36 + void intel_parent_pc8_block(struct intel_display *display); 37 + void intel_parent_pc8_unblock(struct intel_display *display); 38 + 35 39 /* rps */ 36 40 bool intel_parent_rps_available(struct intel_display *display); 37 41 void intel_parent_rps_boost_if_not_started(struct intel_display *display, struct dma_fence *fence);
+31
drivers/gpu/drm/i915/i915_display_pc8.c
··· 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 + };
+9
drivers/gpu/drm/i915/i915_display_pc8.h
··· 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__ */
+2
drivers/gpu/drm/i915/i915_driver.c
··· 89 89 #include "pxp/intel_pxp_pm.h" 90 90 91 91 #include "i915_debugfs.h" 92 + #include "i915_display_pc8.h" 92 93 #include "i915_driver.h" 93 94 #include "i915_drm_client.h" 94 95 #include "i915_drv.h" ··· 766 765 .hdcp = &i915_display_hdcp_interface, 767 766 .irq = &i915_display_irq_interface, 768 767 .panic = &i915_display_panic_interface, 768 + .pc8 = &i915_display_pc8_interface, 769 769 .rpm = &i915_display_rpm_interface, 770 770 .rps = &i915_display_rps_interface, 771 771 .stolen = &i915_display_stolen_interface,
+8
include/drm/intel/display_parent_interface.h
··· 36 36 void (*finish)(struct intel_panic *panic); 37 37 }; 38 38 39 + struct intel_display_pc8_interface { 40 + void (*block)(struct drm_device *drm); 41 + void (*unblock)(struct drm_device *drm); 42 + }; 43 + 39 44 struct intel_display_rpm_interface { 40 45 struct ref_tracker *(*get)(const struct drm_device *drm); 41 46 struct ref_tracker *(*get_raw)(const struct drm_device *drm); ··· 100 95 101 96 /** @panic: Panic interface */ 102 97 const struct intel_display_panic_interface *panic; 98 + 99 + /** @pc8: PC8 interface. Optional. */ 100 + const struct intel_display_pc8_interface *pc8; 103 101 104 102 /** @rpm: Runtime PM functions */ 105 103 const struct intel_display_rpm_interface *rpm;