mirror of
git://nv-tegra.nvidia.com/tegra/kernel-src/nv-kernel-display-driver.git
synced 2025-12-22 17:27:52 +03:00
Compare commits
16 Commits
jetson_36.
...
l4t/l4t-r3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b2fb5ad0da | ||
|
|
95cde7ef1c | ||
|
|
d1aa84175b | ||
|
|
d137833257 | ||
|
|
7296f7cc89 | ||
|
|
6475e2b9c3 | ||
|
|
21c5f3cb07 | ||
|
|
609c9d9754 | ||
|
|
8e45112c82 | ||
|
|
844fb89169 | ||
|
|
438e29f299 | ||
|
|
dc2bae074b | ||
|
|
fae7a52fa6 | ||
|
|
66e81e1855 | ||
|
|
768ff65652 | ||
|
|
e310fe9ca1 |
@@ -1,7 +1,7 @@
|
|||||||
# NVIDIA Linux Open GPU Kernel Module Source
|
# NVIDIA Linux Open GPU Kernel Module Source
|
||||||
|
|
||||||
This is the source release of the NVIDIA Linux open GPU kernel modules,
|
This is the source release of the NVIDIA Linux open GPU kernel modules,
|
||||||
version 540.1.0.
|
version 540.4.0.
|
||||||
|
|
||||||
|
|
||||||
## How to Build
|
## How to Build
|
||||||
@@ -17,7 +17,7 @@ as root:
|
|||||||
|
|
||||||
Note that the kernel modules built here must be used with GSP
|
Note that the kernel modules built here must be used with GSP
|
||||||
firmware and user-space NVIDIA GPU driver components from a corresponding
|
firmware and user-space NVIDIA GPU driver components from a corresponding
|
||||||
540.1.0 driver release. This can be achieved by installing
|
540.4.0 driver release. This can be achieved by installing
|
||||||
the NVIDIA GPU driver from the .run file using the `--no-kernel-modules`
|
the NVIDIA GPU driver from the .run file using the `--no-kernel-modules`
|
||||||
option. E.g.,
|
option. E.g.,
|
||||||
|
|
||||||
@@ -180,7 +180,7 @@ software applications.
|
|||||||
## Compatible GPUs
|
## Compatible GPUs
|
||||||
|
|
||||||
The open-gpu-kernel-modules can be used on any Turing or later GPU
|
The open-gpu-kernel-modules can be used on any Turing or later GPU
|
||||||
(see the table below). However, in the 540.1.0 release,
|
(see the table below). However, in the 540.4.0 release,
|
||||||
GeForce and Workstation support is still considered alpha-quality.
|
GeForce and Workstation support is still considered alpha-quality.
|
||||||
|
|
||||||
To enable use of the open kernel modules on GeForce and Workstation GPUs,
|
To enable use of the open kernel modules on GeForce and Workstation GPUs,
|
||||||
@@ -188,7 +188,7 @@ set the "NVreg_OpenRmEnableUnsupportedGpus" nvidia.ko kernel module
|
|||||||
parameter to 1. For more details, see the NVIDIA GPU driver end user
|
parameter to 1. For more details, see the NVIDIA GPU driver end user
|
||||||
README here:
|
README here:
|
||||||
|
|
||||||
https://us.download.nvidia.com/XFree86/Linux-x86_64/540.1.0/README/kernel_open.html
|
https://us.download.nvidia.com/XFree86/Linux-x86_64/540.4.0/README/kernel_open.html
|
||||||
|
|
||||||
In the below table, if three IDs are listed, the first is the PCI Device
|
In the below table, if three IDs are listed, the first is the PCI Device
|
||||||
ID, the second is the PCI Subsystem Vendor ID, and the third is the PCI
|
ID, the second is the PCI Subsystem Vendor ID, and the third is the PCI
|
||||||
2543
commitFile.txt
2543
commitFile.txt
File diff suppressed because it is too large
Load Diff
@@ -72,7 +72,7 @@ EXTRA_CFLAGS += -I$(src)/common/inc
|
|||||||
EXTRA_CFLAGS += -I$(src)
|
EXTRA_CFLAGS += -I$(src)
|
||||||
EXTRA_CFLAGS += -Wall $(DEFINES) $(INCLUDES) -Wno-cast-qual -Wno-error -Wno-format-extra-args
|
EXTRA_CFLAGS += -Wall $(DEFINES) $(INCLUDES) -Wno-cast-qual -Wno-error -Wno-format-extra-args
|
||||||
EXTRA_CFLAGS += -D__KERNEL__ -DMODULE -DNVRM
|
EXTRA_CFLAGS += -D__KERNEL__ -DMODULE -DNVRM
|
||||||
EXTRA_CFLAGS += -DNV_VERSION_STRING=\"540.1.0\"
|
EXTRA_CFLAGS += -DNV_VERSION_STRING=\"540.4.0\"
|
||||||
|
|
||||||
ifneq ($(SYSSRCHOST1X),)
|
ifneq ($(SYSSRCHOST1X),)
|
||||||
EXTRA_CFLAGS += -I$(SYSSRCHOST1X)
|
EXTRA_CFLAGS += -I$(SYSSRCHOST1X)
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: Copyright (c) 2016-2017 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
* SPDX-FileCopyrightText: Copyright (c) 2016-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
@@ -36,12 +36,21 @@ typedef int vm_fault_t;
|
|||||||
* pin_user_pages() was added by commit eddb1c228f7951d399240
|
* pin_user_pages() was added by commit eddb1c228f7951d399240
|
||||||
* ("mm/gup: introduce pin_user_pages*() and FOLL_PIN") in v5.6-rc1 (2020-01-30)
|
* ("mm/gup: introduce pin_user_pages*() and FOLL_PIN") in v5.6-rc1 (2020-01-30)
|
||||||
*
|
*
|
||||||
|
* Removed vmas parameter from pin_user_pages() by commit 40896a02751
|
||||||
|
* ("mm/gup: remove vmas parameter from pin_user_pages()")
|
||||||
|
* in linux-next, expected in v6.5-rc1 (2023-05-17)
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
#if defined(NV_PIN_USER_PAGES_PRESENT)
|
#if defined(NV_PIN_USER_PAGES_PRESENT)
|
||||||
#define NV_PIN_USER_PAGES pin_user_pages
|
#if defined(NV_PIN_USER_PAGES_HAS_ARGS_VMAS)
|
||||||
|
#define NV_PIN_USER_PAGES pin_user_pages
|
||||||
|
#else
|
||||||
|
#define NV_PIN_USER_PAGES(start, nr_pages, gup_flags, pages, vmas) \
|
||||||
|
pin_user_pages(start, nr_pages, gup_flags, pages)
|
||||||
|
#endif // NV_PIN_USER_PAGES_HAS_ARGS_VMAS
|
||||||
#define NV_UNPIN_USER_PAGE unpin_user_page
|
#define NV_UNPIN_USER_PAGE unpin_user_page
|
||||||
#else
|
#else
|
||||||
#define NV_PIN_USER_PAGES NV_GET_USER_PAGES
|
#define NV_PIN_USER_PAGES NV_GET_USER_PAGES
|
||||||
@@ -64,11 +73,18 @@ typedef int vm_fault_t;
|
|||||||
* commit 8e50b8b07f462ab4b91bc1491b1c91bd75e4ad40 which cherry-picked the
|
* commit 8e50b8b07f462ab4b91bc1491b1c91bd75e4ad40 which cherry-picked the
|
||||||
* replacement of the write and force parameters with gup_flags
|
* replacement of the write and force parameters with gup_flags
|
||||||
*
|
*
|
||||||
|
* Removed vmas parameter from get_user_pages() by commit 7bbf9c8c99
|
||||||
|
* ("mm/gup: remove unused vmas parameter from get_user_pages()")
|
||||||
|
* in linux-next, expected in v6.5-rc1 (2023-05-17)
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(NV_GET_USER_PAGES_HAS_ARGS_FLAGS)
|
#if defined(NV_GET_USER_PAGES_HAS_ARGS_FLAGS)
|
||||||
|
#define NV_GET_USER_PAGES(start, nr_pages, flags, pages, vmas) \
|
||||||
|
get_user_pages(start, nr_pages, flags, pages)
|
||||||
|
#elif defined(NV_GET_USER_PAGES_HAS_ARGS_FLAGS_VMAS)
|
||||||
#define NV_GET_USER_PAGES get_user_pages
|
#define NV_GET_USER_PAGES get_user_pages
|
||||||
#elif defined(NV_GET_USER_PAGES_HAS_ARGS_TSK_FLAGS)
|
#elif defined(NV_GET_USER_PAGES_HAS_ARGS_TSK_FLAGS_VMAS)
|
||||||
#define NV_GET_USER_PAGES(start, nr_pages, flags, pages, vmas) \
|
#define NV_GET_USER_PAGES(start, nr_pages, flags, pages, vmas) \
|
||||||
get_user_pages(current, current->mm, start, nr_pages, flags, pages, vmas)
|
get_user_pages(current, current->mm, start, nr_pages, flags, pages, vmas)
|
||||||
#else
|
#else
|
||||||
@@ -81,13 +97,13 @@ typedef int vm_fault_t;
|
|||||||
int write = flags & FOLL_WRITE;
|
int write = flags & FOLL_WRITE;
|
||||||
int force = flags & FOLL_FORCE;
|
int force = flags & FOLL_FORCE;
|
||||||
|
|
||||||
#if defined(NV_GET_USER_PAGES_HAS_ARGS_WRITE_FORCE)
|
#if defined(NV_GET_USER_PAGES_HAS_ARGS_WRITE_FORCE_VMAS)
|
||||||
return get_user_pages(start, nr_pages, write, force, pages, vmas);
|
return get_user_pages(start, nr_pages, write, force, pages, vmas);
|
||||||
#else
|
#else
|
||||||
// NV_GET_USER_PAGES_HAS_ARGS_TSK_WRITE_FORCE
|
// NV_GET_USER_PAGES_HAS_ARGS_TSK_WRITE_FORCE_VMAS
|
||||||
return get_user_pages(current, current->mm, start, nr_pages, write,
|
return get_user_pages(current, current->mm, start, nr_pages, write,
|
||||||
force, pages, vmas);
|
force, pages, vmas);
|
||||||
#endif // NV_GET_USER_PAGES_HAS_ARGS_WRITE_FORCE
|
#endif // NV_GET_USER_PAGES_HAS_ARGS_WRITE_FORCE_VMAS
|
||||||
}
|
}
|
||||||
#endif // NV_GET_USER_PAGES_HAS_ARGS_FLAGS
|
#endif // NV_GET_USER_PAGES_HAS_ARGS_FLAGS
|
||||||
|
|
||||||
@@ -100,15 +116,22 @@ typedef int vm_fault_t;
|
|||||||
* 64019a2e467a ("mm/gup: remove task_struct pointer for all gup code")
|
* 64019a2e467a ("mm/gup: remove task_struct pointer for all gup code")
|
||||||
* in v5.9-rc1 (2020-08-11). *
|
* in v5.9-rc1 (2020-08-11). *
|
||||||
*
|
*
|
||||||
|
* Removed unused vmas parameter from pin_user_pages_remote() by commit
|
||||||
|
* 83bcc2e132("mm/gup: remove unused vmas parameter from pin_user_pages_remote()")
|
||||||
|
* in linux-next, expected in v6.5-rc1 (2023-05-14)
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(NV_PIN_USER_PAGES_REMOTE_PRESENT)
|
#if defined(NV_PIN_USER_PAGES_REMOTE_PRESENT)
|
||||||
#if defined (NV_PIN_USER_PAGES_REMOTE_HAS_ARGS_TSK)
|
#if defined(NV_PIN_USER_PAGES_REMOTE_HAS_ARGS_TSK_VMAS)
|
||||||
#define NV_PIN_USER_PAGES_REMOTE(mm, start, nr_pages, flags, pages, vmas, locked) \
|
#define NV_PIN_USER_PAGES_REMOTE(mm, start, nr_pages, flags, pages, vmas, locked) \
|
||||||
pin_user_pages_remote(NULL, mm, start, nr_pages, flags, pages, vmas, locked)
|
pin_user_pages_remote(NULL, mm, start, nr_pages, flags, pages, vmas, locked)
|
||||||
#else
|
#elif defined(NV_PIN_USER_PAGES_REMOTE_HAS_ARGS_VMAS)
|
||||||
#define NV_PIN_USER_PAGES_REMOTE pin_user_pages_remote
|
#define NV_PIN_USER_PAGES_REMOTE pin_user_pages_remote
|
||||||
#endif // NV_PIN_USER_PAGES_REMOTE_HAS_ARGS_TSK
|
#else
|
||||||
|
#define NV_PIN_USER_PAGES_REMOTE(mm, start, nr_pages, flags, pages, vmas, locked) \
|
||||||
|
pin_user_pages_remote(mm, start, nr_pages, flags, pages, locked)
|
||||||
|
#endif // NV_PIN_USER_PAGES_REMOTE_HAS_ARGS_TSK_VMAS
|
||||||
#else
|
#else
|
||||||
#define NV_PIN_USER_PAGES_REMOTE NV_GET_USER_PAGES_REMOTE
|
#define NV_PIN_USER_PAGES_REMOTE NV_GET_USER_PAGES_REMOTE
|
||||||
#endif // NV_PIN_USER_PAGES_REMOTE_PRESENT
|
#endif // NV_PIN_USER_PAGES_REMOTE_PRESENT
|
||||||
@@ -135,22 +158,30 @@ typedef int vm_fault_t;
|
|||||||
* commit 64019a2e467a ("mm/gup: remove task_struct pointer for
|
* commit 64019a2e467a ("mm/gup: remove task_struct pointer for
|
||||||
* all gup code") in v5.9-rc1 (2020-08-11).
|
* all gup code") in v5.9-rc1 (2020-08-11).
|
||||||
*
|
*
|
||||||
|
* Removed vmas parameter from get_user_pages_remote() by commit a4bde14d549
|
||||||
|
* ("mm/gup: remove vmas parameter from get_user_pages_remote()")
|
||||||
|
* in linux-next, expected in v6.5-rc1 (2023-05-14)
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(NV_GET_USER_PAGES_REMOTE_PRESENT)
|
#if defined(NV_GET_USER_PAGES_REMOTE_PRESENT)
|
||||||
#if defined(NV_GET_USER_PAGES_REMOTE_HAS_ARGS_FLAGS_LOCKED)
|
#if defined(NV_GET_USER_PAGES_REMOTE_HAS_ARGS_FLAGS_LOCKED)
|
||||||
|
#define NV_GET_USER_PAGES_REMOTE(mm, start, nr_pages, flags, pages, vmas, locked) \
|
||||||
|
get_user_pages_remote(mm, start, nr_pages, flags, pages, locked)
|
||||||
|
|
||||||
|
#elif defined(NV_GET_USER_PAGES_REMOTE_HAS_ARGS_FLAGS_LOCKED_VMAS)
|
||||||
#define NV_GET_USER_PAGES_REMOTE get_user_pages_remote
|
#define NV_GET_USER_PAGES_REMOTE get_user_pages_remote
|
||||||
|
|
||||||
#elif defined(NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_FLAGS_LOCKED)
|
#elif defined(NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_FLAGS_LOCKED_VMAS)
|
||||||
#define NV_GET_USER_PAGES_REMOTE(mm, start, nr_pages, flags, pages, vmas, locked) \
|
#define NV_GET_USER_PAGES_REMOTE(mm, start, nr_pages, flags, pages, vmas, locked) \
|
||||||
get_user_pages_remote(NULL, mm, start, nr_pages, flags, pages, vmas, locked)
|
get_user_pages_remote(NULL, mm, start, nr_pages, flags, pages, vmas, locked)
|
||||||
|
|
||||||
#elif defined(NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_FLAGS)
|
#elif defined(NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_FLAGS_VMAS)
|
||||||
#define NV_GET_USER_PAGES_REMOTE(mm, start, nr_pages, flags, pages, vmas, locked) \
|
#define NV_GET_USER_PAGES_REMOTE(mm, start, nr_pages, flags, pages, vmas, locked) \
|
||||||
get_user_pages_remote(NULL, mm, start, nr_pages, flags, pages, vmas)
|
get_user_pages_remote(NULL, mm, start, nr_pages, flags, pages, vmas)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
// NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_WRITE_FORCE
|
// NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_WRITE_FORCE_VMAS
|
||||||
static inline long NV_GET_USER_PAGES_REMOTE(struct mm_struct *mm,
|
static inline long NV_GET_USER_PAGES_REMOTE(struct mm_struct *mm,
|
||||||
unsigned long start,
|
unsigned long start,
|
||||||
unsigned long nr_pages,
|
unsigned long nr_pages,
|
||||||
@@ -167,7 +198,7 @@ typedef int vm_fault_t;
|
|||||||
}
|
}
|
||||||
#endif // NV_GET_USER_PAGES_REMOTE_HAS_ARGS_FLAGS_LOCKED
|
#endif // NV_GET_USER_PAGES_REMOTE_HAS_ARGS_FLAGS_LOCKED
|
||||||
#else
|
#else
|
||||||
#if defined(NV_GET_USER_PAGES_HAS_ARGS_TSK_WRITE_FORCE)
|
#if defined(NV_GET_USER_PAGES_HAS_ARGS_TSK_WRITE_FORCE_VMAS)
|
||||||
static inline long NV_GET_USER_PAGES_REMOTE(struct mm_struct *mm,
|
static inline long NV_GET_USER_PAGES_REMOTE(struct mm_struct *mm,
|
||||||
unsigned long start,
|
unsigned long start,
|
||||||
unsigned long nr_pages,
|
unsigned long nr_pages,
|
||||||
@@ -185,7 +216,7 @@ typedef int vm_fault_t;
|
|||||||
#else
|
#else
|
||||||
#define NV_GET_USER_PAGES_REMOTE(mm, start, nr_pages, flags, pages, vmas, locked) \
|
#define NV_GET_USER_PAGES_REMOTE(mm, start, nr_pages, flags, pages, vmas, locked) \
|
||||||
get_user_pages(NULL, mm, start, nr_pages, flags, pages, vmas)
|
get_user_pages(NULL, mm, start, nr_pages, flags, pages, vmas)
|
||||||
#endif // NV_GET_USER_PAGES_HAS_ARGS_TSK_WRITE_FORCE
|
#endif // NV_GET_USER_PAGES_HAS_ARGS_TSK_WRITE_FORCE_VMAS
|
||||||
#endif // NV_GET_USER_PAGES_REMOTE_PRESENT
|
#endif // NV_GET_USER_PAGES_REMOTE_PRESENT
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: Copyright (c) 2019-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
* SPDX-FileCopyrightText: Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
@@ -35,6 +35,4 @@ int nv_platform_count_devices(void);
|
|||||||
int nv_soc_register_irqs(nv_state_t *nv);
|
int nv_soc_register_irqs(nv_state_t *nv);
|
||||||
void nv_soc_free_irqs(nv_state_t *nv);
|
void nv_soc_free_irqs(nv_state_t *nv);
|
||||||
|
|
||||||
int nv_remove_conflicting_framebuffers(void);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: Copyright (c) 2014-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
* SPDX-FileCopyrightText: Copyright (c) 2014-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
@@ -554,6 +554,23 @@ enum NvKmsInputColorSpace {
|
|||||||
|
|
||||||
/* PQ, Rec.2020 unity */
|
/* PQ, Rec.2020 unity */
|
||||||
NVKMS_INPUT_COLORSPACE_BT2100_PQ = 2,
|
NVKMS_INPUT_COLORSPACE_BT2100_PQ = 2,
|
||||||
|
|
||||||
|
/* sRGB colorspace with sRGB gamma transfer function */
|
||||||
|
NVKMS_INPUT_COLORSPACE_SRGB = 3,
|
||||||
|
|
||||||
|
/* Rec709 colorspace with Rec709 gamma transfer function */
|
||||||
|
NVKMS_INPUT_COLORSPACE_REC709 = 4,
|
||||||
|
|
||||||
|
/* Rec709 colorspace with linear (identity) gamma */
|
||||||
|
NVKMS_INPUT_COLORSPACE_REC709_LINEAR = 5
|
||||||
|
};
|
||||||
|
|
||||||
|
enum NvKmsOutputColorSpace {
|
||||||
|
/* Unknown colorspace; no re-gamma will be applied */
|
||||||
|
NVKMS_OUTPUT_COLORSPACE_NONE = 0,
|
||||||
|
|
||||||
|
/* sRGB gamma transfer function will be applied */
|
||||||
|
NVKMS_OUTPUT_COLORSPACE_SRGB = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
enum NvKmsOutputTf {
|
enum NvKmsOutputTf {
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: Copyright (c) 2015-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
* SPDX-FileCopyrightText: Copyright (c) 2015-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
@@ -411,6 +411,14 @@ struct NvKmsKapiDynamicDisplayParams {
|
|||||||
NvBool forceDisconnected;
|
NvBool forceDisconnected;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct NvKmsKapiVtFbParams {
|
||||||
|
/* [OUT] VT framebuffer memory base address */
|
||||||
|
NvU64 baseAddress;
|
||||||
|
|
||||||
|
/* [OUT] VT framebuffer memory size */
|
||||||
|
NvU64 size;
|
||||||
|
};
|
||||||
|
|
||||||
struct NvKmsKapiCreateSurfaceParams {
|
struct NvKmsKapiCreateSurfaceParams {
|
||||||
|
|
||||||
/* [IN] Parameter of each plane */
|
/* [IN] Parameter of each plane */
|
||||||
@@ -455,6 +463,8 @@ typedef enum NvKmsKapiRegisterWaiterResultRec {
|
|||||||
NVKMS_KAPI_REG_WAITER_ALREADY_SIGNALLED,
|
NVKMS_KAPI_REG_WAITER_ALREADY_SIGNALLED,
|
||||||
} NvKmsKapiRegisterWaiterResult;
|
} NvKmsKapiRegisterWaiterResult;
|
||||||
|
|
||||||
|
typedef void NvKmsKapiSuspendResumeCallbackFunc(NvBool suspend);
|
||||||
|
|
||||||
struct NvKmsKapiFunctionsTable {
|
struct NvKmsKapiFunctionsTable {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -540,8 +550,8 @@ struct NvKmsKapiFunctionsTable {
|
|||||||
);
|
);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Revoke permissions previously granted. Only one (dispIndex, head,
|
* Revoke modeset permissions previously granted. Only one (dispIndex,
|
||||||
* display) is currently supported.
|
* head, display) is currently supported.
|
||||||
*
|
*
|
||||||
* \param [in] device A device returned by allocateDevice().
|
* \param [in] device A device returned by allocateDevice().
|
||||||
*
|
*
|
||||||
@@ -558,6 +568,34 @@ struct NvKmsKapiFunctionsTable {
|
|||||||
NvKmsKapiDisplay display
|
NvKmsKapiDisplay display
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Grant modeset sub-owner permissions to fd. This is used by clients to
|
||||||
|
* convert drm 'master' permissions into nvkms sub-owner permission.
|
||||||
|
*
|
||||||
|
* \param [in] fd fd from opening /dev/nvidia-modeset.
|
||||||
|
*
|
||||||
|
* \param [in] device A device returned by allocateDevice().
|
||||||
|
*
|
||||||
|
* \return NV_TRUE on success, NV_FALSE on failure.
|
||||||
|
*/
|
||||||
|
NvBool (*grantSubOwnership)
|
||||||
|
(
|
||||||
|
NvS32 fd,
|
||||||
|
struct NvKmsKapiDevice *device
|
||||||
|
);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Revoke sub-owner permissions previously granted.
|
||||||
|
*
|
||||||
|
* \param [in] device A device returned by allocateDevice().
|
||||||
|
*
|
||||||
|
* \return NV_TRUE on success, NV_FALSE on failure.
|
||||||
|
*/
|
||||||
|
NvBool (*revokeSubOwnership)
|
||||||
|
(
|
||||||
|
struct NvKmsKapiDevice *device
|
||||||
|
);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Registers for notification, via
|
* Registers for notification, via
|
||||||
* NvKmsKapiAllocateDeviceParams::eventCallback, of the events specified
|
* NvKmsKapiAllocateDeviceParams::eventCallback, of the events specified
|
||||||
@@ -679,6 +717,20 @@ struct NvKmsKapiFunctionsTable {
|
|||||||
struct NvKmsKapiDynamicDisplayParams *params
|
struct NvKmsKapiDynamicDisplayParams *params
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Get VT framebuffer information.
|
||||||
|
*
|
||||||
|
* \param [out] params Parameters containing the base address and size
|
||||||
|
* of VT framebuffer memory
|
||||||
|
*
|
||||||
|
* \return NV_TRUE on success, NV_FALSE on failure.
|
||||||
|
*/
|
||||||
|
NvBool (*getVtFbInfo)
|
||||||
|
(
|
||||||
|
struct NvKmsKapiDevice *device,
|
||||||
|
struct NvKmsKapiVtFbParams *params
|
||||||
|
);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Allocate some unformatted video memory of the specified size.
|
* Allocate some unformatted video memory of the specified size.
|
||||||
*
|
*
|
||||||
@@ -1336,6 +1388,15 @@ struct NvKmsKapiFunctionsTable {
|
|||||||
NvU64 index,
|
NvU64 index,
|
||||||
NvU64 new_value
|
NvU64 new_value
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Set the callback function for suspending and resuming the display system.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
(*setSuspendResumeCallback)
|
||||||
|
(
|
||||||
|
NvKmsKapiSuspendResumeCallbackFunc *function
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: Copyright (c) 1999-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
* SPDX-FileCopyrightText: Copyright (c) 1999-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
@@ -162,7 +162,7 @@ NvBool NV_API_CALL os_is_vgx_hyper (void);
|
|||||||
NV_STATUS NV_API_CALL os_inject_vgx_msi (NvU16, NvU64, NvU32);
|
NV_STATUS NV_API_CALL os_inject_vgx_msi (NvU16, NvU64, NvU32);
|
||||||
NvBool NV_API_CALL os_is_grid_supported (void);
|
NvBool NV_API_CALL os_is_grid_supported (void);
|
||||||
NvU32 NV_API_CALL os_get_grid_csp_support (void);
|
NvU32 NV_API_CALL os_get_grid_csp_support (void);
|
||||||
void NV_API_CALL os_get_screen_info (NvU64 *, NvU32 *, NvU32 *, NvU32 *, NvU32 *, NvU64, NvU64);
|
void NV_API_CALL os_get_screen_info (NvU64 *, NvU32 *, NvU32 *, NvU32 *, NvU32 *, NvU64 *, NvU64, NvU64);
|
||||||
void NV_API_CALL os_bug_check (NvU32, const char *);
|
void NV_API_CALL os_bug_check (NvU32, const char *);
|
||||||
NV_STATUS NV_API_CALL os_lock_user_pages (void *, NvU64, void **, NvU32);
|
NV_STATUS NV_API_CALL os_lock_user_pages (void *, NvU64, void **, NvU32);
|
||||||
NV_STATUS NV_API_CALL os_lookup_user_io_memory (void *, NvU64, NvU64 **, void**);
|
NV_STATUS NV_API_CALL os_lookup_user_io_memory (void *, NvU64, NvU64 **, void**);
|
||||||
385
nvdisplay/kernel-open/conftest.sh → kernel-open/conftest.sh
Executable file → Normal file
385
nvdisplay/kernel-open/conftest.sh → kernel-open/conftest.sh
Executable file → Normal file
@@ -2466,6 +2466,10 @@ compile_test() {
|
|||||||
# commit 768ae309a961 ("mm: replace get_user_pages() write/force
|
# commit 768ae309a961 ("mm: replace get_user_pages() write/force
|
||||||
# parameters with gup_flags") in v4.9 (2016-10-13)
|
# parameters with gup_flags") in v4.9 (2016-10-13)
|
||||||
#
|
#
|
||||||
|
# Removed vmas parameter from get_user_pages() by commit 7bbf9c8c99
|
||||||
|
# ("mm/gup: remove unused vmas parameter from get_user_pages()")
|
||||||
|
# in linux-next, expected in v6.5-rc1
|
||||||
|
#
|
||||||
# linux-4.4.168 cherry-picked commit 768ae309a961 without
|
# linux-4.4.168 cherry-picked commit 768ae309a961 without
|
||||||
# c12d2da56d0e which is covered in Conftest #3.
|
# c12d2da56d0e which is covered in Conftest #3.
|
||||||
#
|
#
|
||||||
@@ -2475,22 +2479,28 @@ compile_test() {
|
|||||||
# passing conftest's
|
# passing conftest's
|
||||||
#
|
#
|
||||||
set_get_user_pages_defines () {
|
set_get_user_pages_defines () {
|
||||||
if [ "$1" = "NV_GET_USER_PAGES_HAS_ARGS_WRITE_FORCE" ]; then
|
if [ "$1" = "NV_GET_USER_PAGES_HAS_ARGS_WRITE_FORCE_VMAS" ]; then
|
||||||
echo "#define NV_GET_USER_PAGES_HAS_ARGS_WRITE_FORCE" | append_conftest "functions"
|
echo "#define NV_GET_USER_PAGES_HAS_ARGS_WRITE_FORCE_VMAS" | append_conftest "functions"
|
||||||
else
|
else
|
||||||
echo "#undef NV_GET_USER_PAGES_HAS_ARGS_WRITE_FORCE" | append_conftest "functions"
|
echo "#undef NV_GET_USER_PAGES_HAS_ARGS_WRITE_FORCE_VMAS" | append_conftest "functions"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "NV_GET_USER_PAGES_HAS_ARGS_TSK_WRITE_FORCE" ]; then
|
if [ "$1" = "NV_GET_USER_PAGES_HAS_ARGS_TSK_WRITE_FORCE_VMAS" ]; then
|
||||||
echo "#define NV_GET_USER_PAGES_HAS_ARGS_TSK_WRITE_FORCE" | append_conftest "functions"
|
echo "#define NV_GET_USER_PAGES_HAS_ARGS_TSK_WRITE_FORCE_VMAS" | append_conftest "functions"
|
||||||
else
|
else
|
||||||
echo "#undef NV_GET_USER_PAGES_HAS_ARGS_TSK_WRITE_FORCE" | append_conftest "functions"
|
echo "#undef NV_GET_USER_PAGES_HAS_ARGS_TSK_WRITE_FORCE_VMAS" | append_conftest "functions"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "NV_GET_USER_PAGES_HAS_ARGS_TSK_FLAGS" ]; then
|
if [ "$1" = "NV_GET_USER_PAGES_HAS_ARGS_TSK_FLAGS_VMAS" ]; then
|
||||||
echo "#define NV_GET_USER_PAGES_HAS_ARGS_TSK_FLAGS" | append_conftest "functions"
|
echo "#define NV_GET_USER_PAGES_HAS_ARGS_TSK_FLAGS_VMAS" | append_conftest "functions"
|
||||||
else
|
else
|
||||||
echo "#undef NV_GET_USER_PAGES_HAS_ARGS_TSK_FLAGS" | append_conftest "functions"
|
echo "#undef NV_GET_USER_PAGES_HAS_ARGS_TSK_FLAGS_VMAS" | append_conftest "functions"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "NV_GET_USER_PAGES_HAS_ARGS_FLAGS_VMAS" ]; then
|
||||||
|
echo "#define NV_GET_USER_PAGES_HAS_ARGS_FLAGS_VMAS" | append_conftest "functions"
|
||||||
|
else
|
||||||
|
echo "#undef NV_GET_USER_PAGES_HAS_ARGS_FLAGS_VMAS" | append_conftest "functions"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "NV_GET_USER_PAGES_HAS_ARGS_FLAGS" ]; then
|
if [ "$1" = "NV_GET_USER_PAGES_HAS_ARGS_FLAGS" ]; then
|
||||||
@@ -2498,6 +2508,7 @@ compile_test() {
|
|||||||
else
|
else
|
||||||
echo "#undef NV_GET_USER_PAGES_HAS_ARGS_FLAGS" | append_conftest "functions"
|
echo "#undef NV_GET_USER_PAGES_HAS_ARGS_FLAGS" | append_conftest "functions"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Conftest #1: Check if get_user_pages accepts 6 arguments.
|
# Conftest #1: Check if get_user_pages accepts 6 arguments.
|
||||||
@@ -2518,14 +2529,15 @@ compile_test() {
|
|||||||
$CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
|
$CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
|
||||||
rm -f conftest$$.c
|
rm -f conftest$$.c
|
||||||
if [ -f conftest$$.o ]; then
|
if [ -f conftest$$.o ]; then
|
||||||
set_get_user_pages_defines "NV_GET_USER_PAGES_HAS_ARGS_WRITE_FORCE"
|
set_get_user_pages_defines "NV_GET_USER_PAGES_HAS_ARGS_WRITE_FORCE_VMAS"
|
||||||
rm -f conftest$$.o
|
rm -f conftest$$.o
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Conftest #2: Check if get_user_pages has gup_flags instead of
|
# Conftest #2: Check if get_user_pages has gup_flags instead of
|
||||||
# write and force parameters. And that gup doesn't accept a
|
# write and force parameters. And that gup doesn't accept a
|
||||||
# task_struct and mm_struct as its first arguments.
|
# task_struct and mm_struct as its first arguments. get_user_pages
|
||||||
|
# has vm_area_struct as its last argument.
|
||||||
# Return if available.
|
# Return if available.
|
||||||
# Fall through to conftest #3 on failure.
|
# Fall through to conftest #3 on failure.
|
||||||
|
|
||||||
@@ -2543,16 +2555,17 @@ compile_test() {
|
|||||||
rm -f conftest$$.c
|
rm -f conftest$$.c
|
||||||
|
|
||||||
if [ -f conftest$$.o ]; then
|
if [ -f conftest$$.o ]; then
|
||||||
set_get_user_pages_defines "NV_GET_USER_PAGES_HAS_ARGS_FLAGS"
|
set_get_user_pages_defines "NV_GET_USER_PAGES_HAS_ARGS_FLAGS_VMAS"
|
||||||
rm -f conftest$$.o
|
rm -f conftest$$.o
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Conftest #3: Check if get_user_pages has gup_flags instead of
|
# Conftest #3: Check if get_user_pages has gup_flags instead of
|
||||||
# write and force parameters AND that gup has task_struct and
|
# write and force parameters. The gup has task_struct and
|
||||||
# mm_struct as its first arguments.
|
# mm_struct as its first arguments. get_user_pages
|
||||||
|
# has vm_area_struct as its last argument.
|
||||||
# Return if available.
|
# Return if available.
|
||||||
# Fall through to default case if absent.
|
# Fall through to conftest #4 on failure.
|
||||||
|
|
||||||
echo "$CONFTEST_PREAMBLE
|
echo "$CONFTEST_PREAMBLE
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
@@ -2570,12 +2583,35 @@ compile_test() {
|
|||||||
rm -f conftest$$.c
|
rm -f conftest$$.c
|
||||||
|
|
||||||
if [ -f conftest$$.o ]; then
|
if [ -f conftest$$.o ]; then
|
||||||
set_get_user_pages_defines "NV_GET_USER_PAGES_HAS_ARGS_TSK_FLAGS"
|
set_get_user_pages_defines "NV_GET_USER_PAGES_HAS_ARGS_TSK_FLAGS_VMAS"
|
||||||
rm -f conftest$$.o
|
rm -f conftest$$.o
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set_get_user_pages_defines "NV_GET_USER_PAGES_HAS_ARGS_TSK_WRITE_FORCE"
|
# Conftest #4: gup doesn't accept a task_struct and mm_struct as
|
||||||
|
# its first arguments. check if get_user_pages() does not take
|
||||||
|
# vmas argument.
|
||||||
|
# Fall through to default case otherwise.
|
||||||
|
|
||||||
|
echo "$CONFTEST_PREAMBLE
|
||||||
|
#include <linux/mm.h>
|
||||||
|
long get_user_pages(unsigned long start,
|
||||||
|
unsigned long nr_pages,
|
||||||
|
unsigned int gup_flags,
|
||||||
|
struct page **pages) {
|
||||||
|
return 0;
|
||||||
|
}" > conftest$$.c
|
||||||
|
|
||||||
|
$CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
|
||||||
|
rm -f conftest$$.c
|
||||||
|
|
||||||
|
if [ -f conftest$$.o ]; then
|
||||||
|
set_get_user_pages_defines "NV_GET_USER_PAGES_HAS_ARGS_FLAGS"
|
||||||
|
rm -f conftest$$.o
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
set_get_user_pages_defines "NV_GET_USER_PAGES_HAS_ARGS_TSK_WRITE_FORCE_VMAS"
|
||||||
|
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
@@ -2602,6 +2638,10 @@ compile_test() {
|
|||||||
# commit 64019a2e467a ("mm/gup: remove task_struct pointer for
|
# commit 64019a2e467a ("mm/gup: remove task_struct pointer for
|
||||||
# all gup code") in v5.9-rc1 (2020-08-11).
|
# all gup code") in v5.9-rc1 (2020-08-11).
|
||||||
#
|
#
|
||||||
|
# Removed vmas parameter from get_user_pages_remote() by commit
|
||||||
|
# a4bde14d549 ("mm/gup: remove vmas parameter from get_user_pages_remote()")
|
||||||
|
# in linux-next, expected in v6.5-rc1
|
||||||
|
#
|
||||||
|
|
||||||
#
|
#
|
||||||
# This function sets the NV_GET_USER_PAGES_REMOTE_* macros as per
|
# This function sets the NV_GET_USER_PAGES_REMOTE_* macros as per
|
||||||
@@ -2614,22 +2654,28 @@ compile_test() {
|
|||||||
echo "#define NV_GET_USER_PAGES_REMOTE_PRESENT" | append_conftest "functions"
|
echo "#define NV_GET_USER_PAGES_REMOTE_PRESENT" | append_conftest "functions"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_WRITE_FORCE" ]; then
|
if [ "$1" = "NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_WRITE_FORCE_VMAS" ]; then
|
||||||
echo "#define NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_WRITE_FORCE" | append_conftest "functions"
|
echo "#define NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_WRITE_FORCE_VMAS" | append_conftest "functions"
|
||||||
else
|
else
|
||||||
echo "#undef NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_WRITE_FORCE" | append_conftest "functions"
|
echo "#undef NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_WRITE_FORCE_VMAS" | append_conftest "functions"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_FLAGS" ]; then
|
if [ "$1" = "NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_FLAGS_VMAS" ]; then
|
||||||
echo "#define NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_FLAGS" | append_conftest "functions"
|
echo "#define NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_FLAGS_VMAS" | append_conftest "functions"
|
||||||
else
|
else
|
||||||
echo "#undef NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_FLAGS" | append_conftest "functions"
|
echo "#undef NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_FLAGS_VMAS" | append_conftest "functions"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_FLAGS_LOCKED" ]; then
|
if [ "$1" = "NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_FLAGS_LOCKED_VMAS" ]; then
|
||||||
echo "#define NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_FLAGS_LOCKED" | append_conftest "functions"
|
echo "#define NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_FLAGS_LOCKED_VMAS" | append_conftest "functions"
|
||||||
else
|
else
|
||||||
echo "#undef NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_FLAGS_LOCKED" | append_conftest "functions"
|
echo "#undef NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_FLAGS_LOCKED_VMAS" | append_conftest "functions"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "NV_GET_USER_PAGES_REMOTE_HAS_ARGS_FLAGS_LOCKED_VMAS" ]; then
|
||||||
|
echo "#define NV_GET_USER_PAGES_REMOTE_HAS_ARGS_FLAGS_LOCKED_VMAS" | append_conftest "functions"
|
||||||
|
else
|
||||||
|
echo "#undef NV_GET_USER_PAGES_REMOTE_HAS_ARGS_FLAGS_LOCKED_VMAS" | append_conftest "functions"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "NV_GET_USER_PAGES_REMOTE_HAS_ARGS_FLAGS_LOCKED" ]; then
|
if [ "$1" = "NV_GET_USER_PAGES_REMOTE_HAS_ARGS_FLAGS_LOCKED" ]; then
|
||||||
@@ -2637,6 +2683,7 @@ compile_test() {
|
|||||||
else
|
else
|
||||||
echo "#undef NV_GET_USER_PAGES_REMOTE_HAS_ARGS_FLAGS_LOCKED" | append_conftest "functions"
|
echo "#undef NV_GET_USER_PAGES_REMOTE_HAS_ARGS_FLAGS_LOCKED" | append_conftest "functions"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# conftest #1: check if get_user_pages_remote() is available
|
# conftest #1: check if get_user_pages_remote() is available
|
||||||
@@ -2659,8 +2706,8 @@ compile_test() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# conftest #2: check if get_user_pages_remote() has write and
|
# conftest #2: check if get_user_pages_remote() has write, force
|
||||||
# force arguments. Return if these arguments are present
|
# and vmas arguments. Return if these arguments are present
|
||||||
# Fall through to conftest #3 if these args are absent.
|
# Fall through to conftest #3 if these args are absent.
|
||||||
#
|
#
|
||||||
echo "$CONFTEST_PREAMBLE
|
echo "$CONFTEST_PREAMBLE
|
||||||
@@ -2680,14 +2727,14 @@ compile_test() {
|
|||||||
rm -f conftest$$.c
|
rm -f conftest$$.c
|
||||||
|
|
||||||
if [ -f conftest$$.o ]; then
|
if [ -f conftest$$.o ]; then
|
||||||
set_get_user_pages_remote_defines "NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_WRITE_FORCE"
|
set_get_user_pages_remote_defines "NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_WRITE_FORCE_VMAS"
|
||||||
rm -f conftest$$.o
|
rm -f conftest$$.o
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# conftest #3: check if get_user_pages_remote() has gpu_flags
|
# conftest #3: check if get_user_pages_remote() has gpu_flags and
|
||||||
# arguments. Return if these arguments are present
|
# vmas arguments. Return if these arguments are present
|
||||||
# Fall through to conftest #4 if these args are absent.
|
# Fall through to conftest #4 if these args are absent.
|
||||||
#
|
#
|
||||||
echo "$CONFTEST_PREAMBLE
|
echo "$CONFTEST_PREAMBLE
|
||||||
@@ -2706,13 +2753,14 @@ compile_test() {
|
|||||||
rm -f conftest$$.c
|
rm -f conftest$$.c
|
||||||
|
|
||||||
if [ -f conftest$$.o ]; then
|
if [ -f conftest$$.o ]; then
|
||||||
set_get_user_pages_remote_defines "NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_FLAGS"
|
set_get_user_pages_remote_defines "NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_FLAGS_VMAS"
|
||||||
rm -f conftest$$.o
|
rm -f conftest$$.o
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# conftest #4: check if get_user_pages_remote() has locked argument
|
# conftest #4: check if get_user_pages_remote() has locked and
|
||||||
|
# vmas argument
|
||||||
# Return if these arguments are present. Fall through to conftest #5
|
# Return if these arguments are present. Fall through to conftest #5
|
||||||
# if these args are absent.
|
# if these args are absent.
|
||||||
#
|
#
|
||||||
@@ -2733,7 +2781,7 @@ compile_test() {
|
|||||||
rm -f conftest$$.c
|
rm -f conftest$$.c
|
||||||
|
|
||||||
if [ -f conftest$$.o ]; then
|
if [ -f conftest$$.o ]; then
|
||||||
set_get_user_pages_remote_defines "NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_FLAGS_LOCKED"
|
set_get_user_pages_remote_defines "NV_GET_USER_PAGES_REMOTE_HAS_ARGS_TSK_FLAGS_LOCKED_VMAS"
|
||||||
rm -f conftest$$.o
|
rm -f conftest$$.o
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@@ -2757,10 +2805,34 @@ compile_test() {
|
|||||||
$CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
|
$CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
|
||||||
rm -f conftest$$.c
|
rm -f conftest$$.c
|
||||||
|
|
||||||
|
if [ -f conftest$$.o ]; then
|
||||||
|
set_get_user_pages_remote_defines "NV_GET_USER_PAGES_REMOTE_HAS_ARGS_FLAGS_LOCKED_VMAS"
|
||||||
|
rm -f conftest$$.o
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# conftest #6: check if get_user_pages_remote() does not take
|
||||||
|
# vmas argument.
|
||||||
|
#
|
||||||
|
echo "$CONFTEST_PREAMBLE
|
||||||
|
#include <linux/mm.h>
|
||||||
|
long get_user_pages_remote(struct mm_struct *mm,
|
||||||
|
unsigned long start,
|
||||||
|
unsigned long nr_pages,
|
||||||
|
unsigned int gup_flags,
|
||||||
|
struct page **pages,
|
||||||
|
int *locked) {
|
||||||
|
return 0;
|
||||||
|
}" > conftest$$.c
|
||||||
|
|
||||||
|
$CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
|
||||||
|
rm -f conftest$$.c
|
||||||
|
|
||||||
if [ -f conftest$$.o ]; then
|
if [ -f conftest$$.o ]; then
|
||||||
set_get_user_pages_remote_defines "NV_GET_USER_PAGES_REMOTE_HAS_ARGS_FLAGS_LOCKED"
|
set_get_user_pages_remote_defines "NV_GET_USER_PAGES_REMOTE_HAS_ARGS_FLAGS_LOCKED"
|
||||||
rm -f conftest$$.o
|
rm -f conftest$$.o
|
||||||
fi
|
fi
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
pin_user_pages)
|
pin_user_pages)
|
||||||
@@ -2772,17 +2844,65 @@ compile_test() {
|
|||||||
# pin_user_pages() was added by commit eddb1c228f7951d399240
|
# pin_user_pages() was added by commit eddb1c228f7951d399240
|
||||||
# ("mm/gup: introduce pin_user_pages*() and FOLL_PIN") in
|
# ("mm/gup: introduce pin_user_pages*() and FOLL_PIN") in
|
||||||
# v5.6-rc1 (2020-01-30)
|
# v5.6-rc1 (2020-01-30)
|
||||||
|
#
|
||||||
|
# Removed vmas parameter from pin_user_pages() by commit
|
||||||
|
# 40896a02751("mm/gup: remove vmas parameter from pin_user_pages()")
|
||||||
|
# in linux-next, expected in v6.5-rc1
|
||||||
|
|
||||||
|
set_pin_user_pages_defines () {
|
||||||
|
if [ "$1" = "" ]; then
|
||||||
|
echo "#undef NV_PIN_USER_PAGES_PRESENT" | append_conftest "functions"
|
||||||
|
else
|
||||||
|
echo "#define NV_PIN_USER_PAGES_PRESENT" | append_conftest "functions"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "NV_PIN_USER_PAGES_HAS_ARGS_VMAS" ]; then
|
||||||
|
echo "#define NV_PIN_USER_PAGES_HAS_ARGS_VMAS" | append_conftest "functions"
|
||||||
|
else
|
||||||
|
echo "#undef NV_PIN_USER_PAGES_HAS_ARGS_VMAS" | append_conftest "functions"
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
# conftest #1: check if pin_user_pages() is available
|
# conftest #1: check if pin_user_pages() is available
|
||||||
# return if not available.
|
# return if not available.
|
||||||
|
# Fall through to conftest #2 if it is present
|
||||||
#
|
#
|
||||||
CODE="
|
echo "$CONFTEST_PREAMBLE
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
void conftest_pin_user_pages(void) {
|
void conftest_pin_user_pages(void) {
|
||||||
pin_user_pages();
|
pin_user_pages();
|
||||||
}"
|
}" > conftest$$.c
|
||||||
|
|
||||||
compile_check_conftest "$CODE" "NV_PIN_USER_PAGES_PRESENT" "" "functions"
|
$CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
|
||||||
|
rm -f conftest$$.c
|
||||||
|
|
||||||
|
if [ -f conftest$$.o ]; then
|
||||||
|
set_pin_user_pages_defines ""
|
||||||
|
rm -f conftest$$.o
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# conftest #2: Check if pin_user_pages() has vmas argument
|
||||||
|
echo "$CONFTEST_PREAMBLE
|
||||||
|
#include <linux/mm.h>
|
||||||
|
long pin_user_pages(unsigned long start,
|
||||||
|
unsigned long nr_pages,
|
||||||
|
unsigned int gup_flags,
|
||||||
|
struct page **pages,
|
||||||
|
struct vm_area_struct **vmas) {
|
||||||
|
return 0;
|
||||||
|
}" > conftest$$.c
|
||||||
|
|
||||||
|
$CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
|
||||||
|
rm -f conftest$$.c
|
||||||
|
|
||||||
|
if [ -f conftest$$.o ]; then
|
||||||
|
set_pin_user_pages_defines "NV_PIN_USER_PAGES_HAS_ARGS_VMAS"
|
||||||
|
rm -f conftest$$.o
|
||||||
|
else
|
||||||
|
set_pin_user_pages_defines "NV_PIN_USER_PAGES_PRESENT"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
pin_user_pages_remote)
|
pin_user_pages_remote)
|
||||||
@@ -2795,6 +2915,10 @@ compile_test() {
|
|||||||
# pin_user_pages_remote() removed 'tsk' parameter by
|
# pin_user_pages_remote() removed 'tsk' parameter by
|
||||||
# commit 64019a2e467a ("mm/gup: remove task_struct pointer for
|
# commit 64019a2e467a ("mm/gup: remove task_struct pointer for
|
||||||
# all gup code") in v5.9-rc1 (2020-08-11).
|
# all gup code") in v5.9-rc1 (2020-08-11).
|
||||||
|
#
|
||||||
|
# Removed unused vmas parameter from pin_user_pages_remote() by
|
||||||
|
# commit 83bcc2e132 ("mm/gup: remove unused vmas parameter from
|
||||||
|
# pin_user_pages_remote()") in linux-next, expected in v6.5-rc1
|
||||||
|
|
||||||
#
|
#
|
||||||
# This function sets the NV_PIN_USER_PAGES_REMOTE_* macros as per
|
# This function sets the NV_PIN_USER_PAGES_REMOTE_* macros as per
|
||||||
@@ -2807,10 +2931,16 @@ compile_test() {
|
|||||||
echo "#define NV_PIN_USER_PAGES_REMOTE_PRESENT" | append_conftest "functions"
|
echo "#define NV_PIN_USER_PAGES_REMOTE_PRESENT" | append_conftest "functions"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "NV_PIN_USER_PAGES_REMOTE_HAS_ARGS_TSK" ]; then
|
if [ "$1" = "NV_PIN_USER_PAGES_REMOTE_HAS_ARGS_TSK_VMAS" ]; then
|
||||||
echo "#define NV_PIN_USER_PAGES_REMOTE_HAS_ARGS_TSK" | append_conftest "functions"
|
echo "#define NV_PIN_USER_PAGES_REMOTE_HAS_ARGS_TSK_VMAS" | append_conftest "functions"
|
||||||
else
|
else
|
||||||
echo "#undef NV_PIN_USER_PAGES_REMOTE_HAS_ARGS_TSK" | append_conftest "functions"
|
echo "#undef NV_PIN_USER_PAGES_REMOTE_HAS_ARGS_TSK_VMAS" | append_conftest "functions"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "NV_PIN_USER_PAGES_REMOTE_HAS_ARGS_VMAS" ]; then
|
||||||
|
echo "#define NV_PIN_USER_PAGES_REMOTE_HAS_ARGS_VMAS" | append_conftest "functions"
|
||||||
|
else
|
||||||
|
echo "#undef NV_PIN_USER_PAGES_REMOTE_HAS_ARGS_VMAS" | append_conftest "functions"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2833,7 +2963,11 @@ compile_test() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# conftest #2: Check if pin_user_pages_remote() has tsk argument
|
# conftest #2: Check if pin_user_pages_remote() has tsk and
|
||||||
|
# vmas argument
|
||||||
|
# Return if these arguments are present else fall through to
|
||||||
|
# conftest #3
|
||||||
|
|
||||||
echo "$CONFTEST_PREAMBLE
|
echo "$CONFTEST_PREAMBLE
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
long pin_user_pages_remote(struct task_struct *tsk,
|
long pin_user_pages_remote(struct task_struct *tsk,
|
||||||
@@ -2851,11 +2985,34 @@ compile_test() {
|
|||||||
rm -f conftest$$.c
|
rm -f conftest$$.c
|
||||||
|
|
||||||
if [ -f conftest$$.o ]; then
|
if [ -f conftest$$.o ]; then
|
||||||
set_pin_user_pages_remote_defines "NV_PIN_USER_PAGES_REMOTE_HAS_ARGS_TSK"
|
set_pin_user_pages_remote_defines "NV_PIN_USER_PAGES_REMOTE_HAS_ARGS_TSK_VMAS"
|
||||||
|
rm -f conftest$$.o
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# conftest #3: Check if pin_user_pages_remote() has vmas argument
|
||||||
|
echo "$CONFTEST_PREAMBLE
|
||||||
|
#include <linux/mm.h>
|
||||||
|
long pin_user_pages_remote(struct mm_struct *mm,
|
||||||
|
unsigned long start,
|
||||||
|
unsigned long nr_pages,
|
||||||
|
unsigned int gup_flags,
|
||||||
|
struct page **pages,
|
||||||
|
struct vm_area_struct **vmas,
|
||||||
|
int *locked) {
|
||||||
|
return 0;
|
||||||
|
}" > conftest$$.c
|
||||||
|
|
||||||
|
$CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
|
||||||
|
rm -f conftest$$.c
|
||||||
|
|
||||||
|
if [ -f conftest$$.o ]; then
|
||||||
|
set_pin_user_pages_remote_defines "NV_PIN_USER_PAGES_REMOTE_HAS_ARGS_VMAS"
|
||||||
rm -f conftest$$.o
|
rm -f conftest$$.o
|
||||||
else
|
else
|
||||||
set_pin_user_pages_remote_defines "NV_PIN_USER_PAGES_REMOTE_PRESENT"
|
set_pin_user_pages_remote_defines "NV_PIN_USER_PAGES_REMOTE_PRESENT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
vfio_pin_pages_has_vfio_device_arg)
|
vfio_pin_pages_has_vfio_device_arg)
|
||||||
@@ -4933,20 +5090,22 @@ compile_test() {
|
|||||||
compile_check_conftest "$CODE" "NV_PCI_CLASS_MULTIMEDIA_HD_AUDIO_PRESENT" "" "generic"
|
compile_check_conftest "$CODE" "NV_PCI_CLASS_MULTIMEDIA_HD_AUDIO_PRESENT" "" "generic"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
unsafe_follow_pfn)
|
follow_pfn)
|
||||||
#
|
#
|
||||||
# Determine if unsafe_follow_pfn() is present.
|
# Determine if follow_pfn() is present.
|
||||||
#
|
#
|
||||||
# unsafe_follow_pfn() was added by commit 69bacee7f9ad
|
# follow_pfn() was added by commit 3b6748e2dd69
|
||||||
# ("mm: Add unsafe_follow_pfn") in v5.13-rc1.
|
# ("mm: introduce follow_pfn()") in v2.6.31-rc1, and removed
|
||||||
|
# by commit 233eb0bf3b94 ("mm: remove follow_pfn")
|
||||||
|
# from linux-next 233eb0bf3b94.
|
||||||
#
|
#
|
||||||
CODE="
|
CODE="
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
void conftest_unsafe_follow_pfn(void) {
|
void conftest_follow_pfn(void) {
|
||||||
unsafe_follow_pfn();
|
follow_pfn();
|
||||||
}"
|
}"
|
||||||
|
|
||||||
compile_check_conftest "$CODE" "NV_UNSAFE_FOLLOW_PFN_PRESENT" "" "functions"
|
compile_check_conftest "$CODE" "NV_FOLLOW_PFN_PRESENT" "" "functions"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
drm_plane_atomic_check_has_atomic_state_arg)
|
drm_plane_atomic_check_has_atomic_state_arg)
|
||||||
@@ -6124,6 +6283,27 @@ compile_test() {
|
|||||||
compile_check_conftest "$CODE" "NV_MEMORY_FAILURE_MF_SW_SIMULATED_DEFINED" "" "types"
|
compile_check_conftest "$CODE" "NV_MEMORY_FAILURE_MF_SW_SIMULATED_DEFINED" "" "types"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
drm_unlocked_ioctl_flag_present)
|
||||||
|
# Determine if DRM_UNLOCKED IOCTL flag is present.
|
||||||
|
#
|
||||||
|
# DRM_UNLOCKED was removed by commit 2798ffcc1d6a ("drm: Remove
|
||||||
|
# locking for legacy ioctls and DRM_UNLOCKED") in Linux
|
||||||
|
# next-20231208.
|
||||||
|
#
|
||||||
|
# DRM_UNLOCKED definition was moved from drmP.h to drm_ioctl.h by
|
||||||
|
# commit 2640981f3600 ("drm: document drm_ioctl.[hc]") in v4.12.
|
||||||
|
CODE="
|
||||||
|
#if defined(NV_DRM_DRM_IOCTL_H_PRESENT)
|
||||||
|
#include <drm/drm_ioctl.h>
|
||||||
|
#endif
|
||||||
|
#if defined(NV_DRM_DRMP_H_PRESENT)
|
||||||
|
#include <drm/drmP.h>
|
||||||
|
#endif
|
||||||
|
int flags = DRM_UNLOCKED;"
|
||||||
|
|
||||||
|
compile_check_conftest "$CODE" "NV_DRM_UNLOCKED_IOCTL_FLAG_PRESENT" "" "types"
|
||||||
|
;;
|
||||||
|
|
||||||
sync_file_get_fence)
|
sync_file_get_fence)
|
||||||
#
|
#
|
||||||
# Determine if sync_file_get_fence() function is present
|
# Determine if sync_file_get_fence() function is present
|
||||||
@@ -6265,20 +6445,19 @@ compile_test() {
|
|||||||
compile_check_conftest "$CODE" "NV_DRM_APERTURE_REMOVE_CONFLICTING_PCI_FRAMEBUFFERS_HAS_DRIVER_ARG" "" "types"
|
compile_check_conftest "$CODE" "NV_DRM_APERTURE_REMOVE_CONFLICTING_PCI_FRAMEBUFFERS_HAS_DRIVER_ARG" "" "types"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
remove_conflicting_framebuffers)
|
crypto_tfm_ctx_aligned)
|
||||||
|
# Determine if 'crypto_tfm_ctx_aligned' is defined.
|
||||||
#
|
#
|
||||||
# Determine if remove_conflicting_framebuffers function is present.
|
# Removed by commit 25c74a39e0f6 ("crypto: hmac - remove unnecessary
|
||||||
#
|
# alignment logic") in v6.7.
|
||||||
# Added by commit 06415c5 ("fbmem, drm/nouveau: kick firmware framebuffers as soon as possible")
|
|
||||||
# in v2.6.35-rc1 (2010-05-18)
|
|
||||||
#
|
#
|
||||||
CODE="
|
CODE="
|
||||||
#include <linux/fb.h>
|
#include <crypto/algapi.h>
|
||||||
void conftest_remove_conflicting_framebuffers(void) {
|
void conftest_crypto_tfm_ctx_aligned(void) {
|
||||||
remove_conflicting_framebuffers();
|
(void)crypto_tfm_ctx_aligned();
|
||||||
}"
|
}"
|
||||||
|
|
||||||
compile_check_conftest "$CODE" "NV_REMOVE_CONFLICTING_FRAMEBUFFERS_PRESENT" "" "functions"
|
compile_check_conftest "$CODE" "NV_CRYPTO_TFM_CTX_ALIGNED_PRESENT" "" "functions"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
crypto)
|
crypto)
|
||||||
@@ -6307,6 +6486,96 @@ compile_test() {
|
|||||||
compile_check_conftest "$CODE" "NV_CRYPTO_PRESENT" "" "symbols"
|
compile_check_conftest "$CODE" "NV_CRYPTO_PRESENT" "" "symbols"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
drm_aperture_remove_conflicting_framebuffers)
|
||||||
|
#
|
||||||
|
# Determine whether drm_aperture_remove_conflicting_framebuffers is present.
|
||||||
|
#
|
||||||
|
# drm_aperture_remove_conflicting_framebuffers was added in commit 2916059147ea
|
||||||
|
# ("drm/aperture: Add infrastructure for aperture ownership) in
|
||||||
|
# v5.14-rc1 (2021-04-12)
|
||||||
|
#
|
||||||
|
CODE="
|
||||||
|
#if defined(NV_DRM_DRM_APERTURE_H_PRESENT)
|
||||||
|
#include <drm/drm_aperture.h>
|
||||||
|
#endif
|
||||||
|
void conftest_drm_aperture_remove_conflicting_framebuffers(void) {
|
||||||
|
drm_aperture_remove_conflicting_framebuffers();
|
||||||
|
}"
|
||||||
|
|
||||||
|
compile_check_conftest "$CODE" "NV_DRM_APERTURE_REMOVE_CONFLICTING_FRAMEBUFFERS_PRESENT" "" "functions"
|
||||||
|
;;
|
||||||
|
|
||||||
|
drm_aperture_remove_conflicting_framebuffers_has_driver_arg)
|
||||||
|
#
|
||||||
|
# Determine whether drm_aperture_remove_conflicting_framebuffers
|
||||||
|
# takes a struct drm_driver * as its fourth argument.
|
||||||
|
#
|
||||||
|
# Prior to commit 97c9bfe3f6605d41eb8f1206e6e0f62b31ba15d6, the
|
||||||
|
# second argument was a char * pointer to the driver's name.
|
||||||
|
#
|
||||||
|
# To test if drm_aperture_remove_conflicting_framebuffers() has
|
||||||
|
# a req_driver argument, define a function with the expected
|
||||||
|
# signature and then define the corresponding function
|
||||||
|
# implementation with the expected signature. Successful compilation
|
||||||
|
# indicates that this function has the expected signature.
|
||||||
|
#
|
||||||
|
# This change occurred in commit 97c9bfe3f660 ("drm/aperture: Pass
|
||||||
|
# DRM driver structure instead of driver name") in v5.15
|
||||||
|
# (2021-06-29).
|
||||||
|
#
|
||||||
|
CODE="
|
||||||
|
#if defined(NV_DRM_DRM_DRV_H_PRESENT)
|
||||||
|
#include <drm/drm_drv.h>
|
||||||
|
#endif
|
||||||
|
#if defined(NV_DRM_DRM_APERTURE_H_PRESENT)
|
||||||
|
#include <drm/drm_aperture.h>
|
||||||
|
#endif
|
||||||
|
typeof(drm_aperture_remove_conflicting_framebuffers) conftest_drm_aperture_remove_conflicting_framebuffers;
|
||||||
|
int conftest_drm_aperture_remove_conflicting_framebuffers(resource_size_t base, resource_size_t size,
|
||||||
|
bool primary, const struct drm_driver *req_driver)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}"
|
||||||
|
|
||||||
|
compile_check_conftest "$CODE" "NV_DRM_APERTURE_REMOVE_CONFLICTING_FRAMEBUFFERS_HAS_DRIVER_ARG" "" "types"
|
||||||
|
;;
|
||||||
|
|
||||||
|
drm_aperture_remove_conflicting_framebuffers_has_no_primary_arg)
|
||||||
|
#
|
||||||
|
# Determine whether drm_aperture_remove_conflicting_framebuffers
|
||||||
|
# has its third argument as a bool.
|
||||||
|
#
|
||||||
|
# Prior to commit 62aeaeaa1b267c5149abee6b45967a5df3feed58, the
|
||||||
|
# third argument was a bool for figuring out whether the legacy vga
|
||||||
|
# stuff should be nuked, but it's only for pci devices and not
|
||||||
|
# really needed in this function.
|
||||||
|
#
|
||||||
|
# To test if drm_aperture_remove_conflicting_framebuffers() has
|
||||||
|
# a bool primary argument, define a function with the expected
|
||||||
|
# signature and then define the corresponding function
|
||||||
|
# implementation with the expected signature. Successful compilation
|
||||||
|
# indicates that this function has the expected signature.
|
||||||
|
#
|
||||||
|
# This change occurred in commit 62aeaeaa1b26 ("drm/aperture: Remove
|
||||||
|
# primary argument") in v6.5 (2023-04-16).
|
||||||
|
#
|
||||||
|
CODE="
|
||||||
|
#if defined(NV_DRM_DRM_DRV_H_PRESENT)
|
||||||
|
#include <drm/drm_drv.h>
|
||||||
|
#endif
|
||||||
|
#if defined(NV_DRM_DRM_APERTURE_H_PRESENT)
|
||||||
|
#include <drm/drm_aperture.h>
|
||||||
|
#endif
|
||||||
|
typeof(drm_aperture_remove_conflicting_framebuffers) conftest_drm_aperture_remove_conflicting_framebuffers;
|
||||||
|
int conftest_drm_aperture_remove_conflicting_framebuffers(resource_size_t base, resource_size_t size,
|
||||||
|
const struct drm_driver *req_driver)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}"
|
||||||
|
|
||||||
|
compile_check_conftest "$CODE" "NV_DRM_APERTURE_REMOVE_CONFLICTING_FRAMEBUFFERS_HAS_NO_PRIMARY_ARG" "" "types"
|
||||||
|
;;
|
||||||
|
|
||||||
# When adding a new conftest entry, please use the correct format for
|
# When adding a new conftest entry, please use the correct format for
|
||||||
# specifying the relevant upstream Linux kernel commit.
|
# specifying the relevant upstream Linux kernel commit.
|
||||||
#
|
#
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015-2022, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2015-2024, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -604,9 +604,7 @@ static int nv_drm_plane_atomic_set_property(
|
|||||||
to_nv_drm_plane_state(state);
|
to_nv_drm_plane_state(state);
|
||||||
|
|
||||||
if (property == nv_dev->nv_out_fence_property) {
|
if (property == nv_dev->nv_out_fence_property) {
|
||||||
#if defined(NV_LINUX_NVHOST_H_PRESENT) && defined(CONFIG_TEGRA_GRHOST)
|
|
||||||
nv_drm_plane_state->fd_user_ptr = u64_to_user_ptr(val);
|
nv_drm_plane_state->fd_user_ptr = u64_to_user_ptr(val);
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
} else if (property == nv_dev->nv_input_colorspace_property) {
|
} else if (property == nv_dev->nv_input_colorspace_property) {
|
||||||
nv_drm_plane_state->input_colorspace = val;
|
nv_drm_plane_state->input_colorspace = val;
|
||||||
@@ -654,6 +652,38 @@ static int nv_drm_plane_atomic_get_property(
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nv_drm_plane_atomic_reset - plane state reset hook
|
||||||
|
* @plane: DRM plane
|
||||||
|
*
|
||||||
|
* Allocate an empty DRM plane state.
|
||||||
|
*/
|
||||||
|
static void nv_drm_plane_atomic_reset(struct drm_plane *plane)
|
||||||
|
{
|
||||||
|
struct nv_drm_plane_state *nv_plane_state =
|
||||||
|
nv_drm_calloc(1, sizeof(*nv_plane_state));
|
||||||
|
|
||||||
|
if (!nv_plane_state) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
drm_atomic_helper_plane_reset(plane);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The drm atomic helper function allocates a state object that is the wrong
|
||||||
|
* size. Copy its contents into the one we allocated above and replace the
|
||||||
|
* pointer.
|
||||||
|
*/
|
||||||
|
if (plane->state) {
|
||||||
|
nv_plane_state->base = *plane->state;
|
||||||
|
kfree(plane->state);
|
||||||
|
plane->state = &nv_plane_state->base;
|
||||||
|
} else {
|
||||||
|
kfree(nv_plane_state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct drm_plane_state *
|
static struct drm_plane_state *
|
||||||
nv_drm_plane_atomic_duplicate_state(struct drm_plane *plane)
|
nv_drm_plane_atomic_duplicate_state(struct drm_plane *plane)
|
||||||
{
|
{
|
||||||
@@ -713,7 +743,7 @@ static const struct drm_plane_funcs nv_plane_funcs = {
|
|||||||
.update_plane = drm_atomic_helper_update_plane,
|
.update_plane = drm_atomic_helper_update_plane,
|
||||||
.disable_plane = drm_atomic_helper_disable_plane,
|
.disable_plane = drm_atomic_helper_disable_plane,
|
||||||
.destroy = nv_drm_plane_destroy,
|
.destroy = nv_drm_plane_destroy,
|
||||||
.reset = drm_atomic_helper_plane_reset,
|
.reset = nv_drm_plane_atomic_reset,
|
||||||
.atomic_get_property = nv_drm_plane_atomic_get_property,
|
.atomic_get_property = nv_drm_plane_atomic_get_property,
|
||||||
.atomic_set_property = nv_drm_plane_atomic_set_property,
|
.atomic_set_property = nv_drm_plane_atomic_set_property,
|
||||||
.atomic_duplicate_state = nv_drm_plane_atomic_duplicate_state,
|
.atomic_duplicate_state = nv_drm_plane_atomic_duplicate_state,
|
||||||
@@ -770,6 +800,36 @@ static inline void nv_drm_crtc_duplicate_req_head_modeset_config(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nv_drm_atomic_crtc_reset - crtc state reset hook
|
||||||
|
* @crtc: DRM crtc
|
||||||
|
*
|
||||||
|
* Allocate an empty DRM crtc state.
|
||||||
|
*/
|
||||||
|
static void nv_drm_atomic_crtc_reset(struct drm_crtc *crtc)
|
||||||
|
{
|
||||||
|
struct nv_drm_crtc_state *nv_state = nv_drm_calloc(1, sizeof(*nv_state));
|
||||||
|
|
||||||
|
if (!nv_state) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
drm_atomic_helper_crtc_reset(crtc);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The drm atomic helper function allocates a state object that is the wrong
|
||||||
|
* size. Copy its contents into the one we allocated above and replace the
|
||||||
|
* pointer.
|
||||||
|
*/
|
||||||
|
if (crtc->state) {
|
||||||
|
nv_state->base = *crtc->state;
|
||||||
|
kfree(crtc->state);
|
||||||
|
crtc->state = &nv_state->base;
|
||||||
|
} else {
|
||||||
|
kfree(nv_state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nv_drm_atomic_crtc_duplicate_state - crtc state duplicate hook
|
* nv_drm_atomic_crtc_duplicate_state - crtc state duplicate hook
|
||||||
* @crtc: DRM crtc
|
* @crtc: DRM crtc
|
||||||
@@ -831,7 +891,7 @@ static void nv_drm_atomic_crtc_destroy_state(struct drm_crtc *crtc,
|
|||||||
static struct drm_crtc_funcs nv_crtc_funcs = {
|
static struct drm_crtc_funcs nv_crtc_funcs = {
|
||||||
.set_config = drm_atomic_helper_set_config,
|
.set_config = drm_atomic_helper_set_config,
|
||||||
.page_flip = drm_atomic_helper_page_flip,
|
.page_flip = drm_atomic_helper_page_flip,
|
||||||
.reset = drm_atomic_helper_crtc_reset,
|
.reset = nv_drm_atomic_crtc_reset,
|
||||||
.destroy = nv_drm_crtc_destroy,
|
.destroy = nv_drm_crtc_destroy,
|
||||||
.atomic_duplicate_state = nv_drm_atomic_crtc_duplicate_state,
|
.atomic_duplicate_state = nv_drm_atomic_crtc_duplicate_state,
|
||||||
.atomic_destroy_state = nv_drm_atomic_crtc_destroy_state,
|
.atomic_destroy_state = nv_drm_atomic_crtc_destroy_state,
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015-2022, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2015-2024, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -60,7 +60,17 @@
|
|||||||
#include <drm/drm_ioctl.h>
|
#include <drm/drm_ioctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(NV_DRM_FBDEV_GENERIC_AVAILABLE)
|
||||||
|
#include <drm/drm_aperture.h>
|
||||||
|
#include <drm/drm_fb_helper.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(NV_DRM_DRM_FBDEV_GENERIC_H_PRESENT)
|
||||||
|
#include <drm/drm_fbdev_generic.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <linux/pci.h>
|
#include <linux/pci.h>
|
||||||
|
#include <linux/workqueue.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Commit fcd70cd36b9b ("drm: Split out drm_probe_helper.h")
|
* Commit fcd70cd36b9b ("drm: Split out drm_probe_helper.h")
|
||||||
@@ -84,6 +94,11 @@
|
|||||||
#include <drm/drm_atomic_helper.h>
|
#include <drm/drm_atomic_helper.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static int nv_drm_revoke_modeset_permission(struct drm_device *dev,
|
||||||
|
struct drm_file *filep,
|
||||||
|
NvU32 dpyId);
|
||||||
|
static int nv_drm_revoke_sub_ownership(struct drm_device *dev);
|
||||||
|
|
||||||
static struct nv_drm_device *dev_list = NULL;
|
static struct nv_drm_device *dev_list = NULL;
|
||||||
|
|
||||||
static const char* nv_get_input_colorspace_name(
|
static const char* nv_get_input_colorspace_name(
|
||||||
@@ -354,19 +369,15 @@ static int nv_drm_create_properties(struct nv_drm_device *nv_dev)
|
|||||||
len++;
|
len++;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(NV_LINUX_NVHOST_H_PRESENT) && defined(CONFIG_TEGRA_GRHOST)
|
if (nv_dev->supportsSyncpts) {
|
||||||
if (!nv_dev->supportsSyncpts) {
|
nv_dev->nv_out_fence_property =
|
||||||
return 0;
|
drm_property_create_range(nv_dev->dev, DRM_MODE_PROP_ATOMIC,
|
||||||
|
"NV_DRM_OUT_FENCE_PTR", 0, U64_MAX);
|
||||||
|
if (nv_dev->nv_out_fence_property == NULL) {
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nv_dev->nv_out_fence_property =
|
|
||||||
drm_property_create_range(nv_dev->dev, DRM_MODE_PROP_ATOMIC,
|
|
||||||
"NV_DRM_OUT_FENCE_PTR", 0, U64_MAX);
|
|
||||||
if (nv_dev->nv_out_fence_property == NULL) {
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
nv_dev->nv_input_colorspace_property =
|
nv_dev->nv_input_colorspace_property =
|
||||||
drm_property_create_enum(nv_dev->dev, 0, "NV_INPUT_COLORSPACE",
|
drm_property_create_enum(nv_dev->dev, 0, "NV_INPUT_COLORSPACE",
|
||||||
enum_list, len);
|
enum_list, len);
|
||||||
@@ -387,6 +398,25 @@ static int nv_drm_create_properties(struct nv_drm_device *nv_dev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We can't just call drm_kms_helper_hotplug_event directly because
|
||||||
|
* fbdev_generic may attempt to set a mode from inside the hotplug event
|
||||||
|
* handler. Because kapi event handling runs on nvkms_kthread_q, this blocks
|
||||||
|
* other event processing including the flip completion notifier expected by
|
||||||
|
* nv_drm_atomic_commit.
|
||||||
|
*
|
||||||
|
* Defer hotplug event handling to a work item so that nvkms_kthread_q can
|
||||||
|
* continue processing events while a DRM modeset is in progress.
|
||||||
|
*/
|
||||||
|
static void nv_drm_handle_hotplug_event(struct work_struct *work)
|
||||||
|
{
|
||||||
|
struct delayed_work *dwork = to_delayed_work(work);
|
||||||
|
struct nv_drm_device *nv_dev =
|
||||||
|
container_of(dwork, struct nv_drm_device, hotplug_event_work);
|
||||||
|
|
||||||
|
drm_kms_helper_hotplug_event(nv_dev->dev);
|
||||||
|
}
|
||||||
|
|
||||||
static int nv_drm_load(struct drm_device *dev, unsigned long flags)
|
static int nv_drm_load(struct drm_device *dev, unsigned long flags)
|
||||||
{
|
{
|
||||||
#if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
|
#if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
|
||||||
@@ -440,6 +470,22 @@ static int nv_drm_load(struct drm_device *dev, unsigned long flags)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(NV_DRM_FBDEV_GENERIC_AVAILABLE)
|
||||||
|
/*
|
||||||
|
* If fbdev is enabled, take modeset ownership now before other DRM clients
|
||||||
|
* can take master (and thus NVKMS ownership).
|
||||||
|
*/
|
||||||
|
if (nv_drm_fbdev_module_param) {
|
||||||
|
if (!nvKms->grabOwnership(pDevice)) {
|
||||||
|
nvKms->freeDevice(pDevice);
|
||||||
|
NV_DRM_DEV_LOG_ERR(nv_dev, "Failed to grab NVKMS modeset ownership");
|
||||||
|
return -EBUSY;
|
||||||
|
}
|
||||||
|
|
||||||
|
nv_dev->hasFramebufferConsole = NV_TRUE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
mutex_lock(&nv_dev->lock);
|
mutex_lock(&nv_dev->lock);
|
||||||
|
|
||||||
/* Set NvKmsKapiDevice */
|
/* Set NvKmsKapiDevice */
|
||||||
@@ -522,6 +568,7 @@ static int nv_drm_load(struct drm_device *dev, unsigned long flags)
|
|||||||
|
|
||||||
/* Enable event handling */
|
/* Enable event handling */
|
||||||
|
|
||||||
|
INIT_DELAYED_WORK(&nv_dev->hotplug_event_work, nv_drm_handle_hotplug_event);
|
||||||
atomic_set(&nv_dev->enable_event_handling, true);
|
atomic_set(&nv_dev->enable_event_handling, true);
|
||||||
|
|
||||||
init_waitqueue_head(&nv_dev->flip_event_wq);
|
init_waitqueue_head(&nv_dev->flip_event_wq);
|
||||||
@@ -549,8 +596,20 @@ static void __nv_drm_unload(struct drm_device *dev)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Release modeset ownership if fbdev is enabled */
|
||||||
|
|
||||||
|
#if defined(NV_DRM_FBDEV_GENERIC_AVAILABLE)
|
||||||
|
if (nv_dev->hasFramebufferConsole) {
|
||||||
|
drm_atomic_helper_shutdown(dev);
|
||||||
|
nvKms->releaseOwnership(nv_dev->pDevice);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cancel_delayed_work_sync(&nv_dev->hotplug_event_work);
|
||||||
mutex_lock(&nv_dev->lock);
|
mutex_lock(&nv_dev->lock);
|
||||||
|
|
||||||
|
WARN_ON(nv_dev->subOwnershipGranted);
|
||||||
|
|
||||||
/* Disable event handling */
|
/* Disable event handling */
|
||||||
|
|
||||||
atomic_set(&nv_dev->enable_event_handling, false);
|
atomic_set(&nv_dev->enable_event_handling, false);
|
||||||
@@ -600,7 +659,12 @@ static int __nv_drm_master_set(struct drm_device *dev,
|
|||||||
{
|
{
|
||||||
struct nv_drm_device *nv_dev = to_nv_device(dev);
|
struct nv_drm_device *nv_dev = to_nv_device(dev);
|
||||||
|
|
||||||
if (!nvKms->grabOwnership(nv_dev->pDevice)) {
|
/*
|
||||||
|
* If this device is driving a framebuffer, then nvidia-drm already has
|
||||||
|
* modeset ownership. Otherwise, grab ownership now.
|
||||||
|
*/
|
||||||
|
if (!nv_dev->hasFramebufferConsole &&
|
||||||
|
!nvKms->grabOwnership(nv_dev->pDevice)) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -634,33 +698,39 @@ void nv_drm_master_drop(struct drm_device *dev, struct drm_file *file_priv)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
struct nv_drm_device *nv_dev = to_nv_device(dev);
|
struct nv_drm_device *nv_dev = to_nv_device(dev);
|
||||||
int err;
|
|
||||||
|
|
||||||
/*
|
nv_drm_revoke_modeset_permission(dev, file_priv, 0);
|
||||||
* After dropping nvkms modeset onwership, it is not guaranteed that
|
nv_drm_revoke_sub_ownership(dev);
|
||||||
* drm and nvkms modeset state will remain in sync. Therefore, disable
|
|
||||||
* all outputs and crtcs before dropping nvkms modeset ownership.
|
|
||||||
*
|
|
||||||
* First disable all active outputs atomically and then disable each crtc one
|
|
||||||
* by one, there is not helper function available to disable all crtcs
|
|
||||||
* atomically.
|
|
||||||
*/
|
|
||||||
|
|
||||||
drm_modeset_lock_all(dev);
|
if (!nv_dev->hasFramebufferConsole) {
|
||||||
|
int err;
|
||||||
|
|
||||||
if ((err = nv_drm_atomic_helper_disable_all(
|
/*
|
||||||
dev,
|
* After dropping nvkms modeset onwership, it is not guaranteed that drm
|
||||||
dev->mode_config.acquire_ctx)) != 0) {
|
* and nvkms modeset state will remain in sync. Therefore, disable all
|
||||||
|
* outputs and crtcs before dropping nvkms modeset ownership.
|
||||||
|
*
|
||||||
|
* First disable all active outputs atomically and then disable each
|
||||||
|
* crtc one by one, there is not helper function available to disable
|
||||||
|
* all crtcs atomically.
|
||||||
|
*/
|
||||||
|
|
||||||
NV_DRM_DEV_LOG_ERR(
|
drm_modeset_lock_all(dev);
|
||||||
nv_dev,
|
|
||||||
"nv_drm_atomic_helper_disable_all failed with error code %d !",
|
if ((err = nv_drm_atomic_helper_disable_all(
|
||||||
err);
|
dev,
|
||||||
|
dev->mode_config.acquire_ctx)) != 0) {
|
||||||
|
|
||||||
|
NV_DRM_DEV_LOG_ERR(
|
||||||
|
nv_dev,
|
||||||
|
"nv_drm_atomic_helper_disable_all failed with error code %d !",
|
||||||
|
err);
|
||||||
|
}
|
||||||
|
|
||||||
|
drm_modeset_unlock_all(dev);
|
||||||
|
|
||||||
|
nvKms->releaseOwnership(nv_dev->pDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
drm_modeset_unlock_all(dev);
|
|
||||||
|
|
||||||
nvKms->releaseOwnership(nv_dev->pDevice);
|
|
||||||
}
|
}
|
||||||
#endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
|
#endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
|
||||||
|
|
||||||
@@ -844,10 +914,10 @@ static NvU32 nv_drm_get_head_bit_from_connector(struct drm_connector *connector)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nv_drm_grant_permission_ioctl(struct drm_device *dev, void *data,
|
static int nv_drm_grant_modeset_permission(struct drm_device *dev,
|
||||||
struct drm_file *filep)
|
struct drm_nvidia_grant_permissions_params *params,
|
||||||
|
struct drm_file *filep)
|
||||||
{
|
{
|
||||||
struct drm_nvidia_grant_permissions_params *params = data;
|
|
||||||
struct nv_drm_device *nv_dev = to_nv_device(dev);
|
struct nv_drm_device *nv_dev = to_nv_device(dev);
|
||||||
struct nv_drm_connector *target_nv_connector = NULL;
|
struct nv_drm_connector *target_nv_connector = NULL;
|
||||||
struct nv_drm_crtc *target_nv_crtc = NULL;
|
struct nv_drm_crtc *target_nv_crtc = NULL;
|
||||||
@@ -969,6 +1039,67 @@ done:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int nv_drm_grant_sub_ownership(struct drm_device *dev,
|
||||||
|
struct drm_nvidia_grant_permissions_params *params)
|
||||||
|
{
|
||||||
|
int ret = -EINVAL;
|
||||||
|
struct nv_drm_device *nv_dev = to_nv_device(dev);
|
||||||
|
struct drm_modeset_acquire_ctx *pctx;
|
||||||
|
#if NV_DRM_MODESET_LOCK_ALL_END_ARGUMENT_COUNT == 3
|
||||||
|
struct drm_modeset_acquire_ctx ctx;
|
||||||
|
DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE,
|
||||||
|
ret);
|
||||||
|
pctx = &ctx;
|
||||||
|
#else
|
||||||
|
mutex_lock(&dev->mode_config.mutex);
|
||||||
|
pctx = dev->mode_config.acquire_ctx;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (nv_dev->subOwnershipGranted ||
|
||||||
|
!nvKms->grantSubOwnership(params->fd, nv_dev->pDevice)) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When creating an ownership grant, shut down all heads and disable flip
|
||||||
|
* notifications.
|
||||||
|
*/
|
||||||
|
ret = nv_drm_atomic_helper_disable_all(dev, pctx);
|
||||||
|
if (ret != 0) {
|
||||||
|
NV_DRM_DEV_LOG_ERR(
|
||||||
|
nv_dev,
|
||||||
|
"nv_drm_atomic_helper_disable_all failed with error code %d!",
|
||||||
|
ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
atomic_set(&nv_dev->enable_event_handling, false);
|
||||||
|
nv_dev->subOwnershipGranted = NV_TRUE;
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
|
done:
|
||||||
|
#if NV_DRM_MODESET_LOCK_ALL_END_ARGUMENT_COUNT == 3
|
||||||
|
DRM_MODESET_LOCK_ALL_END(dev, ctx, ret);
|
||||||
|
#else
|
||||||
|
mutex_unlock(&dev->mode_config.mutex);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int nv_drm_grant_permission_ioctl(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *filep)
|
||||||
|
{
|
||||||
|
struct drm_nvidia_grant_permissions_params *params = data;
|
||||||
|
|
||||||
|
if (params->type == NV_DRM_PERMISSIONS_TYPE_MODESET) {
|
||||||
|
return nv_drm_grant_modeset_permission(dev, params, filep);
|
||||||
|
} else if (params->type == NV_DRM_PERMISSIONS_TYPE_SUB_OWNER) {
|
||||||
|
return nv_drm_grant_sub_ownership(dev, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
static bool nv_drm_revoke_connector(struct nv_drm_device *nv_dev,
|
static bool nv_drm_revoke_connector(struct nv_drm_device *nv_dev,
|
||||||
struct nv_drm_connector *nv_connector)
|
struct nv_drm_connector *nv_connector)
|
||||||
{
|
{
|
||||||
@@ -986,8 +1117,8 @@ static bool nv_drm_revoke_connector(struct nv_drm_device *nv_dev,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nv_drm_revoke_permission(struct drm_device *dev,
|
static int nv_drm_revoke_modeset_permission(struct drm_device *dev,
|
||||||
struct drm_file *filep, NvU32 dpyId)
|
struct drm_file *filep, NvU32 dpyId)
|
||||||
{
|
{
|
||||||
struct drm_connector *connector;
|
struct drm_connector *connector;
|
||||||
struct drm_crtc *crtc;
|
struct drm_crtc *crtc;
|
||||||
@@ -1040,14 +1171,55 @@ static int nv_drm_revoke_permission(struct drm_device *dev,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int nv_drm_revoke_sub_ownership(struct drm_device *dev)
|
||||||
|
{
|
||||||
|
int ret = -EINVAL;
|
||||||
|
struct nv_drm_device *nv_dev = to_nv_device(dev);
|
||||||
|
#if NV_DRM_MODESET_LOCK_ALL_END_ARGUMENT_COUNT == 3
|
||||||
|
struct drm_modeset_acquire_ctx ctx;
|
||||||
|
DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE,
|
||||||
|
ret);
|
||||||
|
#else
|
||||||
|
mutex_lock(&dev->mode_config.mutex);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!nv_dev->subOwnershipGranted) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!nvKms->revokeSubOwnership(nv_dev->pDevice)) {
|
||||||
|
NV_DRM_DEV_LOG_ERR(nv_dev, "Failed to revoke sub-ownership from NVKMS");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
nv_dev->subOwnershipGranted = NV_FALSE;
|
||||||
|
atomic_set(&nv_dev->enable_event_handling, true);
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
|
done:
|
||||||
|
#if NV_DRM_MODESET_LOCK_ALL_END_ARGUMENT_COUNT == 3
|
||||||
|
DRM_MODESET_LOCK_ALL_END(dev, ctx, ret);
|
||||||
|
#else
|
||||||
|
mutex_unlock(&dev->mode_config.mutex);
|
||||||
|
#endif
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static int nv_drm_revoke_permission_ioctl(struct drm_device *dev, void *data,
|
static int nv_drm_revoke_permission_ioctl(struct drm_device *dev, void *data,
|
||||||
struct drm_file *filep)
|
struct drm_file *filep)
|
||||||
{
|
{
|
||||||
struct drm_nvidia_revoke_permissions_params *params = data;
|
struct drm_nvidia_revoke_permissions_params *params = data;
|
||||||
if (!params->dpyId) {
|
|
||||||
return -EINVAL;
|
if (params->type == NV_DRM_PERMISSIONS_TYPE_MODESET) {
|
||||||
|
if (!params->dpyId) {
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
return nv_drm_revoke_modeset_permission(dev, filep, params->dpyId);
|
||||||
|
} else if (params->type == NV_DRM_PERMISSIONS_TYPE_SUB_OWNER) {
|
||||||
|
return nv_drm_revoke_sub_ownership(dev);
|
||||||
}
|
}
|
||||||
return nv_drm_revoke_permission(dev, filep, params->dpyId);
|
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nv_drm_postclose(struct drm_device *dev, struct drm_file *filep)
|
static void nv_drm_postclose(struct drm_device *dev, struct drm_file *filep)
|
||||||
@@ -1062,7 +1234,7 @@ static void nv_drm_postclose(struct drm_device *dev, struct drm_file *filep)
|
|||||||
dev->mode_config.num_connector > 0 &&
|
dev->mode_config.num_connector > 0 &&
|
||||||
dev->mode_config.connector_list.next != NULL &&
|
dev->mode_config.connector_list.next != NULL &&
|
||||||
dev->mode_config.connector_list.prev != NULL) {
|
dev->mode_config.connector_list.prev != NULL) {
|
||||||
nv_drm_revoke_permission(dev, filep, 0);
|
nv_drm_revoke_modeset_permission(dev, filep, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
|
#endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
|
||||||
@@ -1332,9 +1504,21 @@ static const struct drm_ioctl_desc nv_drm_ioctls[] = {
|
|||||||
DRM_RENDER_ALLOW|DRM_UNLOCKED),
|
DRM_RENDER_ALLOW|DRM_UNLOCKED),
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DRM_UNLOCKED is implicit for all non-legacy DRM driver IOCTLs since Linux
|
||||||
|
* v4.10 commit fa5386459f06 "drm: Used DRM_LEGACY for all legacy functions"
|
||||||
|
* (Linux v4.4 commit ea487835e887 "drm: Enforce unlocked ioctl operation
|
||||||
|
* for kms driver ioctls" previously did it only for drivers that set the
|
||||||
|
* DRM_MODESET flag), so this will race with SET_CLIENT_CAP. Linux v4.11
|
||||||
|
* commit dcf727ab5d17 "drm: setclientcap doesn't need the drm BKL" also
|
||||||
|
* removed locking from SET_CLIENT_CAP so there is no use attempting to lock
|
||||||
|
* manually. The latter commit acknowledges that this can expose userspace
|
||||||
|
* to inconsistent behavior when racing with itself, but accepts that risk.
|
||||||
|
*/
|
||||||
DRM_IOCTL_DEF_DRV(NVIDIA_GET_CLIENT_CAPABILITY,
|
DRM_IOCTL_DEF_DRV(NVIDIA_GET_CLIENT_CAPABILITY,
|
||||||
nv_drm_get_client_capability_ioctl,
|
nv_drm_get_client_capability_ioctl,
|
||||||
0),
|
0),
|
||||||
|
|
||||||
#if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
|
#if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
|
||||||
DRM_IOCTL_DEF_DRV(NVIDIA_GET_CRTC_CRC32,
|
DRM_IOCTL_DEF_DRV(NVIDIA_GET_CRTC_CRC32,
|
||||||
nv_drm_get_crtc_crc32_ioctl,
|
nv_drm_get_crtc_crc32_ioctl,
|
||||||
@@ -1387,8 +1571,23 @@ static struct drm_driver nv_drm_driver = {
|
|||||||
.ioctls = nv_drm_ioctls,
|
.ioctls = nv_drm_ioctls,
|
||||||
.num_ioctls = ARRAY_SIZE(nv_drm_ioctls),
|
.num_ioctls = ARRAY_SIZE(nv_drm_ioctls),
|
||||||
|
|
||||||
|
/*
|
||||||
|
* linux-next commit 71a7974ac701 ("drm/prime: Unexport helpers for fd/handle
|
||||||
|
* conversion") unexports drm_gem_prime_handle_to_fd() and
|
||||||
|
* drm_gem_prime_fd_to_handle().
|
||||||
|
*
|
||||||
|
* Prior linux-next commit 6b85aa68d9d5 ("drm: Enable PRIME import/export for
|
||||||
|
* all drivers") made these helpers the default when .prime_handle_to_fd /
|
||||||
|
* .prime_fd_to_handle are unspecified, so it's fine to just skip specifying
|
||||||
|
* them if the helpers aren't present.
|
||||||
|
*/
|
||||||
|
#if NV_IS_EXPORT_SYMBOL_PRESENT_drm_gem_prime_handle_to_fd
|
||||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
||||||
|
#endif
|
||||||
|
#if NV_IS_EXPORT_SYMBOL_PRESENT_drm_gem_prime_fd_to_handle
|
||||||
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
|
||||||
|
#endif
|
||||||
|
|
||||||
.gem_prime_import = nv_drm_gem_prime_import,
|
.gem_prime_import = nv_drm_gem_prime_import,
|
||||||
.gem_prime_import_sg_table = nv_drm_gem_prime_import_sg_table,
|
.gem_prime_import_sg_table = nv_drm_gem_prime_import_sg_table,
|
||||||
|
|
||||||
@@ -1472,6 +1671,7 @@ static void nv_drm_register_drm_device(const nv_gpu_info_t *gpu_info)
|
|||||||
struct nv_drm_device *nv_dev = NULL;
|
struct nv_drm_device *nv_dev = NULL;
|
||||||
struct drm_device *dev = NULL;
|
struct drm_device *dev = NULL;
|
||||||
struct device *device = gpu_info->os_device_ptr;
|
struct device *device = gpu_info->os_device_ptr;
|
||||||
|
bool bus_is_pci;
|
||||||
|
|
||||||
DRM_DEBUG(
|
DRM_DEBUG(
|
||||||
"Registering device for NVIDIA GPU ID 0x08%x",
|
"Registering device for NVIDIA GPU ID 0x08%x",
|
||||||
@@ -1505,8 +1705,15 @@ static void nv_drm_register_drm_device(const nv_gpu_info_t *gpu_info)
|
|||||||
dev->dev_private = nv_dev;
|
dev->dev_private = nv_dev;
|
||||||
nv_dev->dev = dev;
|
nv_dev->dev = dev;
|
||||||
|
|
||||||
|
bus_is_pci =
|
||||||
|
#if defined(NV_LINUX)
|
||||||
|
device->bus == &pci_bus_type;
|
||||||
|
#elif defined(NV_BSD)
|
||||||
|
devclass_find("pci");
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(NV_DRM_DEVICE_HAS_PDEV)
|
#if defined(NV_DRM_DEVICE_HAS_PDEV)
|
||||||
if (device->bus == &pci_bus_type) {
|
if (bus_is_pci) {
|
||||||
dev->pdev = to_pci_dev(device);
|
dev->pdev = to_pci_dev(device);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1518,6 +1725,42 @@ static void nv_drm_register_drm_device(const nv_gpu_info_t *gpu_info)
|
|||||||
goto failed_drm_register;
|
goto failed_drm_register;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(NV_DRM_FBDEV_GENERIC_AVAILABLE)
|
||||||
|
if (nv_drm_fbdev_module_param &&
|
||||||
|
drm_core_check_feature(dev, DRIVER_MODESET)) {
|
||||||
|
|
||||||
|
if (bus_is_pci) {
|
||||||
|
struct pci_dev *pdev = to_pci_dev(device);
|
||||||
|
|
||||||
|
#if defined(NV_DRM_APERTURE_REMOVE_CONFLICTING_PCI_FRAMEBUFFERS_HAS_DRIVER_ARG)
|
||||||
|
drm_aperture_remove_conflicting_pci_framebuffers(pdev, &nv_drm_driver);
|
||||||
|
#else
|
||||||
|
drm_aperture_remove_conflicting_pci_framebuffers(pdev, nv_drm_driver.name);
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
struct NvKmsKapiVtFbParams params;
|
||||||
|
resource_size_t base, size = 0;
|
||||||
|
|
||||||
|
if (nvKms->getVtFbInfo(nv_dev->pDevice, ¶ms)) {
|
||||||
|
|
||||||
|
base = (resource_size_t) params.baseAddress;
|
||||||
|
size = (resource_size_t) params.size;
|
||||||
|
|
||||||
|
#if defined(NV_DRM_APERTURE_REMOVE_CONFLICTING_FRAMEBUFFERS_HAS_DRIVER_ARG)
|
||||||
|
drm_aperture_remove_conflicting_framebuffers(base, size, false, &nv_drm_driver);
|
||||||
|
#elif defined(NV_DRM_APERTURE_REMOVE_CONFLICTING_FRAMEBUFFERS_HAS_NO_PRIMARY_ARG)
|
||||||
|
drm_aperture_remove_conflicting_framebuffers(base, size, &nv_drm_driver);
|
||||||
|
#else
|
||||||
|
drm_aperture_remove_conflicting_framebuffers(base, size, false, nv_drm_driver.name);
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
NV_DRM_DEV_LOG_WARN(nv_dev, "Failed to get framebuffer console info");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
drm_fbdev_generic_setup(dev, 32);
|
||||||
|
}
|
||||||
|
#endif /* defined(NV_DRM_FBDEV_GENERIC_AVAILABLE) */
|
||||||
|
|
||||||
/* Add NVIDIA-DRM device into list */
|
/* Add NVIDIA-DRM device into list */
|
||||||
|
|
||||||
nv_dev->next = dev_list;
|
nv_dev->next = dev_list;
|
||||||
@@ -1587,9 +1830,10 @@ void nv_drm_remove_devices(void)
|
|||||||
{
|
{
|
||||||
while (dev_list != NULL) {
|
while (dev_list != NULL) {
|
||||||
struct nv_drm_device *next = dev_list->next;
|
struct nv_drm_device *next = dev_list->next;
|
||||||
|
struct drm_device *dev = dev_list->dev;
|
||||||
|
|
||||||
drm_dev_unregister(dev_list->dev);
|
drm_dev_unregister(dev);
|
||||||
nv_drm_dev_free(dev_list->dev);
|
nv_drm_dev_free(dev);
|
||||||
|
|
||||||
nv_drm_free(dev_list);
|
nv_drm_free(dev_list);
|
||||||
|
|
||||||
@@ -1597,4 +1841,79 @@ void nv_drm_remove_devices(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Handle system suspend and resume.
|
||||||
|
*
|
||||||
|
* Normally, a DRM driver would use drm_mode_config_helper_suspend() to save the
|
||||||
|
* current state on suspend and drm_mode_config_helper_resume() to restore it
|
||||||
|
* after resume. This works for upstream drivers because user-mode tasks are
|
||||||
|
* frozen before the suspend hook is called.
|
||||||
|
*
|
||||||
|
* In the case of nvidia-drm, the suspend hook is also called when 'suspend' is
|
||||||
|
* written to /proc/driver/nvidia/suspend, before user-mode tasks are frozen.
|
||||||
|
* However, we don't actually need to save and restore the display state because
|
||||||
|
* the driver requires a VT switch to an unused VT before suspending and a
|
||||||
|
* switch back to the application (or fbdev console) on resume. The DRM client
|
||||||
|
* (or fbdev helper functions) will restore the appropriate mode on resume.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void nv_drm_suspend_resume(NvBool suspend)
|
||||||
|
{
|
||||||
|
static DEFINE_MUTEX(nv_drm_suspend_mutex);
|
||||||
|
static NvU32 nv_drm_suspend_count = 0;
|
||||||
|
struct nv_drm_device *nv_dev;
|
||||||
|
|
||||||
|
mutex_lock(&nv_drm_suspend_mutex);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Count the number of times the driver is asked to suspend. Suspend all DRM
|
||||||
|
* devices on the first suspend call and resume them on the last resume
|
||||||
|
* call. This is necessary because the kernel may call nvkms_suspend()
|
||||||
|
* simultaneously for each GPU, but NVKMS itself also suspends all GPUs on
|
||||||
|
* the first call.
|
||||||
|
*/
|
||||||
|
if (suspend) {
|
||||||
|
if (nv_drm_suspend_count++ > 0) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
BUG_ON(nv_drm_suspend_count == 0);
|
||||||
|
|
||||||
|
if (--nv_drm_suspend_count > 0) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
|
||||||
|
nv_dev = dev_list;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NVKMS shuts down all heads on suspend. Update DRM state accordingly.
|
||||||
|
*/
|
||||||
|
for (nv_dev = dev_list; nv_dev; nv_dev = nv_dev->next) {
|
||||||
|
struct drm_device *dev = nv_dev->dev;
|
||||||
|
|
||||||
|
if (!drm_core_check_feature(dev, DRIVER_MODESET)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (suspend) {
|
||||||
|
drm_kms_helper_poll_disable(dev);
|
||||||
|
#if defined(NV_DRM_FBDEV_GENERIC_AVAILABLE)
|
||||||
|
drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 1);
|
||||||
|
#endif
|
||||||
|
drm_mode_config_reset(dev);
|
||||||
|
} else {
|
||||||
|
#if defined(NV_DRM_FBDEV_GENERIC_AVAILABLE)
|
||||||
|
drm_fb_helper_set_suspend_unlocked(dev->fb_helper, 0);
|
||||||
|
#endif
|
||||||
|
drm_kms_helper_poll_enable(dev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
|
||||||
|
|
||||||
|
done:
|
||||||
|
mutex_unlock(&nv_drm_suspend_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* NV_DRM_AVAILABLE */
|
#endif /* NV_DRM_AVAILABLE */
|
||||||
@@ -31,6 +31,8 @@ int nv_drm_probe_devices(void);
|
|||||||
|
|
||||||
void nv_drm_remove_devices(void);
|
void nv_drm_remove_devices(void);
|
||||||
|
|
||||||
|
void nv_drm_suspend_resume(NvBool suspend);
|
||||||
|
|
||||||
#endif /* defined(NV_DRM_AVAILABLE) */
|
#endif /* defined(NV_DRM_AVAILABLE) */
|
||||||
|
|
||||||
#endif /* __NVIDIA_DRM_DRV_H__ */
|
#endif /* __NVIDIA_DRM_DRV_H__ */
|
||||||
@@ -300,7 +300,7 @@ void nv_drm_handle_display_change(struct nv_drm_device *nv_dev,
|
|||||||
|
|
||||||
nv_drm_connector_mark_connection_status_dirty(nv_encoder->nv_connector);
|
nv_drm_connector_mark_connection_status_dirty(nv_encoder->nv_connector);
|
||||||
|
|
||||||
drm_kms_helper_hotplug_event(dev);
|
schedule_delayed_work(&nv_dev->hotplug_event_work, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nv_drm_handle_dynamic_display_connected(struct nv_drm_device *nv_dev,
|
void nv_drm_handle_dynamic_display_connected(struct nv_drm_device *nv_dev,
|
||||||
@@ -347,6 +347,6 @@ void nv_drm_handle_dynamic_display_connected(struct nv_drm_device *nv_dev,
|
|||||||
drm_reinit_primary_mode_group(dev);
|
drm_reinit_primary_mode_group(dev);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
drm_kms_helper_hotplug_event(dev);
|
schedule_delayed_work(&nv_dev->hotplug_event_work, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -180,7 +180,35 @@ static void *__nv_drm_gem_nvkms_prime_vmap(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nv_nvkms_memory->pWriteCombinedIORemapAddress;
|
if (nv_nvkms_memory->physically_mapped) {
|
||||||
|
return nv_nvkms_memory->pWriteCombinedIORemapAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If this buffer isn't physically mapped, it might be backed by struct
|
||||||
|
* pages. Use vmap in that case. Do a noncached mapping for system memory
|
||||||
|
* as display is non io-coherent device in case of Tegra.
|
||||||
|
*/
|
||||||
|
if (nv_nvkms_memory->pages_count > 0) {
|
||||||
|
return nv_drm_vmap(nv_nvkms_memory->pages,
|
||||||
|
nv_nvkms_memory->pages_count,
|
||||||
|
false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ERR_PTR(-ENOMEM);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __nv_drm_gem_nvkms_prime_vunmap(
|
||||||
|
struct nv_drm_gem_object *nv_gem,
|
||||||
|
void *address)
|
||||||
|
{
|
||||||
|
struct nv_drm_gem_nvkms_memory *nv_nvkms_memory =
|
||||||
|
to_nv_nvkms_memory(nv_gem);
|
||||||
|
|
||||||
|
if (!nv_nvkms_memory->physically_mapped &&
|
||||||
|
nv_nvkms_memory->pages_count > 0) {
|
||||||
|
nv_drm_vunmap(address);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __nv_drm_gem_map_nvkms_memory_offset(
|
static int __nv_drm_gem_map_nvkms_memory_offset(
|
||||||
@@ -228,6 +256,7 @@ const struct nv_drm_gem_object_funcs nv_gem_nvkms_memory_ops = {
|
|||||||
.free = __nv_drm_gem_nvkms_memory_free,
|
.free = __nv_drm_gem_nvkms_memory_free,
|
||||||
.prime_dup = __nv_drm_gem_nvkms_prime_dup,
|
.prime_dup = __nv_drm_gem_nvkms_prime_dup,
|
||||||
.prime_vmap = __nv_drm_gem_nvkms_prime_vmap,
|
.prime_vmap = __nv_drm_gem_nvkms_prime_vmap,
|
||||||
|
.prime_vunmap = __nv_drm_gem_nvkms_prime_vunmap,
|
||||||
.mmap = __nv_drm_gem_nvkms_mmap,
|
.mmap = __nv_drm_gem_nvkms_mmap,
|
||||||
.handle_vma_fault = __nv_drm_gem_nvkms_handle_vma_fault,
|
.handle_vma_fault = __nv_drm_gem_nvkms_handle_vma_fault,
|
||||||
.create_mmap_offset = __nv_drm_gem_map_nvkms_memory_offset,
|
.create_mmap_offset = __nv_drm_gem_map_nvkms_memory_offset,
|
||||||
@@ -64,7 +64,8 @@ static void *__nv_drm_gem_user_memory_prime_vmap(
|
|||||||
struct nv_drm_gem_user_memory *nv_user_memory = to_nv_user_memory(nv_gem);
|
struct nv_drm_gem_user_memory *nv_user_memory = to_nv_user_memory(nv_gem);
|
||||||
|
|
||||||
return nv_drm_vmap(nv_user_memory->pages,
|
return nv_drm_vmap(nv_user_memory->pages,
|
||||||
nv_user_memory->pages_count);
|
nv_user_memory->pages_count,
|
||||||
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __nv_drm_gem_user_memory_prime_vunmap(
|
static void __nv_drm_gem_user_memory_prime_vunmap(
|
||||||
@@ -582,6 +582,19 @@ static inline int nv_drm_format_num_planes(uint32_t format)
|
|||||||
|
|
||||||
#endif /* defined(NV_DRM_FORMAT_MODIFIERS_PRESENT) */
|
#endif /* defined(NV_DRM_FORMAT_MODIFIERS_PRESENT) */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DRM_UNLOCKED was removed with linux-next commit 2798ffcc1d6a ("drm: Remove
|
||||||
|
* locking for legacy ioctls and DRM_UNLOCKED"), but it was previously made
|
||||||
|
* implicit for all non-legacy DRM driver IOCTLs since Linux v4.10 commit
|
||||||
|
* fa5386459f06 "drm: Used DRM_LEGACY for all legacy functions" (Linux v4.4
|
||||||
|
* commit ea487835e887 "drm: Enforce unlocked ioctl operation for kms driver
|
||||||
|
* ioctls" previously did it only for drivers that set the DRM_MODESET flag), so
|
||||||
|
* it was effectively a no-op anyway.
|
||||||
|
*/
|
||||||
|
#if !defined(NV_DRM_UNLOCKED_IOCTL_FLAG_PRESENT)
|
||||||
|
#define DRM_UNLOCKED 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* drm_vma_offset_exact_lookup_locked() were added
|
* drm_vma_offset_exact_lookup_locked() were added
|
||||||
* by kernel commit 2225cfe46bcc which was Signed-off-by:
|
* by kernel commit 2225cfe46bcc which was Signed-off-by:
|
||||||
@@ -289,13 +289,20 @@ struct drm_nvidia_get_connector_id_for_dpy_id_params {
|
|||||||
uint32_t connectorId; /* OUT */
|
uint32_t connectorId; /* OUT */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum drm_nvidia_permissions_type {
|
||||||
|
NV_DRM_PERMISSIONS_TYPE_MODESET = 2,
|
||||||
|
NV_DRM_PERMISSIONS_TYPE_SUB_OWNER = 3
|
||||||
|
};
|
||||||
|
|
||||||
struct drm_nvidia_grant_permissions_params {
|
struct drm_nvidia_grant_permissions_params {
|
||||||
int32_t fd; /* IN */
|
int32_t fd; /* IN */
|
||||||
uint32_t dpyId; /* IN */
|
uint32_t dpyId; /* IN */
|
||||||
|
uint32_t type; /* IN */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct drm_nvidia_revoke_permissions_params {
|
struct drm_nvidia_revoke_permissions_params {
|
||||||
uint32_t dpyId; /* IN */
|
uint32_t dpyId; /* IN */
|
||||||
|
uint32_t type; /* IN */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct drm_nvidia_semsurf_fence_ctx_create_params {
|
struct drm_nvidia_semsurf_fence_ctx_create_params {
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user