1. May 12, 2022
  2. May 10, 2022
  3. May 07, 2022
    • Pierre Gondois's avatar
      cpufreq: CPPC: Register EM based on efficiency class information · 740fcdc2
      Pierre Gondois authored
      
      
      Performance states and energy consumption values are not advertised
      in ACPI. In the GicC structure of the MADT table, the "Processor
      Power Efficiency Class field" (called efficiency class from now)
      allows to describe the relative energy efficiency of CPUs.
      
      To leverage the EM and EAS, the CPPC driver creates a set of
      artificial performance states and registers them in the Energy Model
      (EM), such as:
      - Every 20 capacity unit, a performance state is created.
      - The energy cost of each performance state gradually increases.
      No power value is generated as only the cost is used in the EM.
      
      During task placement, a task can raise the frequency of its whole
      pd. This can make EAS place a task on a pd with CPUs that are
      individually less energy efficient.
      As cost values are artificial, and to place tasks on CPUs with the
      lower efficiency class, a gap in cost values is generated for adjacent
      efficiency classes.
      E.g.:
      - efficiency class = 0, capacity is in [0-1024], so cost values
        are in [0: 51] (one performance state every 20 capacity unit)
      - efficiency class = 1, capacity is in [0-1024], cost values
        are in [1*gap+0: 1*gap+51].
      
      The value of the cost gap is chosen to absorb a the energy of 4 CPUs
      at their maximum capacity. This means that between:
      1- a pd of 4 CPUs, each of them being used at almost their full
         capacity. Their efficiency class is N.
      2- a CPU using almost none of its capacity. Its efficiency class is
         N+1
      EAS will choose the first option.
      
      This patch also populates the (struct cpufreq_driver).register_em
      callback if the valid efficiency_class ACPI values are provided.
      
      Signed-off-by: default avatarPierre Gondois <Pierre.Gondois@arm.com>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      740fcdc2
    • Pierre Gondois's avatar
      cpufreq: CPPC: Add per_cpu efficiency_class · d3c3db41
      Pierre Gondois authored
      
      
      In ACPI, describing power efficiency of CPUs can be done through the
      following arm specific field:
      ACPI 6.4, s5.2.12.14 'GIC CPU Interface (GICC) Structure',
      'Processor Power Efficiency Class field':
        Describes the relative power efficiency of the associated pro-
        cessor. Lower efficiency class numbers are more efficient than
        higher ones (e.g. efficiency class 0 should be treated as more
        efficient than efficiency class 1). However, absolute values
        of this number have no meaning: 2 isn’t necessarily half as
        efficient as 1.
      
      The efficiency_class field is stored in the GicC structure of the
      ACPI MADT table and it's currently supported in Linux for arm64 only.
      Thus, this new functionality is introduced for arm64 only.
      
      To allow the cppc_cpufreq driver to know and preprocess the
      efficiency_class values of all the CPUs, add a per_cpu efficiency_class
      variable to store them.
      
      At least 2 different efficiency classes must be present,
      otherwise there is no use in creating an Energy Model.
      
      The efficiency_class values are squeezed in [0:#efficiency_class-1]
      while conserving the order. For instance, efficiency classes of:
        [111, 212, 250]
      will be mapped to:
        [0 (was 111), 1 (was 212), 2 (was 250)].
      
      Each policy being independently registered in the driver, populating
      the per_cpu efficiency_class is done only once at the driver
      initialization. This prevents from having each policy re-searching the
      efficiency_class values of other CPUs. The EM will be registered in a
      following patch.
      
      The patch also exports acpi_cpu_get_madt_gicc() to fetch the GicC
      structure of the ACPI MADT table for each CPU.
      
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarPierre Gondois <Pierre.Gondois@arm.com>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      d3c3db41
    • Rafael J. Wysocki's avatar
    • Viresh Kumar's avatar
      cpufreq: Avoid unnecessary frequency updates due to mismatch · f55ae08c
      Viresh Kumar authored
      
      
      For some platforms, the frequency returned by hardware may be slightly
      different from what is provided in the frequency table. For example,
      hardware may return 499 MHz instead of 500 MHz. In such cases it is
      better to avoid getting into unnecessary frequency updates, as we may
      end up switching policy->cur between the two and sending unnecessary
      pre/post update notifications, etc.
      
      This patch has chosen allows the hardware frequency and table frequency
      to deviate by 1 MHz for now, we may want to increase it a bit later on
      if someone still complains.
      
      Reported-by: default avatarRex-BC Chen <rex-bc.chen@mediatek.com>
      Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Tested-by: default avatarJia-wei Chang <jia-wei.chang@mediatek.com>
      Reviewed-by: default avatarMatthias Brugger <matthias.bgg@gmail.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      f55ae08c
  4. May 05, 2022
  5. Apr 28, 2022
    • Rafael J. Wysocki's avatar
      Merge tag 'cpufreq-arm-fixes-5.18-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm · 0f03610b
      Rafael J. Wysocki authored
      Pull ARM cpufreq fixes for 5.18-rc5 from Viresh Kumar:
      
      "- Fix issues with the Qualcomm's cpufreq driver (Dmitry Baryshkov and
         Vladimir Zapolskiy).
       - Fix memory leak with the Sun501 driver (Xiaobing Luo)."
      
      * tag 'cpufreq-arm-fixes-5.18-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm:
        cpufreq: qcom-cpufreq-hw: Clear dcvs interrupts
        cpufreq: fix memory leak in sun50i_cpufreq_nvmem_probe
        cpufreq: qcom-cpufreq-hw: Fix throttle frequency value on EPSS platforms
        cpufreq: qcom-hw: provide online/offline operations
        cpufreq: qcom-hw: fix the opp entries refcounting
        cpufreq: qcom-hw: fix the race between LMH worker and cpuhp
        cpufreq: qcom-hw: drop affinity hint before freeing the IRQ
      0f03610b
  6. Apr 26, 2022
  7. Apr 25, 2022
  8. Apr 24, 2022
  9. Apr 23, 2022