Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions kernel-open/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ else
endif
endif

# RANDSTRUCT is incompatible with how we build the OS-agnostic part, leading
# to calling the wrong callback functions from pure *ops structures at
# runtime.
ranstruct_enabled=$(firstword $(shell . $(KERNEL_OUTPUT)/.config; \
echo "$$CONFIG_RANDSTRUCT$$CONFIG_GCC_PLUGIN_RANDSTRUCT"))
ifneq ($(ranstruct_enabled),)
$(error RANDSTRUCT enabled kernel is incompatible with binary objects!))
endif

CC ?= cc
LD ?= ld
OBJDUMP ?= objdump
Expand Down
37 changes: 35 additions & 2 deletions kernel-open/conftest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4919,6 +4919,38 @@ compile_test() {
compile_check_conftest "$CODE" "NV_DRM_DRIVER_HAS_DATE" "" "types"
;;

drm_connector_helper_funcs_mode_valid_has_int_ret_type)
#
# Determine if the return type is 'int' for
# drm_connector_helper_funcs::mode_valid.
#
# It was changed to 'enum drm_mode_status' by commit 0993f1d0d8a1
# ("drm: Make the connector mode_valid() vfunc return a
# drm_mode_status enum") in v3.14.
#
CODE="
#include <drm/drm_atomic_helper.h>

#ifndef __same_type
#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
#endif

/* BUILD_BUG_ON() from <linux/kernel.h> isn't working */
#define CONF_BUILD_BUG_ON(cond) \
char conf_bug_on_trigger[0 - !!(cond)]

/* We exploit the fact, that 'int' and 'enum' are compatible but
* 'enum e1' and 'enum e2' are not to cause a build error if the
* return type of drm_connector_helper_funcs::mode_valid is an enum.
*/
enum conftest_enum { CONFTEST = -1 } conftest_enum;
const struct drm_connector_helper_funcs conftest_func;
CONF_BUILD_BUG_ON(!__same_type(conftest_func.mode_valid(NULL, NULL), conftest_enum));
"

compile_check_conftest "$CODE" "NV_DRM_CONNECTOR_HELPER_FUNCS_MODE_VALID_HAS_INT_RET_TYPE" "" "types"
;;

drm_connector_helper_funcs_mode_valid_has_const_mode_arg)
#
# Determine if the 'mode' pointer argument is const in
Expand All @@ -4932,8 +4964,9 @@ compile_test() {
CODE="
#include <drm/drm_atomic_helper.h>

static int conftest_drm_connector_mode_valid(struct drm_connector *connector,
const struct drm_display_mode *mode) {
static enum drm_mode_status
conftest_drm_connector_mode_valid(struct drm_connector *connector,
const struct drm_display_mode *mode) {
return 0;
}

Expand Down
11 changes: 8 additions & 3 deletions kernel-open/nvidia-drm/nvidia-drm-connector.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,16 @@ static int nv_drm_connector_get_modes(struct drm_connector *connector)
return count;
}

static int nv_drm_connector_mode_valid(struct drm_connector *connector,
#ifdef NV_DRM_CONNECTOR_HELPER_FUNCS_MODE_VALID_HAS_INT_RET_TYPE
static int
#else
static enum drm_mode_status
#endif
nv_drm_connector_mode_valid(struct drm_connector *connector,
#if defined(NV_DRM_CONNECTOR_HELPER_FUNCS_MODE_VALID_HAS_CONST_MODE_ARG)
const struct drm_display_mode *mode)
const struct drm_display_mode *mode)
#else
struct drm_display_mode *mode)
struct drm_display_mode *mode)
#endif
{
struct drm_device *dev = connector->dev;
Expand Down
1 change: 1 addition & 0 deletions kernel-open/nvidia-drm/nvidia-drm-sources.mk
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,6 @@ NV_CONFTEST_TYPE_COMPILE_TESTS += drm_format_info_has_is_yuv
NV_CONFTEST_TYPE_COMPILE_TESTS += drm_driver_has_gem_prime_mmap
NV_CONFTEST_TYPE_COMPILE_TESTS += drm_output_poll_changed
NV_CONFTEST_TYPE_COMPILE_TESTS += drm_driver_has_date
NV_CONFTEST_TYPE_COMPILE_TESTS += drm_connector_helper_funcs_mode_valid_has_int_ret_type
NV_CONFTEST_TYPE_COMPILE_TESTS += drm_connector_helper_funcs_mode_valid_has_const_mode_arg
NV_CONFTEST_TYPE_COMPILE_TESTS += drm_fb_create_takes_format_info
14 changes: 7 additions & 7 deletions kernel-open/nvidia-uvm/uvm_global.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@
#include "nv_uvm_interface.h"

uvm_global_t g_uvm_global;
static struct UvmEventsLinux g_exported_uvm_events;
static struct UvmEventsLinux g_exported_uvm_events = {
.isrTopHalf = uvm_isr_top_half_entry,
.suspend = uvm_suspend_entry,
.resume = uvm_resume_entry,
.drainP2P = uvm_suspend_and_drainP2P_entry,
.resumeP2P = uvm_resumeP2P_entry,
};
static bool g_ops_registered = false;

static NV_STATUS uvm_register_callbacks(void)
{
NV_STATUS status = NV_OK;

g_exported_uvm_events.isrTopHalf = uvm_isr_top_half_entry;
g_exported_uvm_events.suspend = uvm_suspend_entry;
g_exported_uvm_events.resume = uvm_resume_entry;
g_exported_uvm_events.drainP2P = uvm_suspend_and_drainP2P_entry;
g_exported_uvm_events.resumeP2P = uvm_resumeP2P_entry;

// Register the UVM callbacks with the main GPU driver:
status = uvm_rm_locked_call(nvUvmInterfaceRegisterUvmEvents(&g_exported_uvm_events));
if (status != NV_OK)
Expand Down
7 changes: 4 additions & 3 deletions kernel-open/nvidia/linux_nvswitch.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ struct file_operations ctl_fops =
static int nvswitch_initialize_device_interrupt(NVSWITCH_DEV *nvswitch_dev);
static void nvswitch_shutdown_device_interrupt(NVSWITCH_DEV *nvswitch_dev);
static void nvswitch_load_bar_info(NVSWITCH_DEV *nvswitch_dev);
static void nvswitch_task_dispatch(NVSWITCH_DEV *nvswitch_dev);
static void nvswitch_task_dispatch(void *nvswitch_dev);

static NvBool
nvswitch_is_device_blacklisted
Expand Down Expand Up @@ -313,7 +313,7 @@ nvswitch_init_background_tasks
NV_ATOMIC_SET(nvswitch_dev->task_q_ready, 1);

nv_kthread_q_item_init(&nvswitch_dev->task_item,
(nv_q_func_t) &nvswitch_task_dispatch,
&nvswitch_task_dispatch,
nvswitch_dev);

if (!nv_kthread_q_schedule_q_item(&nvswitch_dev->task_q,
Expand Down Expand Up @@ -1208,9 +1208,10 @@ nvswitch_isr_thread
static void
nvswitch_task_dispatch
(
NVSWITCH_DEV *nvswitch_dev
void *_nvswitch_dev
)
{
NVSWITCH_DEV *nvswitch_dev = _nvswitch_dev;
NvU64 nsec;
NvU64 timeout;
NvS64 rc;
Expand Down
6 changes: 3 additions & 3 deletions kernel-open/nvidia/nvidia.Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ $(call ASSIGN_PER_OBJ_CFLAGS, $(NVIDIA_OBJECTS), $(NVIDIA_CFLAGS))
# nv-procfs.c requires nv-compiler.h
#

NV_COMPILER_VERSION_HEADER = $(obj)/nv_compiler.h
NV_COMPILER_VERSION_HEADER = nv_compiler.h

$(NV_COMPILER_VERSION_HEADER):
$(obj)/$(NV_COMPILER_VERSION_HEADER):
@echo \#define NV_COMPILER \"`$(CC) -v 2>&1 | tail -n 1`\" > $@

$(obj)/nvidia/nv-procfs.o: $(NV_COMPILER_VERSION_HEADER)
$(obj)/nvidia/nv-procfs.o: $(obj)/$(NV_COMPILER_VERSION_HEADER)

clean-files += $(NV_COMPILER_VERSION_HEADER)

Expand Down
19 changes: 0 additions & 19 deletions src/nvidia-modeset/include/nvkms-evo-states.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,6 @@ typedef enum NVEvoLockSignal {
NV_EVO_LOCK_SIGNAL_STEREO,
} NVEvoLockSignal;

typedef enum NVEvoLockAction {
NV_EVO_PROHIBIT_LOCK,
NV_EVO_PROHIBIT_LOCK_DISABLE,
NV_EVO_LOCK_HEADS,
NV_EVO_UNLOCK_HEADS,
NV_EVO_ADD_FRAME_LOCK_SERVER,
NV_EVO_REM_FRAME_LOCK_SERVER,
NV_EVO_ADD_FRAME_LOCK_HOUSE_SYNC,
NV_EVO_REM_FRAME_LOCK_HOUSE_SYNC,
NV_EVO_ADD_FRAME_LOCK_CLIENT,
NV_EVO_REM_FRAME_LOCK_CLIENT,
NV_EVO_ADD_FRAME_LOCK_REF,
NV_EVO_REM_FRAME_LOCK_REF,
NV_EVO_ADD_SLI_SECONDARY,
NV_EVO_ADD_SLI_LAST_SECONDARY,
NV_EVO_ADD_SLI_PRIMARY,
NV_EVO_REM_SLI,
} NVEvoLockAction;

/* nv_evo.c */

NVEvoLockPin nvEvoGetPinForSignal(const NVDispEvoRec *,
Expand Down
21 changes: 20 additions & 1 deletion src/nvidia-modeset/include/nvkms-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,25 @@ typedef struct {
NvU32 surfaceCount;
} NVHsStateOneHeadAllDisps;

typedef enum NVEvoLockAction {
NV_EVO_PROHIBIT_LOCK,
NV_EVO_PROHIBIT_LOCK_DISABLE,
NV_EVO_LOCK_HEADS,
NV_EVO_UNLOCK_HEADS,
NV_EVO_ADD_FRAME_LOCK_SERVER,
NV_EVO_REM_FRAME_LOCK_SERVER,
NV_EVO_ADD_FRAME_LOCK_HOUSE_SYNC,
NV_EVO_REM_FRAME_LOCK_HOUSE_SYNC,
NV_EVO_ADD_FRAME_LOCK_CLIENT,
NV_EVO_REM_FRAME_LOCK_CLIENT,
NV_EVO_ADD_FRAME_LOCK_REF,
NV_EVO_REM_FRAME_LOCK_REF,
NV_EVO_ADD_SLI_SECONDARY,
NV_EVO_ADD_SLI_LAST_SECONDARY,
NV_EVO_ADD_SLI_PRIMARY,
NV_EVO_REM_SLI,
} NVEvoLockAction;

/* Subdevice-specific, channel-independent state */
typedef struct _NVEvoSubDevRec {
NvU32 subDeviceInstance;
Expand All @@ -812,7 +831,7 @@ typedef struct _NVEvoSubDevRec {
void *cursorPio[NVKMS_MAX_HEADS_PER_DISP];
NvBool (*scanLockState)(NVDispEvoPtr pDispEvo,
NVEvoSubDevPtr pEvoSubDev,
NvU32 action,
NVEvoLockAction action,
/* NV_INVALID_HEAD-terminated
* array of head indices */
const NvU32 *pHeads);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1692,7 +1692,7 @@ dmaFreeMapping_GM107

if (pCliMapInfo != NULL && pCliMapInfo->pDmaMappingInfo->bNeedL2InvalidateAtUnmap)
{
GMMU_APERTURE aperture = (pCliMapInfo->pDmaMappingInfo->aperture == GMMU_APERTURE_PEER) ?
FB_CACHE_MEMTYPE aperture = (pCliMapInfo->pDmaMappingInfo->aperture == GMMU_APERTURE_PEER) ?
FB_CACHE_PEER_MEMORY : FB_CACHE_SYSTEM_MEMORY;

kmemsysCacheOp_HAL(pGpu, GPU_GET_KERNEL_MEMORY_SYSTEM(pGpu), NULL, aperture, FB_CACHE_INVALIDATE);
Expand Down
4 changes: 2 additions & 2 deletions src/nvidia/src/kernel/gpu/timer/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1769,7 +1769,7 @@ tmrapiDeregisterEvents_IMPL(TimerApi *pTimerApi)
// inner callback and calls it correctly from itself. Hacky but it should work around the
// limitations in the SDK (all RM derived types undefined, so TIMEPROC type is impossible).
//
typedef NvU32 (*TMR_CALLBACK_FUNCTION)(void *pCallbackData);
typedef void (*TMR_CALLBACK_FUNCTION)(void *pCallbackData);

typedef struct
{
Expand Down Expand Up @@ -1822,7 +1822,7 @@ tmrCtrlCmdEventCreate
)
{
NV_STATUS rc;
TMR_EVENT *pEvent;
TMR_EVENT *pEvent = NULL;
wrapperStorage_t *pWrapper;
OBJTMR *pTmr = GPU_GET_TIMER(pGpu);

Expand Down