Repository navigation
scsi: ufs: exynos: zumapro: Gate the host clocks when idle - #99
Conversation
d2508df to
4ab3ffc
Compare
|
Thank you for this, and for the numbers: C2 residency before and after, plus an I/O soak with the root on it, make the 9a side easy to follow. Stock zumapro does run software Hibern8 with clock gating (its The checks pass on today's Before I can merge it, two things:
Once it's 9a-only, with the PHY sequences or a reason, I'll merge it, and #69 can close then as you suggest. |
The PHY tables can only describe register writes. Tensor G4's Hibern8 exit sequence in Google's zuma calibration tables waits 10 us (COMMON_WAIT) between its write to the PMA common register 0x000 and its writes to the lane registers. Add a table entry for such a wait. Like a common block write, it runs once, on the lane 0 pass. Existing tables are unchanged. Link: https://android.googlesource.com/kernel/google-modules/soc/gs/+/204078758737776959ecc85c527a00fd2cabb62f/drivers/ufs/zuma/ufs-cal.h Link: https://android.googlesource.com/kernel/google-modules/soc/gs/+/204078758737776959ecc85c527a00fd2cabb62f/drivers/ufs/zuma/ufs-cal-if.c Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
Google's UFS driver runs a PMA sequence after every Hibern8 entry (ufs_cal_post_h8_enter) and another before every exit (ufs_cal_pre_h8_exit). The Tensor G4 PHY data has no cfgs_hibern8, so phy_notify_state() writes nothing and the PMA stays in its active setting while the link is in Hibern8. Add both tables from Google's zuma calibration, which the zuma and zumapro builds share (CONFIG_SOC_ZUMA). After entry: the TRSV_SQ registers 0x9f4 = 0x08 and 0xa00 = 0x3a on each lane, the common register 0x000 = 0x51, then 0xb64 = 0x30 and 0x33 on each lane. Before exit: 0x000 = 0x11, a 10 us wait, 0x9f4 = 0x00 and 0xa00 = 0x30, then 0xb64 = 0x32 and 0x22. As in the existing table, Google's byte offsets are converted to words and the lane stride is 0x800 bytes. The sequences are the same for every power mode (PMD_ALL), and Google's exit sequence has no CDR wait, so no wait_for_cdr is needed. As on gs101, the host driver runs the entry sequence after it has stopped the host clocks, where Google's runs it just before. The Pixel 8 Pro binds this data through its google,zuma-ufs-phy fallback. Its host has no idle clock gating, and runtime PM of its LUNs stays off unless userspace allows it, so it enters Hibern8 only on the way to turning the link off, at shutdown and system suspend. Google's driver runs the same entry sequence there, from the same tables. Link: https://android.googlesource.com/kernel/google-modules/soc/gs/+/204078758737776959ecc85c527a00fd2cabb62f/drivers/ufs/zuma/ufs-cal.h Link: https://android.googlesource.com/kernel/google-modules/soc/gs/+/204078758737776959ecc85c527a00fd2cabb62f/drivers/ufs/ufs-exynos.c Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
The Pixel 8 Pro's UFS host is "google,zuma-ufs", "google,zumapro-ufs", and the driver matches only the fallback, so Tensor G3 and Tensor G4 share one set of host data and anything enabled for G4 reaches G3 too. Idle Hibern8 has not been tried on G3 yet, and the next patch turns on idle clock gating with the link in Hibern8 on G4. Match "google,zuma-ufs", which the binding already documents, with a copy of today's data, and rename the shared drv_init to the SoC that keeps it. No functional change. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
zumapro set neither UFSHCD_CAP_CLK_GATING nor UFSHCD_CAP_HIBERN8_WITH_CLK_GATING, so the host clocks never went off at idle. The core also holds its CPU latency request at 0 while the clocks are on (on a host without clock scaling), so no core reached its C2 state. Gate them with the link in Hibern8 after the core's idle delay, as gs101 and gs201 do, and as Google's driver does on zumapro: its zuma-ufs.dtsi has no samsung,support-ah8, so it sets both caps. Only Tensor G4 gets this. Tensor G3 keeps its own host data, with the link active at idle, until Hibern8 has been tried there. Tested on the Pixel 9a with 7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty, before the PHY's Hibern8 sequences were added: clkgate_enable 1 with the 150 ms default delay, pm_qos_enable left on, /dev/cpu_dma_latency idle at the default, and in an idle minute cpu0 spent 36 s in C2, cpu4 39 s and cpu7 41 s (0 s with the clocks held on). A cold read of 20000 files under /usr and 30 fsync'd 8 MiB writes with idle gaps between them ran with no UFS errors, and the root file system has been on it since boot. Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
4ab3ffc to
5894c52
Compare
|
Thanks for catching both. Reworked as four commits (head 5894c52, rebased onto
husky shares the PHY data through its A boot of this head on the palmtop today ( What this boot can't show is the C2 residency. |
|
Thank you, @W4HO-ham. The four-commit split reads well, and thank you for correcting my summary of What I checked on
One thing for the record, which your PHY commit already says: the Pixel 8 Pro binds the zumapro PHY data through its fallback, so it now runs these two sequences when its link goes into Hibern8 on the way to link-off, at shutdown and system suspend. That's the same sequence Google's driver runs on zuma, and on that path only, so I'm fine with it. I'll let Brett know, so his next husky reboot covers it. Optional, not a blocker: the last commit's "Tested" paragraph is from your integration kernel before the PHY sequences existed, and it says so. If you'd like to add today's boot of this head ( |
|
Merged. Thanks, @W4HO-ham. |
zumapro's UFS host never gated its clocks at idle: it set neither
UFSHCD_CAP_CLK_GATINGnorUFSHCD_CAP_HIBERN8_WITH_CLK_GATING. On a host without clock scaling the core also holds its CPU latency request at 0 while the clocks are on, so no core on the 9a reached C2 (this is what #69 worked around at probe). This turns on gating with the link in Hibern8 after the core's idle delay, as gs101 and gs201 do.Tested on the 9a (7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty,
ufs-exynos.cblob 5fdf7d01be6a, the file in this patch):clkgate_enable1 with the default 150 ms delay;pm_qos_enableleft on,/dev/cpu_dma_latencysits at the default when idle;The root file system has been on it since boot. With this in, #69 is no longer needed for the 9a. I'll close #69 if you agree.