From 26bd5451c2cdaa4f2ba4207a9b1e794f601102e3 Mon Sep 17 00:00:00 2001 From: vasukis Date: Tue, 9 May 2023 21:50:25 +0000 Subject: [PATCH] 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 Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2901186 Reviewed-by: Vedashree Vidwans Reviewed-by: Seema Khowala GVS: Gerrit_Virtual_Submit --- drivers/tegra/hwpm/common/allowlist.c | 4 +- drivers/tegra/hwpm/common/aperture.c | 40 ++++++++++------- drivers/tegra/hwpm/common/ip.c | 45 ++++++++++--------- .../hwpm/hal/t234/ip/display/t234_display.c | 2 + drivers/tegra/hwpm/hal/t234/ip/isp/t234_isp.c | 2 + .../tegra/hwpm/hal/t234/ip/mgbe/t234_mgbe.c | 2 + .../t234/ip/mss_channel/t234_mss_channel.c | 2 + .../t234/ip/mss_gpu_hub/t234_mss_gpu_hub.c | 2 + .../t234_mss_iso_niso_hubs.c | 2 + .../hwpm/hal/t234/ip/mss_mcf/t234_mss_mcf.c | 2 + .../tegra/hwpm/hal/t234/ip/nvdec/t234_nvdec.c | 2 + .../tegra/hwpm/hal/t234/ip/nvdla/t234_nvdla.c | 4 ++ .../tegra/hwpm/hal/t234/ip/nvenc/t234_nvenc.c | 2 + drivers/tegra/hwpm/hal/t234/ip/ofa/t234_ofa.c | 2 + .../tegra/hwpm/hal/t234/ip/pcie/t234_pcie.c | 22 +++++++++ drivers/tegra/hwpm/hal/t234/ip/pma/t234_pma.c | 2 + drivers/tegra/hwpm/hal/t234/ip/pva/t234_pva.c | 2 + drivers/tegra/hwpm/hal/t234/ip/rtr/t234_rtr.c | 4 ++ drivers/tegra/hwpm/hal/t234/ip/scf/t234_scf.c | 2 + drivers/tegra/hwpm/hal/t234/ip/vi/t234_vi.c | 4 ++ drivers/tegra/hwpm/hal/t234/ip/vic/t234_vic.c | 2 + drivers/tegra/hwpm/hal/t234/t234_ip.c | 10 ++--- drivers/tegra/hwpm/hal/t234/t234_mem_mgmt.c | 2 +- drivers/tegra/hwpm/hal/t234/t234_resource.c | 6 ++- drivers/tegra/hwpm/include/tegra_hwpm.h | 20 ++++++++- .../tegra/hwpm/include/tegra_hwpm_clk_rst.h | 13 +++--- .../tegra/hwpm/include/tegra_hwpm_common.h | 2 + drivers/tegra/hwpm/include/tegra_hwpm_io.h | 2 + drivers/tegra/hwpm/include/tegra_hwpm_ip.h | 6 +-- .../tegra/hwpm/include/tegra_hwpm_mem_mgmt.h | 2 + 30 files changed, 157 insertions(+), 57 deletions(-) diff --git a/drivers/tegra/hwpm/common/allowlist.c b/drivers/tegra/hwpm/common/allowlist.c index 4ca9808..d321a0d 100644 --- a/drivers/tegra/hwpm/common/allowlist.c +++ b/drivers/tegra/hwpm/common/allowlist.c @@ -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) { tegra_hwpm_err(hwpm, "full_alist_size 0x%llx doesn't match " "max full_alist_idx 0x%llx", - hwpm->alist_map->full_alist_size, - func_args.full_alist_idx); + (unsigned long long)hwpm->alist_map->full_alist_size, + (unsigned long long)func_args.full_alist_idx); err = -EINVAL; } diff --git a/drivers/tegra/hwpm/common/aperture.c b/drivers/tegra/hwpm/common/aperture.c index 0757129..1c5934a 100644 --- a/drivers/tegra/hwpm/common/aperture.c +++ b/drivers/tegra/hwpm/common/aperture.c @@ -233,7 +233,8 @@ static int tegra_hwpm_alloc_dynamic_inst_element_array( tegra_hwpm_dbg(hwpm, hwpm_dbg_driver_init, "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); 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, "IP %d inst %d a_type %d element type %d" " start_addr 0x%llx static idx %d == dynamic idx %d", - ip_idx, static_inst_idx, a_type, element->element_type, - element->start_abs_pa, static_aperture_idx, idx); + ip_idx, static_inst_idx, a_type, + element->element_type, (unsigned long long)element->start_abs_pa, + static_aperture_idx, idx); /* Set element slot pointer */ 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 */ tegra_hwpm_dbg(hwpm, hwpm_dbg_floorsweep_info, "skip floorswept element 0x%llx", - element->start_abs_pa); + (unsigned long long)element->start_abs_pa); 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, "perfmux start_abs_pa 0x%llx unavailable", - element->start_abs_pa); + (unsigned long long)element->start_abs_pa); ip_inst->element_fs_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" " start_addr 0x%llx not reserved", 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; } 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" " start_addr 0x%llx not reserved", 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; } 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" " start_addr 0x%llx not reservable", 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; } 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" " start_addr 0x%llx not reserved", 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; } 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" " start_addr 0x%llx not reserved", 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; } 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" " start_addr 0x%llx not reserved", 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; } @@ -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" " start_addr 0x%llx not reserved", 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; } 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 " "num_element_per_inst %d", 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); } @@ -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" "element range start 0x%llx" " static inst idx %d == dynamic idx %d", - ip_idx, a_type, inst_a_info->range_start, - e_info->range_start, static_inst_idx, idx); + ip_idx, a_type, (unsigned long long)inst_a_info->range_start, + (unsigned long long)e_info->range_start, static_inst_idx, idx); /* Set perfmux slot pointer */ inst_a_info->inst_arr[idx] = ip_inst; diff --git a/drivers/tegra/hwpm/common/ip.c b/drivers/tegra/hwpm/common/ip.c index a8685df..550bb23 100644 --- a/drivers/tegra/hwpm/common/ip.c +++ b/drivers/tegra/hwpm/common/ip.c @@ -55,7 +55,7 @@ int tegra_hwpm_ip_handle_power_mgmt(struct tegra_soc_hwpm *hwpm, 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) { 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); if (!found) { tegra_hwpm_err(hwpm, "Base addr 0x%llx not in IP %d", - base_address, idx); + (unsigned long long)base_address, idx); return -EINVAL; } tegra_hwpm_dbg(hwpm, hwpm_dbg_ip_register, "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) { 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, "IP %d addr 0x%llx inst_idx %d " "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; } @@ -330,8 +332,8 @@ static bool tegra_hwpm_addr_in_single_element(struct tegra_soc_hwpm *hwpm, tegra_hwpm_dbg(hwpm, hwpm_dbg_regops, "IP %d addr 0x%llx inst_idx %d " "a_type %d: element_idx %d: not available", - *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; } @@ -340,8 +342,8 @@ static bool tegra_hwpm_addr_in_single_element(struct tegra_soc_hwpm *hwpm, (find_addr > element->end_abs_pa)) { tegra_hwpm_err(hwpm, "IP %d addr 0x%llx inst_idx %d " "a_type %d element_idx %d: out of bounds", - *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; } @@ -353,8 +355,8 @@ static bool tegra_hwpm_addr_in_single_element(struct tegra_soc_hwpm *hwpm, tegra_hwpm_dbg(hwpm, hwpm_dbg_regops, "IP %d addr 0x%llx inst_idx %d " "a_type %d element_idx %d address not in alist", - *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; } @@ -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, "IP %d addr 0x%llx inst_idx %d " "a_type %d element_idx %d: addr != start addr", - *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; } *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) { tegra_hwpm_dbg(hwpm, hwpm_verbose, "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; } @@ -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 */ tegra_hwpm_dbg(hwpm, hwpm_verbose, "IP %d inst_idx %d: " "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; } @@ -417,7 +419,7 @@ static bool tegra_hwpm_addr_in_all_elements(struct tegra_soc_hwpm *hwpm, if (idx >= e_info->element_slots) { tegra_hwpm_err(hwpm, "IP %d addr 0x%llx inst_idx %d a_type %d: " "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; } @@ -444,7 +446,7 @@ static bool tegra_hwpm_addr_in_single_instance(struct tegra_soc_hwpm *hwpm, if (ip_inst == NULL) { tegra_hwpm_dbg(hwpm, hwpm_verbose, "IP %d addr 0x%llx: " "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; } @@ -454,7 +456,7 @@ static bool tegra_hwpm_addr_in_single_instance(struct tegra_soc_hwpm *hwpm, tegra_hwpm_dbg(hwpm, hwpm_dbg_regops, "IP %d addr 0x%llx: " "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; } } @@ -488,7 +490,7 @@ static bool tegra_hwpm_addr_in_all_instances(struct tegra_soc_hwpm *hwpm, if (idx >= inst_a_info->inst_slots) { tegra_hwpm_err(hwpm, "IP %d addr 0x%llx a_type %d: " "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; } @@ -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 */ tegra_hwpm_dbg(hwpm, hwpm_verbose, "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; } @@ -630,7 +632,8 @@ bool tegra_hwpm_aperture_for_address(struct tegra_soc_hwpm *hwpm, ip_idx, inst_idx, element_idx, element_type); if (!found) { 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; } } @@ -640,7 +643,7 @@ bool tegra_hwpm_aperture_for_address(struct tegra_soc_hwpm *hwpm, ip_idx, inst_idx, element_idx, element_type); if (!found) { tegra_hwpm_err(hwpm, "Address 0x%llx not in IP %d", - find_addr, *ip_idx); + (unsigned long long)find_addr, *ip_idx); return found; } } diff --git a/drivers/tegra/hwpm/hal/t234/ip/display/t234_display.c b/drivers/tegra/hwpm/hal/t234/ip/display/t234_display.c index 7a4a8b4..742e05b 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/display/t234_display.c +++ b/drivers/tegra/hwpm/hal/t234/ip/display/t234_display.c @@ -129,9 +129,11 @@ static struct hwpm_ip_inst t234_display_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, }; diff --git a/drivers/tegra/hwpm/hal/t234/ip/isp/t234_isp.c b/drivers/tegra/hwpm/hal/t234/ip/isp/t234_isp.c index bc2c0d7..615fde1 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/isp/t234_isp.c +++ b/drivers/tegra/hwpm/hal/t234/ip/isp/t234_isp.c @@ -127,9 +127,11 @@ static struct hwpm_ip_inst t234_isp_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, }; diff --git a/drivers/tegra/hwpm/hal/t234/ip/mgbe/t234_mgbe.c b/drivers/tegra/hwpm/hal/t234/ip/mgbe/t234_mgbe.c index f47764c..d2b0941 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/mgbe/t234_mgbe.c +++ b/drivers/tegra/hwpm/hal/t234/ip/mgbe/t234_mgbe.c @@ -244,9 +244,11 @@ static struct hwpm_ip_inst t234_mgbe_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, { .hw_inst_mask = BIT(1), diff --git a/drivers/tegra/hwpm/hal/t234/ip/mss_channel/t234_mss_channel.c b/drivers/tegra/hwpm/hal/t234/ip/mss_channel/t234_mss_channel.c index daaf7ec..b073125 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/mss_channel/t234_mss_channel.c +++ b/drivers/tegra/hwpm/hal/t234/ip/mss_channel/t234_mss_channel.c @@ -614,9 +614,11 @@ static struct hwpm_ip_inst t234_mss_channel_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, }; diff --git a/drivers/tegra/hwpm/hal/t234/ip/mss_gpu_hub/t234_mss_gpu_hub.c b/drivers/tegra/hwpm/hal/t234/ip/mss_gpu_hub/t234_mss_gpu_hub.c index 4a4845d..f5b6e21 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/mss_gpu_hub/t234_mss_gpu_hub.c +++ b/drivers/tegra/hwpm/hal/t234/ip/mss_gpu_hub/t234_mss_gpu_hub.c @@ -232,9 +232,11 @@ static struct hwpm_ip_inst t234_mss_gpu_hub_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, }; diff --git a/drivers/tegra/hwpm/hal/t234/ip/mss_iso_niso_hubs/t234_mss_iso_niso_hubs.c b/drivers/tegra/hwpm/hal/t234/ip/mss_iso_niso_hubs/t234_mss_iso_niso_hubs.c index b817146..77ba049 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/mss_iso_niso_hubs/t234_mss_iso_niso_hubs.c +++ b/drivers/tegra/hwpm/hal/t234/ip/mss_iso_niso_hubs/t234_mss_iso_niso_hubs.c @@ -293,9 +293,11 @@ static struct hwpm_ip_inst t234_mss_iso_niso_hub_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, }; diff --git a/drivers/tegra/hwpm/hal/t234/ip/mss_mcf/t234_mss_mcf.c b/drivers/tegra/hwpm/hal/t234/ip/mss_mcf/t234_mss_mcf.c index 1d5c771..df78df9 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/mss_mcf/t234_mss_mcf.c +++ b/drivers/tegra/hwpm/hal/t234/ip/mss_mcf/t234_mss_mcf.c @@ -286,9 +286,11 @@ static struct hwpm_ip_inst t234_mss_mcf_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, }; diff --git a/drivers/tegra/hwpm/hal/t234/ip/nvdec/t234_nvdec.c b/drivers/tegra/hwpm/hal/t234/ip/nvdec/t234_nvdec.c index 103c3b5..cb0a1fb 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/nvdec/t234_nvdec.c +++ b/drivers/tegra/hwpm/hal/t234/ip/nvdec/t234_nvdec.c @@ -127,9 +127,11 @@ static struct hwpm_ip_inst t234_nvdec_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, }; diff --git a/drivers/tegra/hwpm/hal/t234/ip/nvdla/t234_nvdla.c b/drivers/tegra/hwpm/hal/t234/ip/nvdla/t234_nvdla.c index 8c71065..3c8b657 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/nvdla/t234_nvdla.c +++ b/drivers/tegra/hwpm/hal/t234/ip/nvdla/t234_nvdla.c @@ -166,9 +166,11 @@ static struct hwpm_ip_inst t234_nvdla_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, { .hw_inst_mask = BIT(1), @@ -227,9 +229,11 @@ static struct hwpm_ip_inst t234_nvdla_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, }; diff --git a/drivers/tegra/hwpm/hal/t234/ip/nvenc/t234_nvenc.c b/drivers/tegra/hwpm/hal/t234/ip/nvenc/t234_nvenc.c index ff3d6be..deae570 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/nvenc/t234_nvenc.c +++ b/drivers/tegra/hwpm/hal/t234/ip/nvenc/t234_nvenc.c @@ -127,9 +127,11 @@ static struct hwpm_ip_inst t234_nvenc_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, }; diff --git a/drivers/tegra/hwpm/hal/t234/ip/ofa/t234_ofa.c b/drivers/tegra/hwpm/hal/t234/ip/ofa/t234_ofa.c index 5121611..88289f1 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/ofa/t234_ofa.c +++ b/drivers/tegra/hwpm/hal/t234/ip/ofa/t234_ofa.c @@ -127,9 +127,11 @@ static struct hwpm_ip_inst t234_ofa_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, }; diff --git a/drivers/tegra/hwpm/hal/t234/ip/pcie/t234_pcie.c b/drivers/tegra/hwpm/hal/t234/ip/pcie/t234_pcie.c index 0032090..c895e03 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/pcie/t234_pcie.c +++ b/drivers/tegra/hwpm/hal/t234/ip/pcie/t234_pcie.c @@ -517,9 +517,11 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, { .hw_inst_mask = BIT(1), @@ -578,9 +580,11 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, { .hw_inst_mask = BIT(2), @@ -639,9 +643,11 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, { .hw_inst_mask = BIT(3), @@ -700,9 +706,11 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, { .hw_inst_mask = BIT(4), @@ -761,9 +769,11 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, { .hw_inst_mask = BIT(5), @@ -822,9 +832,11 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, { .hw_inst_mask = BIT(6), @@ -883,9 +895,11 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, { .hw_inst_mask = BIT(7), @@ -944,9 +958,11 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, { .hw_inst_mask = BIT(8), @@ -1005,9 +1021,11 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, { .hw_inst_mask = BIT(9), @@ -1066,9 +1084,11 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, { .hw_inst_mask = BIT(10), @@ -1127,9 +1147,11 @@ static struct hwpm_ip_inst t234_pcie_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, }; diff --git a/drivers/tegra/hwpm/hal/t234/ip/pma/t234_pma.c b/drivers/tegra/hwpm/hal/t234/ip/pma/t234_pma.c index d7ccb6d..ef71ef2 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/pma/t234_pma.c +++ b/drivers/tegra/hwpm/hal/t234/ip/pma/t234_pma.c @@ -128,9 +128,11 @@ static struct hwpm_ip_inst t234_pma_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0x1U, + .dev_name = "", }, }; diff --git a/drivers/tegra/hwpm/hal/t234/ip/pva/t234_pva.c b/drivers/tegra/hwpm/hal/t234/ip/pva/t234_pva.c index 90b314c..b691494 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/pva/t234_pva.c +++ b/drivers/tegra/hwpm/hal/t234/ip/pva/t234_pva.c @@ -159,9 +159,11 @@ static struct hwpm_ip_inst t234_pva_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = 1, }, .element_fs_mask = 0U, + .dev_name = "/dev/nvpvadebugfs/pva0/hwpm", }, }; diff --git a/drivers/tegra/hwpm/hal/t234/ip/rtr/t234_rtr.c b/drivers/tegra/hwpm/hal/t234/ip/rtr/t234_rtr.c index 75b817f..c5c175a 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/rtr/t234_rtr.c +++ b/drivers/tegra/hwpm/hal/t234/ip/rtr/t234_rtr.c @@ -129,9 +129,11 @@ static struct hwpm_ip_inst t234_rtr_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0x1U, + .dev_name = "", }, { .hw_inst_mask = BIT(1), @@ -189,9 +191,11 @@ static struct hwpm_ip_inst t234_rtr_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0x1U, + .dev_name = "", }, }; diff --git a/drivers/tegra/hwpm/hal/t234/ip/scf/t234_scf.c b/drivers/tegra/hwpm/hal/t234/ip/scf/t234_scf.c index 19d83b3..d809d55 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/scf/t234_scf.c +++ b/drivers/tegra/hwpm/hal/t234/ip/scf/t234_scf.c @@ -106,9 +106,11 @@ static struct hwpm_ip_inst t234_scf_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0x1U, + .dev_name = "", }, }; diff --git a/drivers/tegra/hwpm/hal/t234/ip/vi/t234_vi.c b/drivers/tegra/hwpm/hal/t234/ip/vi/t234_vi.c index 1290b51..a36b36c 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/vi/t234_vi.c +++ b/drivers/tegra/hwpm/hal/t234/ip/vi/t234_vi.c @@ -167,9 +167,11 @@ static struct hwpm_ip_inst t234_vi_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, { .hw_inst_mask = BIT(1), @@ -228,9 +230,11 @@ static struct hwpm_ip_inst t234_vi_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, }; diff --git a/drivers/tegra/hwpm/hal/t234/ip/vic/t234_vic.c b/drivers/tegra/hwpm/hal/t234/ip/vic/t234_vic.c index 57d0e39..a7decc5 100644 --- a/drivers/tegra/hwpm/hal/t234/ip/vic/t234_vic.c +++ b/drivers/tegra/hwpm/hal/t234/ip/vic/t234_vic.c @@ -127,9 +127,11 @@ static struct hwpm_ip_inst t234_vic_inst_static_array[ .ip_dev = NULL, .hwpm_ip_pm = NULL, .hwpm_ip_reg_op = NULL, + .fd = -1, }, .element_fs_mask = 0U, + .dev_name = "", }, }; diff --git a/drivers/tegra/hwpm/hal/t234/t234_ip.c b/drivers/tegra/hwpm/hal/t234/t234_ip.c index 5095c2a..1b14c5d 100644 --- a/drivers/tegra/hwpm/hal/t234/t234_ip.c +++ b/drivers/tegra/hwpm/hal/t234/t234_ip.c @@ -52,7 +52,7 @@ int t234_hwpm_extract_ip_ops(struct tegra_soc_hwpm *hwpm, resource_enum, &ip_idx))) { tegra_hwpm_dbg(hwpm, hwpm_dbg_ip_register, "SOC hwpm resource %d (base 0x%llx) is unconfigured", - resource_enum, base_address); + resource_enum, (unsigned long long)base_address); goto fail; } @@ -102,7 +102,7 @@ int t234_hwpm_extract_ip_ops(struct tegra_soc_hwpm *hwpm, tegra_hwpm_err(hwpm, "Failed to %s fs/ops for IP %d (base 0x%llx)", available == true ? "set" : "reset", - ip_idx, base_address); + ip_idx, (unsigned long long)base_address); goto fail; } break; @@ -133,7 +133,7 @@ int t234_hwpm_extract_ip_ops(struct tegra_soc_hwpm *hwpm, if (ret != -ENODEV) { tegra_hwpm_err(hwpm, "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"); goto fail; } @@ -156,7 +156,7 @@ int t234_hwpm_extract_ip_ops(struct tegra_soc_hwpm *hwpm, if (ret != -ENODEV) { tegra_hwpm_err(hwpm, "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"); goto fail; } @@ -179,7 +179,7 @@ int t234_hwpm_extract_ip_ops(struct tegra_soc_hwpm *hwpm, if (ret != -ENODEV) { tegra_hwpm_err(hwpm, "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"); goto fail; } diff --git a/drivers/tegra/hwpm/hal/t234/t234_mem_mgmt.c b/drivers/tegra/hwpm/hal/t234/t234_mem_mgmt.c index 34c6920..ebe48c2 100644 --- a/drivers/tegra/hwpm/hal/t234/t234_mem_mgmt.c +++ b/drivers/tegra/hwpm/hal/t234/t234_mem_mgmt.c @@ -129,7 +129,7 @@ int t234_hwpm_enable_mem_mgmt(struct tegra_soc_hwpm *hwpm) return err; } 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, pmasys_channel_mem_block_r(0), diff --git a/drivers/tegra/hwpm/hal/t234/t234_resource.c b/drivers/tegra/hwpm/hal/t234/t234_resource.c index 8f6de97..5b7751c 100644 --- a/drivers/tegra/hwpm/hal/t234/t234_resource.c +++ b/drivers/tegra/hwpm/hal/t234/t234_resource.c @@ -41,7 +41,8 @@ int t234_hwpm_perfmon_enable(struct tegra_soc_hwpm *hwpm, /* Enable */ tegra_hwpm_dbg(hwpm, hwpm_dbg_bind, "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, pmmsys_sys0_enginestatus_r(0), ®_val); @@ -80,7 +81,8 @@ int t234_hwpm_perfmon_disable(struct tegra_soc_hwpm *hwpm, /* Disable */ tegra_hwpm_dbg(hwpm, hwpm_dbg_release_resource, "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), ®_val); if (err != 0) { diff --git a/drivers/tegra/hwpm/include/tegra_hwpm.h b/drivers/tegra/hwpm/include/tegra_hwpm.h index 36ab391..28f250a 100644 --- a/drivers/tegra/hwpm/include/tegra_hwpm.h +++ b/drivers/tegra/hwpm/include/tegra_hwpm.h @@ -40,7 +40,12 @@ #define TEGRA_HWPM_FUSE_SECURITY_MODE_MASK BIT(1) #define TEGRA_HWPM_FUSE_HWPM_GLOBAL_DISABLE_MASK BIT(2) +#ifdef __KERNEL__ 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_allowlist_map; enum tegra_soc_hwpm_ip_reg_op; @@ -349,6 +354,12 @@ struct hwpm_ip_inst { * (except for SCF). */ 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 { @@ -424,12 +435,17 @@ struct tegra_soc_hwpm_chip { /* Chip HALs */ 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_set_rate_enable)(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); - +#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, u32 ip_enum, u32 *config_ip_index); bool (*is_resource_active)(struct tegra_soc_hwpm *hwpm, diff --git a/drivers/tegra/hwpm/include/tegra_hwpm_clk_rst.h b/drivers/tegra/hwpm/include/tegra_hwpm_clk_rst.h index d9beb67..adc0027 100644 --- a/drivers/tegra/hwpm/include/tegra_hwpm_clk_rst.h +++ b/drivers/tegra/hwpm/include/tegra_hwpm_clk_rst.h @@ -27,23 +27,26 @@ #ifdef __KERNEL__ #include #else -struct tegra_hwpm_os_linux; +#include -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; } -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; } -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 diff --git a/drivers/tegra/hwpm/include/tegra_hwpm_common.h b/drivers/tegra/hwpm/include/tegra_hwpm_common.h index 815d91a..5379f7b 100644 --- a/drivers/tegra/hwpm/include/tegra_hwpm_common.h +++ b/drivers/tegra/hwpm/include/tegra_hwpm_common.h @@ -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_release_hw(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 */ diff --git a/drivers/tegra/hwpm/include/tegra_hwpm_io.h b/drivers/tegra/hwpm/include/tegra_hwpm_io.h index 4c6084d..caff55a 100644 --- a/drivers/tegra/hwpm/include/tegra_hwpm_io.h +++ b/drivers/tegra/hwpm/include/tegra_hwpm_io.h @@ -24,6 +24,8 @@ #ifndef TEGRA_HWPM_IO_H #define TEGRA_HWPM_IO_H +#include "tegra_hwpm_types.h" + /** * Sets a particular field value in input data. * diff --git a/drivers/tegra/hwpm/include/tegra_hwpm_ip.h b/drivers/tegra/hwpm/include/tegra_hwpm_ip.h index 5c92154..1c03086 100644 --- a/drivers/tegra/hwpm/include/tegra_hwpm_ip.h +++ b/drivers/tegra/hwpm/include/tegra_hwpm_ip.h @@ -26,11 +26,9 @@ #ifdef __KERNEL__ #include - -#define tegra_hwpm_complete_ip_register(hwpm) \ - tegra_hwpm_complete_ip_register_impl(hwpm) #else #include #endif - +#define tegra_hwpm_complete_ip_register(hwpm) \ + tegra_hwpm_complete_ip_register_impl(hwpm) #endif /* TEGRA_HWPM_IP_H */ diff --git a/drivers/tegra/hwpm/include/tegra_hwpm_mem_mgmt.h b/drivers/tegra/hwpm/include/tegra_hwpm_mem_mgmt.h index ee5d5ac..f4b812f 100644 --- a/drivers/tegra/hwpm/include/tegra_hwpm_mem_mgmt.h +++ b/drivers/tegra/hwpm/include/tegra_hwpm_mem_mgmt.h @@ -26,6 +26,8 @@ #ifdef __KERNEL__ #include +#else +#include #endif #endif /* TEGRA_HWPM_MEM_MGMT_H */