Skip to content

Commit 5be0ed8

Browse files
committed
595.80
1 parent 51edebe commit 5be0ed8

75 files changed

Lines changed: 82488 additions & 82077 deletions

File tree

Some content is hidden

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

README.md

Lines changed: 4 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 595.71.05.
4+
version 595.80.
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-
595.71.05 driver release. This can be achieved by installing
20+
595.80 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/595.71.05/README/kernel_open.html
188+
https://us.download.nvidia.com/XFree86/Linux-x86_64/595.80/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.
@@ -1020,6 +1020,7 @@ Subsystem Device ID.
10201020
| NVIDIA RTX PRO 500 Blackwell Embedded GPU | 2DF9 |
10211021
| NVIDIA GB10 | 2E12 10DE 21EC |
10221022
| NVIDIA GeForce RTX 5070 | 2F04 |
1023+
| NVIDIA GeForce RTX 5060 | 2F06 |
10231024
| NVIDIA GeForce RTX 5070 Ti Laptop GPU | 2F18 |
10241025
| NVIDIA RTX PRO 3000 Blackwell Generation Laptop GPU | 2F38 |
10251026
| NVIDIA GeForce RTX 5070 Ti Laptop GPU | 2F58 |

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=\"595.71.05\"
82+
ccflags-y += -DNV_VERSION_STRING=\"595.80\"
8383

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

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ void nv_revoke_gpu_mappings_locked(nv_state_t *);
4949

5050
NvUPtr nv_vm_map_pages (struct page **, NvU32, NvBool, NvBool);
5151
void nv_vm_unmap_pages (NvUPtr, NvU32);
52+
NvU64 nv_get_reclaimable_memory_usage(void);
5253

5354
NV_STATUS nv_alloc_contig_pages (nv_state_t *, nv_alloc_t *);
5455
void nv_free_contig_pages (nv_alloc_t *);

kernel-open/common/inc/nv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ typedef struct nv_event_s
359359
NvU16 info16;
360360
nv_file_private_t *nvfp; /* per file-descriptor data pointer */
361361
NvU32 fd;
362-
NvBool active; /* whether the event should be signaled */
362+
PORT_ATOMIC NvS32 active; /* whether the event should be signaled */
363363
NvU32 refcount; /* count of associated RM events */
364364
struct nv_event_s *next;
365365
} nv_event_t;

kernel-open/common/inc/os-interface.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ enum os_pci_req_atomics_type {
224224
};
225225
NV_STATUS NV_API_CALL os_enable_pci_req_atomics (void *, enum os_pci_req_atomics_type);
226226
void NV_API_CALL os_pci_trigger_flr(void *handle);
227+
NvU64 NV_API_CALL os_get_reclaimable_memory_usage(void);
227228
NV_STATUS NV_API_CALL os_get_numa_node_memory_usage (NvS32, NvU64 *, NvU64 *);
228229
NV_STATUS NV_API_CALL os_numa_add_gpu_memory (void *, NvU64, NvU64, NvU32 *);
229230
NV_STATUS NV_API_CALL os_numa_remove_gpu_memory (void *, NvU64, NvU64, NvU32);

kernel-open/conftest.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5085,6 +5085,25 @@ compile_test() {
50855085
compile_check_conftest "$CODE" "NV_SHRINKER_ALLOC_PRESENT" "" "functions"
50865086
;;
50875087

5088+
nr_kernel_misc_reclaimable)
5089+
#
5090+
# Determine if NR_KERNEL_MISC_RECLAIMABLE is present in
5091+
# enum node_stat_item.
5092+
#
5093+
# Added by commit a4a33ef5657a ("mm: add NR_KERNEL_MISC_RECLAIMABLE
5094+
# node stat for misc reclaimable kernel memory") in v5.9.
5095+
#
5096+
CODE="
5097+
#include <linux/mmzone.h>
5098+
5099+
void conftest_nr_kernel_misc_reclaimable(void) {
5100+
enum node_stat_item x = NR_KERNEL_MISC_RECLAIMABLE;
5101+
(void)x;
5102+
}"
5103+
5104+
compile_check_conftest "$CODE" "NV_NR_KERNEL_MISC_RECLAIMABLE_PRESENT" "" "types"
5105+
;;
5106+
50885107
memory_device_coherent_present)
50895108
#
50905109
# Determine if MEMORY_DEVICE_COHERENT support is present or not
@@ -5138,6 +5157,22 @@ compile_test() {
51385157
compile_check_conftest "$CODE" "NV_IS_VMA_WRITE_LOCKED_HAS_MM_LOCK_SEQ_ARG" "" "types"
51395158
;;
51405159

5160+
drm_atomic_commit_struct_present)
5161+
#
5162+
# Determine if 'struct drm_atomic_state' has been renamed to
5163+
# 'struct drm_atomic_commit'.
5164+
#
5165+
# Renamed by commit 5164f7e7ff8e ("drm: Rename struct
5166+
# drm_atomic_state to drm_atomic_commit"), expected in Linux v7.2.
5167+
#
5168+
CODE="
5169+
#include <drm/drm_atomic.h>
5170+
5171+
struct drm_atomic_commit state;"
5172+
5173+
compile_check_conftest "$CODE" "NV_DRM_ATOMIC_COMMIT_STRUCT_PRESENT" "" "types"
5174+
;;
5175+
51415176
# When adding a new conftest entry, please use the correct format for
51425177
# specifying the relevant upstream Linux kernel commit. Please
51435178
# avoid specifying -rc kernels, and only use SHAs that actually exist

kernel-open/nvidia-uvm/uvm_pmm_gpu.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3062,10 +3062,12 @@ static void devmem_page_free(struct page *page)
30623062
&gpu->pmm.root_chunks.va_block_lazy_free_q_item);
30633063
}
30643064

3065+
#if defined(NV_PAGEMAP_OPS_HAS_FOLIO_FREE)
30653066
static void devmem_folio_free(struct folio *folio)
30663067
{
30673068
devmem_page_free(&folio->page);
30683069
}
3070+
#endif
30693071

30703072
// This is called by HMM when the CPU faults on a ZONE_DEVICE private entry.
30713073
static vm_fault_t devmem_fault(struct vm_fault *vmf)
@@ -3279,22 +3281,26 @@ static void device_p2p_page_free(struct page *page)
32793281
nv_kref_put(&p2p_mem->refcount, device_p2p_page_free_wake);
32803282
}
32813283

3284+
#if defined(NV_PAGEMAP_OPS_HAS_FOLIO_FREE)
32823285
static void device_p2p_folio_free(struct folio *folio)
32833286
{
32843287
device_p2p_page_free(&folio->page);
32853288
}
32863289
#endif
3290+
#endif
32873291

32883292
#if UVM_CDMM_PAGES_SUPPORTED()
32893293
static void device_coherent_page_free(struct page *page)
32903294
{
32913295
device_p2p_page_free(page);
32923296
}
32933297

3298+
#if defined(NV_PAGEMAP_OPS_HAS_FOLIO_FREE)
32943299
static void device_coherent_folio_free(struct folio *folio)
32953300
{
32963301
device_p2p_page_free(&folio->page);
32973302
}
3303+
#endif
32983304

32993305
static const struct dev_pagemap_ops uvm_device_coherent_pgmap_ops =
33003306
{

kernel-open/nvidia/nv-pci.c

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
#include <linux/pci-ats.h>
7979
#endif
8080

81-
extern int NVreg_GrdmaPciTopoCheckOverride;
8281
extern int NVreg_ExcludeAllGpus;
8382

8483
static void
@@ -1485,6 +1484,14 @@ nv_pci_tegra_devfreq_remove(struct nv_pci_tegra_devfreq_dev *tdev)
14851484
struct thermal_zone_device *tzdev;
14861485
#endif
14871486

1487+
#if defined(NV_UPDATE_DEVFREQ_PRESENT)
1488+
if (tdev->boost_enabled)
1489+
{
1490+
tdev->boost_enabled = 0;
1491+
cancel_delayed_work_sync(&tdev->boost_disable);
1492+
}
1493+
#endif
1494+
14881495
if (tdev->devfreq != NULL)
14891496
{
14901497
#if NV_HAS_COOLING_SUPPORTED
@@ -1499,8 +1506,8 @@ nv_pci_tegra_devfreq_remove(struct nv_pci_tegra_devfreq_dev *tdev)
14991506
thermal_unbind_cdev_from_trip(tzdev, data->passive_trip, tdev->devfreq->cdev);
15001507
}
15011508
#endif
1502-
devm_devfreq_remove_device(&tdev->dev, tdev->devfreq);
15031509
nv_pci_tegra_devfreq_remove_opps(tdev);
1510+
devm_devfreq_remove_device(&tdev->dev, tdev->devfreq);
15041511
tdev->devfreq = NULL;
15051512
}
15061513

@@ -1539,7 +1546,7 @@ nv_pci_tegra_devfreq_remove(struct nv_pci_tegra_devfreq_dev *tdev)
15391546

15401547
if (tdev->clk != NULL)
15411548
{
1542-
devm_clk_put(tdev->dev.parent, tptr->clk);
1549+
devm_clk_put(tdev->dev.parent, tdev->clk);
15431550
tdev->clk = NULL;
15441551
device_unregister(&tdev->dev);
15451552
}
@@ -2660,7 +2667,9 @@ nv_pci_count_devices(void)
26602667
/*
26612668
* On coherent platforms that support BAR1 mappings for GPUDirect RDMA,
26622669
* dma-buf and nv-p2p subsystems need to ensure the 2 devices belong to
2663-
* the same IOMMU group.
2670+
* the same IOMMU group. If the importer device doesn't have an IOMMU
2671+
* group assigned, at least check if the GPU and importer are under the same
2672+
* root port.
26642673
*/
26652674
NvBool nv_pci_is_valid_topology_for_direct_pci(
26662675
nv_state_t *nv,
@@ -2675,7 +2684,13 @@ NvBool nv_pci_is_valid_topology_for_direct_pci(
26752684
return NV_FALSE;
26762685
}
26772686

2678-
return (pdev0->dev.iommu_group == pdev1->dev.iommu_group);
2687+
if (pdev0->dev.iommu_group == pdev1->dev.iommu_group)
2688+
return NV_TRUE;
2689+
2690+
if (pdev1->dev.iommu_group == NULL)
2691+
return nv_pci_has_common_pci_switch(nv, peer);
2692+
2693+
return NV_FALSE;
26792694
}
26802695

26812696
NvBool nv_pci_has_common_pci_switch(
@@ -2719,16 +2734,6 @@ NvBool NV_API_CALL nv_grdma_pci_topology_supported(
27192734
return NV_TRUE;
27202735
}
27212736

2722-
switch (NVreg_GrdmaPciTopoCheckOverride)
2723-
{
2724-
case NV_REG_GRDMA_PCI_TOPO_CHECK_OVERRIDE_ALLOW_ACCESS:
2725-
return NV_TRUE;
2726-
case NV_REG_GRDMA_PCI_TOPO_CHECK_OVERRIDE_DENY_ACCESS:
2727-
return NV_FALSE;
2728-
default:
2729-
break;
2730-
}
2731-
27322737
// Allow RDMA by default on passthrough VMs.
27332738
if ((nv->flags & NV_FLAG_PASSTHRU) != 0)
27342739
return NV_TRUE;

kernel-open/nvidia/nv-reg.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -975,25 +975,6 @@
975975
#define __NV_CREATE_IMEX_CHANNEL_0 CreateImexChannel0
976976
#define NV_CREATE_IMEX_CHANNEL_0 NV_REG_STRING(__CREATE_IMEX_CHANNEL_0)
977977

978-
/*
979-
* Option: NVreg_GrdmaPciTopoCheckOverride
980-
*
981-
* Description:
982-
*
983-
* This option allows users to override the PCI topology validation enforced by
984-
* the GPU driver's dma-buf and nv-p2p subsystems.
985-
*
986-
* Possible values:
987-
* 0 - Driver's topology check to allow or deny access (default).
988-
* 1 - Override driver's topology check to allow access.
989-
* 2 - Override driver's topology check to deny access.
990-
*/
991-
#define __NV_GRDMA_PCI_TOPO_CHECK_OVERRIDE GrdmaPciTopoCheckOverride
992-
#define NV_GRDMA_PCI_TOPO_CHECK_OVERRIDE NV_REG_STRING(__NV_GRDMA_PCI_TOPO_CHECK_OVERRIDE)
993-
#define NV_REG_GRDMA_PCI_TOPO_CHECK_OVERRIDE_DEFAULT 0
994-
#define NV_REG_GRDMA_PCI_TOPO_CHECK_OVERRIDE_ALLOW_ACCESS 1
995-
#define NV_REG_GRDMA_PCI_TOPO_CHECK_OVERRIDE_DENY_ACCESS 2
996-
997978
/*
998979
* Option: NVreg_EnableSystemMemoryPools
999980
*
@@ -1084,8 +1065,6 @@ NV_DEFINE_REG_STRING_ENTRY(__NV_RM_NVLINK_BW, NULL);
10841065
NV_DEFINE_REG_ENTRY(__NV_RM_NVLINK_BW_LINK_COUNT, 0);
10851066
NV_DEFINE_REG_ENTRY_GLOBAL(__NV_IMEX_CHANNEL_COUNT, 2048);
10861067
NV_DEFINE_REG_ENTRY_GLOBAL(__NV_CREATE_IMEX_CHANNEL_0, 0);
1087-
NV_DEFINE_REG_ENTRY_GLOBAL(__NV_GRDMA_PCI_TOPO_CHECK_OVERRIDE,
1088-
NV_REG_GRDMA_PCI_TOPO_CHECK_OVERRIDE_DEFAULT);
10891068
NV_DEFINE_REG_ENTRY_GLOBAL(__NV_ENABLE_SYSTEM_MEMORY_POOLS, NV_ENABLE_SYSTEM_MEMORY_POOLS_DEFAULT);
10901069
NV_DEFINE_REG_ENTRY_GLOBAL(__NV_USE_KERNEL_SUSPEND_NOTIFIERS, 0);
10911070

@@ -1138,7 +1117,6 @@ nv_parm_t nv_parms[] = {
11381117
NV_DEFINE_PARAMS_TABLE_ENTRY(__NV_DMA_REMAP_PEER_MMIO),
11391118
NV_DEFINE_PARAMS_TABLE_ENTRY(__NV_IMEX_CHANNEL_COUNT),
11401119
NV_DEFINE_PARAMS_TABLE_ENTRY(__NV_CREATE_IMEX_CHANNEL_0),
1141-
NV_DEFINE_PARAMS_TABLE_ENTRY(__NV_GRDMA_PCI_TOPO_CHECK_OVERRIDE),
11421120
NV_DEFINE_PARAMS_TABLE_ENTRY(__NV_ENABLE_SYSTEM_MEMORY_POOLS),
11431121
{NULL, NULL}
11441122
};

kernel-open/nvidia/nv-vm.c

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,20 @@ static void nv_mem_pool_shrinker_register(nv_page_pool_t *mem_pool, struct shrin
464464
}
465465
#endif // NV_SHRINKER_ALLOC_PRESENT
466466

467+
// Pages in the pool are reclaimable non-slab kernel memory. Tracking them
468+
// with NR_KERNEL_MISC_RECLAIMABLE lets si_mem_available() include them in
469+
// MemAvailable (/proc/meminfo), giving the kernel an accurate picture of how
470+
// much memory can be recovered under pressure via the registered shrinker.
471+
static void nv_mem_pool_mod_misc_reclaimable(nv_page_pool_t *mem_pool, long delta_compound_pages)
472+
{
473+
#if defined(NV_NR_KERNEL_MISC_RECLAIMABLE_PRESENT)
474+
if (delta_compound_pages != 0)
475+
mod_node_page_state(NODE_DATA(mem_pool->node_id),
476+
NR_KERNEL_MISC_RECLAIMABLE,
477+
delta_compound_pages << mem_pool->order);
478+
#endif
479+
}
480+
467481
static unsigned long
468482
nv_mem_pool_move_pages
469483
(
@@ -561,6 +575,8 @@ nv_mem_pool_shrinker_scan
561575
mem_pool->pages_owned -= pages_freed;
562576
os_release_mutex(mem_pool->lock);
563577

578+
nv_mem_pool_mod_misc_reclaimable(mem_pool, -(long)pages_freed);
579+
564580
nv_mem_pool_free_page_list(&reclaim_list, mem_pool->order);
565581

566582
nv_printf(NV_DBG_MEMINFO, "NVRM: VM: %s: node=%d order=%u: %lu/%lu pages freed\n",
@@ -619,6 +635,8 @@ nv_mem_pool_alloc_pages
619635
pages_owned = mem_pool->pages_owned;
620636
os_release_mutex(mem_pool->lock);
621637

638+
nv_mem_pool_mod_misc_reclaimable(mem_pool, -(long)pages_allocated);
639+
622640
while ((pool_entry = NV_MEM_POOL_LIST_HEAD(&alloc_clean_pages)))
623641
{
624642
nv_alloc_set_page(at, i, pool_entry->virt_addr);
@@ -691,9 +709,12 @@ void
691709
nv_mem_pool_destroy(nv_page_pool_t *mem_pool)
692710
{
693711
NV_STATUS status;
712+
unsigned long saved_pages_owned;
694713

695714
status = os_acquire_mutex(mem_pool->lock);
696715
WARN_ON(status != NV_OK);
716+
// Snapshot before freeing: counts dirty + in-flight + clean pages.
717+
saved_pages_owned = mem_pool->pages_owned;
697718
nv_mem_pool_free_page_list(&mem_pool->dirty_list, mem_pool->order);
698719
os_release_mutex(mem_pool->lock);
699720

@@ -706,6 +727,8 @@ nv_mem_pool_destroy(nv_page_pool_t *mem_pool)
706727
nv_mem_pool_free_page_list(&mem_pool->clean_list, mem_pool->order);
707728
os_release_mutex(mem_pool->lock);
708729

730+
nv_mem_pool_mod_misc_reclaimable(mem_pool, -(long)saved_pages_owned);
731+
709732
nv_mem_pool_shrinker_free(mem_pool);
710733

711734
os_free_mutex(mem_pool->lock);
@@ -832,8 +855,12 @@ nv_mem_pool_free_pages
832855
pages_owned = mem_pool->pages_owned;
833856
os_release_mutex(mem_pool->lock);
834857

835-
nv_printf(NV_DBG_MEMINFO, "NVRM: VM: %s: node=%d order=%u: %lu/%lu pages added to pool (%lu now in pool)\n",
836-
__FUNCTION__, mem_pool->node_id, mem_pool->order, num_added_pages, num_pages, pages_owned);
858+
nv_mem_pool_mod_misc_reclaimable(mem_pool, (long)num_added_pages);
859+
860+
nv_printf(NV_DBG_MEMINFO, "NVRM: VM: %s: at = %lx, at->order = %u, at->num_pages = %u, \
861+
pool_order = %u: %lu/%lu pages added to pool (%lu now in pool)\n", \
862+
__FUNCTION__, (long int) at, at->order, at->num_pages, mem_pool->order, \
863+
num_added_pages, num_pages, pages_owned);
837864

838865
if (queue_worker)
839866
{
@@ -1122,6 +1149,35 @@ static NvUPtr nv_vmap(struct page **pages, NvU32 page_count,
11221149
return (NvUPtr)ptr;
11231150
}
11241151

1152+
NvU64 nv_get_reclaimable_memory_usage(void)
1153+
{
1154+
int node_id;
1155+
unsigned int order;
1156+
NvU64 reclaimable_memory_bytes = 0;
1157+
1158+
for_each_node(node_id)
1159+
{
1160+
for (order = 0; order <= NV_MAX_PAGE_ORDER; order++)
1161+
{
1162+
if (sysmem_page_pools[node_id][order])
1163+
{
1164+
nv_printf(NV_DBG_MEMINFO, "NVRM: VM: %s: node_id = %u, pool_order = %u: %lu pages in pool\n", \
1165+
__FUNCTION__, node_id, sysmem_page_pools[node_id][order]->order, \
1166+
sysmem_page_pools[node_id][order]->pages_owned);
1167+
1168+
reclaimable_memory_bytes += (sysmem_page_pools[node_id][order]->pages_owned \
1169+
<< sysmem_page_pools[node_id][order]->order) \
1170+
* PAGE_SIZE;
1171+
1172+
nv_printf(NV_DBG_MEMINFO, "NVRM: VM: %s: reclaimable_memory_bytes = %d\n", \
1173+
__FUNCTION__, reclaimable_memory_bytes);
1174+
}
1175+
}
1176+
}
1177+
1178+
return reclaimable_memory_bytes;
1179+
}
1180+
11251181
static void nv_vunmap(NvUPtr vaddr, NvU32 page_count)
11261182
{
11271183
vunmap((void *)vaddr);

0 commit comments

Comments
 (0)