Commit Graph

3 Commits

Author SHA1 Message Date
Jinesh Parakh
19de6baf19 drivers: devfreq: Fix CERT-C Violations
Fix the following CERT-C Violations:
governor_pod_scaling_v2.c : CERT ERR33-C

The violations occur due to non-verification of the snprintf
return values.
Adding WARN_ON statements to verify the return values.

CID 378002
CID 391305
CID 442828
CID 443110

Bug 3512546

Signed-off-by: Jinesh Parakh <jparakh@nvidia.com>
Change-Id: I91c35ecce9348d4f7127eafa603d2b8c2391ba18
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2723684
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00
Peng Liu
8a2d6e1b54 devfreq: pod v2: build as ext module for kstable
governor_pod_scaling_v2 will be provided as a kernel module in future
NVIDIA software deliverables for Linux platforms. As of this moment, the
function that returns the range of the device's scaling frequency hasn't
been exposed from Linux kernel for modules to call. A similar function
is implemented in the governor_pod_scaling_v2, but this function cannot
get the frequency constraints put through the PM QOS interface due to
the same reason, lack of kernel API function. An upstream kernel patch
has been proposed by the power management maintainer to provide the
function needed by governor_pod_scaling_v2, but it's not in any release
kernel yet. For now, PM QOS support is removed from
governor_pod_scaling_v2 and it will be added back when the upstream
kernel patch is available in kernel releases.

drivers_devfreq_governor_5_14.h is a copy of drivers/devfreq/governor.h
of Linux kernel 5.14. Having this copy is to avoid introducing the
dependency on Linux source for building the podgov as external module.

JIRA ID: LS-418

Signed-off-by: Peng Liu <pengliu@nvidia.com>
Change-Id: I0c70acf5679fed53f30bc3ba7c01ea571036cc5e
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2638232
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-04 05:18:03 +00:00
Aaron Tian
008fd60935 devfreq: introduce DEVFREQ_GOV_POD_SCALING_V2
Introduce DEVFREQ_GOV_POD_SCALING_V2 for podgov
governor implementation on kernel-5.9 and later
version to address major changes in upstream
devfreq framework.

1. devfreq framework uses devm_pm_qos to store
   "min/max frequency request from user-space",
   which caused 'min_freq' & 'max_freq' field
   in struct devfreq have been removed.
2. DEVFREQ_GOV_INTERVAL renamed as DEVFREQ_GOV_UPDATE_INTERVAL, and
   devfreq_interval_update() renamed as devfreq_update_interval()
3. return type of debugfs_create_u32() changed to void

Bug 200639056

Change-Id: I673ae3ac6b55b26766253ae0f1aeba181e2e0b53
Signed-off-by: Aaron Tian <atian@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2400108
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-04 05:18:03 +00:00