Skip to content

Commit 22009b6

Browse files
bnilawarrodrigovivi
authored andcommitted
drm/i915/mtl: Modify CAGF functions for MTL
Update CAGF functions for MTL to get actual resolved frequency of 3D and SAMedia. v2: Update MTL_MIRROR_TARGET_WP1 position/formatting (MattR) Move MTL branches in cagf functions to top (MattR) Fix commit message (Andi) v3: Added comment about registers not needing forcewake for Gen12+ and returning 0 freq in RC6 v4: Use REG_FIELD_GET and uncore (Rodrigo) Bspec: 66300 Signed-off-by: Ashutosh Dixit <[email protected]> Signed-off-by: Badal Nilawar <[email protected]> Reviewed-by: Ashutosh Dixit <[email protected]> Acked-by: Rodrigo Vivi <[email protected]> Signed-off-by: Rodrigo Vivi <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 01b8c2e commit 22009b6

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
*/
2222
#define PERF_REG(offset) _MMIO(offset)
2323

24+
/* MTL workpoint reg to get core C state and actual freq of 3D, SAMedia */
25+
#define MTL_MIRROR_TARGET_WP1 _MMIO(0xc60)
26+
#define MTL_CAGF_MASK REG_GENMASK(8, 0)
27+
2428
/* RPM unit config (Gen8+) */
2529
#define RPM_CONFIG0 _MMIO(0xd00)
2630
#define GEN9_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT 3

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2099,7 +2099,9 @@ u32 intel_rps_get_cagf(struct intel_rps *rps, u32 rpstat)
20992099
struct drm_i915_private *i915 = rps_to_i915(rps);
21002100
u32 cagf;
21012101

2102-
if (GRAPHICS_VER(i915) >= 12)
2102+
if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 70))
2103+
cagf = REG_FIELD_GET(MTL_CAGF_MASK, rpstat);
2104+
else if (GRAPHICS_VER(i915) >= 12)
21032105
cagf = REG_FIELD_GET(GEN12_CAGF_MASK, rpstat);
21042106
else if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915))
21052107
cagf = REG_FIELD_GET(RPE_MASK, rpstat);
@@ -2121,7 +2123,13 @@ static u32 read_cagf(struct intel_rps *rps)
21212123
struct intel_uncore *uncore = rps_to_uncore(rps);
21222124
u32 freq;
21232125

2124-
if (GRAPHICS_VER(i915) >= 12) {
2126+
/*
2127+
* For Gen12+ reading freq from HW does not need a forcewake and
2128+
* registers will return 0 freq when GT is in RC6
2129+
*/
2130+
if (GRAPHICS_VER_FULL(i915) >= IP_VER(12, 70)) {
2131+
freq = intel_uncore_read(uncore, MTL_MIRROR_TARGET_WP1);
2132+
} else if (GRAPHICS_VER(i915) >= 12) {
21252133
freq = intel_uncore_read(uncore, GEN12_RPSTAT1);
21262134
} else if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915)) {
21272135
vlv_punit_get(i915);

0 commit comments

Comments
 (0)