diff --git a/common/tegra_hwpm_aperture_utils.c b/common/tegra_hwpm_aperture_utils.c index dec80c2..2d0415c 100644 --- a/common/tegra_hwpm_aperture_utils.c +++ b/common/tegra_hwpm_aperture_utils.c @@ -708,9 +708,10 @@ int tegra_hwpm_func_single_ip(struct tegra_soc_hwpm *hwpm, return 0; } - if (chip_ip->inst_fs_mask == 0U) { + if (chip_ip->resource_status == + TEGRA_HWPM_RESOURCE_STATUS_INVALID) { /* No IP instance is available to reserve */ - return 0; + return -EINVAL; } break; case TEGRA_HWPM_RELEASE_RESOURCES: diff --git a/common/tegra_hwpm_ip_utils.c b/common/tegra_hwpm_ip_utils.c index fce199e..e2003c2 100644 --- a/common/tegra_hwpm_ip_utils.c +++ b/common/tegra_hwpm_ip_utils.c @@ -20,6 +20,31 @@ #include #include +int tegra_hwpm_get_resource_info(struct tegra_soc_hwpm *hwpm, + struct tegra_soc_hwpm_resource_info *rsrc_info) +{ + int ret = 0; + u32 i = 0U; + + tegra_hwpm_fn(hwpm, " "); + + for (i = 0U; i < rsrc_info->num_queries; i++) { + ret = hwpm->active_chip->get_resource_info( + hwpm, (u32)rsrc_info->resource_info[i].resource, + &rsrc_info->resource_info[i].status); + if (ret < 0) { + /* Print error for debug purpose. */ + tegra_hwpm_err(hwpm, "Failed to get rsrc_info"); + } + + tegra_hwpm_dbg(hwpm, hwpm_verbose, + "Query %d: resource %d: status: %d", + i, rsrc_info->resource_info[i].resource, + rsrc_info->resource_info[i].status); + } + return ret; +} + int tegra_hwpm_ip_handle_power_mgmt(struct tegra_soc_hwpm *hwpm, struct hwpm_ip_inst *ip_inst, bool disable) { @@ -86,8 +111,13 @@ static int tegra_hwpm_update_ip_inst_fs_mask(struct tegra_soc_hwpm *hwpm, /* Update inst fs info */ if (available) { chip_ip->inst_fs_mask |= ip_inst->hw_inst_mask; + chip_ip->resource_status = TEGRA_HWPM_RESOURCE_STATUS_VALID; } else { chip_ip->inst_fs_mask &= ~(ip_inst->hw_inst_mask); + if (chip_ip->inst_fs_mask == 0U) { + chip_ip->resource_status = + TEGRA_HWPM_RESOURCE_STATUS_INVALID; + } } return tegra_hwpm_update_ip_inst_element_fs_mask(hwpm, ip_idx, diff --git a/common/tegra_hwpm_resource_utils.c b/common/tegra_hwpm_resource_utils.c index dc581e0..c555af3 100644 --- a/common/tegra_hwpm_resource_utils.c +++ b/common/tegra_hwpm_resource_utils.c @@ -71,12 +71,6 @@ int tegra_hwpm_reserve_resource(struct tegra_soc_hwpm *hwpm, u32 resource) if (!active_chip->is_resource_active(hwpm, resource, &ip_idx)) { tegra_hwpm_err(hwpm, "Requested resource %d is unavailable", resource); - /* Remove after uapi update */ - if (resource == TEGRA_SOC_HWPM_RESOURCE_MSS_NVLINK) { - tegra_hwpm_dbg(hwpm, hwpm_verbose, - "ignoring resource %d", resource); - return 0; - } return -EINVAL; } diff --git a/hal/t234/ip/display/t234_hwpm_ip_display.c b/hal/t234/ip/display/t234_hwpm_ip_display.c index 1bb39ee..ad3be2f 100644 --- a/hal/t234/ip/display/t234_hwpm_ip_display.c +++ b/hal/t234/ip/display/t234_hwpm_ip_display.c @@ -166,5 +166,6 @@ struct hwpm_ip t234_hwpm_ip_display = { .override_enable = false, .inst_fs_mask = 0U, + .resource_status = TEGRA_HWPM_RESOURCE_STATUS_INVALID, .reserved = false, }; diff --git a/hal/t234/ip/isp/t234_hwpm_ip_isp.c b/hal/t234/ip/isp/t234_hwpm_ip_isp.c index 9878506..52fa51b 100644 --- a/hal/t234/ip/isp/t234_hwpm_ip_isp.c +++ b/hal/t234/ip/isp/t234_hwpm_ip_isp.c @@ -163,5 +163,6 @@ struct hwpm_ip t234_hwpm_ip_isp = { .override_enable = false, .inst_fs_mask = 0U, + .resource_status = TEGRA_HWPM_RESOURCE_STATUS_INVALID, .reserved = false, }; diff --git a/hal/t234/ip/mgbe/t234_hwpm_ip_mgbe.c b/hal/t234/ip/mgbe/t234_hwpm_ip_mgbe.c index 4979a02..395a22d 100644 --- a/hal/t234/ip/mgbe/t234_hwpm_ip_mgbe.c +++ b/hal/t234/ip/mgbe/t234_hwpm_ip_mgbe.c @@ -455,5 +455,6 @@ struct hwpm_ip t234_hwpm_ip_mgbe = { .override_enable = false, .inst_fs_mask = 0U, + .resource_status = TEGRA_HWPM_RESOURCE_STATUS_INVALID, .reserved = false, }; diff --git a/hal/t234/ip/mss_gpu_hub/t234_hwpm_ip_mss_gpu_hub.c b/hal/t234/ip/mss_gpu_hub/t234_hwpm_ip_mss_gpu_hub.c index f591815..ed1ab96 100644 --- a/hal/t234/ip/mss_gpu_hub/t234_hwpm_ip_mss_gpu_hub.c +++ b/hal/t234/ip/mss_gpu_hub/t234_hwpm_ip_mss_gpu_hub.c @@ -269,5 +269,6 @@ struct hwpm_ip t234_hwpm_ip_mss_gpu_hub = { .override_enable = false, .inst_fs_mask = 0U, + .resource_status = TEGRA_HWPM_RESOURCE_STATUS_INVALID, .reserved = false, }; diff --git a/hal/t234/ip/mss_iso_niso_hubs/t234_hwpm_ip_mss_iso_niso_hubs.c b/hal/t234/ip/mss_iso_niso_hubs/t234_hwpm_ip_mss_iso_niso_hubs.c index 7c7b7cc..7299713 100644 --- a/hal/t234/ip/mss_iso_niso_hubs/t234_hwpm_ip_mss_iso_niso_hubs.c +++ b/hal/t234/ip/mss_iso_niso_hubs/t234_hwpm_ip_mss_iso_niso_hubs.c @@ -331,6 +331,7 @@ struct hwpm_ip t234_hwpm_ip_mss_iso_niso_hubs = { .override_enable = false, .inst_fs_mask = 0U, + .resource_status = TEGRA_HWPM_RESOURCE_STATUS_INVALID, .reserved = false, }; diff --git a/hal/t234/ip/mss_mcf/t234_hwpm_ip_mss_mcf.c b/hal/t234/ip/mss_mcf/t234_hwpm_ip_mss_mcf.c index 6276251..42e0634 100644 --- a/hal/t234/ip/mss_mcf/t234_hwpm_ip_mss_mcf.c +++ b/hal/t234/ip/mss_mcf/t234_hwpm_ip_mss_mcf.c @@ -323,5 +323,6 @@ struct hwpm_ip t234_hwpm_ip_mss_mcf = { .override_enable = false, .inst_fs_mask = 0U, + .resource_status = TEGRA_HWPM_RESOURCE_STATUS_INVALID, .reserved = false, }; diff --git a/hal/t234/ip/nvdec/t234_hwpm_ip_nvdec.c b/hal/t234/ip/nvdec/t234_hwpm_ip_nvdec.c index 4c8d6f6..eb9115c 100644 --- a/hal/t234/ip/nvdec/t234_hwpm_ip_nvdec.c +++ b/hal/t234/ip/nvdec/t234_hwpm_ip_nvdec.c @@ -164,5 +164,6 @@ struct hwpm_ip t234_hwpm_ip_nvdec = { .override_enable = false, .inst_fs_mask = 0U, + .resource_status = TEGRA_HWPM_RESOURCE_STATUS_INVALID, .reserved = false, }; diff --git a/hal/t234/ip/nvdla/t234_hwpm_ip_nvdla.c b/hal/t234/ip/nvdla/t234_hwpm_ip_nvdla.c index 5ceb3d1..3864b7b 100644 --- a/hal/t234/ip/nvdla/t234_hwpm_ip_nvdla.c +++ b/hal/t234/ip/nvdla/t234_hwpm_ip_nvdla.c @@ -261,5 +261,6 @@ struct hwpm_ip t234_hwpm_ip_nvdla = { .override_enable = false, .inst_fs_mask = 0U, + .resource_status = TEGRA_HWPM_RESOURCE_STATUS_INVALID, .reserved = false, }; diff --git a/hal/t234/ip/nvenc/t234_hwpm_ip_nvenc.c b/hal/t234/ip/nvenc/t234_hwpm_ip_nvenc.c index 87b9038..c67ebd9 100644 --- a/hal/t234/ip/nvenc/t234_hwpm_ip_nvenc.c +++ b/hal/t234/ip/nvenc/t234_hwpm_ip_nvenc.c @@ -164,5 +164,6 @@ struct hwpm_ip t234_hwpm_ip_nvenc = { .override_enable = false, .inst_fs_mask = 0U, + .resource_status = TEGRA_HWPM_RESOURCE_STATUS_INVALID, .reserved = false, }; diff --git a/hal/t234/ip/ofa/t234_hwpm_ip_ofa.c b/hal/t234/ip/ofa/t234_hwpm_ip_ofa.c index 6de2d6b..e4a30c5 100644 --- a/hal/t234/ip/ofa/t234_hwpm_ip_ofa.c +++ b/hal/t234/ip/ofa/t234_hwpm_ip_ofa.c @@ -164,5 +164,6 @@ struct hwpm_ip t234_hwpm_ip_ofa = { .override_enable = false, .inst_fs_mask = 0U, + .resource_status = TEGRA_HWPM_RESOURCE_STATUS_INVALID, .reserved = false, }; diff --git a/hal/t234/ip/pcie/t234_hwpm_ip_pcie.c b/hal/t234/ip/pcie/t234_hwpm_ip_pcie.c index 8e28775..f2c62b2 100644 --- a/hal/t234/ip/pcie/t234_hwpm_ip_pcie.c +++ b/hal/t234/ip/pcie/t234_hwpm_ip_pcie.c @@ -1135,5 +1135,6 @@ struct hwpm_ip t234_hwpm_ip_pcie = { .override_enable = false, .inst_fs_mask = 0U, + .resource_status = TEGRA_HWPM_RESOURCE_STATUS_INVALID, .reserved = false, }; diff --git a/hal/t234/ip/pma/t234_hwpm_ip_pma.c b/hal/t234/ip/pma/t234_hwpm_ip_pma.c index facd278..389233a 100644 --- a/hal/t234/ip/pma/t234_hwpm_ip_pma.c +++ b/hal/t234/ip/pma/t234_hwpm_ip_pma.c @@ -164,5 +164,6 @@ struct hwpm_ip t234_hwpm_ip_pma = { .override_enable = false, .inst_fs_mask = 0x1U, + .resource_status = TEGRA_HWPM_RESOURCE_STATUS_VALID, .reserved = false, }; diff --git a/hal/t234/ip/pva/t234_hwpm_ip_pva.c b/hal/t234/ip/pva/t234_hwpm_ip_pva.c index 8daf74b..6709dc2 100644 --- a/hal/t234/ip/pva/t234_hwpm_ip_pva.c +++ b/hal/t234/ip/pva/t234_hwpm_ip_pva.c @@ -194,5 +194,6 @@ struct hwpm_ip t234_hwpm_ip_pva = { .override_enable = false, .inst_fs_mask = 0U, + .resource_status = TEGRA_HWPM_RESOURCE_STATUS_INVALID, .reserved = false, }; diff --git a/hal/t234/ip/rtr/t234_hwpm_ip_rtr.c b/hal/t234/ip/rtr/t234_hwpm_ip_rtr.c index 321cdfd..fb89631 100644 --- a/hal/t234/ip/rtr/t234_hwpm_ip_rtr.c +++ b/hal/t234/ip/rtr/t234_hwpm_ip_rtr.c @@ -225,5 +225,6 @@ struct hwpm_ip t234_hwpm_ip_rtr = { /* RTR is defined as 2 instance IP corresponding to router and pma */ /* Set this mask to indicate that instances are available */ .inst_fs_mask = 0x3U, + .resource_status = TEGRA_HWPM_RESOURCE_STATUS_VALID, .reserved = false, }; diff --git a/hal/t234/ip/scf/t234_hwpm_ip_scf.c b/hal/t234/ip/scf/t234_hwpm_ip_scf.c index 4874626..a48f55f 100644 --- a/hal/t234/ip/scf/t234_hwpm_ip_scf.c +++ b/hal/t234/ip/scf/t234_hwpm_ip_scf.c @@ -142,5 +142,6 @@ struct hwpm_ip t234_hwpm_ip_scf = { .override_enable = false, .inst_fs_mask = 0x1U, + .resource_status = TEGRA_HWPM_RESOURCE_STATUS_VALID, .reserved = false, }; diff --git a/hal/t234/ip/vi/t234_hwpm_ip_vi.c b/hal/t234/ip/vi/t234_hwpm_ip_vi.c index 7c9d29c..9c105c0 100644 --- a/hal/t234/ip/vi/t234_hwpm_ip_vi.c +++ b/hal/t234/ip/vi/t234_hwpm_ip_vi.c @@ -263,5 +263,6 @@ struct hwpm_ip t234_hwpm_ip_vi = { .override_enable = false, .inst_fs_mask = 0U, + .resource_status = TEGRA_HWPM_RESOURCE_STATUS_INVALID, .reserved = false, }; diff --git a/hal/t234/ip/vic/t234_hwpm_ip_vic.c b/hal/t234/ip/vic/t234_hwpm_ip_vic.c index f29a7f4..3ab44e7 100644 --- a/hal/t234/ip/vic/t234_hwpm_ip_vic.c +++ b/hal/t234/ip/vic/t234_hwpm_ip_vic.c @@ -164,5 +164,6 @@ struct hwpm_ip t234_hwpm_ip_vic = { .override_enable = false, .inst_fs_mask = 0U, + .resource_status = TEGRA_HWPM_RESOURCE_STATUS_INVALID, .reserved = false, }; diff --git a/hal/t234/t234_hwpm_interface_utils.c b/hal/t234/t234_hwpm_interface_utils.c index 00aedff..e89f783 100644 --- a/hal/t234/t234_hwpm_interface_utils.c +++ b/hal/t234/t234_hwpm_interface_utils.c @@ -34,6 +34,7 @@ struct tegra_soc_hwpm_chip t234_chip_info = { .extract_ip_ops = t234_hwpm_extract_ip_ops, .force_enable_ips = t234_hwpm_force_enable_ips, .get_fs_info = t234_hwpm_get_fs_info, + .get_resource_info = t234_hwpm_get_resource_info, .init_prod_values = t234_hwpm_init_prod_values, .disable_slcg = t234_hwpm_disable_slcg, @@ -101,6 +102,11 @@ static bool t234_hwpm_validate_hals(struct tegra_soc_hwpm *hwpm) return false; } + if (hwpm->active_chip->get_resource_info == NULL) { + tegra_hwpm_err(hwpm, "get_resource_info uninitialized"); + return false; + } + if (hwpm->active_chip->init_prod_values == NULL) { tegra_hwpm_err(hwpm, "init_prod_values uninitialized"); return false; diff --git a/hal/t234/t234_hwpm_internal.h b/hal/t234/t234_hwpm_internal.h index bc98c10..71b81d7 100644 --- a/hal/t234/t234_hwpm_internal.h +++ b/hal/t234/t234_hwpm_internal.h @@ -81,6 +81,8 @@ int t234_hwpm_extract_ip_ops(struct tegra_soc_hwpm *hwpm, int t234_hwpm_force_enable_ips(struct tegra_soc_hwpm *hwpm); int t234_hwpm_get_fs_info(struct tegra_soc_hwpm *hwpm, u32 ip_enum, u64 *fs_mask, u8 *ip_status); +int t234_hwpm_get_resource_info(struct tegra_soc_hwpm *hwpm, + u32 resource_enum, u8 *status); int t234_hwpm_init_prod_values(struct tegra_soc_hwpm *hwpm); int t234_hwpm_disable_slcg(struct tegra_soc_hwpm *hwpm); diff --git a/hal/t234/t234_hwpm_ip_utils.c b/hal/t234/t234_hwpm_ip_utils.c index 45c202b..ba618ff 100644 --- a/hal/t234/t234_hwpm_ip_utils.c +++ b/hal/t234/t234_hwpm_ip_utils.c @@ -21,6 +21,11 @@ #include #include +/* + * This function is invoked by register_ip API. + * Convert the external resource enum to internal IP index. + * Extract given ip_ops and update corresponding IP structure. + */ int t234_hwpm_extract_ip_ops(struct tegra_soc_hwpm *hwpm, struct tegra_soc_hwpm_ip_ops *hwpm_ip_ops, bool available) { @@ -345,5 +350,27 @@ int t234_hwpm_get_fs_info(struct tegra_soc_hwpm *hwpm, *ip_status = TEGRA_SOC_HWPM_IP_STATUS_VALID; + return 0; +} + +int t234_hwpm_get_resource_info(struct tegra_soc_hwpm *hwpm, + u32 resource_enum, u8 *status) +{ + u32 ip_idx = 0U; + struct tegra_soc_hwpm_chip *active_chip = hwpm->active_chip; + struct hwpm_ip *chip_ip = NULL; + + tegra_hwpm_fn(hwpm, " "); + + /* Convert tegra_soc_hwpm_resource to internal enum */ + if (!(t234_hwpm_is_resource_active(hwpm, resource_enum, &ip_idx))) { + *status = tegra_hwpm_safe_cast_u32_to_u8( + TEGRA_HWPM_RESOURCE_STATUS_INVALID); + } else { + chip_ip = active_chip->chip_ips[ip_idx]; + *status = tegra_hwpm_safe_cast_u32_to_u8( + chip_ip->resource_status); + } + return 0; } diff --git a/include/tegra_hwpm.h b/include/tegra_hwpm.h index d7590a9..ef4a1be 100644 --- a/include/tegra_hwpm.h +++ b/include/tegra_hwpm.h @@ -89,6 +89,11 @@ struct tegra_hwpm_ip_ops { #define TEGRA_HWPM_APERTURE_TYPE_PERFMON 2U #define TEGRA_HWPM_APERTURE_TYPE_MAX 3U +#define TEGRA_HWPM_RESOURCE_STATUS_INVALID \ + TEGRA_SOC_HWPM_RESOURCE_STATUS_INVALID +#define TEGRA_HWPM_RESOURCE_STATUS_VALID \ + TEGRA_SOC_HWPM_RESOURCE_STATUS_VALID + /* * Devices handled by HWPM driver can be divided into 2 categories * - HWPM : Components in HWPM device address space @@ -284,6 +289,14 @@ struct hwpm_ip { */ u32 inst_fs_mask; + /* + * Resource status can be: TEGRA_HWPM_RESOURCE_STATUS_* + * - invalid: resource is not available to be reserved + * - valid: resource exists on the chip + * - reserved: resource is reserved + * - fault: resource faulted during reservation + */ + u32 resource_status; bool reserved; }; @@ -307,6 +320,8 @@ struct tegra_soc_hwpm_chip { int (*force_enable_ips)(struct tegra_soc_hwpm *hwpm); int (*get_fs_info)(struct tegra_soc_hwpm *hwpm, u32 ip_enum, u64 *fs_mask, u8 *ip_status); + int (*get_resource_info)(struct tegra_soc_hwpm *hwpm, + u32 resource_enum, u8 *status); int (*init_prod_values)(struct tegra_soc_hwpm *hwpm); int (*disable_slcg)(struct tegra_soc_hwpm *hwpm); diff --git a/include/tegra_hwpm_common.h b/include/tegra_hwpm_common.h index 8cf1ed6..419d0aa 100644 --- a/include/tegra_hwpm_common.h +++ b/include/tegra_hwpm_common.h @@ -21,6 +21,7 @@ struct tegra_hwpm_func_args; struct tegra_soc_hwpm; struct tegra_soc_hwpm_exec_reg_ops; struct tegra_soc_hwpm_ip_floorsweep_info; +struct tegra_soc_hwpm_resource_info; struct tegra_soc_hwpm_alloc_pma_stream; struct tegra_soc_hwpm_update_get_put; struct hwpm_ip; @@ -76,6 +77,8 @@ void tegra_hwpm_release_sw_setup(struct tegra_soc_hwpm *hwpm); int tegra_hwpm_get_floorsweep_info(struct tegra_soc_hwpm *hwpm, struct tegra_soc_hwpm_ip_floorsweep_info *fs_info); +int tegra_hwpm_get_resource_info(struct tegra_soc_hwpm *hwpm, + struct tegra_soc_hwpm_resource_info *rsrc_info); int tegra_hwpm_map_stream_buffer(struct tegra_soc_hwpm *hwpm, struct tegra_soc_hwpm_alloc_pma_stream *alloc_pma_stream); diff --git a/include/tegra_hwpm_static_analysis.h b/include/tegra_hwpm_static_analysis.h index 686461d..9807992 100644 --- a/include/tegra_hwpm_static_analysis.h +++ b/include/tegra_hwpm_static_analysis.h @@ -224,4 +224,25 @@ static inline s32 tegra_hwpm_safe_cast_u64_to_s32(u64 ul_a) } } +/** + * @brief Cast u32 to u8 and check for overflow. + * + * @param ui_a [in] Value to cast. + * + * Casts \a ui_a to a u8 unless the result will overflow a u8. If \a ui_a is + * greater than UCHAR_MAX (typecasted to u32) which indicates overflow, call + * #BUG(). + * + * @return If no overflow, u8 representation of the value in \a ui_a. + */ +static inline u8 tegra_hwpm_safe_cast_u32_to_u8(u32 ui_a) +{ + if (ui_a > U8_MAX) { + WARN_ON(true); + return 0U; + } else { + return (u8)ui_a; + } +} + #endif /* TEGRA_HWPM_STATIC_ANALYSIS_H */ diff --git a/os/linux/tegra_hwpm_ioctl.c b/os/linux/tegra_hwpm_ioctl.c index 90dd0bf..bdd0e6c 100644 --- a/os/linux/tegra_hwpm_ioctl.c +++ b/os/linux/tegra_hwpm_ioctl.c @@ -42,7 +42,7 @@ static int device_info_ioctl(struct tegra_soc_hwpm *hwpm, void *ioctl_struct); static int floorsweep_info_ioctl(struct tegra_soc_hwpm *hwpm, void *ioctl_struct); -static int timer_relation_ioctl(struct tegra_soc_hwpm *hwpm, +static int resource_info_ioctl(struct tegra_soc_hwpm *hwpm, void *ioctl_struct); static int reserve_resource_ioctl(struct tegra_soc_hwpm *hwpm, void *ioctl_struct); @@ -68,10 +68,10 @@ static const struct tegra_soc_hwpm_ioctl ioctls[] = { .struct_size = sizeof(struct tegra_soc_hwpm_ip_floorsweep_info), .handler = floorsweep_info_ioctl, }, - [TEGRA_SOC_HWPM_IOCTL_GET_GPU_CPU_TIME_CORRELATION_INFO] = { - .name = "timer_relation", - .struct_size = sizeof(struct tegra_soc_hwpm_timer_relation), - .handler = timer_relation_ioctl, + [TEGRA_SOC_HWPM_IOCTL_RESOURCE_INFO] = { + .name = "resource_info", + .struct_size = sizeof(struct tegra_soc_hwpm_resource_info), + .handler = resource_info_ioctl, }, [TEGRA_SOC_HWPM_IOCTL_RESERVE_RESOURCE] = { .name = "reserve_resource", @@ -142,18 +142,19 @@ static int floorsweep_info_ioctl(struct tegra_soc_hwpm *hwpm, return tegra_hwpm_get_floorsweep_info(hwpm, fs_info); } -static int timer_relation_ioctl(struct tegra_soc_hwpm *hwpm, +static int resource_info_ioctl(struct tegra_soc_hwpm *hwpm, void *ioctl_struct) { -/* FIXME: Implement IOCTL */ -#if 0 - struct tegra_soc_hwpm_timer_relation *timer_relation = - (struct tegra_soc_hwpm_timer_relation *)ioctl_struct; -#endif + struct tegra_soc_hwpm_resource_info *rsrc_info = + (struct tegra_soc_hwpm_resource_info *)ioctl_struct; - tegra_hwpm_err(hwpm, "The GET_GPU_CPU_TIME_CORRELATION_INFO IOCTL is" - " currently not implemented"); - return -ENXIO; + if (rsrc_info->num_queries > TEGRA_SOC_HWPM_RESOURCE_QUERIES_MAX) { + tegra_hwpm_err(hwpm, "Number of queries exceed max limit of %u", + TEGRA_SOC_HWPM_RESOURCE_QUERIES_MAX); + return -EINVAL; + } + + return tegra_hwpm_get_resource_info(hwpm, rsrc_info); }