tegra: hwpm: Modify OS common code for HWPM resmgr

- Modify the OS common code to be used by HWPM resource
manager in QNX.
- Add dev_name and fd fields in IP files
- Typecast variables to unsigned long long where ever they
are printed with %llx.

Jira THWPM-54

Change-Id: Ie3696f5dab03dddf30ae6939525ef8f999260d5d
Signed-off-by: vasukis <vasukis@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2901186
Reviewed-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
vasukis
2023-05-09 21:50:25 +00:00
committed by mobile promotions
parent afce55ed44
commit 26bd5451c2
30 changed files with 157 additions and 57 deletions

View File

@@ -122,8 +122,8 @@ int tegra_hwpm_combine_alist(struct tegra_soc_hwpm *hwpm, u64 *alist)
if (func_args.full_alist_idx != hwpm->alist_map->full_alist_size) { if (func_args.full_alist_idx != hwpm->alist_map->full_alist_size) {
tegra_hwpm_err(hwpm, "full_alist_size 0x%llx doesn't match " tegra_hwpm_err(hwpm, "full_alist_size 0x%llx doesn't match "
"max full_alist_idx 0x%llx", "max full_alist_idx 0x%llx",
hwpm->alist_map->full_alist_size, (unsigned long long)hwpm->alist_map->full_alist_size,
func_args.full_alist_idx); (unsigned long long)func_args.full_alist_idx);
err = -EINVAL; err = -EINVAL;
} }

View File

@@ -233,7 +233,8 @@ static int tegra_hwpm_alloc_dynamic_inst_element_array(
tegra_hwpm_dbg(hwpm, hwpm_dbg_driver_init, tegra_hwpm_dbg(hwpm, hwpm_dbg_driver_init,
"IP inst range(0x%llx-0x%llx) a_type = %d inst_slots %d", "IP inst range(0x%llx-0x%llx) a_type = %d inst_slots %d",
inst_a_info->range_start, inst_a_info->range_end, (unsigned long long)inst_a_info->range_start,
(unsigned long long)inst_a_info->range_end,
a_type, inst_a_info->inst_slots); a_type, inst_a_info->inst_slots);
return 0; return 0;
@@ -294,8 +295,9 @@ static int tegra_hwpm_func_single_element(struct tegra_soc_hwpm *hwpm,
tegra_hwpm_dbg(hwpm, hwpm_dbg_driver_init, tegra_hwpm_dbg(hwpm, hwpm_dbg_driver_init,
"IP %d inst %d a_type %d element type %d" "IP %d inst %d a_type %d element type %d"
" start_addr 0x%llx static idx %d == dynamic idx %d", " start_addr 0x%llx static idx %d == dynamic idx %d",
ip_idx, static_inst_idx, a_type, element->element_type, ip_idx, static_inst_idx, a_type,
element->start_abs_pa, static_aperture_idx, idx); element->element_type, (unsigned long long)element->start_abs_pa,
static_aperture_idx, idx);
/* Set element slot pointer */ /* Set element slot pointer */
e_info->element_arr[idx] = element; e_info->element_arr[idx] = element;
@@ -313,7 +315,7 @@ static int tegra_hwpm_func_single_element(struct tegra_soc_hwpm *hwpm,
/* This element is floorswept */ /* This element is floorswept */
tegra_hwpm_dbg(hwpm, hwpm_dbg_floorsweep_info, tegra_hwpm_dbg(hwpm, hwpm_dbg_floorsweep_info,
"skip floorswept element 0x%llx", "skip floorswept element 0x%llx",
element->start_abs_pa); (unsigned long long)element->start_abs_pa);
break; break;
} }
} }
@@ -332,7 +334,7 @@ static int tegra_hwpm_func_single_element(struct tegra_soc_hwpm *hwpm,
*/ */
tegra_hwpm_dbg(hwpm, hwpm_dbg_floorsweep_info, tegra_hwpm_dbg(hwpm, hwpm_dbg_floorsweep_info,
"perfmux start_abs_pa 0x%llx unavailable", "perfmux start_abs_pa 0x%llx unavailable",
element->start_abs_pa); (unsigned long long)element->start_abs_pa);
ip_inst->element_fs_mask &= ip_inst->element_fs_mask &=
~(element->element_index_mask); ~(element->element_index_mask);
@@ -348,7 +350,8 @@ static int tegra_hwpm_func_single_element(struct tegra_soc_hwpm *hwpm,
"IP %d inst %d a_type %d element type %d" "IP %d inst %d a_type %d element type %d"
" start_addr 0x%llx not reserved", " start_addr 0x%llx not reserved",
ip_idx, static_inst_idx, a_type, ip_idx, static_inst_idx, a_type,
element->element_type, element->start_abs_pa); element->element_type,
(unsigned long long)element->start_abs_pa);
return 0; return 0;
} }
if (element->alist) { if (element->alist) {
@@ -369,7 +372,8 @@ static int tegra_hwpm_func_single_element(struct tegra_soc_hwpm *hwpm,
"IP %d inst %d a_type %d element type %d" "IP %d inst %d a_type %d element type %d"
" start_addr 0x%llx not reserved", " start_addr 0x%llx not reserved",
ip_idx, static_inst_idx, a_type, ip_idx, static_inst_idx, a_type,
element->element_type, element->start_abs_pa); element->element_type,
(unsigned long long)element->start_abs_pa);
return 0; return 0;
} }
err = hwpm->active_chip->copy_alist(hwpm, err = hwpm->active_chip->copy_alist(hwpm,
@@ -389,7 +393,8 @@ static int tegra_hwpm_func_single_element(struct tegra_soc_hwpm *hwpm,
"IP %d inst %d a_type %d element type %d" "IP %d inst %d a_type %d element type %d"
" start_addr 0x%llx not reservable", " start_addr 0x%llx not reservable",
ip_idx, static_inst_idx, a_type, ip_idx, static_inst_idx, a_type,
element->element_type, element->start_abs_pa); element->element_type,
(unsigned long long)element->start_abs_pa);
return 0; return 0;
} }
err = tegra_hwpm_element_reserve(hwpm, ip_inst, element); err = tegra_hwpm_element_reserve(hwpm, ip_inst, element);
@@ -408,7 +413,8 @@ static int tegra_hwpm_func_single_element(struct tegra_soc_hwpm *hwpm,
"IP %d inst %d a_type %d element type %d" "IP %d inst %d a_type %d element type %d"
" start_addr 0x%llx not reserved", " start_addr 0x%llx not reserved",
ip_idx, static_inst_idx, a_type, ip_idx, static_inst_idx, a_type,
element->element_type, element->start_abs_pa); element->element_type,
(unsigned long long)element->start_abs_pa);
return 0; return 0;
} }
ret = tegra_hwpm_element_release(hwpm, element); ret = tegra_hwpm_element_release(hwpm, element);
@@ -425,7 +431,8 @@ static int tegra_hwpm_func_single_element(struct tegra_soc_hwpm *hwpm,
"IP %d inst %d a_type %d element type %d" "IP %d inst %d a_type %d element type %d"
" start_addr 0x%llx not reserved", " start_addr 0x%llx not reserved",
ip_idx, static_inst_idx, a_type, ip_idx, static_inst_idx, a_type,
element->element_type, element->start_abs_pa); element->element_type,
(unsigned long long)element->start_abs_pa);
return 0; return 0;
} }
err = hwpm->active_chip->zero_alist_regs( err = hwpm->active_chip->zero_alist_regs(
@@ -452,7 +459,8 @@ static int tegra_hwpm_func_single_element(struct tegra_soc_hwpm *hwpm,
"IP %d inst %d a_type %d element type %d" "IP %d inst %d a_type %d element type %d"
" start_addr 0x%llx not reserved", " start_addr 0x%llx not reserved",
ip_idx, static_inst_idx, a_type, ip_idx, static_inst_idx, a_type,
element->element_type, element->start_abs_pa); element->element_type,
(unsigned long long)element->start_abs_pa);
return 0; return 0;
} }
@@ -480,7 +488,8 @@ static int tegra_hwpm_func_single_element(struct tegra_soc_hwpm *hwpm,
"IP %d inst %d a_type %d element type %d" "IP %d inst %d a_type %d element type %d"
" start_addr 0x%llx not reserved", " start_addr 0x%llx not reserved",
ip_idx, static_inst_idx, a_type, ip_idx, static_inst_idx, a_type,
element->element_type, element->start_abs_pa); element->element_type,
(unsigned long long)element->start_abs_pa);
return 0; return 0;
} }
break; break;
@@ -542,7 +551,8 @@ static int tegra_hwpm_func_all_elements_of_type(struct tegra_soc_hwpm *hwpm,
" element range(0x%llx-0x%llx) element_slots %d " " element range(0x%llx-0x%llx) element_slots %d "
"num_element_per_inst %d", "num_element_per_inst %d",
iia_func, ip_idx, static_inst_idx, a_type, iia_func, ip_idx, static_inst_idx, a_type,
e_info->range_start, e_info->range_end, (unsigned long long)e_info->range_start,
(unsigned long long)e_info->range_end,
e_info->element_slots, e_info->num_element_per_inst); e_info->element_slots, e_info->num_element_per_inst);
} }
@@ -644,8 +654,8 @@ static int tegra_hwpm_func_single_inst(struct tegra_soc_hwpm *hwpm,
"IP %d a_type %d inst range start 0x%llx" "IP %d a_type %d inst range start 0x%llx"
"element range start 0x%llx" "element range start 0x%llx"
" static inst idx %d == dynamic idx %d", " static inst idx %d == dynamic idx %d",
ip_idx, a_type, inst_a_info->range_start, ip_idx, a_type, (unsigned long long)inst_a_info->range_start,
e_info->range_start, static_inst_idx, idx); (unsigned long long)e_info->range_start, static_inst_idx, idx);
/* Set perfmux slot pointer */ /* Set perfmux slot pointer */
inst_a_info->inst_arr[idx] = ip_inst; inst_a_info->inst_arr[idx] = ip_inst;

View File

@@ -55,7 +55,7 @@ int tegra_hwpm_ip_handle_power_mgmt(struct tegra_soc_hwpm *hwpm,
return err; return err;
} }
static int tegra_hwpm_update_ip_inst_fs_mask(struct tegra_soc_hwpm *hwpm, int tegra_hwpm_update_ip_inst_fs_mask(struct tegra_soc_hwpm *hwpm,
u32 ip_idx, u32 a_type, u32 inst_idx, bool available) u32 ip_idx, u32 a_type, u32 inst_idx, bool available)
{ {
struct tegra_soc_hwpm_chip *active_chip = hwpm->active_chip; struct tegra_soc_hwpm_chip *active_chip = hwpm->active_chip;
@@ -147,13 +147,14 @@ int tegra_hwpm_set_fs_info_ip_ops(struct tegra_soc_hwpm *hwpm,
&idx, &inst_idx, &element_idx, &element_type); &idx, &inst_idx, &element_idx, &element_type);
if (!found) { if (!found) {
tegra_hwpm_err(hwpm, "Base addr 0x%llx not in IP %d", tegra_hwpm_err(hwpm, "Base addr 0x%llx not in IP %d",
base_address, idx); (unsigned long long)base_address, idx);
return -EINVAL; return -EINVAL;
} }
tegra_hwpm_dbg(hwpm, hwpm_dbg_ip_register, tegra_hwpm_dbg(hwpm, hwpm_dbg_ip_register,
"Found addr 0x%llx IP %d inst_idx %d element_idx %d e_type %d", "Found addr 0x%llx IP %d inst_idx %d element_idx %d e_type %d",
base_address, idx, inst_idx, element_idx, element_type); (unsigned long long)base_address, idx, inst_idx,
element_idx, element_type);
switch (element_type) { switch (element_type) {
case HWPM_ELEMENT_PERFMON: case HWPM_ELEMENT_PERFMON:
@@ -319,7 +320,8 @@ static bool tegra_hwpm_addr_in_single_element(struct tegra_soc_hwpm *hwpm,
tegra_hwpm_dbg(hwpm, hwpm_verbose, tegra_hwpm_dbg(hwpm, hwpm_verbose,
"IP %d addr 0x%llx inst_idx %d " "IP %d addr 0x%llx inst_idx %d "
"a_type %d: element_idx %d not populated", "a_type %d: element_idx %d not populated",
*ip_idx, find_addr, *inst_idx, a_type, *element_idx); *ip_idx, (unsigned long long)find_addr, *inst_idx,
a_type, *element_idx);
return false; return false;
} }
@@ -330,8 +332,8 @@ static bool tegra_hwpm_addr_in_single_element(struct tegra_soc_hwpm *hwpm,
tegra_hwpm_dbg(hwpm, hwpm_dbg_regops, tegra_hwpm_dbg(hwpm, hwpm_dbg_regops,
"IP %d addr 0x%llx inst_idx %d " "IP %d addr 0x%llx inst_idx %d "
"a_type %d: element_idx %d: not available", "a_type %d: element_idx %d: not available",
*ip_idx, find_addr, *inst_idx, a_type, *ip_idx, (unsigned long long)find_addr,
*element_idx); *inst_idx, a_type, *element_idx);
return false; return false;
} }
@@ -340,8 +342,8 @@ static bool tegra_hwpm_addr_in_single_element(struct tegra_soc_hwpm *hwpm,
(find_addr > element->end_abs_pa)) { (find_addr > element->end_abs_pa)) {
tegra_hwpm_err(hwpm, "IP %d addr 0x%llx inst_idx %d " tegra_hwpm_err(hwpm, "IP %d addr 0x%llx inst_idx %d "
"a_type %d element_idx %d: out of bounds", "a_type %d element_idx %d: out of bounds",
*ip_idx, find_addr, *inst_idx, a_type, *ip_idx, (unsigned long long)find_addr, *inst_idx,
*element_idx); a_type, *element_idx);
return false; return false;
} }
@@ -353,8 +355,8 @@ static bool tegra_hwpm_addr_in_single_element(struct tegra_soc_hwpm *hwpm,
tegra_hwpm_dbg(hwpm, hwpm_dbg_regops, tegra_hwpm_dbg(hwpm, hwpm_dbg_regops,
"IP %d addr 0x%llx inst_idx %d " "IP %d addr 0x%llx inst_idx %d "
"a_type %d element_idx %d address not in alist", "a_type %d element_idx %d address not in alist",
*ip_idx, find_addr, *inst_idx, a_type, *ip_idx, (unsigned long long)find_addr,
*element_idx); *inst_idx, a_type, *element_idx);
return false; return false;
} }
@@ -364,8 +366,8 @@ static bool tegra_hwpm_addr_in_single_element(struct tegra_soc_hwpm *hwpm,
tegra_hwpm_dbg(hwpm, hwpm_dbg_ip_register, tegra_hwpm_dbg(hwpm, hwpm_dbg_ip_register,
"IP %d addr 0x%llx inst_idx %d " "IP %d addr 0x%llx inst_idx %d "
"a_type %d element_idx %d: addr != start addr", "a_type %d element_idx %d: addr != start addr",
*ip_idx, find_addr, *inst_idx, a_type, *ip_idx, (unsigned long long)find_addr, *inst_idx,
*element_idx); a_type, *element_idx);
return false; return false;
} }
*element_type = element->element_type; *element_type = element->element_type;
@@ -394,7 +396,7 @@ static bool tegra_hwpm_addr_in_all_elements(struct tegra_soc_hwpm *hwpm,
if (e_info->num_element_per_inst == 0U) { if (e_info->num_element_per_inst == 0U) {
tegra_hwpm_dbg(hwpm, hwpm_verbose, tegra_hwpm_dbg(hwpm, hwpm_verbose,
"IP %d addr 0x%llx: inst_idx %d no type %d elements", "IP %d addr 0x%llx: inst_idx %d no type %d elements",
*ip_idx, find_addr, *inst_idx, a_type); *ip_idx, (unsigned long long)find_addr, *inst_idx, a_type);
return false; return false;
} }
@@ -403,7 +405,7 @@ static bool tegra_hwpm_addr_in_all_elements(struct tegra_soc_hwpm *hwpm,
/* Address not in this instance corresponding to a_type */ /* Address not in this instance corresponding to a_type */
tegra_hwpm_dbg(hwpm, hwpm_verbose, "IP %d inst_idx %d: " tegra_hwpm_dbg(hwpm, hwpm_verbose, "IP %d inst_idx %d: "
"addr 0x%llx not in type %d elements", "addr 0x%llx not in type %d elements",
*ip_idx, *inst_idx, find_addr, a_type); *ip_idx, *inst_idx, (unsigned long long)find_addr, a_type);
return false; return false;
} }
@@ -417,7 +419,7 @@ static bool tegra_hwpm_addr_in_all_elements(struct tegra_soc_hwpm *hwpm,
if (idx >= e_info->element_slots) { if (idx >= e_info->element_slots) {
tegra_hwpm_err(hwpm, "IP %d addr 0x%llx inst_idx %d a_type %d: " tegra_hwpm_err(hwpm, "IP %d addr 0x%llx inst_idx %d a_type %d: "
"element_idx %d out of bounds", "element_idx %d out of bounds",
*ip_idx, find_addr, *inst_idx, a_type, idx); *ip_idx, (unsigned long long)find_addr, *inst_idx, a_type, idx);
return false; return false;
} }
@@ -444,7 +446,7 @@ static bool tegra_hwpm_addr_in_single_instance(struct tegra_soc_hwpm *hwpm,
if (ip_inst == NULL) { if (ip_inst == NULL) {
tegra_hwpm_dbg(hwpm, hwpm_verbose, "IP %d addr 0x%llx: " tegra_hwpm_dbg(hwpm, hwpm_verbose, "IP %d addr 0x%llx: "
"a_type %d inst_idx %d not populated", "a_type %d inst_idx %d not populated",
*ip_idx, find_addr, a_type, *inst_idx); *ip_idx, (unsigned long long)find_addr, a_type, *inst_idx);
return false; return false;
} }
@@ -454,7 +456,7 @@ static bool tegra_hwpm_addr_in_single_instance(struct tegra_soc_hwpm *hwpm,
tegra_hwpm_dbg(hwpm, hwpm_dbg_regops, tegra_hwpm_dbg(hwpm, hwpm_dbg_regops,
"IP %d addr 0x%llx: " "IP %d addr 0x%llx: "
"a_type %d inst_idx %d not available", "a_type %d inst_idx %d not available",
*ip_idx, find_addr, a_type, *inst_idx); *ip_idx, (unsigned long long)find_addr, a_type, *inst_idx);
return false; return false;
} }
} }
@@ -488,7 +490,7 @@ static bool tegra_hwpm_addr_in_all_instances(struct tegra_soc_hwpm *hwpm,
if (idx >= inst_a_info->inst_slots) { if (idx >= inst_a_info->inst_slots) {
tegra_hwpm_err(hwpm, "IP %d addr 0x%llx a_type %d: " tegra_hwpm_err(hwpm, "IP %d addr 0x%llx a_type %d: "
"inst_idx %d out of bounds", "inst_idx %d out of bounds",
*ip_idx, find_addr, a_type, idx); *ip_idx, (unsigned long long)find_addr, a_type, idx);
return false; return false;
} }
@@ -550,7 +552,7 @@ static bool tegra_hwpm_addr_in_single_ip(struct tegra_soc_hwpm *hwpm,
/* Address not in this IP for this a_type */ /* Address not in this IP for this a_type */
tegra_hwpm_dbg(hwpm, hwpm_verbose, tegra_hwpm_dbg(hwpm, hwpm_verbose,
"IP %d addr 0x%llx not in a_type %d elements", "IP %d addr 0x%llx not in a_type %d elements",
*ip_idx, find_addr, a_type); *ip_idx, (unsigned long long)find_addr, a_type);
continue; continue;
} }
@@ -630,7 +632,8 @@ bool tegra_hwpm_aperture_for_address(struct tegra_soc_hwpm *hwpm,
ip_idx, inst_idx, element_idx, element_type); ip_idx, inst_idx, element_idx, element_type);
if (!found) { if (!found) {
tegra_hwpm_err(hwpm, tegra_hwpm_err(hwpm,
"Address 0x%llx not in any IP", find_addr); "Address 0x%llx not in any IP",
(unsigned long long)find_addr);
return found; return found;
} }
} }
@@ -640,7 +643,7 @@ bool tegra_hwpm_aperture_for_address(struct tegra_soc_hwpm *hwpm,
ip_idx, inst_idx, element_idx, element_type); ip_idx, inst_idx, element_idx, element_type);
if (!found) { if (!found) {
tegra_hwpm_err(hwpm, "Address 0x%llx not in IP %d", tegra_hwpm_err(hwpm, "Address 0x%llx not in IP %d",
find_addr, *ip_idx); (unsigned long long)find_addr, *ip_idx);
return found; return found;
} }
} }

View File

@@ -129,9 +129,11 @@ static struct hwpm_ip_inst t234_display_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
}; };

View File

@@ -127,9 +127,11 @@ static struct hwpm_ip_inst t234_isp_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
}; };

View File

@@ -244,9 +244,11 @@ static struct hwpm_ip_inst t234_mgbe_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
{ {
.hw_inst_mask = BIT(1), .hw_inst_mask = BIT(1),

View File

@@ -614,9 +614,11 @@ static struct hwpm_ip_inst t234_mss_channel_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
}; };

View File

@@ -232,9 +232,11 @@ static struct hwpm_ip_inst t234_mss_gpu_hub_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
}; };

View File

@@ -293,9 +293,11 @@ static struct hwpm_ip_inst t234_mss_iso_niso_hub_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
}; };

View File

@@ -286,9 +286,11 @@ static struct hwpm_ip_inst t234_mss_mcf_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
}; };

View File

@@ -127,9 +127,11 @@ static struct hwpm_ip_inst t234_nvdec_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
}; };

View File

@@ -166,9 +166,11 @@ static struct hwpm_ip_inst t234_nvdla_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
{ {
.hw_inst_mask = BIT(1), .hw_inst_mask = BIT(1),
@@ -227,9 +229,11 @@ static struct hwpm_ip_inst t234_nvdla_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
}; };

View File

@@ -127,9 +127,11 @@ static struct hwpm_ip_inst t234_nvenc_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
}; };

View File

@@ -127,9 +127,11 @@ static struct hwpm_ip_inst t234_ofa_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
}; };

View File

@@ -517,9 +517,11 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
{ {
.hw_inst_mask = BIT(1), .hw_inst_mask = BIT(1),
@@ -578,9 +580,11 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
{ {
.hw_inst_mask = BIT(2), .hw_inst_mask = BIT(2),
@@ -639,9 +643,11 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
{ {
.hw_inst_mask = BIT(3), .hw_inst_mask = BIT(3),
@@ -700,9 +706,11 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
{ {
.hw_inst_mask = BIT(4), .hw_inst_mask = BIT(4),
@@ -761,9 +769,11 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
{ {
.hw_inst_mask = BIT(5), .hw_inst_mask = BIT(5),
@@ -822,9 +832,11 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
{ {
.hw_inst_mask = BIT(6), .hw_inst_mask = BIT(6),
@@ -883,9 +895,11 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
{ {
.hw_inst_mask = BIT(7), .hw_inst_mask = BIT(7),
@@ -944,9 +958,11 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
{ {
.hw_inst_mask = BIT(8), .hw_inst_mask = BIT(8),
@@ -1005,9 +1021,11 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
{ {
.hw_inst_mask = BIT(9), .hw_inst_mask = BIT(9),
@@ -1066,9 +1084,11 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
{ {
.hw_inst_mask = BIT(10), .hw_inst_mask = BIT(10),
@@ -1127,9 +1147,11 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
}; };

View File

@@ -128,9 +128,11 @@ static struct hwpm_ip_inst t234_pma_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0x1U, .element_fs_mask = 0x1U,
.dev_name = "",
}, },
}; };

View File

@@ -159,9 +159,11 @@ static struct hwpm_ip_inst t234_pva_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = 1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "/dev/nvpvadebugfs/pva0/hwpm",
}, },
}; };

View File

@@ -129,9 +129,11 @@ static struct hwpm_ip_inst t234_rtr_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0x1U, .element_fs_mask = 0x1U,
.dev_name = "",
}, },
{ {
.hw_inst_mask = BIT(1), .hw_inst_mask = BIT(1),
@@ -189,9 +191,11 @@ static struct hwpm_ip_inst t234_rtr_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0x1U, .element_fs_mask = 0x1U,
.dev_name = "",
}, },
}; };

View File

@@ -106,9 +106,11 @@ static struct hwpm_ip_inst t234_scf_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0x1U, .element_fs_mask = 0x1U,
.dev_name = "",
}, },
}; };

View File

@@ -167,9 +167,11 @@ static struct hwpm_ip_inst t234_vi_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
{ {
.hw_inst_mask = BIT(1), .hw_inst_mask = BIT(1),
@@ -228,9 +230,11 @@ static struct hwpm_ip_inst t234_vi_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
}; };

View File

@@ -127,9 +127,11 @@ static struct hwpm_ip_inst t234_vic_inst_static_array[
.ip_dev = NULL, .ip_dev = NULL,
.hwpm_ip_pm = NULL, .hwpm_ip_pm = NULL,
.hwpm_ip_reg_op = NULL, .hwpm_ip_reg_op = NULL,
.fd = -1,
}, },
.element_fs_mask = 0U, .element_fs_mask = 0U,
.dev_name = "",
}, },
}; };

View File

@@ -52,7 +52,7 @@ int t234_hwpm_extract_ip_ops(struct tegra_soc_hwpm *hwpm,
resource_enum, &ip_idx))) { resource_enum, &ip_idx))) {
tegra_hwpm_dbg(hwpm, hwpm_dbg_ip_register, tegra_hwpm_dbg(hwpm, hwpm_dbg_ip_register,
"SOC hwpm resource %d (base 0x%llx) is unconfigured", "SOC hwpm resource %d (base 0x%llx) is unconfigured",
resource_enum, base_address); resource_enum, (unsigned long long)base_address);
goto fail; goto fail;
} }
@@ -102,7 +102,7 @@ int t234_hwpm_extract_ip_ops(struct tegra_soc_hwpm *hwpm,
tegra_hwpm_err(hwpm, tegra_hwpm_err(hwpm,
"Failed to %s fs/ops for IP %d (base 0x%llx)", "Failed to %s fs/ops for IP %d (base 0x%llx)",
available == true ? "set" : "reset", available == true ? "set" : "reset",
ip_idx, base_address); ip_idx, (unsigned long long)base_address);
goto fail; goto fail;
} }
break; break;
@@ -133,7 +133,7 @@ int t234_hwpm_extract_ip_ops(struct tegra_soc_hwpm *hwpm,
if (ret != -ENODEV) { if (ret != -ENODEV) {
tegra_hwpm_err(hwpm, tegra_hwpm_err(hwpm,
"IP %d base 0x%llx:Failed to %s fs/ops", "IP %d base 0x%llx:Failed to %s fs/ops",
ip_idx, base_address, ip_idx, (unsigned long long)base_address,
available == true ? "set" : "reset"); available == true ? "set" : "reset");
goto fail; goto fail;
} }
@@ -156,7 +156,7 @@ int t234_hwpm_extract_ip_ops(struct tegra_soc_hwpm *hwpm,
if (ret != -ENODEV) { if (ret != -ENODEV) {
tegra_hwpm_err(hwpm, tegra_hwpm_err(hwpm,
"IP %d base 0x%llx:Failed to %s fs/ops", "IP %d base 0x%llx:Failed to %s fs/ops",
ip_idx, base_address, ip_idx, (unsigned long long)base_address,
available == true ? "set" : "reset"); available == true ? "set" : "reset");
goto fail; goto fail;
} }
@@ -179,7 +179,7 @@ int t234_hwpm_extract_ip_ops(struct tegra_soc_hwpm *hwpm,
if (ret != -ENODEV) { if (ret != -ENODEV) {
tegra_hwpm_err(hwpm, tegra_hwpm_err(hwpm,
"IP %d base 0x%llx:Failed to %s fs/ops", "IP %d base 0x%llx:Failed to %s fs/ops",
ip_idx, base_address, ip_idx, (unsigned long long)base_address,
available == true ? "set" : "reset"); available == true ? "set" : "reset");
goto fail; goto fail;
} }

View File

@@ -129,7 +129,7 @@ int t234_hwpm_enable_mem_mgmt(struct tegra_soc_hwpm *hwpm)
return err; return err;
} }
tegra_hwpm_dbg(hwpm, hwpm_verbose, tegra_hwpm_dbg(hwpm, hwpm_verbose,
"MEM_BYTES_ADDR = 0x%llx", mem_bytes_addr); "MEM_BYTES_ADDR = 0x%llx", (unsigned long long)mem_bytes_addr);
err = tegra_hwpm_writel(hwpm, pma_perfmux, err = tegra_hwpm_writel(hwpm, pma_perfmux,
pmasys_channel_mem_block_r(0), pmasys_channel_mem_block_r(0),

View File

@@ -41,7 +41,8 @@ int t234_hwpm_perfmon_enable(struct tegra_soc_hwpm *hwpm,
/* Enable */ /* Enable */
tegra_hwpm_dbg(hwpm, hwpm_dbg_bind, tegra_hwpm_dbg(hwpm, hwpm_dbg_bind,
"Enabling PERFMON(0x%llx - 0x%llx)", "Enabling PERFMON(0x%llx - 0x%llx)",
perfmon->start_abs_pa, perfmon->end_abs_pa); (unsigned long long)perfmon->start_abs_pa,
(unsigned long long)perfmon->end_abs_pa);
err = tegra_hwpm_readl(hwpm, perfmon, err = tegra_hwpm_readl(hwpm, perfmon,
pmmsys_sys0_enginestatus_r(0), &reg_val); pmmsys_sys0_enginestatus_r(0), &reg_val);
@@ -80,7 +81,8 @@ int t234_hwpm_perfmon_disable(struct tegra_soc_hwpm *hwpm,
/* Disable */ /* Disable */
tegra_hwpm_dbg(hwpm, hwpm_dbg_release_resource, tegra_hwpm_dbg(hwpm, hwpm_dbg_release_resource,
"Disabling PERFMON(0x%llx - 0x%llx)", "Disabling PERFMON(0x%llx - 0x%llx)",
perfmon->start_abs_pa, perfmon->end_abs_pa); (unsigned long long)perfmon->start_abs_pa,
(unsigned long long)perfmon->end_abs_pa);
err = tegra_hwpm_readl(hwpm, perfmon, pmmsys_control_r(0), &reg_val); err = tegra_hwpm_readl(hwpm, perfmon, pmmsys_control_r(0), &reg_val);
if (err != 0) { if (err != 0) {

View File

@@ -40,7 +40,12 @@
#define TEGRA_HWPM_FUSE_SECURITY_MODE_MASK BIT(1) #define TEGRA_HWPM_FUSE_SECURITY_MODE_MASK BIT(1)
#define TEGRA_HWPM_FUSE_HWPM_GLOBAL_DISABLE_MASK BIT(2) #define TEGRA_HWPM_FUSE_HWPM_GLOBAL_DISABLE_MASK BIT(2)
#ifdef __KERNEL__
struct tegra_hwpm_os_linux; struct tegra_hwpm_os_linux;
#else
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
struct tegra_hwpm_os_qnx;
#endif
struct tegra_hwpm_mem_mgmt; struct tegra_hwpm_mem_mgmt;
struct tegra_hwpm_allowlist_map; struct tegra_hwpm_allowlist_map;
enum tegra_soc_hwpm_ip_reg_op; enum tegra_soc_hwpm_ip_reg_op;
@@ -349,6 +354,12 @@ struct hwpm_ip_inst {
* (except for SCF). * (except for SCF).
*/ */
u32 element_fs_mask; u32 element_fs_mask;
/*
* dev_name corresponds to the name of the IP debug node that has been
* exposed to perform Regops Read/write operation
*/
char dev_name[64];
}; };
struct hwpm_ip_inst_per_aperture_info { struct hwpm_ip_inst_per_aperture_info {
@@ -424,12 +435,17 @@ struct tegra_soc_hwpm_chip {
/* Chip HALs */ /* Chip HALs */
bool (*validate_secondary_hals)(struct tegra_soc_hwpm *hwpm); bool (*validate_secondary_hals)(struct tegra_soc_hwpm *hwpm);
#ifdef __KERNEL__
int (*clk_rst_prepare)(struct tegra_hwpm_os_linux *hwpm_linux); int (*clk_rst_prepare)(struct tegra_hwpm_os_linux *hwpm_linux);
int (*clk_rst_set_rate_enable)(struct tegra_hwpm_os_linux *hwpm_linux); int (*clk_rst_set_rate_enable)(struct tegra_hwpm_os_linux *hwpm_linux);
int (*clk_rst_disable)(struct tegra_hwpm_os_linux *hwpm_linux); int (*clk_rst_disable)(struct tegra_hwpm_os_linux *hwpm_linux);
void (*clk_rst_release)(struct tegra_hwpm_os_linux *hwpm_linux); void (*clk_rst_release)(struct tegra_hwpm_os_linux *hwpm_linux);
#else
int (*clk_rst_prepare)(struct tegra_hwpm_os_qnx *hwpm_qnx);
int (*clk_rst_set_rate_enable)(struct tegra_hwpm_os_qnx *hwpm_qnx);
int (*clk_rst_disable)(struct tegra_hwpm_os_qnx *hwpm_qnx);
void (*clk_rst_release)(struct tegra_hwpm_os_qnx *hwpm_qnx);
#endif
bool (*is_ip_active)(struct tegra_soc_hwpm *hwpm, bool (*is_ip_active)(struct tegra_soc_hwpm *hwpm,
u32 ip_enum, u32 *config_ip_index); u32 ip_enum, u32 *config_ip_index);
bool (*is_resource_active)(struct tegra_soc_hwpm *hwpm, bool (*is_resource_active)(struct tegra_soc_hwpm *hwpm,

View File

@@ -27,23 +27,26 @@
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <os/linux/clk_rst_utils.h> #include <os/linux/clk_rst_utils.h>
#else #else
struct tegra_hwpm_os_linux; #include <errno.h>
int tegra_hwpm_clk_rst_prepare(struct tegra_hwpm_os_linux *hwpm_linux) struct tegra_hwpm_os_qnx;
static inline int tegra_hwpm_clk_rst_prepare(struct tegra_hwpm_os_qnx *hwpm_qnx)
{ {
return -EINVAL; return -EINVAL;
} }
int tegra_hwpm_clk_rst_set_rate_enable(struct tegra_hwpm_os_linux *hwpm_linux) static inline int tegra_hwpm_clk_rst_set_rate_enable(struct tegra_hwpm_os_qnx *hwpm_qnx)
{ {
return -EINVAL; return -EINVAL;
} }
int tegra_hwpm_clk_rst_disable(struct tegra_hwpm_os_linux *hwpm_linux) static inline int tegra_hwpm_clk_rst_disable(struct tegra_hwpm_os_qnx *hwpm_qnx)
{ {
return -EINVAL;
} }
void tegra_hwpm_clk_rst_release(struct tegra_hwpm_os_linux *hwpm_linux) static inline void tegra_hwpm_clk_rst_release(struct tegra_hwpm_os_qnx *hwpm_qnx)
{ {
} }
#endif #endif

View File

@@ -89,5 +89,7 @@ int tegra_hwpm_disable_triggers(struct tegra_soc_hwpm *hwpm);
int tegra_hwpm_check_status(struct tegra_soc_hwpm *hwpm); int tegra_hwpm_check_status(struct tegra_soc_hwpm *hwpm);
int tegra_hwpm_release_hw(struct tegra_soc_hwpm *hwpm); int tegra_hwpm_release_hw(struct tegra_soc_hwpm *hwpm);
void tegra_hwpm_release_sw_setup(struct tegra_soc_hwpm *hwpm); void tegra_hwpm_release_sw_setup(struct tegra_soc_hwpm *hwpm);
int tegra_hwpm_update_ip_inst_fs_mask(struct tegra_soc_hwpm *hwpm,
u32 ip_idx, u32 a_type, u32 inst_idx, bool available);
#endif /* TEGRA_HWPM_COMMON_H */ #endif /* TEGRA_HWPM_COMMON_H */

View File

@@ -24,6 +24,8 @@
#ifndef TEGRA_HWPM_IO_H #ifndef TEGRA_HWPM_IO_H
#define TEGRA_HWPM_IO_H #define TEGRA_HWPM_IO_H
#include "tegra_hwpm_types.h"
/** /**
* Sets a particular field value in input data. * Sets a particular field value in input data.
* *

View File

@@ -26,11 +26,9 @@
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <os/linux/ip_utils.h> #include <os/linux/ip_utils.h>
#define tegra_hwpm_complete_ip_register(hwpm) \
tegra_hwpm_complete_ip_register_impl(hwpm)
#else #else
#include <os/qnx/ip_utils.h> #include <os/qnx/ip_utils.h>
#endif #endif
#define tegra_hwpm_complete_ip_register(hwpm) \
tegra_hwpm_complete_ip_register_impl(hwpm)
#endif /* TEGRA_HWPM_IP_H */ #endif /* TEGRA_HWPM_IP_H */

View File

@@ -26,6 +26,8 @@
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <os/linux/mem_mgmt_utils.h> #include <os/linux/mem_mgmt_utils.h>
#else
#include <os/qnx/mem_mgmt_utils.h>
#endif #endif
#endif /* TEGRA_HWPM_MEM_MGMT_H */ #endif /* TEGRA_HWPM_MEM_MGMT_H */