The lowest performance level state for the E-cores on the M2 Pro/Max is
authorkettenis <kettenis@openbsd.org>
Sun, 16 Apr 2023 08:02:45 +0000 (08:02 +0000)
committerkettenis <kettenis@openbsd.org>
Sun, 16 Apr 2023 08:02:45 +0000 (08:02 +0000)
2 instead of 1.  Handle this by taking the lowest state from the opp tables
instead of hardcoding it.  Fixes cpuperf on the M2 Pro/Max.

ok patrick@

sys/arch/arm64/dev/aplcpu.c

index f11f8e6..5e661f5 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: aplcpu.c,v 1.5 2022/12/03 13:31:32 kettenis Exp $     */
+/*     $OpenBSD: aplcpu.c,v 1.6 2023/04/16 08:02:45 kettenis Exp $     */
 /*
  * Copyright (c) 2022 Mark Kettenis <kettenis@openbsd.org>
  *
@@ -375,8 +375,8 @@ aplcpu_setperf(int level)
                                continue;
 
                        /* Translate performance level to a P-state. */
-                       opp_level = 1;
                        ot = sc->sc_opp_table[j];
+                       opp_level = ot->ot_opp[0].opp_level;
                        for (k = 0; k < ot->ot_nopp; k++) {
                                if (ot->ot_opp[k].opp_hz <= level_hz &&
                                    ot->ot_opp[k].opp_level >= opp_level)