Files
linux-nvgpu/drivers/gpu/nvgpu/include/nvgpu/log.h
Richard Zhao 1f9fbc85fe gpu: nvgpu: add nvgpu_hvrtos build
- nvgpu_hvrtos disabled bellow configs:
  - CONFIG_NVGPU_IVM_BUILD
  - CONFIG_NVGPU_TRACE
  - CONFIG_NVGPU_SYSFS
  - CONFIG_NVGPU_DGPU
  - CONFIG_NVGPU_IGPU_VIRT
  - CONFIG_NVGPU_NVLINK
  - CONFIG_NVGPU_CLK_ARB
  - CONFIG_NVGPU_MIG
- nvgpu_hvrtos re-uses posix bitmap.c
- add nvgpu_hvrtos specific headers
- add static check of vgpu ivc frame
- fix build errors caused by new CFLAGS

Jira GVSCI-9976

Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Change-Id: I5f65fda9444d0cbfe6008ac4ab8262b44d1a4f56
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2653745
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Austin Tajiri <atajiri@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Aparna Das <aparnad@nvidia.com>
GVS: Gerrit_Virtual_Submit
2022-07-28 23:59:10 -07:00

132 lines
4.4 KiB
C

/*
* Copyright (c) 2017-2022, 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_LOG_H
#define NVGPU_LOG_H
#ifdef __KERNEL__
#include <nvgpu/linux/log.h>
#elif defined(__NVGPU_POSIX__)
#include <nvgpu/posix/log.h>
#elif defined(NVGPU_HVRTOS)
#include <nvgpu_hvrtos/log.h>
#else
#include <nvgpu_rmos/include/log.h>
#endif
#ifdef CONFIG_NVGPU_NON_FUSA
/**
* nvgpu_log_mask_enabled - Check if logging is enabled
*
* @g - The GPU.
* @log_mask - The mask to check against.
*
* Check if, given the passed mask, logging would actually happen. This is
* useful for avoiding calling the logging function many times when we know that
* said prints would not happen. For example for-loops of log statements in
* critical paths.
*/
bool nvgpu_log_mask_enabled(struct gk20a *g, u64 log_mask);
#endif
/**
* nvgpu_log - Print a debug message
*
* @g - The GPU.
* @log_mask - A mask defining when the print should happen. See enum
* %nvgpu_log_categories.
* @fmt - A format string (printf style).
* @arg... - Arguments for the format string.
*
* Print a message if the log_mask matches the enabled debugging.
*/
#define nvgpu_log(g, log_mask, fmt, arg...) \
nvgpu_log_impl(g, log_mask, fmt, ##arg)
/**
* nvgpu_err - Print an error
*
* @g - The GPU.
* @fmt - A format string (printf style).
* @arg... - Arguments for the format string.
*
* Unconditionally print an error message.
*/
#define nvgpu_err(g, fmt, arg...) \
nvgpu_err_impl(g, fmt, ##arg)
/**
* nvgpu_warn - Print a warning
*
* @g - The GPU.
* @fmt - A format string (printf style).
* @arg... - Arguments for the format string.
*
* Unconditionally print a warning message.
*/
#define nvgpu_warn(g, fmt, arg...) \
nvgpu_warn_impl(g, fmt, ##arg)
/**
* nvgpu_info - Print an info message
*
* @g - The GPU.
* @fmt - A format string (printf style).
* @arg... - Arguments for the format string.
*
* Unconditionally print an information message.
*/
#define nvgpu_info(g, fmt, arg...) \
nvgpu_info_impl(g, fmt, ##arg)
/*
* Some convenience macros.
*/
#define nvgpu_log_fn(g, fmt, arg...) nvgpu_log(g, gpu_dbg_fn, fmt, ##arg)
#define nvgpu_log_info(g, fmt, arg...) nvgpu_log(g, gpu_dbg_info, fmt, ##arg)
/******************************************************************************
* The old legacy debugging API minus some parts that are unnecessary. *
* Please, please, please do not use this!!! This is still around to aid *
* transitioning to the new API. *
* *
* This changes up the print formats to be closer to the new APIs formats. *
* Also it removes the dev_warn() and dev_err() usage. Those arguments are *
* ignored now. *
******************************************************************************/
/*
* This exist for backwards compatibility with the old debug/logging API. If you
* want ftrace support use the new API!
*/
#define gk20a_dbg(log_mask, fmt, arg...) \
gk20a_dbg_impl(log_mask, fmt, ##arg)
/*
* Some convenience macros.
*/
#define gk20a_dbg_fn(fmt, arg...) gk20a_dbg(gpu_dbg_fn, fmt, ##arg)
#define gk20a_dbg_info(fmt, arg...) gk20a_dbg(gpu_dbg_info, fmt, ##arg)
#endif /* NVGPU_LOG_H */