mbox series

[v1,0/5] Add cpuidle support for Tegra194

Message ID 1614838092-30398-1-git-send-email-skomatineni@nvidia.com
Headers show
Series Add cpuidle support for Tegra194 | expand

Message

Sowjanya Komatineni March 4, 2021, 6:08 a.m. UTC
This series adds cpuidle support for Tegra194 carmel CPUs.

MCE firmware is responsible for deciding on CPU idle power state
based on state information and MCE firmware background work.

Tegra MCE ARI driver is the interface driver to communicate with
MCE firmware from the kernel.

CPU idle driver passes idle state information to MCE through Tegra
MCE driver and requests idle state transition to MCE happens through
PSCI CPU suspend.

This series includes below patches
- Add CPUIDLE section to MAINTAINERS
- Add Tegra MCE ARI driver to communicate with MCE firmware from kernel
- Add dt-bindings for Tegra194 cpu idle states
- Add cpuidle driver to support Tegra194 CPUs idle state management
- Update Tegra194 device tree with cpuidle support to Tegra194 CPUs.


Sowjanya Komatineni (5):
  MAINTAINERS: Add Tegra CPUIDLE driver section
  firmware: tegra: Add Tegra194 MCE ARI driver
  dt-bindings: arm: Add cpu-idle-states to Tegra194 CPU nodes
  cpuidle: Add Tegra194 cpuidle driver
  arm64: dts: tegra194: Add CPU idle states

 .../bindings/arm/nvidia,tegra194-ccplex.yaml       |  53 ++++
 MAINTAINERS                                        |  12 +
 arch/arm64/boot/dts/nvidia/tegra194.dtsi           |  28 ++
 drivers/cpuidle/Kconfig.arm                        |  10 +
 drivers/cpuidle/Makefile                           |   1 +
 drivers/cpuidle/cpuidle-tegra194.c                 | 319 +++++++++++++++++++++
 drivers/firmware/tegra/Kconfig                     |  11 +
 drivers/firmware/tegra/Makefile                    |   4 +
 drivers/firmware/tegra/mce-tegra194.c              | 155 ++++++++++
 drivers/firmware/tegra/mce.c                       |  88 ++++++
 include/soc/tegra/mce.h                            |  32 +++
 include/soc/tegra/t194_nvg.h                       |  56 ++++
 12 files changed, 769 insertions(+)
 create mode 100644 drivers/cpuidle/cpuidle-tegra194.c
 create mode 100644 drivers/firmware/tegra/mce-tegra194.c
 create mode 100644 drivers/firmware/tegra/mce.c
 create mode 100644 include/soc/tegra/mce.h
 create mode 100644 include/soc/tegra/t194_nvg.h

Comments

Daniel Lezcano March 4, 2021, 8:01 a.m. UTC | #1
On 04/03/2021 07:08, Sowjanya Komatineni wrote:
> Add Tegra CPUIDLE driver section with maintainers and mailing list
> entries.
> 
> Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
> ---
>  MAINTAINERS | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index cac8429..277fcfd 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -4679,6 +4679,18 @@ S:	Supported
>  F:	drivers/cpuidle/cpuidle-psci.h
>  F:	drivers/cpuidle/cpuidle-psci-domain.c
>  
> +CPUIDLE DRIVER - TEGRA194
> +M:	Thierry Reding <thierry.reding@gmail.com>
> +M:	Jonathan Hunter <jonathanh@nvidia.com>
> +M:	Krishna Sitaraman <ksitaraman@nvidia.com>
> +M:	Sanjay Chandrashekara <sanjayc@nvidia.com>
> +M:	Sowjanya Komatineni <skomatineni@nvidia.com>

It does not make sense to have so many maintainers for a single file.


> +L:	linux-pm@vger.kernel.org
> +L:	linux-tegra@vger.kernel.org
> +S:	Maintained
> +F:	Documentation/devicetree/bindings/arm/nvidia,tegra194-ccplex.yaml
> +F:	drivers/cpuidle/cpuidle-tegra194.c
> +
>  CRAMFS FILESYSTEM
>  M:	Nicolas Pitre <nico@fluxnic.net>
>  S:	Maintained
>
Dmitry Osipenko March 5, 2021, 1:50 p.m. UTC | #2
04.03.2021 09:08, Sowjanya Komatineni пишет:
...
> +static int __init tegra194_cpuidle_probe(struct platform_device *pdev)
> +{
> +	struct cpumask *cpumask;
> +	int cpu, ret;
> +
> +	if (!check_mce_version()) {
> +		pr_err("cpuidle: incompatible MCE version, cannot register driver\n");

Should be dev_err() everywhere.

> +		return -ENODEV;
> +	}
> +
> +	tsc_per_usec = arch_timer_get_cntfrq() / 1000000;
> +
> +	cpumask = devm_kzalloc(&pdev->dev, cpumask_size(), GFP_KERNEL);
> +	for_each_online_cpu(cpu)
> +		cpumask_set_cpu(cpu, cpumask);

cpumask_copy(..)?

> +	t194_cpu_idle_driver.cpumask = cpumask;

Depending on 'online' mask instead of the 'present' mask looks odd. Is
this really intended to be so?

...
> +static int tegra194_cpuidle_remove(struct platform_device *pdev)
> +{
> +	unregister_pm_notifier(&suspend_notifier);
> +	cpuhp_remove_state(hp_state);
> +	cpuidle_unregister(&t194_cpu_idle_driver);
> +	kfree(t194_cpu_idle_driver.cpumask);

kfree() of a managed resource.