aarch64-laptops / build

Build an Linux OS based image
221 stars 47 forks source link

cpu opp table 5.9.2, working cpu boost/turbo patch #64

Open bm16ton opened 3 years ago

bm16ton commented 3 years ago

So updating from 5.9.1 to 5.9.2 i lost 2.84ghz as a possible speed. The update includes a check that compares the hardware interface listings against the opp table. The 2.8ghz entry was/is 2803200000 which is not valid on my yoga c630 (A diff between sdm845 and sdm850?) , and since the LUT doesnt have a corresponding OPP entry it wont work. Also the yoga has a 2956800000 entry in LUT. So I added the 2 entries

    cpu4_opp33: opp-2841600000 {
        opp-hz = /bits/ 64 <2841600000>;
        opp-peak-kBps = <7216000 25497600>;
    };

    cpu4_opp34: opp-2956800000 {
        opp-hz = /bits/ 64 <2956800000>;
        opp-peak-kBps = <7216000 25497600>;
    };

Now 2.84ghz is back. I also see the same thing in regards to the 2.96ghz entry now as i do on previous kernels. cpufreq-info lists 2.96 but also says "frequency should be within 826 MHz and 2.84 GHz" cat /sys/devices/system/cpu/cpufreq/policy4/scaling_boost_frequencies returns 2956800 but even in coldest conditions with all cpu cores maxed it never switches to 2.96ghz and I dont know of anyway to force turbo mode. cat cat /sys/kernel/debug/opp/cpu4/opp\:2956800000/turbo would return N so I added turbo-mode; to the opp entry but it stil wont jump. Anyone been able to get turbo modes working? I see in a patch for qcom-cpufreq-hw here https://patchwork.kernel.org/project/linux-pm/patch/1545415608-15163-1-git-send-email-tdas@codeaurora.org/ that his available freq maxout at 2.6ghz and 2803200 listed as his turbo freq. I find it a little suspicious that the turbo boost on the sdm850 is only 110mhz. So im worried my available freqs actually have turbo freqs mixed in?

UPDATE: I just patched qcom-cpufreq-hw.c to remove turbo flag from last cpu freq, then dropped the cpu thermal trips by 5c and crit by 10c in sdm845.dtsi . It now lists 2.96ghz as usable and everything scales nicely under load, staying at 2.96ghz for a fair amount then auto adjusts to 2.84ghz max for even longer, then eventually under max load hits 2.75ghz max and stays. As soon as the temp drops the higher freqs become available again. This seems fine to me, and basically how turbo works except that 2.96ghz is select-able? Anyway any ideas or suggestions on how to do this the correct way is appreciated.

UPDATE2: so simply adding cpufreq_enable_boost_support(); to line 317 of qcom-cpufreq-hw.c I now can "echo 1 > /sys/devices/system/cpu/cpufreq/boost" to enable turbo frequencies!! Well along with the opp table additions added above

patch with above changes plus a 5c lower temp alert here; https://github.com/bm16ton/yoga-c630-linux-kernel/commit/a2662630b67938622754f94e629415662ba4a67d

UPDATE3: even tho functionally it doesnt make any difference i moved the new freqs to sdm850-lenovo-yoga-c630.dts it seems the correct way and now the new freqs wont show in /sys/kernel/debug/opp for sdm845 devices (not that it matters) and split everything into 3 patches; add boost support to qcom-cpufreq-hw https://github.com/bm16ton/yoga-c630-linux-kernel/commit/a702ba94e8a8f5c32ad5d30a5f996b9f39b64af6.patch add the 2 freqs to sdm850 dts https://github.com/bm16ton/yoga-c630-linux-kernel/commit/301f0047da5750ddc6b528e084540d621124f466.patch drop temp alerts by 5c and crit by 10c in sdm845.dtsi https://github.com/bm16ton/yoga-c630-linux-kernel/commit/0f9e46aa812f74a56012ccf8fac9d2032d22ff42.patch

I emailed these to what i hope was the appropriate maintainers, the 2 new freqs i have received a response and hopefully will go thru. still waiting to hear about qcom-cpufreq-hw.