30 Jul, 2020

2 commits

  • The current error paths for the cpuidle-psci driver, may leak memory or
    possibly leave CPU devices attached to their PM domains. These are quite
    harmless issues, but still deserves to be taken care of.

    Although, rather than fixing them by keeping track of allocations that
    needs to be freed, which tends to become a bit messy, let's convert into a
    platform driver. In this way, it gets easier to fix the memory leaks as we
    can rely on the devm_* functions.

    Moreover, converting to a platform driver also enables support for deferred
    probe, which subsequent changes takes benefit from.

    Signed-off-by: Ulf Hansson
    Reviewed-by: Lukasz Luba
    Signed-off-by: Rafael J. Wysocki

    Ulf Hansson
     
  • The combined build object for the PSCI cpuidle driver and the PSCI PM
    domain, is a bit messy. Therefore let's split it up by adding a new Kconfig
    ARM_PSCI_CPUIDLE_DOMAIN and convert into two separate objects.

    Reviewed-by: Lina Iyer
    Reviewed-by: Sudeep Holla
    Signed-off-by: Ulf Hansson
    Signed-off-by: Rafael J. Wysocki

    Ulf Hansson
     

02 Jan, 2020

2 commits

  • When the hierarchical CPU topology layout is used in DT and the PSCI OSI
    mode is supported by the PSCI FW, let's initialize a corresponding PM
    domain topology by using genpd. This enables a CPU and a group of CPUs,
    when attached to the topology, to be power-managed accordingly.

    To trigger the attempt to initialize the genpd data structures let's use a
    subsys_initcall, which should be early enough to allow CPUs, but also other
    devices to be attached.

    The initialization consists of parsing the PSCI OF node for the topology
    and the "domain idle states" DT bindings. In case the idle states are
    compatible with "domain-idle-state", the initialized genpd becomes
    responsible of selecting an idle state for the PM domain, via assigning it
    a genpd governor.

    Note that, a successful initialization of the genpd data structures, is
    followed by a call to psci_set_osi_mode(), as to try to enable the OSI mode
    in the PSCI FW. In case this fails, we fall back into a degraded mode
    rather than bailing out and returning error codes.

    Co-developed-by: Lina Iyer
    Signed-off-by: Lina Iyer
    Signed-off-by: Ulf Hansson
    Reviewed-by: Sudeep Holla
    Acked-by: Rafael J. Wysocki

    Ulf Hansson
     
  • Introduce a PSCI DT helper function, psci_dt_attach_cpu(), which takes a
    CPU number as an in-parameter and tries to attach the CPU's struct device
    to its corresponding PM domain.

    Let's makes use of dev_pm_domain_attach_by_name(), as it allows us to
    specify "psci" as the "name" of the PM domain to attach to. Additionally,
    let's also prepare the attached device to be power managed via runtime PM.

    Note that, the implementation of the new helper function is in a new
    separate c-file, which may seems a bit too much at this point. However,
    subsequent changes that implements the remaining part of the PM domain
    support for cpuidle-psci, helps to justify this split.

    Signed-off-by: Ulf Hansson
    Reviewed-by: Sudeep Holla
    Acked-by: Rafael J. Wysocki

    Ulf Hansson