610.57.04

This commit is contained in:
Maneet Singh
2026-08-03 14:41:34 -07:00
parent 452cec62d8
commit e4a5faa256
114 changed files with 202606 additions and 201512 deletions
+1 -1
View File
@@ -79,7 +79,7 @@ ccflags-y += -I$(src)/common/inc
ccflags-y += -I$(src)
ccflags-y += -Wall $(DEFINES) $(INCLUDES) -Wno-cast-qual -Wno-format-extra-args
ccflags-y += -D__KERNEL__ -DMODULE -DNVRM
ccflags-y += -DNV_VERSION_STRING=\"610.43.03\"
ccflags-y += -DNV_VERSION_STRING=\"610.57.04\"
# Include and link Tegra out-of-tree modules.
ifneq ($(wildcard /usr/src/nvidia/nvidia-public),)
+39 -24
View File
@@ -169,6 +169,9 @@
#include <linux/efi.h> /* efi_enabled */
#include <linux/fb.h> /* fb_info struct */
#include <linux/screen_info.h> /* screen_info */
#if defined(NV_LINUX_SYSFB_H_PRESENT)
#include <linux/sysfb.h> /* sysfb_primary_display */
#endif
#if !defined(CONFIG_PCI)
#warning "Attempting to build driver for a platform with no PCI support!"
@@ -252,6 +255,10 @@ NV_STATUS nvos_forward_error_to_cray(struct pci_dev *, NvU32,
user_function, NULL, args)
#endif
#if defined(NV_LINUX_IOMMU_DMA_H_PRESENT)
#include <linux/iommu-dma.h>
#endif
#define NV_PAGE_COUNT(page) \
((unsigned int)page_count(page))
@@ -938,6 +945,11 @@ typedef struct nv_alloc_s {
*/
static inline NvBool nv_is_dma_direct(struct device *dev)
{
#if defined(NV_USE_DMA_IOMMU_PRESENT)
if (use_dma_iommu(dev))
return NV_FALSE;
#endif
return get_dma_ops(dev) == NULL;
}
@@ -1041,6 +1053,7 @@ typedef struct nv_dma_map_s {
NvU64 page_count;
NvBool contiguous;
NvU32 cache_type;
NvBool bReadOnlyDeviceMap;
struct sg_table *import_sgt;
union
@@ -1711,6 +1724,25 @@ typedef enum
#else
#include <linux/gpio/driver.h>
static inline int __to_hwgpio(const struct gpio_device *gdev,
const struct of_phandle_args *gpiospec)
{
#if defined(CONFIG_OF_GPIO)
/*
* Use the chip's of_xlate callback to translate the DT GPIO
* specifier into a linear offset. Tegra GPIO controllers encode
* port and pin in args[0] and of_xlate sums per-port pin counts
* to produce the real offset.
*/
struct gpio_chip *chip = gpio_device_get_chip(gdev);
if (chip->of_xlate)
return chip->of_xlate(chip, gpiospec, NULL);
#endif
return gpiospec->args[0];
}
/*
* of_get_named_gpio() was removed along with linux/of_gpio.h by commit
* 51aaf65bbd21 ("gpio: of: Remove <linux/of_gpio.h>"). Provide a compat
@@ -1722,7 +1754,7 @@ static inline int of_get_named_gpio(const struct device_node *np,
struct of_phandle_args gpiospec;
struct gpio_device *gdev;
struct gpio_desc *desc;
int ret;
int ret, hwgpio;
if (!np)
return -ENOENT;
@@ -1737,30 +1769,13 @@ static inline int of_get_named_gpio(const struct device_node *np,
if (!gdev)
return -EPROBE_DEFER;
/*
* Use the chip's of_xlate callback to translate the DT GPIO
* specifier into a linear offset. Tegra GPIO controllers encode
* port and pin in args[0] and of_xlate sums per-port pin counts
* to produce the real offset.
*/
{
struct gpio_chip *chip = gpio_device_get_chip(gdev);
int hwgpio;
#if defined(CONFIG_OF_GPIO)
if (chip->of_xlate)
hwgpio = chip->of_xlate(chip, &gpiospec, NULL);
else
#endif
hwgpio = gpiospec.args[0];
if (hwgpio < 0) {
gpio_device_put(gdev);
return hwgpio;
}
desc = gpio_device_get_desc(gdev, hwgpio);
hwgpio = __to_hwgpio(gdev, &gpiospec);
if (hwgpio < 0) {
gpio_device_put(gdev);
return hwgpio;
}
desc = gpio_device_get_desc(gdev, hwgpio);
gpio_device_put(gdev);
if (IS_ERR(desc))
+9 -2
View File
@@ -660,6 +660,8 @@ struct nv_file_private_t
nv_file_private_t * PORT_ATOMIC ctl_nvfp;
void *ctl_nvfp_priv;
PORT_ATOMIC NvU32 register_or_refcount;
// In-flight nv_post_event() calls using this file private.
PORT_ATOMIC NvS32 event_posting_refcount;
//
// True if a client or an event was ever allocated on this fd.
@@ -668,6 +670,11 @@ struct nv_file_private_t
NvBool bCleanupRmapi;
};
static inline NvS32 nv_event_posting_refcount_read(nv_file_private_t *nvfp)
{
return *((volatile NvS32 *)&nvfp->event_posting_refcount);
}
// Forward define the gpu ops structures
typedef struct gpuSession *nvgpuSessionHandle_t;
typedef struct gpuDevice *nvgpuDeviceHandle_t;
@@ -969,9 +976,9 @@ void NV_API_CALL nv_unregister_sgt (nv_state_t *, struct sg_table
NV_STATUS NV_API_CALL nv_register_phys_pages (nv_state_t *, NvU64 *, NvU64, NvU32, void **);
void NV_API_CALL nv_unregister_phys_pages (nv_state_t *, void *);
NV_STATUS NV_API_CALL nv_dma_map_sgt (nv_dma_device_t *, NvU64, NvU64 *, NvU32, void **);
NV_STATUS NV_API_CALL nv_dma_map_sgt (nv_dma_device_t *, NvU64, NvU64 *, NvU32, NvBool, void **);
NV_STATUS NV_API_CALL nv_dma_map_alloc (nv_dma_device_t *, NvU64, NvU64 *, NvBool, void **);
NV_STATUS NV_API_CALL nv_dma_map_alloc (nv_dma_device_t *, NvU64, NvU64 *, NvBool, NvBool, void **);
NV_STATUS NV_API_CALL nv_dma_unmap_alloc (nv_dma_device_t *, NvU64, NvU64 *, void **);
NV_STATUS NV_API_CALL nv_dma_map_peer (nv_dma_device_t *, nv_dma_device_t *, NvU8, NvU64, NvU64 *);
+39 -4
View File
@@ -1175,14 +1175,15 @@ compile_test() {
#
CODE="
#include <linux/pci.h>
#if defined(NV_LINUX_NVGRACE_EGM_H_PRESENT)
#include <linux/nvgrace-egm.h>
#endif
void conftest_egm_module_helper_api_present() {
struct pci_dev *pdev = NULL;
register_egm_node(pdev);
unregister_egm_node(pdev);
register_egm_node();
unregister_egm_node();
}
"
compile_check_conftest "$CODE" "NV_EGM_MODULE_HELPER_API_PRESENT" "" "types"
compile_check_conftest "$CODE" "NV_EGM_MODULE_HELPER_API_PRESENT" "" "functions"
;;
egm_bad_pages_handling_support)
@@ -5216,6 +5217,40 @@ compile_test() {
compile_check_conftest "$CODE" "NV_DRM_COLOROP_HAS_FUNCS" "" "types"
;;
use_dma_iommu)
#
# Determine if use_dma_iommu() function is present.
#
# Added by commit 19156263cb1f ("dma-mapping: use IOMMU DMA
# calls for common alloc/free page calls") in 6.12
#
CODE="
#if defined(NV_LINUX_IOMMU_DMA_H_PRESENT)
#include <linux/iommu-dma.h>
#endif
void conftest_use_dma_iommu(void) {
use_dma_iommu();
}"
compile_check_conftest "$CODE" "NV_USE_DMA_IOMMU_PRESENT" "" "functions"
;;
drm_atomic_commit_struct_present)
#
# Determine if 'struct drm_atomic_state' has been renamed to
# 'struct drm_atomic_commit'.
#
# Renamed by commit 5164f7e7ff8e ("drm: Rename struct
# drm_atomic_state to drm_atomic_commit"), expected in Linux v7.2.
#
CODE="
#include <drm/drm_atomic.h>
struct drm_atomic_commit state;"
compile_check_conftest "$CODE" "NV_DRM_ATOMIC_COMMIT_STRUCT_PRESENT" "" "types"
;;
# When adding a new conftest entry, please use the correct format for
# specifying the relevant upstream Linux kernel commit. Please
# avoid specifying -rc kernels, and only use SHAs that actually exist
+4 -1
View File
@@ -39,11 +39,14 @@ NV_HEADER_PRESENCE_TESTS = \
linux/stdarg.h \
linux/iosys-map.h \
linux/vfio_pci_core.h \
linux/nvgrace-egm.h \
linux/cc_platform.h \
linux/slub_def.h \
linux/of_gpio.h \
asm/cpufeature.h \
asm/mshyperv.h \
crypto/sig.h \
drm/drm_colorop.h
drm/drm_colorop.h \
linux/iommu-dma.h \
linux/sysfb.h
@@ -289,7 +289,7 @@ failed:
static int plane_update_state_from_colorops(struct drm_plane *plane,
struct drm_plane_state *plane_state)
{
struct drm_atomic_state *state = plane_state->state;
nv_drm_atomic_state_base_t *state = plane_state->state;
struct nv_drm_plane_state *nv_plane_state = to_nv_drm_plane_state(plane_state);
struct nv_drm_colorop *nv_colorop;
struct nv_drm_color_pipeline *pipeline;
@@ -500,7 +500,7 @@ static const NvU32 __nv_drm_connector_supported_colorspaces =
#if defined(NV_DRM_CONNECTOR_ATTACH_HDR_OUTPUT_METADATA_PROPERTY_PRESENT)
static int
__nv_drm_connector_atomic_check(struct drm_connector *connector,
struct drm_atomic_state *state)
nv_drm_atomic_state_base_t *state)
{
struct drm_connector_state *new_connector_state =
drm_atomic_get_new_connector_state(state, connector);
+6 -6
View File
@@ -1604,16 +1604,16 @@ static int __nv_drm_cursor_atomic_check(struct drm_plane *plane,
return 0;
}
#if defined(NV_DRM_PLANE_ATOMIC_CHECK_HAS_ATOMIC_STATE_ARG)
#if defined(NV_DRM_PLANE_ATOMIC_CHECK_HAS_FULL_STATE_ARG)
static int nv_drm_plane_atomic_check(struct drm_plane *plane,
struct drm_atomic_state *state)
nv_drm_atomic_state_base_t *state)
#else
static int nv_drm_plane_atomic_check(struct drm_plane *plane,
struct drm_plane_state *plane_state)
#endif
{
struct nv_drm_plane *nv_plane = to_nv_plane(plane);
#if defined(NV_DRM_PLANE_ATOMIC_CHECK_HAS_ATOMIC_STATE_ARG)
#if defined(NV_DRM_PLANE_ATOMIC_CHECK_HAS_FULL_STATE_ARG)
struct drm_plane_state *plane_state =
drm_atomic_get_new_plane_state(state, plane);
#endif
@@ -2608,15 +2608,15 @@ static int color_mgmt_config_set_luts(struct nv_drm_crtc_state *nv_crtc_state,
* the 'nv_drm_crtc_state::req_config', that is fine because 'nv_drm_crtc_state'
* will be discarded if ->atomic_check() fails.
*/
#if defined(NV_DRM_CRTC_ATOMIC_CHECK_HAS_ATOMIC_STATE_ARG)
#if defined(NV_DRM_CRTC_ATOMIC_CHECK_HAS_FULL_STATE_ARG)
static int nv_drm_crtc_atomic_check(struct drm_crtc *crtc,
struct drm_atomic_state *state)
nv_drm_atomic_state_base_t *state)
#else
static int nv_drm_crtc_atomic_check(struct drm_crtc *crtc,
struct drm_crtc_state *crtc_state)
#endif
{
#if defined(NV_DRM_CRTC_ATOMIC_CHECK_HAS_ATOMIC_STATE_ARG)
#if defined(NV_DRM_CRTC_ATOMIC_CHECK_HAS_FULL_STATE_ARG)
struct drm_crtc_state *crtc_state =
drm_atomic_get_new_crtc_state(state, crtc);
#endif
+7 -7
View File
@@ -987,7 +987,7 @@ static void nv_drm_master_set(struct drm_device *dev,
static
int nv_drm_reset_input_colorspace(struct drm_device *dev)
{
struct drm_atomic_state *state;
nv_drm_atomic_state_base_t *state;
struct drm_plane_state *plane_state;
struct drm_plane *plane;
struct nv_drm_plane_state *nv_drm_plane_state;
@@ -996,7 +996,7 @@ int nv_drm_reset_input_colorspace(struct drm_device *dev)
bool do_reset = false;
NvU32 flags = 0;
state = drm_atomic_state_alloc(dev);
state = nv_drm_atomic_state_base_alloc(dev);
if (!state)
return -ENOMEM;
@@ -1027,7 +1027,7 @@ int nv_drm_reset_input_colorspace(struct drm_device *dev)
}
out:
drm_atomic_state_put(state);
nv_drm_atomic_state_base_put(state);
drm_modeset_drop_locks(&ctx);
drm_modeset_acquire_fini(&ctx);
@@ -1435,7 +1435,7 @@ static int nv_drm_grant_permission_ioctl(struct drm_device *dev, void *data,
}
static int
nv_drm_atomic_disable_connector(struct drm_atomic_state *state,
nv_drm_atomic_disable_connector(nv_drm_atomic_state_base_t *state,
struct nv_drm_connector *nv_connector)
{
struct drm_crtc_state *crtc_state;
@@ -1468,7 +1468,7 @@ static int nv_drm_revoke_modeset_permission(struct drm_device *dev,
struct drm_file *filep, NvU32 dpyId)
{
struct drm_modeset_acquire_ctx *pctx;
struct drm_atomic_state *state;
nv_drm_atomic_state_base_t *state;
struct drm_connector *connector;
struct drm_crtc *crtc;
int ret = 0;
@@ -1483,7 +1483,7 @@ static int nv_drm_revoke_modeset_permission(struct drm_device *dev,
pctx = dev->mode_config.acquire_ctx;
#endif
state = drm_atomic_state_alloc(dev);
state = nv_drm_atomic_state_base_alloc(dev);
if (!state) {
ret = -ENOMEM;
goto done;
@@ -1519,7 +1519,7 @@ static int nv_drm_revoke_modeset_permission(struct drm_device *dev,
ret = drm_atomic_commit(state);
done:
drm_atomic_state_put(state);
nv_drm_atomic_state_base_put(state);
#if NV_DRM_MODESET_LOCK_ALL_END_ARGUMENT_COUNT == 3
DRM_MODESET_LOCK_ALL_END(dev, ctx, ret);
+3 -3
View File
@@ -91,7 +91,7 @@
int nv_drm_atomic_helper_disable_all(struct drm_device *dev,
struct drm_modeset_acquire_ctx *ctx)
{
struct drm_atomic_state *state;
nv_drm_atomic_state_base_t *state;
struct drm_connector_state *conn_state;
struct drm_connector *conn;
struct drm_plane_state *plane_state;
@@ -101,7 +101,7 @@ int nv_drm_atomic_helper_disable_all(struct drm_device *dev,
unsigned plane_mask = 0;
int ret, i;
state = drm_atomic_state_alloc(dev);
state = nv_drm_atomic_state_base_alloc(dev);
if (!state)
return -ENOMEM;
@@ -173,7 +173,7 @@ free:
}
}
drm_atomic_state_put(state);
nv_drm_atomic_state_base_put(state);
return ret;
}
@@ -135,6 +135,92 @@ nv_drm_prime_pages_to_sg(struct drm_device *dev,
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
/*
* Linux commit 5164f7e7ff8e ("drm: Rename struct drm_atomic_state to
* drm_atomic_commit"), expected in Linux v7.2, renamed the top-level atomic
* commit object and its lifetime helpers.
*/
#if defined(NV_DRM_ATOMIC_COMMIT_STRUCT_PRESENT)
typedef struct drm_atomic_commit nv_drm_atomic_state_base_t;
#else
typedef struct drm_atomic_state nv_drm_atomic_state_base_t;
#endif
/*
* Linux commits 29b77ad7b9ca ("drm/atomic: Pass the full state to CRTC
* atomic_check") and 7c11b99a8e58 ("drm/atomic: Pass the full state to
* planes atomic_check") changed the CRTC and plane helper atomic_check
* callbacks from per-object state arguments to the full atomic transaction
* state. The existing conftests detect those full-state callback signatures
* when the argument type is still struct drm_atomic_state.
*
* Linux commit 5164f7e7ff8e ("drm: Rename struct drm_atomic_state to
* drm_atomic_commit"), expected in Linux v7.2, renamed that full transaction
* type. In those kernels, the callbacks still use the full atomic transaction
* state ABI, but the argument type is struct drm_atomic_commit. Either
* conftest means the helper callbacks take the full atomic transaction state.
*/
#if defined(NV_DRM_CRTC_ATOMIC_CHECK_HAS_ATOMIC_STATE_ARG) || \
defined(NV_DRM_ATOMIC_COMMIT_STRUCT_PRESENT)
#define NV_DRM_CRTC_ATOMIC_CHECK_HAS_FULL_STATE_ARG
#endif
#if defined(NV_DRM_PLANE_ATOMIC_CHECK_HAS_ATOMIC_STATE_ARG) || \
defined(NV_DRM_ATOMIC_COMMIT_STRUCT_PRESENT)
#define NV_DRM_PLANE_ATOMIC_CHECK_HAS_FULL_STATE_ARG
#endif
static inline nv_drm_atomic_state_base_t *
nv_drm_atomic_state_base_alloc(struct drm_device *dev)
{
#if defined(NV_DRM_ATOMIC_COMMIT_STRUCT_PRESENT)
return drm_atomic_commit_alloc(dev);
#else
return drm_atomic_state_alloc(dev);
#endif
}
static inline int
nv_drm_atomic_state_base_init(struct drm_device *dev,
nv_drm_atomic_state_base_t *state)
{
#if defined(NV_DRM_ATOMIC_COMMIT_STRUCT_PRESENT)
return drm_atomic_commit_init(dev, state);
#else
return drm_atomic_state_init(dev, state);
#endif
}
static inline void
nv_drm_atomic_state_base_put(nv_drm_atomic_state_base_t *state)
{
#if defined(NV_DRM_ATOMIC_COMMIT_STRUCT_PRESENT)
drm_atomic_commit_put(state);
#else
drm_atomic_state_put(state);
#endif
}
static inline void
nv_drm_atomic_state_base_default_clear(nv_drm_atomic_state_base_t *state)
{
#if defined(NV_DRM_ATOMIC_COMMIT_STRUCT_PRESENT)
drm_atomic_commit_default_clear(state);
#else
drm_atomic_state_default_clear(state);
#endif
}
static inline void
nv_drm_atomic_state_base_default_release(nv_drm_atomic_state_base_t *state)
{
#if defined(NV_DRM_ATOMIC_COMMIT_STRUCT_PRESENT)
drm_atomic_commit_default_release(state);
#else
drm_atomic_state_default_release(state);
#endif
}
int nv_drm_atomic_helper_disable_all(struct drm_device *dev,
struct drm_modeset_acquire_ctx *ctx);
+14 -12
View File
@@ -50,21 +50,23 @@
struct nv_drm_atomic_state {
struct NvKmsKapiRequestedModeSetConfig config;
struct drm_atomic_state base;
nv_drm_atomic_state_base_t base;
};
static inline struct nv_drm_atomic_state *to_nv_atomic_state(
struct drm_atomic_state *state)
nv_drm_atomic_state_base_t *state)
{
return container_of(state, struct nv_drm_atomic_state, base);
}
struct drm_atomic_state *nv_drm_atomic_state_alloc(struct drm_device *dev)
nv_drm_atomic_state_base_t *
nv_drm_atomic_state_alloc(struct drm_device *dev)
{
struct nv_drm_atomic_state *nv_state =
nv_drm_calloc(1, sizeof(*nv_state));
if (nv_state == NULL || drm_atomic_state_init(dev, &nv_state->base) < 0) {
if (nv_state == NULL ||
nv_drm_atomic_state_base_init(dev, &nv_state->base) < 0) {
nv_drm_free(nv_state);
return NULL;
}
@@ -72,16 +74,16 @@ struct drm_atomic_state *nv_drm_atomic_state_alloc(struct drm_device *dev)
return &nv_state->base;
}
void nv_drm_atomic_state_clear(struct drm_atomic_state *state)
void nv_drm_atomic_state_clear(nv_drm_atomic_state_base_t *state)
{
drm_atomic_state_default_clear(state);
nv_drm_atomic_state_base_default_clear(state);
}
void nv_drm_atomic_state_free(struct drm_atomic_state *state)
void nv_drm_atomic_state_free(nv_drm_atomic_state_base_t *state)
{
struct nv_drm_atomic_state *nv_state =
to_nv_atomic_state(state);
drm_atomic_state_default_release(state);
nv_drm_atomic_state_base_default_release(state);
nv_drm_free(nv_state);
}
@@ -178,7 +180,7 @@ __nv_drm_plane_fence_cb(
static int __nv_drm_convert_in_fences(
struct nv_drm_device *nv_dev,
struct drm_atomic_state *state,
nv_drm_atomic_state_base_t *state,
struct drm_crtc *crtc,
struct drm_crtc_state *crtc_state)
{
@@ -392,7 +394,7 @@ static int __nv_drm_get_syncpt_data(
*/
static int
nv_drm_atomic_apply_modeset_config(struct drm_device *dev,
struct drm_atomic_state *state,
nv_drm_atomic_state_base_t *state,
bool commit)
{
struct nv_drm_device *nv_dev = to_nv_device(dev);
@@ -527,7 +529,7 @@ nv_drm_atomic_apply_modeset_config(struct drm_device *dev,
}
int nv_drm_atomic_check(struct drm_device *dev,
struct drm_atomic_state *state)
nv_drm_atomic_state_base_t *state)
{
int ret = 0;
@@ -688,7 +690,7 @@ static void __nv_drm_handle_flip_event(struct nv_drm_crtc *nv_crtc)
}
int nv_drm_atomic_commit(struct drm_device *dev,
struct drm_atomic_state *state,
nv_drm_atomic_state_base_t *state,
bool nonblock)
{
int ret = -EBUSY;
+7 -6
View File
@@ -27,20 +27,21 @@
#if defined(NV_DRM_AVAILABLE)
#include "nvidia-drm-helper.h"
#include "nvkms-kapi.h"
struct drm_device;
struct drm_atomic_state;
struct drm_atomic_state *nv_drm_atomic_state_alloc(struct drm_device *dev);
void nv_drm_atomic_state_clear(struct drm_atomic_state *state);
void nv_drm_atomic_state_free(struct drm_atomic_state *state);
nv_drm_atomic_state_base_t *
nv_drm_atomic_state_alloc(struct drm_device *dev);
void nv_drm_atomic_state_clear(nv_drm_atomic_state_base_t *state);
void nv_drm_atomic_state_free(nv_drm_atomic_state_base_t *state);
int nv_drm_atomic_check(struct drm_device *dev,
struct drm_atomic_state *state);
nv_drm_atomic_state_base_t *state);
int nv_drm_atomic_commit(struct drm_device *dev,
struct drm_atomic_state *state, bool nonblock);
nv_drm_atomic_state_base_t *state, bool nonblock);
void nv_drm_handle_flip_occurred(struct nv_drm_device *nv_dev,
@@ -114,3 +114,4 @@ NV_CONFTEST_TYPE_COMPILE_TESTS += drm_fb_create_takes_format_info
NV_CONFTEST_TYPE_COMPILE_TESTS += drm_crtc_funcs_has_get_vblank_timestamp
NV_CONFTEST_TYPE_COMPILE_TESTS += drm_color_lut32_present
NV_CONFTEST_TYPE_COMPILE_TESTS += drm_colorop_has_funcs
NV_CONFTEST_TYPE_COMPILE_TESTS += drm_atomic_commit_struct_present
@@ -664,11 +664,6 @@ int nvkms_strcmp(const char *s1, const char *s2)
return strcmp(s1, s2);
}
char* nvkms_strncpy(char *dest, const char *src, size_t n)
{
return strncpy(dest, src, n);
}
void nvkms_usleep(NvU64 usec)
{
if (usec < 1000) {
@@ -149,9 +149,6 @@ int nvkms_memcmp (const void *s1,
size_t nvkms_strlen (const char *s);
int nvkms_strcmp (const char *s1,
const char *s2);
char* nvkms_strncpy (char *dest,
const char *src,
size_t n);
void nvkms_usleep (NvU64 usec);
NvU64 nvkms_get_usec (void);
int nvkms_copyin (void *kptr,
+15 -2
View File
@@ -40,6 +40,14 @@
#define CE_TEST_MEM_MIDDLE_OFFSET (CE_TEST_MEM_BEGIN_SIZE)
#define CE_TEST_MEM_END_OFFSET (CE_TEST_MEM_SIZE - CE_TEST_MEM_BEGIN_SIZE)
#define CE_TEST_MEM_COUNT 5
// Minimum payload size (bytes) for which the "ciphertext must differ from
// plaintext" sanity check is statistically meaningful. AES-CTR produces
// ciphertext = plaintext XOR keystream, so for tiny payloads (e.g. the 1-byte
// small_sizes case) the keystream byte can be 0x00, making ciphertext ==
// plaintext purely by chance (~1/256 per byte) even when encryption is
// correct. Below this size the heuristic is skipped; the authoritative
// correctness check remains the end-to-end roundtrip compare.
#define CE_TEST_MIN_CIPHERTEXT_DIFF_SIZE 16
static NV_STATUS test_non_pipelined(uvm_gpu_t *gpu)
{
@@ -1107,9 +1115,14 @@ static NV_STATUS test_cpu_to_gpu_roundtrip(uvm_gpu_t *gpu,
TEST_NV_CHECK_GOTO(uvm_push_end_and_wait(&push), out);
TEST_CHECK_GOTO(!mem_match(src_plain, src_cipher, size), out);
// Skip the "ciphertext must differ from plaintext" heuristic for tiny
// payloads; see CE_TEST_MIN_CIPHERTEXT_DIFF_SIZE above. The roundtrip
// compare below still verifies correctness for all sizes.
if (size >= CE_TEST_MIN_CIPHERTEXT_DIFF_SIZE) {
TEST_CHECK_GOTO(!mem_match(src_plain, src_cipher, size), out);
TEST_CHECK_GOTO(!mem_match(dst_cipher, src_plain, size), out);
TEST_CHECK_GOTO(!mem_match(dst_cipher, src_plain, size), out);
}
// CPU (encrypted) > CPU (decrypted), using CPU
if (decrypt_in_order) {
+15 -2
View File
@@ -2923,7 +2923,7 @@ static NV_STATUS add_gpu(const NvProcessorUuid *gpu_uuid,
goto error;
if (alloc_parent) {
if (enable_devmem && !gpu->mem_info.numa.enabled && !gpu->parent->is_integrated_gpu) {
if (enable_devmem && uvm_gpu_supports_devmem(gpu)) {
status = uvm_devmem_init(parent_gpu);
if (status != NV_OK) {
UVM_ERR_PRINT("failed to intialize device private memory: %s, GPU %s\n",
@@ -2938,7 +2938,7 @@ static NV_STATUS add_gpu(const NvProcessorUuid *gpu_uuid,
#if UVM_IS_CONFIG_HMM()
// HMM was disabled when first initialising the parent so we can't support
// it now. Tell the caller to retry with it disabled.
else if (!parent_gpu->devmem && enable_devmem && !gpu->mem_info.numa.enabled && !gpu->parent->is_integrated_gpu) {
else if (!parent_gpu->devmem && enable_devmem && uvm_gpu_supports_devmem(gpu)) {
status = NV_ERR_BUSY_RETRY;
goto error;
}
@@ -3094,6 +3094,19 @@ static NV_STATUS gpu_retain_by_uuid_locked(const NvProcessorUuid *gpu_uuid,
if (status != NV_OK)
goto error_unregister;
}
#if UVM_IS_CONFIG_HMM()
// The GPU object already exists but was first brought up by a VA space with
// HMM disabled, so it has no devmem and can't service this HMM request.
// add_gpu(), which performs the same check, is not reached on this path, so
// repeat it here. Tell the caller to retry with HMM disabled. Nothing was
// retained, so there is nothing to undo.
// NUMA and integrated GPUs don't supoport ZONE_DEVICE memory so we don't
// need devmem to be initialised on those.
else if (!parent_gpu->devmem && enable_devmem && uvm_gpu_supports_devmem(gpu)) {
status = NV_ERR_BUSY_RETRY;
goto error_unregister;
}
#endif
else {
atomic64_inc(&gpu->retained_count);
}
+14
View File
@@ -1613,6 +1613,20 @@ static bool uvm_parent_gpu_supports_full_coherence(uvm_parent_gpu_t *parent_gpu)
return parent_gpu->is_integrated_gpu;
}
// NUMA-attached and integrated GPUs don't support ZONE_DEVICE (devmem) memory,
// so pageable memory which uses ZONE_DEVICE can only be migrated to GPUs which
// have neither property.
//
// CDMM GPUs use a separate devmem mechanism that does not rely on
// DEVICE_PRIVATE pages, so UVM_CAN_USE_DEVICE_PRIVATE_MEMREMAP_PAGES() does
// not apply to them — uvm_devmem_init() handles this distinction internally.
static bool uvm_gpu_supports_devmem(uvm_gpu_t *gpu)
{
if (gpu->mem_info.numa.enabled || gpu->parent->is_integrated_gpu)
return false;
return gpu->parent->cdmm_enabled || UVM_CAN_USE_DEVICE_PRIVATE_MEMREMAP_PAGES();
}
// Returns a GPU peer pair index in the range [0 .. UVM_MAX_UNIQUE_GPU_PAIRS).
NvU32 uvm_gpu_pair_index(const uvm_gpu_id_t id0, const uvm_gpu_id_t id1);
+3 -1
View File
@@ -2804,7 +2804,9 @@ static NV_STATUS init_chunk_split_cache_level(uvm_pmm_gpu_t *pmm, size_t level)
size_t size;
size_t align;
if (level == 0) {
strncpy(chunk_split_cache[level].name, "uvm_gpu_chunk_t", sizeof(chunk_split_cache[level].name) - 1);
snprintf(chunk_split_cache[level].name,
sizeof(chunk_split_cache[level].name),
"uvm_gpu_chunk_t");
size = sizeof(uvm_gpu_chunk_t);
align = __alignof__(uvm_gpu_chunk_t);
} else {
+10 -1
View File
@@ -304,8 +304,10 @@ static NV_STATUS map_user_pages(NvU64 user_va, NvU64 size, void **addr, struct p
}
*addr = vmap(*pages, num_pages, VM_MAP, PAGE_KERNEL);
if (*addr == NULL)
if (*addr == NULL) {
status = NV_ERR_NO_MEMORY;
goto fail;
}
return NV_OK;
@@ -2497,6 +2499,13 @@ static NV_STATUS tools_access_process_memory(uvm_va_space_t *va_space,
// Make sure a CPU resident page has an up to date struct page pointer.
if (uvm_va_block_is_hmm(block)) {
// Verify the target address is writable. This isn't needed for
// managed ranges since those are always RW. If the target is a
// CoW mapping that will be broken below in the residency update.
if (is_write && !(block_context->hmm.vma->vm_flags & VM_WRITE)) {
status = NV_ERR_INSUFFICIENT_PERMISSIONS;
goto unlock_and_exit;
}
status = uvm_hmm_va_block_update_residency_info_unlocked(block, mm, UVM_PAGE_ALIGN_DOWN(target_va_start), true);
if (status != NV_OK)
goto unlock_and_exit;
-8
View File
@@ -807,14 +807,6 @@ nvswitch_os_strlen
const char *str
);
char*
nvswitch_os_strncpy
(
char *pDest,
const char *pSrc,
NvLength length
);
int
nvswitch_os_strncmp
(
+3 -1
View File
@@ -335,7 +335,8 @@ static bool lkca_ecdsa_verify_akcipher(void *ec_context, size_t hash_nid,
}
req = akcipher_request_alloc(tfm, GFP_KERNEL);
if (IS_ERR(req)) {
if (IS_ERR_OR_NULL(req)) {
err = IS_ERR(req) ? PTR_ERR(req) : -ENOMEM;
pr_info("akcipher_request_alloc failed in lkca_ecdsa_verify\n");
goto failTfm;
}
@@ -343,6 +344,7 @@ static bool lkca_ecdsa_verify_akcipher(void *ec_context, size_t hash_nid,
// We concatenate signature and hash and ship it to kernel
ber = kmalloc(ber_max_len + hash_size, GFP_KERNEL);
if (ber == NULL) {
err = -ENOMEM;
goto failReq;
}
+1 -12
View File
@@ -2059,7 +2059,7 @@ nvswitch_os_read_registry_dword
return -NVL_ERR_GENERIC;
}
strncpy(regkey_val, regkey_val_start, regkey_val_len);
memcpy(regkey_val, regkey_val_start, regkey_val_len);
regkey_val[regkey_val_len] = '\0';
if (nvswitch_os_strtouint(regkey_val, data) != 0)
@@ -2406,17 +2406,6 @@ nvswitch_os_strlen
return strlen(str);
}
char*
nvswitch_os_strncpy
(
char *dest,
const char *src,
NvLength length
)
{
return strncpy(dest, src, length);
}
int
nvswitch_os_strncmp
(
+25 -6
View File
@@ -53,6 +53,14 @@ void nv_unmap_dma_map_scatterlist (nv_dma_map_t *dma_map);
static void nv_dma_unmap_contig (nv_dma_map_t *dma_map);
static void nv_dma_unmap_scatterlist (nv_dma_map_t *dma_map);
static enum dma_data_direction nv_dma_get_direction
(
nv_dma_map_t *dma_map
)
{
return dma_map->bReadOnlyDeviceMap ? DMA_TO_DEVICE : DMA_BIDIRECTIONAL;
}
static inline NvBool nv_dma_is_addressable(
nv_dma_device_t *dma_dev,
NvU64 start,
@@ -72,9 +80,11 @@ static NV_STATUS nv_dma_map_contig(
NvU64 *va
)
{
enum dma_data_direction direction = nv_dma_get_direction(dma_map);
*va = dma_map_page_attrs(dma_map->dev, dma_map->pages[0], 0,
dma_map->page_count * PAGE_SIZE,
DMA_BIDIRECTIONAL,
direction,
(dma_map->cache_type == NV_MEMORY_UNCACHED) ?
DMA_ATTR_SKIP_CPU_SYNC : 0);
if (dma_mapping_error(dma_map->dev, *va))
@@ -101,9 +111,11 @@ static NV_STATUS nv_dma_map_contig(
static void nv_dma_unmap_contig(nv_dma_map_t *dma_map)
{
enum dma_data_direction direction = nv_dma_get_direction(dma_map);
dma_unmap_page_attrs(dma_map->dev, dma_map->mapping.contig.dma_addr,
dma_map->page_count * PAGE_SIZE,
DMA_BIDIRECTIONAL,
direction,
(dma_map->cache_type == NV_MEMORY_UNCACHED) ?
DMA_ATTR_SKIP_CPU_SYNC : 0);
}
@@ -224,6 +236,7 @@ NV_STATUS nv_map_dma_map_scatterlist(nv_dma_map_t *dma_map)
NV_STATUS status = NV_OK;
nv_dma_submap_t *submap;
NvU64 i;
enum dma_data_direction direction = nv_dma_get_direction(dma_map);
NV_FOR_EACH_DMA_SUBMAP(dma_map, submap, i)
{
@@ -233,7 +246,7 @@ NV_STATUS nv_map_dma_map_scatterlist(nv_dma_map_t *dma_map)
dma_map_sg(dma_map->dev,
submap->sgt.sgl,
submap->sgt.orig_nents,
DMA_BIDIRECTIONAL);
direction);
if (submap->sg_map_count == 0)
{
status = NV_ERR_OPERATING_SYSTEM;
@@ -253,6 +266,7 @@ void nv_unmap_dma_map_scatterlist(nv_dma_map_t *dma_map)
{
nv_dma_submap_t *submap;
NvU64 i;
enum dma_data_direction direction = nv_dma_get_direction(dma_map);
NV_FOR_EACH_DMA_SUBMAP(dma_map, submap, i)
{
@@ -269,7 +283,7 @@ void nv_unmap_dma_map_scatterlist(nv_dma_map_t *dma_map)
dma_unmap_sg(dma_map->dev, submap->sgt.sgl,
submap->sgt.orig_nents,
DMA_BIDIRECTIONAL);
direction);
}
}
@@ -376,6 +390,7 @@ NV_STATUS NV_API_CALL nv_dma_map_sgt(
NvU64 page_count,
NvU64 *va_array,
NvU32 cache_type,
NvBool bReadOnlyDeviceMap,
void **priv
)
{
@@ -408,6 +423,7 @@ NV_STATUS NV_API_CALL nv_dma_map_sgt(
dma_map->page_count = page_count;
dma_map->contiguous = NV_FALSE;
dma_map->cache_type = cache_type;
dma_map->bReadOnlyDeviceMap = bReadOnlyDeviceMap;
dma_map->mapping.discontig.submap_count = 0;
status = nv_dma_map_scatterlist(dma_dev, dma_map, va_array);
@@ -453,6 +469,7 @@ static NV_STATUS NV_API_CALL nv_dma_map_pages(
NvU64 *va_array,
NvBool contig,
NvU32 cache_type,
NvBool bReadOnlyDeviceMap,
void **priv
)
{
@@ -489,6 +506,7 @@ static NV_STATUS NV_API_CALL nv_dma_map_pages(
dma_map->page_count = page_count;
dma_map->contiguous = contig;
dma_map->cache_type = cache_type;
dma_map->bReadOnlyDeviceMap = bReadOnlyDeviceMap;
if (dma_map->page_count > 1 && !dma_map->contiguous)
{
@@ -579,6 +597,7 @@ NV_STATUS NV_API_CALL nv_dma_map_alloc
NvU64 page_count,
NvU64 *va_array,
NvBool contig,
NvBool bReadOnlyDeviceMap,
void **priv
)
{
@@ -594,7 +613,7 @@ NV_STATUS NV_API_CALL nv_dma_map_alloc
{
*priv = at->import_sgt;
status = nv_dma_map_sgt(dma_dev, page_count, va_array, at->cache_type,
priv);
bReadOnlyDeviceMap, priv);
if (status != NV_OK)
{
*priv = at;
@@ -653,7 +672,7 @@ NV_STATUS NV_API_CALL nv_dma_map_alloc
*priv = pages;
status = nv_dma_map_pages(dma_dev, page_count, va_array, contig, cache_type,
priv);
bReadOnlyDeviceMap, priv);
if (status != NV_OK)
{
*priv = at;
+8 -2
View File
@@ -617,7 +617,7 @@ nv_dma_buf_get_phys_addresses (
nvidia_stack_t *sp = NULL;
NvBool api_lock_taken = NV_FALSE;
NvBool gpu_lock_taken = NV_FALSE;
NvU32 i;
NvU32 i = 0;
int rc = 0;
if (!nv_inc_and_check_one_phys_refcount(priv, start_index, handle_count))
@@ -693,6 +693,11 @@ nv_dma_buf_get_phys_addresses (
return NV_OK;
unmap_handles:
//
// Restore pre-call refcounts so nv_put_phys_addresses() can unmap handles
// that were first mapped by this call.
//
(void) nv_dec_and_check_zero_phys_refcount(priv, start_index, i);
nv_put_phys_addresses(sp, priv, start_index, i);
if (gpu_lock_taken)
@@ -710,7 +715,8 @@ free_sp:
nv_kmem_cache_free_stack(sp);
failed:
nv_reset_phys_refcount(priv, start_index, handle_count);
(void) nv_dec_and_check_zero_phys_refcount(priv, start_index + i,
handle_count - i);
return status;
}
+2 -2
View File
@@ -218,9 +218,9 @@ found:
ret = length;
if (write)
memcpy(kernel_mapping, buffer, length);
os_mem_copy(kernel_mapping, buffer, length);
else
memcpy(buffer, kernel_mapping, length);
os_mem_copy(buffer, kernel_mapping, length);
if (at == NULL && !has_pages)
{
+33 -7
View File
@@ -63,6 +63,7 @@ extern char *NVreg_TemporaryFilePath;
extern char *NVreg_ExcludedGpus;
static char nv_registry_keys[NV_MAX_REGISTRY_KEYS_LENGTH];
static struct semaphore nv_registry_keys_lock;
#if defined(CONFIG_PM)
nv_pm_action_depth_t nv_procfs_pm_action_depth = NV_PM_ACTION_DEPTH_DEFAULT;
@@ -397,16 +398,28 @@ nv_procfs_close_registry(
registry_keys = ((nvl != NULL) ?
nvl->registry_keys : nv_registry_keys);
if (strstr(registry_keys, key_name) != NULL)
goto done;
len = strlen(registry_keys);
if (nvl != NULL)
down(&nvl->ldata_lock);
else
down(&nv_registry_keys_lock);
if ((len + key_len + 2) <= NV_MAX_REGISTRY_KEYS_LENGTH)
// Keep the duplicate check, length check, and append atomic.
if (strstr(registry_keys, key_name) == NULL)
{
if (len != 0)
strcat(registry_keys, ", ");
strcat(registry_keys, key_name);
len = strlen(registry_keys);
if ((len + key_len + 2) <= NV_MAX_REGISTRY_KEYS_LENGTH)
{
if (len != 0)
strcat(registry_keys, ", ");
strcat(registry_keys, key_name);
}
}
if (nvl != NULL)
up(&nvl->ldata_lock);
else
up(&nv_registry_keys_lock);
}
done:
@@ -467,7 +480,18 @@ nv_procfs_read_registry(
registry_keys = ((nvl != NULL) ?
nvl->registry_keys : nv_registry_keys);
if (nvl != NULL)
down(&nvl->ldata_lock);
else
down(&nv_registry_keys_lock);
seq_printf(s, "Binary: \"%s\"\n", registry_keys);
if (nvl != NULL)
up(&nvl->ldata_lock);
else
up(&nv_registry_keys_lock);
return 0;
}
@@ -1329,6 +1353,8 @@ int nv_procfs_init(void)
nv_dir_name[sizeof(nv_dir_name) - 1] = '\0';
NV_INIT_MUTEX(&nv_registry_keys_lock);
proc_nvidia = NV_CREATE_PROC_DIR(nv_dir_name, NULL);
if (!proc_nvidia)
+38 -13
View File
@@ -1088,6 +1088,10 @@ static void nv_free_file_private(nv_linux_file_private_t *nvlfp)
if (nvlfp == NULL)
return;
// Event teardown can race in-flight posts that still use nvfp.
while (READ_ONCE(nvlfp->nvfp.event_posting_refcount) != 0)
cond_resched();
for (nvet = nvlfp->event_data_head; nvet != NULL; nvet = nvlfp->event_data_head)
{
nvlfp->event_data_head = nvlfp->event_data_head->next;
@@ -2396,10 +2400,8 @@ out:
return rc;
}
static NV_STATUS nv_validate_ioctls(unsigned int cmd)
static NV_STATUS nv_validate_ioctl_data(unsigned int arg_cmd, size_t arg_size)
{
size_t arg_size = _IOC_SIZE(cmd);
int arg_cmd = _IOC_NR(cmd);
int i;
NV_STATUS status;
static const struct {
@@ -2423,7 +2425,7 @@ static NV_STATUS nv_validate_ioctls(unsigned int cmd)
_NV_IOCTL_ENTRY(NV_ESC_SET_NUMA_STATUS, nv_ioctl_set_numa_status_t, NV_FALSE),
};
status = rm_validate_ioctls(cmd, arg_size);
status = rm_validate_ioctls(arg_cmd, arg_size);
if (status != NV_ERR_INVALID_COMMAND)
{
return status;
@@ -2452,6 +2454,11 @@ static NV_STATUS nv_validate_ioctls(unsigned int cmd)
return NV_ERR_INVALID_ARGUMENT;
}
static NV_STATUS nv_validate_ioctls(unsigned int cmd)
{
return nv_validate_ioctl_data(_IOC_NR(cmd), _IOC_SIZE(cmd));
}
int
nvidia_ioctl(
struct inode *inode,
@@ -2509,6 +2516,12 @@ nvidia_ioctl(
status = -EINVAL;
goto done_early;
}
if (nv_validate_ioctl_data(arg_cmd, arg_size) != NV_OK)
{
status = -EINVAL;
goto done_early;
}
}
NV_KMALLOC(arg_copy, arg_size);
@@ -6309,6 +6322,9 @@ void NV_API_CALL nv_get_screen_info(
NvU64 *pFbSize
)
{
#if NV_CHECK_EXPORT_SYMBOL(screen_info) || NV_CHECK_EXPORT_SYMBOL(sysfb_primary_display)
struct screen_info *sysfb_info;
#endif
nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv);
struct pci_dev *pci_dev = nvl->pci_dev;
int i;
@@ -6374,9 +6390,18 @@ void NV_API_CALL nv_get_screen_info(
*
* After commit b8466fe82b79 ("efi: move screen_info into efi init code")
* in v6.7, 'screen_info' is exported as GPL licensed symbol for ARM64.
*
* After commit a41e0ab394e4 ("sysfb: Replace screen_info with sysfb_primary_display")
* in v7.0, 'screen_info' is refactored as 'sysfb_primary_display.screen'.
*/
#if NV_CHECK_EXPORT_SYMBOL(screen_info)
#if NV_CHECK_EXPORT_SYMBOL(screen_info) || NV_CHECK_EXPORT_SYMBOL(sysfb_primary_display)
#if NV_CHECK_EXPORT_SYMBOL(sysfb_primary_display)
sysfb_info = &sysfb_primary_display.screen;
#else
sysfb_info = &screen_info;
#endif
/*
* If there is not a framebuffer console, return 0 size.
*
@@ -6384,13 +6409,13 @@ void NV_API_CALL nv_get_screen_info(
* initialization, and then will be set to a value, such as
* VIDEO_TYPE_VLFB or VIDEO_TYPE_EFI if an fbdev console is used.
*/
if (screen_info.orig_video_isVGA > 1)
if (sysfb_info->orig_video_isVGA > 1)
{
NvU64 physAddr = screen_info.lfb_base;
NvU64 physAddr = sysfb_info->lfb_base;
#if defined(VIDEO_CAPABILITY_64BIT_BASE)
if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE)
if (sysfb_info->capabilities & VIDEO_CAPABILITY_64BIT_BASE)
{
physAddr |= (NvU64)screen_info.ext_lfb_base << 32;
physAddr |= (NvU64)sysfb_info->ext_lfb_base << 32;
}
#endif
/*
@@ -6402,10 +6427,10 @@ void NV_API_CALL nv_get_screen_info(
NV_IS_CONSOLE_MAPPED(nv, physAddr))
{
*pPhysicalAddress = physAddr;
*pFbWidth = screen_info.lfb_width;
*pFbHeight = screen_info.lfb_height;
*pFbDepth = screen_info.lfb_depth;
*pFbPitch = screen_info.lfb_linelength;
*pFbWidth = sysfb_info->lfb_width;
*pFbHeight = sysfb_info->lfb_height;
*pFbDepth = sysfb_info->lfb_depth;
*pFbPitch = sysfb_info->lfb_linelength;
*pFbSize = (NvU64)(*pFbHeight) * (NvU64)(*pFbPitch);
return;
}
+3
View File
@@ -164,6 +164,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += shrinker_alloc
NV_CONFTEST_FUNCTION_COMPILE_TESTS += vma_flags_set_word
NV_CONFTEST_FUNCTION_COMPILE_TESTS += vm_flags_set
NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_dev_pagemap_has_pgmap_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += use_dma_iommu
NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_gpl_sme_active
NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_present_swiotlb_map_sg_attrs
@@ -173,6 +174,8 @@ NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_present_close_fd
NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_present_pxm_to_node
NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_present_screen_info
NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_gpl_screen_info
NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_present_sysfb_primary_display
NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_gpl_sysfb_primary_display
NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_present_i2c_bus_status
NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_present_tegra_fuse_control_read
NV_CONFTEST_SYMBOL_COMPILE_TESTS += is_export_symbol_present_pci_find_host_bridge
+4 -2
View File
@@ -770,8 +770,10 @@ NvU32 NV_API_CALL os_get_current_process(void)
void NV_API_CALL os_get_current_process_name(char *buf, NvU32 len)
{
task_lock(current);
strncpy(buf, current->comm, len - 1);
buf[len - 1] = '\0';
if (strscpy(buf, current->comm, len) < 0) {
// strscpy() returns -E2BIG on truncation, which is acceptable here.
}
task_unlock(current);
}