Files
linux-nvgpu/drivers/gpu/nvgpu/include/nvgpu/gr/gr_utils.h
Divya c62bdb94ba gpu: nvgpu: add sysfs node for golden img status
- Add a sysfs node "golden_img_status" to show
  if golden_image size and ptr are already initialized
  or not.
- This node helps to know golden image status before
  attempting to modify gpc/tpc/fbp masks.

Bug 3960290

Change-Id: I3c3de69b369bcaf2f0127e897d06e21cb8e2d68e
Signed-off-by: Divya <dsinghatwari@nvidia.com>
(cherry picked from commit c728f09c18)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2864095
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-05 06:06:47 -07:00

140 lines
4.3 KiB
C

/*
* Copyright (c) 2019-2023, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef NVGPU_GR_UTILS_H
#define NVGPU_GR_UTILS_H
#include <nvgpu/types.h>
#include <nvgpu/static_analysis.h>
/**
* @file
*
* common.gr.utils unit interface
*/
struct gk20a;
struct nvgpu_gr;
struct nvgpu_gr_falcon;
struct nvgpu_gr_config;
struct nvgpu_gr_intr;
#ifdef CONFIG_NVGPU_DEBUGGER
struct nvgpu_gr_obj_ctx_golden_image;
#endif
#ifdef CONFIG_NVGPU_GRAPHICS
struct nvgpu_gr_zbc;
struct nvgpu_gr_zcull;
#endif
#ifdef CONFIG_NVGPU_DEBUGGER
struct nvgpu_gr_hwpm_map;
#endif
#ifdef CONFIG_NVGPU_FECS_TRACE
struct nvgpu_gr_global_ctx_buffer_desc;
#endif
/**
* @brief Compute checksum.
*
* @param a [in] First unsigned integer.
* @param b [in] Second unsigned integer.
*
* This function will calculate checksum of two unsigned integers and
* return the result. This function is typically needed to calculate
* checksum of falcon ucode boot binary.
*
* @return Checksum of two unsigned integers.
*/
u32 nvgpu_gr_checksum_u32(u32 a, u32 b);
/**
* @brief Get GR falcon data struct pointer.
*
* @param g [in] Pointer to GPU driver struct.
*
* This function returns pointer to #nvgpu_gr_falcon structure.
*
* @return Pointer to GR falcon data struct.
*/
struct nvgpu_gr_falcon *nvgpu_gr_get_falcon_ptr(struct gk20a *g);
/**
* @brief Get GR configuration struct pointer.
*
* @param g [in] Pointer to GPU driver struct.
*
* This function returns pointer to #nvgpu_gr_config structure.
*
* @return Pointer to GR configuration struct.
*/
struct nvgpu_gr_config *nvgpu_gr_get_config_ptr(struct gk20a *g);
/**
* @brief Get GR configuration struct pointer.
*
* @param g [in] Pointer to GPU driver struct.
* @param gr_instance_id [in] Gr instance Id.
*
* This function returns pointer to #nvgpu_gr_config structure.
*
* @return Pointer to GR configuration struct.
*/
struct nvgpu_gr_config *nvgpu_gr_get_gr_instance_config_ptr(struct gk20a *g,
u32 gr_instance_id);
/**
* @brief Get GR interrupt data struct pointer.
*
* @param g [in] Pointer to GPU driver struct.
*
* This function returns pointer to #nvgpu_gr_intr structure.
*
* @return Pointer to GR interrupt data struct.
*/
struct nvgpu_gr_intr *nvgpu_gr_get_intr_ptr(struct gk20a *g);
#ifdef CONFIG_NVGPU_NON_FUSA
/* gr variables */
u32 nvgpu_gr_get_override_ecc_val(struct gk20a *g);
void nvgpu_gr_override_ecc_val(struct nvgpu_gr *gr, u32 ecc_val);
#endif
#ifdef CONFIG_NVGPU_GRAPHICS
struct nvgpu_gr_zcull *nvgpu_gr_get_zcull_ptr(struct gk20a *g);
struct nvgpu_gr_zbc *nvgpu_gr_get_zbc_ptr(struct gk20a *g);
#endif
#ifdef CONFIG_NVGPU_CILP
u32 nvgpu_gr_get_cilp_preempt_pending_chid(struct gk20a *g);
void nvgpu_gr_clear_cilp_preempt_pending_chid(struct gk20a *g);
#endif
struct nvgpu_gr_obj_ctx_golden_image *nvgpu_gr_get_golden_image_ptr(
struct gk20a *g);
bool nvgpu_gr_obj_ctx_golden_img_status(struct gk20a *g);
#ifdef CONFIG_NVGPU_DEBUGGER
struct nvgpu_gr_hwpm_map *nvgpu_gr_get_hwpm_map_ptr(struct gk20a *g);
void nvgpu_gr_reset_falcon_ptr(struct gk20a *g);
void nvgpu_gr_reset_golden_image_ptr(struct gk20a *g);
#endif
#ifdef CONFIG_NVGPU_FECS_TRACE
struct nvgpu_gr_global_ctx_buffer_desc *nvgpu_gr_get_global_ctx_buffer_ptr(
struct gk20a *g);
#endif
#endif /* NVGPU_GR_UTILS_H */