Skip to content

Commit 1a5075f

Browse files
committed
580.142
1 parent beeb40f commit 1a5075f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1201
-305
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# NVIDIA Linux Open GPU Kernel Module Source
22

33
This is the source release of the NVIDIA Linux open GPU kernel modules,
4-
version 580.126.20.
4+
version 580.142.
55

66

77
## How to Build
@@ -17,7 +17,7 @@ as root:
1717

1818
Note that the kernel modules built here must be used with GSP
1919
firmware and user-space NVIDIA GPU driver components from a corresponding
20-
580.126.20 driver release. This can be achieved by installing
20+
580.142 driver release. This can be achieved by installing
2121
the NVIDIA GPU driver from the .run file using the `--no-kernel-modules`
2222
option. E.g.,
2323

@@ -185,7 +185,7 @@ table below).
185185
For details on feature support and limitations, see the NVIDIA GPU driver
186186
end user README here:
187187

188-
https://us.download.nvidia.com/XFree86/Linux-x86_64/580.126.20/README/kernel_open.html
188+
https://us.download.nvidia.com/XFree86/Linux-x86_64/580.142/README/kernel_open.html
189189

190190
For vGPU support, please refer to the README.vgpu packaged in the vGPU Host
191191
Package for more details.
@@ -974,6 +974,7 @@ Subsystem Device ID.
974974
| NVIDIA RTX PRO 6000 Blackwell Server Edition | 2BB5 10DE 204E |
975975
| NVIDIA RTX PRO 6000 Blackwell Server Edition | 2BB5 10DE 220B |
976976
| NVIDIA RTX 6000D | 2BB9 10DE 2091 |
977+
| NVIDIA RTX 6000D | 2BB9 10DE 2092 |
977978
| NVIDIA GeForce RTX 5080 | 2C02 |
978979
| NVIDIA GeForce RTX 5070 Ti | 2C05 |
979980
| NVIDIA GeForce RTX 5090 Laptop GPU | 2C18 |
@@ -992,6 +993,7 @@ Subsystem Device ID.
992993
| NVIDIA RTX PRO 4000 Blackwell | 2C34 17AA 2052 |
993994
| NVIDIA RTX PRO 5000 Blackwell Generation Laptop GPU | 2C38 |
994995
| NVIDIA RTX PRO 4000 Blackwell Generation Laptop GPU | 2C39 |
996+
| NVIDIA RTX PRO 4500 Blackwell Server Edition | 2C3A 10DE 21F4 |
995997
| NVIDIA GeForce RTX 5090 Laptop GPU | 2C58 |
996998
| NVIDIA GeForce RTX 5080 Laptop GPU | 2C59 |
997999
| NVIDIA RTX PRO 5000 Blackwell Embedded GPU | 2C77 |

kernel-open/Kbuild

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ ccflags-y += -I$(src)/common/inc
7979
ccflags-y += -I$(src)
8080
ccflags-y += -Wall $(DEFINES) $(INCLUDES) -Wno-cast-qual -Wno-format-extra-args
8181
ccflags-y += -D__KERNEL__ -DMODULE -DNVRM
82-
ccflags-y += -DNV_VERSION_STRING=\"580.126.20\"
82+
ccflags-y += -DNV_VERSION_STRING=\"580.142\"
8383

8484
# Include and link Tegra out-of-tree modules.
8585
ifneq ($(wildcard /usr/src/nvidia/nvidia-oot),)

kernel-open/common/inc/nv-linux.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
#include <asm/pgtable.h> /* pte bit definitions */
141141
#include <asm/bitops.h> /* __set_bit() */
142142
#include <linux/time.h> /* FD_SET() */
143+
#include <linux/memremap.h>
143144

144145
#include "nv-list-helpers.h"
145146

@@ -596,8 +597,8 @@ static inline dma_addr_t nv_phys_to_dma(struct device *dev, NvU64 pa)
596597
#endif
597598
}
598599

600+
#define NV_GET_PAGE_STRUCT(phys_page) pfn_to_page(phys_page >> PAGE_SHIFT)
599601
#define NV_GET_OFFSET_IN_PAGE(phys_page) offset_in_page(phys_page)
600-
#define NV_GET_PAGE_STRUCT(phys_page) virt_to_page(__va(phys_page))
601602
#define NV_VMA_PGOFF(vma) ((vma)->vm_pgoff)
602603
#define NV_VMA_SIZE(vma) ((vma)->vm_end - (vma)->vm_start)
603604
#define NV_VMA_OFFSET(vma) (((NvU64)(vma)->vm_pgoff) << PAGE_SHIFT)
@@ -606,6 +607,12 @@ static inline dma_addr_t nv_phys_to_dma(struct device *dev, NvU64 pa)
606607

607608
#define NV_DEVICE_MINOR_NUMBER(x) minor((x)->i_rdev)
608609

610+
#if defined(NV_GET_DEV_PAGEMAP_HAS_PGMAP_ARG)
611+
#define NV_GET_DEV_PAGEMAP(pfn) get_dev_pagemap(pfn, NULL)
612+
#else
613+
#define NV_GET_DEV_PAGEMAP get_dev_pagemap
614+
#endif
615+
609616
#define NV_PCI_DISABLE_DEVICE(pci_dev) \
610617
{ \
611618
NvU16 __cmd[2]; \

kernel-open/common/inc/nv-mm.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,16 @@ static inline void nv_vma_flags_clear_word(struct vm_area_struct *vma, unsigned
216216
ACCESS_PRIVATE(vma, __vm_flags) &= ~flags;
217217
#endif
218218
}
219+
220+
static inline int nv_is_vma_write_locked(struct vm_area_struct *vma, unsigned int *mm_lock_seq)
221+
{
222+
#if defined(NV_IS_VMA_WRITE_LOCKED_HAS_MM_LOCK_SEQ_ARG)
223+
return __is_vma_write_locked(vma, mm_lock_seq);
224+
#else
225+
*mm_lock_seq = __vma_raw_mm_seqnum(vma);
226+
return __is_vma_write_locked(vma);
227+
#endif
228+
}
219229
#endif // !NV_CAN_CALL_VMA_START_WRITE
220230

221231
static inline void nv_vm_flags_set(struct vm_area_struct *vma, vm_flags_t flags)

kernel-open/common/inc/nv.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,14 @@ typedef struct nv_state_t
567567
*/
568568
NvBool mem_has_struct_page;
569569

570+
/*
571+
* Coherent GPU Memory Mode, one of:
572+
* NV_COHERENT_GPU_MEM_MODE_NONE
573+
* NV_COHERENT_GPU_MEM_MODE_NUMA
574+
* NV_COHERENT_GPU_MEM_MODE_DRIVER
575+
*/
576+
NvBool coherent_gpu_mem_mode;
577+
570578
/* OS detected GPU has ATS capability */
571579
NvBool ats_support;
572580
/*
@@ -767,6 +775,13 @@ typedef enum
767775
#define NV_EVAL_ACPI_METHOD_NVIF 0x01
768776
#define NV_EVAL_ACPI_METHOD_WMMX 0x02
769777

778+
/*
779+
* Coherent GPU Memory Mode
780+
*/
781+
#define NV_COHERENT_GPU_MEM_MODE_NONE 0
782+
#define NV_COHERENT_GPU_MEM_MODE_NUMA 1
783+
#define NV_COHERENT_GPU_MEM_MODE_DRIVER 2
784+
770785
typedef enum {
771786
NV_I2C_CMD_READ = 1,
772787
NV_I2C_CMD_WRITE,
@@ -915,13 +930,14 @@ NV_STATUS NV_API_CALL nv_dma_map_alloc (nv_dma_device_t *, NvU64, NvU6
915930
NV_STATUS NV_API_CALL nv_dma_unmap_alloc (nv_dma_device_t *, NvU64, NvU64 *, void **);
916931

917932
NV_STATUS NV_API_CALL nv_dma_map_peer (nv_dma_device_t *, nv_dma_device_t *, NvU8, NvU64, NvU64 *);
918-
NV_STATUS NV_API_CALL nv_dma_map_non_pci_peer (nv_dma_device_t *, NvU64, NvU64 *);
919933
void NV_API_CALL nv_dma_unmap_peer (nv_dma_device_t *, NvU64, NvU64);
920934

921935
NV_STATUS NV_API_CALL nv_dma_map_mmio (nv_dma_device_t *, NvU64, NvU64 *);
922936
void NV_API_CALL nv_dma_unmap_mmio (nv_dma_device_t *, NvU64, NvU64);
923937

924938
void NV_API_CALL nv_dma_cache_invalidate (nv_dma_device_t *, void *);
939+
void* NV_API_CALL nv_dma_get_dev_pagemap (NvU64);
940+
void NV_API_CALL nv_dma_put_dev_pagemap (void *);
925941
NvBool NV_API_CALL nv_grdma_pci_topology_supported(nv_state_t *, nv_dma_device_t *);
926942

927943
NvS32 NV_API_CALL nv_start_rc_timer (nv_state_t *);

kernel-open/common/inc/nvkms-kapi.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ struct NvKmsKapiConnectorInfo {
212212
NvU32 numIncompatibleConnectors;
213213
NvKmsKapiConnector incompatibleConnectorHandles[NVKMS_KAPI_MAX_CONNECTORS];
214214

215+
NvBool dynamicDpyIdListValid;
215216
NVDpyIdList dynamicDpyIdList;
216217
};
217218

@@ -603,7 +604,17 @@ struct NvKmsKapiGpuInfo {
603604
MIGDeviceId migDevice;
604605
};
605606

607+
/*
608+
* Linux kernel options CONFIG_RANDSTRUCT_* randomize structs that are composed
609+
* entirely of function pointers, but can only control struct layout for sources
610+
* built by kbuild. NvKmsKapiCallbacks is shared between kbuild-built
611+
* nvidia-drm.ko, and the "OS-agnostic" portions of nvidia-modeset.ko (not built
612+
* by kbuild). Add a _padding member to disable struct randomization.
613+
*
614+
* Refer to https://github.com/NVIDIA/open-gpu-kernel-modules/issues/1033
615+
*/
606616
struct NvKmsKapiCallbacks {
617+
int _padding;
607618
void (*suspendResume)(NvBool suspend);
608619
void (*remove)(NvU32 gpuId);
609620
void (*probe)(const struct NvKmsKapiGpuInfo *gpu_info);

kernel-open/conftest.sh

Lines changed: 58 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@ compile_test() {
507507
#include <asm/pgtable_types.h>
508508
#endif
509509
#include <asm/page.h>
510+
#include <linux/percpu.h>
510511
#include <asm/set_memory.h>
511512
#else
512513
#include <asm/cacheflush.h>
@@ -530,6 +531,7 @@ compile_test() {
530531
#include <asm/pgtable_types.h>
531532
#endif
532533
#include <asm/page.h>
534+
#include <linux/percpu.h>
533535
#include <asm/set_memory.h>
534536
#else
535537
#include <asm/cacheflush.h>
@@ -588,6 +590,7 @@ compile_test() {
588590
#include <asm/pgtable_types.h>
589591
#endif
590592
#include <asm/page.h>
593+
#include <linux/percpu.h>
591594
#include <asm/set_memory.h>
592595
#else
593596
#include <asm/cacheflush.h>
@@ -614,6 +617,7 @@ compile_test() {
614617
#include <asm/pgtable_types.h>
615618
#endif
616619
#include <asm/page.h>
620+
#include <linux/percpu.h>
617621
#include <asm/set_memory.h>
618622
#else
619623
#include <asm/cacheflush.h>
@@ -1126,19 +1130,44 @@ compile_test() {
11261130
compile_check_conftest "$CODE" "NV_VFIO_DEVICE_OPS_HAS_DETACH_IOAS" "" "types"
11271131
;;
11281132

1133+
vfio_device_ops_has_get_region_info_caps)
1134+
#
1135+
# Determine if 'struct vfio_device_ops' has 'get_region_info_caps'
1136+
# callback.
1137+
#
1138+
# Added by commit 775f726a742a ("vfio: Add get_region_info_caps op")
1139+
# in v6.19
1140+
#
1141+
CODE="
1142+
#include <linux/pci.h>
1143+
#include <linux/vfio.h>
1144+
int conftest_vfio_device_ops_has_get_region_info_caps(void) {
1145+
return offsetof(struct vfio_device_ops, get_region_info_caps);
1146+
}"
1147+
1148+
compile_check_conftest "$CODE" "NV_VFIO_DEVICE_OPS_HAS_GET_REGION_INFO_CAPS" "" "types"
1149+
;;
1150+
11291151
pfn_address_space)
11301152
#
11311153
# Determine if 'struct pfn_address_space' structure is present or not.
11321154
#
1155+
# Added by commit 2ec41967189c ("mm: handle poisoning of pfn without
1156+
# struct pages") in v6.19
1157+
# Added by commit e6dbcb7c0e7b ("mm: fixup pfnmap memory failure
1158+
# handling to use pgoff in v6.19
1159+
#
11331160
CODE="
11341161
#include <linux/memory-failure.h>
11351162
void conftest_pfn_address_space() {
11361163
struct pfn_address_space pfn_address_space;
1164+
pfn_address_space.pfn_to_vma_pgoff = NULL;
1165+
register_pfn_address_space(&pfn_address_space);
1166+
unregister_pfn_address_space(&pfn_address_space);
11371167
}"
1138-
11391168
compile_check_conftest "$CODE" "NV_PFN_ADDRESS_SPACE_STRUCT_PRESENT" "" "types"
11401169
;;
1141-
1170+
11421171
irq_bypass_producer_has_token)
11431172
#
11441173
# Determine if 'struct irq_bypass_producer' has 'token' field
@@ -1182,13 +1211,18 @@ compile_test() {
11821211
#
11831212
# Determine if egm management api are present or not.
11841213
#
1214+
# unregister_egm_node() function signature changed by commit
1215+
# 9863aeed3a2d ("NVIDIA: SAUCE: vfio/nvgrace-egm: Update EGM
1216+
# unregistration API") to use PCI device as its parameter
1217+
# https://github.com/NVIDIA/NV-Kernels.git
1218+
#
11851219
CODE="
11861220
#include <linux/pci.h>
11871221
#include <linux/nvgrace-egm.h>
11881222
void conftest_egm_module_helper_api_present() {
1189-
struct pci_dev *pdev;
1223+
struct pci_dev *pdev = NULL;
11901224
register_egm_node(pdev);
1191-
unregister_egm_node(0);
1225+
unregister_egm_node(pdev);
11921226
}
11931227
"
11941228
compile_check_conftest "$CODE" "NV_EGM_MODULE_HELPER_API_PRESENT" "" "types"
@@ -2138,24 +2172,6 @@ compile_test() {
21382172
fi
21392173
;;
21402174

2141-
enable_apicv)
2142-
#
2143-
# Determine if enable_apicv boolean is exported by kernel.
2144-
#
2145-
# Added by commit fdf513e37a3b ("KVM: x86: Use common
2146-
# 'enable_apicv' variable for both APICv and AVIC") in v5.14.
2147-
#
2148-
CODE="
2149-
$CONFTEST_PREAMBLE
2150-
#include <asm/kvm_host.h>
2151-
2152-
bool is_enable_apicv_present() {
2153-
return enable_apicv;
2154-
}"
2155-
2156-
compile_check_conftest "$CODE" "NV_ENABLE_APICV_PRESENT" "" "types"
2157-
;;
2158-
21592175
pci_driver_has_driver_managed_dma)
21602176
#
21612177
# Determine if "struct pci_driver" has .driver_managed_dma member.
@@ -5044,6 +5060,26 @@ compile_test() {
50445060
;;
50455061

50465062

5063+
is_vma_write_locked_has_mm_lock_seq_arg)
5064+
#
5065+
# Determine if __is_vma_write_locked() takes only a single
5066+
# 'struct vm_area_struct *' argument.
5067+
#
5068+
# Commit 22f7639f2f03 ("mm/vma: improve and document
5069+
# __is_vma_write_locked()") removed the 'unsigned int *mm_lock_seq'
5070+
# parameter in v7.0-rc1.
5071+
#
5072+
CODE="
5073+
#include <linux/mm.h>
5074+
#include <linux/mmap_lock.h>
5075+
int conftest_is_vma_write_locked_has_mm_lock_seq_arg(struct vm_area_struct *vma) {
5076+
unsigned int mm_lock_seq;
5077+
return __is_vma_write_locked(vma, &mm_lock_seq);
5078+
}"
5079+
5080+
compile_check_conftest "$CODE" "NV_IS_VMA_WRITE_LOCKED_HAS_MM_LOCK_SEQ_ARG" "" "types"
5081+
;;
5082+
50475083
# When adding a new conftest entry, please use the correct format for
50485084
# specifying the relevant upstream Linux kernel commit. Please
50495085
# avoid specifying -rc kernels, and only use SHAs that actually exist

kernel-open/nvidia-drm/nvidia-drm-crtc.c

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ static void ctm_3x4_to_csc(struct NvKmsCscMatrix *nvkms_csc,
282282
}
283283
}
284284

285-
static void
285+
static int
286286
cursor_plane_req_config_update(struct drm_plane *plane,
287287
struct drm_plane_state *plane_state,
288288
struct NvKmsKapiCursorRequestedConfig *req_config)
@@ -292,11 +292,14 @@ cursor_plane_req_config_update(struct drm_plane *plane,
292292

293293
if (plane_state->fb == NULL) {
294294
cursor_req_config_disable(req_config);
295-
return;
295+
return 0;
296296
}
297297

298298
memset(req_config, 0, sizeof(*req_config));
299299
req_config->surface = to_nv_framebuffer(plane_state->fb)->pSurface;
300+
if (req_config->surface == NULL) {
301+
return -EINVAL;
302+
}
300303
req_config->dstX = plane_state->crtc_x;
301304
req_config->dstY = plane_state->crtc_y;
302305

@@ -368,12 +371,14 @@ cursor_plane_req_config_update(struct drm_plane *plane,
368371
if (old_config.surface == NULL &&
369372
old_config.surface != req_config->surface) {
370373
req_config->flags.dstXYChanged = NV_TRUE;
371-
return;
374+
return 0;
372375
}
373376

374377
req_config->flags.dstXYChanged =
375378
old_config.dstX != req_config->dstX ||
376379
old_config.dstY != req_config->dstY;
380+
381+
return 0;
377382
}
378383

379384
static void release_drm_nvkms_surface(struct nv_drm_nvkms_surface *drm_nvkms_surface)
@@ -1171,6 +1176,9 @@ plane_req_config_update(struct drm_plane *plane,
11711176
memset(req_config, 0, sizeof(*req_config));
11721177

11731178
req_config->config.surface = to_nv_framebuffer(plane_state->fb)->pSurface;
1179+
if (req_config->config.surface == NULL) {
1180+
return -EINVAL;
1181+
}
11741182

11751183
/* Source values are 16.16 fixed point */
11761184
req_config->config.srcX = plane_state->src_x >> 16;
@@ -1553,7 +1561,7 @@ static int __nv_drm_cursor_atomic_check(struct drm_plane *plane,
15531561
struct drm_plane_state *plane_state)
15541562
{
15551563
struct nv_drm_plane *nv_plane = to_nv_plane(plane);
1556-
int i;
1564+
int i, ret;
15571565
struct drm_crtc *crtc;
15581566
struct drm_crtc_state *crtc_state;
15591567

@@ -1573,8 +1581,11 @@ static int __nv_drm_cursor_atomic_check(struct drm_plane *plane,
15731581
}
15741582

15751583
if (plane_state->crtc == crtc) {
1576-
cursor_plane_req_config_update(plane, plane_state,
1577-
cursor_req_config);
1584+
ret = cursor_plane_req_config_update(plane, plane_state,
1585+
cursor_req_config);
1586+
if (ret != 0) {
1587+
return ret;
1588+
}
15781589
}
15791590
}
15801591

0 commit comments

Comments
 (0)