tegra: hwpm: return error from read/write function

Currently, read/write functions validate aperture and mmio address
pointers. However, the error cannot be returned to the parent resulting
into undetected errors.
Modify all read write functions to return error on failure. This will
also allow HWPM driver to know about unavailable IP perfmuxes.

Jira THWPM-41

Change-Id: I6cc4ba7a831d5058657d4f2536b1ce3ab20b30c6
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2707446
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Vedashree Vidwans
2022-05-04 16:28:56 -07:00
committed by mobile promotions
parent 8e27814e39
commit c220f9f46f
8 changed files with 417 additions and 172 deletions

View File

@@ -64,7 +64,8 @@ static int tegra_hwpm_perfmon_reserve(struct tegra_soc_hwpm *hwpm,
static int tegra_hwpm_perfmux_reserve(struct tegra_soc_hwpm *hwpm,
struct hwpm_ip_inst *ip_inst, struct hwpm_ip_aperture *perfmux)
{
u32 val = 0U;
int ret = 0;
u32 reg_val = 0U;
tegra_hwpm_fn(hwpm, " ");
@@ -89,10 +90,10 @@ static int tegra_hwpm_perfmux_reserve(struct tegra_soc_hwpm *hwpm,
}
/* Validate perfmux availability by reading 1st alist offset */
val = tegra_hwpm_regops_readl(hwpm,
ret = tegra_hwpm_regops_readl(hwpm, ip_inst, perfmux,
tegra_hwpm_safe_add_u64(perfmux->start_abs_pa,
perfmux->alist[0U].reg_offset), ip_inst, perfmux);
if (val < 0U) {
perfmux->alist[0U].reg_offset), &reg_val);
if (ret != 0) {
tegra_hwpm_dbg(hwpm, hwpm_info,
"perfmux start_abs_pa 0x%llx unavailable",
perfmux->start_abs_pa);