tegra: hwpm: fix bug in hwpm unregister

Currently, both register and unregister calls to HWPM continue to mark
IP to be available. Fix this bug by updating tegra_hwpm_record_ip_ops()
to accept IP "available" as boolean argument.

Jira THWPM-8

Change-Id: I5a80ffa7ff20c1dc94528f20fd760a4f09721910
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2925492
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Vedashree Vidwans
2023-06-23 15:05:53 -07:00
committed by mobile promotions
parent fe31e92d6c
commit 4a4774bc0a

View File

@@ -232,7 +232,7 @@ int tegra_hwpm_obtain_resource_info(struct tegra_soc_hwpm *hwpm,
} }
static int tegra_hwpm_record_ip_ops(struct tegra_soc_hwpm *hwpm, static int tegra_hwpm_record_ip_ops(struct tegra_soc_hwpm *hwpm,
struct tegra_soc_hwpm_ip_ops *soc_ip_ops) struct tegra_soc_hwpm_ip_ops *soc_ip_ops, bool available)
{ {
struct tegra_hwpm_ip_ops ip_ops; struct tegra_hwpm_ip_ops ip_ops;
@@ -252,7 +252,7 @@ static int tegra_hwpm_record_ip_ops(struct tegra_soc_hwpm *hwpm,
tegra_hwpm_translate_soc_hwpm_resource(hwpm, tegra_hwpm_translate_soc_hwpm_resource(hwpm,
(enum tegra_soc_hwpm_resource)soc_ip_ops->resource_enum), (enum tegra_soc_hwpm_resource)soc_ip_ops->resource_enum),
soc_ip_ops->ip_base_address, soc_ip_ops->ip_base_address,
&ip_ops, true); &ip_ops, available);
} }
int tegra_hwpm_complete_ip_register_impl(struct tegra_soc_hwpm *hwpm) int tegra_hwpm_complete_ip_register_impl(struct tegra_soc_hwpm *hwpm)
@@ -263,7 +263,7 @@ int tegra_hwpm_complete_ip_register_impl(struct tegra_soc_hwpm *hwpm)
tegra_hwpm_fn(hwpm, " "); tegra_hwpm_fn(hwpm, " ");
while (node != NULL) { while (node != NULL) {
ret = tegra_hwpm_record_ip_ops(hwpm, &node->ip_ops); ret = tegra_hwpm_record_ip_ops(hwpm, &node->ip_ops, REGISTER_IP);
if (ret != 0) { if (ret != 0) {
tegra_hwpm_err(hwpm, tegra_hwpm_err(hwpm,
"Resource enum %d extract IP ops failed", "Resource enum %d extract IP ops failed",
@@ -360,7 +360,7 @@ void tegra_soc_hwpm_ip_register(struct tegra_soc_hwpm_ip_ops *hwpm_ip_ops)
tegra_hwpm_dbg(hwpm, hwpm_info | hwpm_dbg_ip_register, tegra_hwpm_dbg(hwpm, hwpm_info | hwpm_dbg_ip_register,
"Register IP 0x%llx", hwpm_ip_ops->ip_base_address); "Register IP 0x%llx", hwpm_ip_ops->ip_base_address);
ret = tegra_hwpm_record_ip_ops(hwpm, hwpm_ip_ops); ret = tegra_hwpm_record_ip_ops(hwpm, hwpm_ip_ops, REGISTER_IP);
if (ret < 0) { if (ret < 0) {
tegra_hwpm_err(hwpm, "Failed to set IP ops for IP %d", tegra_hwpm_err(hwpm, "Failed to set IP ops for IP %d",
hwpm_ip_ops->resource_enum); hwpm_ip_ops->resource_enum);
@@ -392,7 +392,7 @@ void tegra_soc_hwpm_ip_unregister(struct tegra_soc_hwpm_ip_ops *hwpm_ip_ops)
tegra_hwpm_dbg(hwpm, hwpm_info | hwpm_dbg_ip_register, tegra_hwpm_dbg(hwpm, hwpm_info | hwpm_dbg_ip_register,
"Unregister IP 0x%llx", hwpm_ip_ops->ip_base_address); "Unregister IP 0x%llx", hwpm_ip_ops->ip_base_address);
ret = tegra_hwpm_record_ip_ops(hwpm, hwpm_ip_ops); ret = tegra_hwpm_record_ip_ops(hwpm, hwpm_ip_ops, UNREGISTER_IP);
if (ret < 0) { if (ret < 0) {
tegra_hwpm_err(hwpm, "Failed to reset IP ops for IP %d", tegra_hwpm_err(hwpm, "Failed to reset IP ops for IP %d",
hwpm_ip_ops->resource_enum); hwpm_ip_ops->resource_enum);