Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions drivers/soc/apple/clpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2193,22 +2193,28 @@ static int apple_clpc_resume(struct device *dev)
static DEFINE_SIMPLE_DEV_PM_OPS(apple_clpc_pm_ops, apple_clpc_suspend,
apple_clpc_resume);

/* Only the stock M5/F3 busy floor is qualified on T8132. Do not invent
* intermediate frequency-to-memory tables; idle can still release the vote.
/*
* T8132: DCS states 0-5 on rail 0, fabric states 0-3 on rail 1. Step the
* CPU memory floor by frequency quartile and require three busy samples in
* a row (12 ms), as on T6040, so brief interactive bursts and low-clocked
* E-core work do not hold top DCS/fabric voltage states. Top-quartile CPU
* work still requests DCS 5 / fabric 3 for full memory bandwidth.
*
* The G16 firmware keeps graphics powered while the GPU idles, so its power
* state would hold the floor up all the time: on J713 that keeps the DCS and
* the fabric at their top states at an idle desktop, about 0.45 W more than
* with the floor released. The GPU driver reports its work instead, as on
* T6040, and gets the M5/F3 floor while it has work in flight. Without that
* floor, rendering is about 45% slower.
* T6040, and gets the M5/F3 floor (or DT busy-share ladder where present)
* while it has work in flight. Without that floor, rendering is about 45%
* slower.
*/
static const struct apple_clpc_hw apple_clpc_hw_t8132 = {
.rail = { [APPLE_CLPC_DCS] = 0, [APPLE_CLPC_SOC] = 1 },
.map = {
[APPLE_CLPC_DCS] = { 5, 5, 5, 5 },
[APPLE_CLPC_SOC] = { 3, 3, 3, 3 },
[APPLE_CLPC_DCS] = { 1, 2, 4, 5 },
[APPLE_CLPC_SOC] = { 0, 0, 1, 3 },
},
.sustain = 3,
.gpu_demand = false,
.gpu_input = true,
};
Expand Down Expand Up @@ -2507,6 +2513,15 @@ static void apple_clpc_t8132_gpu_input_test(struct kunit *test)
kref_init(&gpu->ref);
spin_lock_init(&gpu->lock);
KUNIT_EXPECT_FALSE(test, apple_clpc_hw_t8132.gpu_demand);
KUNIT_EXPECT_EQ(test, apple_clpc_hw_t8132.sustain, 3u);
KUNIT_EXPECT_EQ(test, apple_clpc_hw_t8132.map[APPLE_CLPC_DCS][0], 1u);
KUNIT_EXPECT_EQ(test, apple_clpc_hw_t8132.map[APPLE_CLPC_DCS][1], 2u);
KUNIT_EXPECT_EQ(test, apple_clpc_hw_t8132.map[APPLE_CLPC_DCS][2], 4u);
KUNIT_EXPECT_EQ(test, apple_clpc_hw_t8132.map[APPLE_CLPC_DCS][3], 5u);
KUNIT_EXPECT_EQ(test, apple_clpc_hw_t8132.map[APPLE_CLPC_SOC][0], 0u);
KUNIT_EXPECT_EQ(test, apple_clpc_hw_t8132.map[APPLE_CLPC_SOC][1], 0u);
KUNIT_EXPECT_EQ(test, apple_clpc_hw_t8132.map[APPLE_CLPC_SOC][2], 1u);
KUNIT_EXPECT_EQ(test, apple_clpc_hw_t8132.map[APPLE_CLPC_SOC][3], 3u);

/* No input, or no work reported: no GPU floor. */
KUNIT_EXPECT_FALSE(test, apple_clpc_gpu_input_demand(&apple_clpc_hw_t8132,
Expand Down
9 changes: 7 additions & 2 deletions tools/asahi/clpc-gpu-demand-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,11 +715,16 @@ def main():
}

// T8132's G16 firmware keeps graphics powered while the GPU idles: the
// M5/F3 floor follows the work the GPU driver reports, as on T6040.
// M5/F3 floor follows the work the GPU driver reports, as on T6040, while CPU
// clusters step through the quartile ladder after a 3-sample busy streak.
static void check_t8132(void) {
struct apple_clpc_gpu gpu={0};
struct apple_clpc c={.hw=&apple_clpc_hw_t8132,.has_pmc=true,.agent=1,.mask=3,.gpu=&gpu};
assert(!c.hw->gpu_demand);
assert(!c.hw->gpu_demand && c.hw->sustain==3);
assert(c.hw->map[APPLE_CLPC_DCS][0]==1 && c.hw->map[APPLE_CLPC_DCS][1]==2 &&
c.hw->map[APPLE_CLPC_DCS][2]==4 && c.hw->map[APPLE_CLPC_DCS][3]==5);
assert(c.hw->map[APPLE_CLPC_SOC][0]==0 && c.hw->map[APPLE_CLPC_SOC][1]==0 &&
c.hw->map[APPLE_CLPC_SOC][2]==1 && c.hw->map[APPLE_CLPC_SOC][3]==3);
read_error=vote_error=0; pmgr_status=0xf0; pmp_floor=0; jiffies=0; published=~0u;
apple_clpc_sample(&c); assert(published==0 && queued_idle && c.last_reason==0);
gpu.active=true; jiffies=100;
Expand Down
Loading