kernel-6.6.30
This commit is contained in:
@@ -36,6 +36,16 @@ def setup():
|
||||
shelltools.system("patch -p1 < kernel-5.11.patch")
|
||||
shelltools.system("patch -p1 < kernel-5.14.patch")
|
||||
shelltools.system("patch -p1 < kernel-5.15.patch")
|
||||
|
||||
shelltools.system("patch -p1 < kernel-5.16.patch")
|
||||
shelltools.system("patch -p1 < kernel-5.17.patch")
|
||||
shelltools.system("patch -p1 < kernel-5.18.patch")
|
||||
shelltools.system("patch -p1 < kernel-6.0.patch")
|
||||
shelltools.system("patch -p1 < kernel-6.2.patch")
|
||||
shelltools.system("patch -p1 < kernel-6.3.patch")
|
||||
shelltools.system("patch -p1 < kernel-6.5.patch")
|
||||
shelltools.system("patch -p1 < kernel-6.6.patch")
|
||||
shelltools.system("patch -p1 < kernel-6.8.patch")
|
||||
|
||||
|
||||
# Our libc is TLS enabled so use TLS library
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
--- a/kernel/os-interface.h 2019-12-11 22:04:24.000000000 +0000
|
||||
+++ b/kernel/os-interface.h 2022-01-10 02:04:26.740899810 +0000
|
||||
@@ -24,7 +24,12 @@
|
||||
* *
|
||||
\***************************************************************************/
|
||||
|
||||
+#include <linux/version.h>
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
|
||||
+#include <linux/stdarg.h>
|
||||
+#else
|
||||
#include <stdarg.h>
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* Define away Microsoft compiler extensions when possible
|
||||
--- a/kernel/nv.h 2019-12-11 22:04:24.000000000 +0000
|
||||
+++ b/kernel/nv.h 2022-01-10 02:29:07.828733372 +0000
|
||||
@@ -13,7 +13,12 @@
|
||||
#define _NV_H_
|
||||
|
||||
#include <nvtypes.h>
|
||||
+#include <linux/version.h>
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
|
||||
+#include <linux/stdarg.h>
|
||||
+#else
|
||||
#include <stdarg.h>
|
||||
+#endif
|
||||
|
||||
#if !defined(NV_MIN)
|
||||
#define NV_MIN(_a,_b) ((_a) < (_b) ? (_a) : (_b))
|
||||
@@ -0,0 +1,57 @@
|
||||
diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
|
||||
--- a/kernel/conftest.sh 2022-04-02 10:27:54.463179319 +0000
|
||||
+++ b/kernel/conftest.sh 2022-04-02 10:27:54.553179467 +0000
|
||||
@@ -1619,7 +1619,11 @@
|
||||
CODE="
|
||||
#include <linux/proc_fs.h>
|
||||
void conftest_PDE_DATA(void) {
|
||||
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
|
||||
+ pde_data();
|
||||
+ #else
|
||||
PDE_DATA();
|
||||
+ #endif
|
||||
}"
|
||||
|
||||
compile_check_conftest "$CODE" "NV_PDE_DATA_PRESENT" "" "functions"
|
||||
diff -Naur a/kernel/nv-linux.h b/kernel/nv-linux.h
|
||||
--- a/kernel/nv-linux.h 2022-04-02 10:27:54.463179319 +0000
|
||||
+++ b/kernel/nv-linux.h 2022-04-02 10:27:54.556512806 +0000
|
||||
@@ -266,9 +266,9 @@
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
-#include <linux/proc_fs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#endif
|
||||
+#include <linux/proc_fs.h>
|
||||
|
||||
#ifdef CONFIG_KDB
|
||||
#include <linux/kdb.h>
|
||||
@@ -2052,8 +2052,12 @@
|
||||
})
|
||||
|
||||
#if defined(NV_PDE_DATA_PRESENT)
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
|
||||
# define NV_PDE_DATA(inode) PDE_DATA(inode)
|
||||
#else
|
||||
+# define NV_PDE_DATA(inode) pde_data(inode)
|
||||
+#endif
|
||||
+#else
|
||||
# define NV_PDE_DATA(inode) PDE(inode)->data
|
||||
#endif
|
||||
|
||||
diff -Naur a/kernel/uvm/conftest.sh b/kernel/uvm/conftest.sh
|
||||
--- a/kernel/uvm/conftest.sh 2022-04-02 10:27:54.456512642 +0000
|
||||
+++ b/kernel/uvm/conftest.sh 2022-04-02 10:27:54.556512806 +0000
|
||||
@@ -1578,7 +1578,11 @@
|
||||
CODE="
|
||||
#include <linux/proc_fs.h>
|
||||
void conftest_PDE_DATA(void) {
|
||||
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
|
||||
+ pde_data();
|
||||
+ #else
|
||||
PDE_DATA();
|
||||
+ #endif
|
||||
}"
|
||||
|
||||
compile_check_conftest "$CODE" "NV_PDE_DATA_PRESENT" "" "functions"
|
||||
@@ -0,0 +1,151 @@
|
||||
diff -Naur a/kernel/nv-acpi.c b/kernel/nv-acpi.c
|
||||
--- a/kernel/nv-acpi.c 2019-12-12 06:04:24.000000000 +0800
|
||||
+++ b/kernel/nv-acpi.c 2022-05-29 20:00:00.000000000 +0800
|
||||
@@ -577,9 +577,13 @@
|
||||
{
|
||||
if (!nvif_parent_gpu_handle) /* unknown error */
|
||||
break;
|
||||
-
|
||||
- retVal = acpi_bus_get_device(nvif_parent_gpu_handle, &device);
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
+ device = acpi_fetch_acpi_dev(nvif_parent_gpu_handle);
|
||||
+ retVal = 0;
|
||||
+#else
|
||||
+ retVal = acpi_bus_get_device(nvif_parent_gpu_handle, &device);
|
||||
+#endif
|
||||
if (ACPI_FAILURE(retVal) || !device)
|
||||
break;
|
||||
|
||||
@@ -652,8 +656,11 @@
|
||||
if (nvif_parent_gpu_handle == NULL)
|
||||
return;
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
+ device = acpi_fetch_acpi_dev(nvif_parent_gpu_handle);
|
||||
+#else
|
||||
acpi_bus_get_device(nvif_parent_gpu_handle, &device);
|
||||
-
|
||||
+#endif
|
||||
nv_uninstall_notifier(device, nv_acpi_event);
|
||||
nvif_parent_gpu_handle = NULL;
|
||||
|
||||
@@ -1212,7 +1219,12 @@
|
||||
if (!dev_handle)
|
||||
return RM_ERR_INVALID_ARGUMENT;
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
+ device = acpi_fetch_acpi_dev(dev_handle);
|
||||
+ status = 0;
|
||||
+#else
|
||||
status = acpi_bus_get_device(dev_handle, &device);
|
||||
+#endif
|
||||
|
||||
if (ACPI_FAILURE(status) || !device)
|
||||
return RM_ERR_INVALID_ARGUMENT;
|
||||
diff -Naur a/kernel/nv-dma.c b/kernel/nv-dma.c
|
||||
--- a/kernel/nv-dma.c 2019-12-12 06:04:24.000000000 +0800
|
||||
+++ b/kernel/nv-dma.c 2022-05-29 20:00:00.000000000 +0800
|
||||
@@ -136,10 +136,17 @@
|
||||
return status;
|
||||
}
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
+ dma_map->sg_map_count = dma_map_sg(&dma_map->dev->dev,
|
||||
+ NV_DMA_MAP_SCATTERLIST(dma_map),
|
||||
+ NV_DMA_MAP_SCATTERLIST_LENGTH(dma_map),
|
||||
+ DMA_BIDIRECTIONAL);
|
||||
+#else
|
||||
dma_map->sg_map_count = pci_map_sg(dma_map->dev,
|
||||
NV_DMA_MAP_SCATTERLIST(dma_map),
|
||||
NV_DMA_MAP_SCATTERLIST_LENGTH(dma_map),
|
||||
PCI_DMA_BIDIRECTIONAL);
|
||||
+#endif
|
||||
if (dma_map->sg_map_count == 0)
|
||||
{
|
||||
nv_printf(NV_DBG_ERRORS,
|
||||
@@ -211,8 +218,13 @@
|
||||
|
||||
if (dma_map->sg_map_count != 0)
|
||||
{
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
+ dma_unmap_sg(&dma_map->dev->dev, NV_DMA_MAP_SCATTERLIST(dma_map),
|
||||
+ NV_DMA_MAP_SCATTERLIST_LENGTH(dma_map), DMA_BIDIRECTIONAL);
|
||||
+#else
|
||||
pci_unmap_sg(dma_map->dev, NV_DMA_MAP_SCATTERLIST(dma_map),
|
||||
NV_DMA_MAP_SCATTERLIST_LENGTH(dma_map), PCI_DMA_BIDIRECTIONAL);
|
||||
+#endif
|
||||
}
|
||||
|
||||
*priv = dma_map->user_pages;
|
||||
diff -Naur a/kernel/nv-drm.c b/kernel/nv-drm.c
|
||||
--- a/kernel/nv-drm.c 2022-05-29 21:57:55.203782383 +0800
|
||||
+++ b/kernel/nv-drm.c 2022-05-29 20:00:00.000000000 +0800
|
||||
@@ -458,9 +458,15 @@
|
||||
return nv_gem_prime_get_sg_table(gem);
|
||||
}
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
+static int nv_drm_gem_vmap(struct drm_gem_object *gem,
|
||||
+ struct iosys_map *map)
|
||||
+{
|
||||
+#else
|
||||
static int nv_drm_gem_vmap(struct drm_gem_object *gem,
|
||||
struct dma_buf_map *map)
|
||||
{
|
||||
+#endif
|
||||
map->vaddr = nv_gem_prime_vmap(gem);
|
||||
if (map->vaddr == NULL) {
|
||||
return -ENOMEM;
|
||||
@@ -469,9 +475,15 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
+static void nv_drm_gem_vunmap(struct drm_gem_object *gem,
|
||||
+ struct iosys_map *map)
|
||||
+{
|
||||
+#else
|
||||
static void nv_drm_gem_vunmap(struct drm_gem_object *gem,
|
||||
struct dma_buf_map *map)
|
||||
{
|
||||
+#endif
|
||||
nv_gem_prime_vunmap(gem, map->vaddr);
|
||||
map->vaddr = NULL;
|
||||
}
|
||||
diff -Naur a/kernel/nv-vm.c b/kernel/nv-vm.c
|
||||
--- a/kernel/nv-vm.c 2019-12-12 06:04:24.000000000 +0800
|
||||
+++ b/kernel/nv-vm.c 2022-05-29 20:00:00.000000000 +0800
|
||||
@@ -169,12 +169,20 @@
|
||||
|
||||
static inline int nv_map_sg(struct pci_dev *dev, struct scatterlist *sg)
|
||||
{
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
+ return dma_map_sg(&dev->dev, sg, 1, DMA_BIDIRECTIONAL);
|
||||
+#else
|
||||
return pci_map_sg(dev, sg, 1, PCI_DMA_BIDIRECTIONAL);
|
||||
+#endif
|
||||
}
|
||||
|
||||
static inline void nv_unmap_sg(struct pci_dev *dev, struct scatterlist *sg)
|
||||
{
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
+ dma_unmap_sg(&dev->dev, sg, 1, DMA_BIDIRECTIONAL);
|
||||
+#else
|
||||
pci_unmap_sg(dev, sg, 1, PCI_DMA_BIDIRECTIONAL);
|
||||
+#endif
|
||||
}
|
||||
|
||||
#define NV_MAP_SG_MAX_RETRIES 16
|
||||
diff -Naur a/kernel/nv-frontend.c b/kernel/nv-frontend.c
|
||||
--- a/kernel/nv-frontend.c 2019-12-12 06:04:24.000000000 +0800
|
||||
+++ b/kernel/nv-frontend.c 2022-05-29 20:00:00.000000000 +0800
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "nv-frontend.h"
|
||||
|
||||
#if defined(MODULE_LICENSE)
|
||||
-MODULE_LICENSE("NVIDIA");
|
||||
+MODULE_LICENSE("GPL");
|
||||
#endif
|
||||
#if defined(MODULE_INFO)
|
||||
MODULE_INFO(supported, "external");
|
||||
@@ -0,0 +1,121 @@
|
||||
--- a/kernel/nv-acpi.c 2020-01-01 00:00:00.000000000 +0000
|
||||
+++ b/kernel/nv-acpi.c 2020-01-01 00:00:00.000000000 +0000
|
||||
@@ -190,9 +190,9 @@
|
||||
union acpi_object control_argument_0 = { ACPI_TYPE_INTEGER };
|
||||
struct acpi_object_list control_argument_list = { 0, NULL };
|
||||
nv_stack_t *sp = NULL;
|
||||
- struct list_head *node, *next;
|
||||
nv_acpi_integer_t device_id = 0;
|
||||
int device_counter = 0;
|
||||
+ acpi_handle handle = NULL;
|
||||
|
||||
NV_KMEM_CACHE_ALLOC_STACK(sp);
|
||||
if (sp == NULL)
|
||||
@@ -220,13 +220,12 @@
|
||||
|
||||
// grab handles to all the important nodes representing devices
|
||||
|
||||
- list_for_each_safe(node, next, &device->children)
|
||||
+ do
|
||||
{
|
||||
- struct acpi_device *dev =
|
||||
- list_entry(node, struct acpi_device, node);
|
||||
-
|
||||
- if (!dev)
|
||||
- continue;
|
||||
+ status = acpi_get_next_object(ACPI_TYPE_DEVICE, device->handle,
|
||||
+ handle, &handle);
|
||||
+ if (ACPI_FAILURE(status) || (handle == NULL))
|
||||
+ break;
|
||||
|
||||
if (device_counter == NV_MAXNUM_DISPLAY_DEVICES)
|
||||
{
|
||||
@@ -237,7 +236,7 @@
|
||||
}
|
||||
|
||||
status =
|
||||
- acpi_evaluate_integer(dev->handle, "_ADR", NULL, &device_id);
|
||||
+ acpi_evaluate_integer(handle, "_ADR", NULL, &device_id);
|
||||
if (ACPI_FAILURE(status))
|
||||
/* Couldnt query device_id for this device */
|
||||
continue;
|
||||
@@ -256,11 +255,11 @@
|
||||
}
|
||||
|
||||
pNvAcpiObject->pNvVideo[device_counter].dev_id = device_id;
|
||||
- pNvAcpiObject->pNvVideo[device_counter].dev_handle = dev->handle;
|
||||
+ pNvAcpiObject->pNvVideo[device_counter].dev_handle = handle;
|
||||
|
||||
device_counter++;
|
||||
|
||||
- }
|
||||
+ } while (handle != NULL);
|
||||
|
||||
// arg 0, bits 1:0, 0 = enable events
|
||||
control_argument_0.integer.type = ACPI_TYPE_INTEGER;
|
||||
@@ -1202,16 +1201,15 @@
|
||||
)
|
||||
{
|
||||
acpi_status status;
|
||||
- struct acpi_device *device = NULL;
|
||||
struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||
union acpi_object *ddc;
|
||||
union acpi_object ddc_arg0 = { ACPI_TYPE_INTEGER };
|
||||
struct acpi_object_list input = { 1, &ddc_arg0 };
|
||||
- struct list_head *node, *next;
|
||||
nv_acpi_integer_t device_id = 0;
|
||||
NvU32 i;
|
||||
acpi_handle dev_handle = NULL;
|
||||
acpi_handle lcd_dev_handle = NULL;
|
||||
+ acpi_handle handle = NULL;
|
||||
|
||||
if (!nv_acpi_get_device_handle(nv, &dev_handle))
|
||||
return RM_ERR_NOT_SUPPORTED;
|
||||
@@ -1219,16 +1217,6 @@
|
||||
if (!dev_handle)
|
||||
return RM_ERR_INVALID_ARGUMENT;
|
||||
|
||||
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
||||
- device = acpi_fetch_acpi_dev(dev_handle);
|
||||
- status = 0;
|
||||
-#else
|
||||
- status = acpi_bus_get_device(dev_handle, &device);
|
||||
-#endif
|
||||
-
|
||||
- if (ACPI_FAILURE(status) || !device)
|
||||
- return RM_ERR_INVALID_ARGUMENT;
|
||||
-
|
||||
if (!NV_MAY_SLEEP())
|
||||
{
|
||||
#if defined(DEBUG)
|
||||
@@ -1239,15 +1227,15 @@
|
||||
return RM_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
- list_for_each_safe(node, next, &device->children)
|
||||
+ while (lcd_dev_handle == NULL)
|
||||
{
|
||||
- struct acpi_device *dev =
|
||||
- list_entry(node, struct acpi_device, node);
|
||||
+ status = acpi_get_next_object(ACPI_TYPE_DEVICE, dev_handle,
|
||||
+ handle, &handle);
|
||||
+ if (ACPI_FAILURE(status) || (handle == NULL))
|
||||
+ break;
|
||||
|
||||
- if (!dev)
|
||||
- continue;
|
||||
+ status = acpi_evaluate_integer(handle, "_ADR", NULL, &device_id);
|
||||
|
||||
- status = acpi_evaluate_integer(dev->handle, "_ADR", NULL, &device_id);
|
||||
if (ACPI_FAILURE(status))
|
||||
/* Couldnt query device_id for this device */
|
||||
continue;
|
||||
@@ -1256,7 +1244,7 @@
|
||||
|
||||
if ((device_id == 0x0110) || (device_id == 0x0118) || (device_id == 0x0400)) /* Only for an LCD*/
|
||||
{
|
||||
- lcd_dev_handle = dev->handle;
|
||||
+ lcd_dev_handle = handle;
|
||||
nv_printf(NV_DBG_INFO, "NVRM: %s Found LCD: %x\n", __FUNCTION__, device_id);
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
--- a/kernel/conftest.sh 2023-02-24 10:35:02.633467500 +0100
|
||||
+++ b/kernel/conftest.sh 2023-02-24 11:13:02.892079164 +0100
|
||||
@@ -794,12 +794,19 @@
|
||||
|
||||
echo "$CONFTEST_PREAMBLE
|
||||
#include <linux/acpi.h>
|
||||
+ #include <linux/version.h>
|
||||
|
||||
acpi_op_remove conftest_op_remove_routine;
|
||||
|
||||
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0)
|
||||
+ void conftest_acpi_device_ops_remove(struct acpi_device *device) {
|
||||
+ conftest_op_remove_routine(device);
|
||||
+ }
|
||||
+ #else
|
||||
int conftest_acpi_device_ops_remove(struct acpi_device *device) {
|
||||
return conftest_op_remove_routine(device);
|
||||
- }" > conftest$$.c
|
||||
+ }
|
||||
+ #endif" > conftest$$.c
|
||||
|
||||
$CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
|
||||
rm -f conftest$$.c
|
||||
--- a/kernel/nv-acpi.c 2023-02-24 10:35:02.643467765 +0100
|
||||
+++ b/kernel/nv-acpi.c 2023-02-24 11:09:14.821580592 +0100
|
||||
@@ -26,8 +26,12 @@
|
||||
#if !defined(NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT) || (NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT == 2)
|
||||
static int nv_acpi_remove_two_args(struct acpi_device *device, int type);
|
||||
#else
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0)
|
||||
+static void nv_acpi_remove_one_arg(struct acpi_device *device);
|
||||
+#else
|
||||
static int nv_acpi_remove_one_arg(struct acpi_device *device);
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
static void nv_acpi_event (acpi_handle, u32, void *);
|
||||
static acpi_status nv_acpi_find_methods (acpi_handle, u32, void *, void **);
|
||||
@@ -356,8 +360,12 @@
|
||||
#if !defined(NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT) || (NV_ACPI_DEVICE_OPS_REMOVE_ARGUMENT_COUNT == 2)
|
||||
static int nv_acpi_remove_two_args(struct acpi_device *device, int type)
|
||||
#else
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0)
|
||||
+static void nv_acpi_remove_one_arg(struct acpi_device *device)
|
||||
+#else
|
||||
static int nv_acpi_remove_one_arg(struct acpi_device *device)
|
||||
#endif
|
||||
+#endif
|
||||
{
|
||||
/*
|
||||
* This function will cause RM to relinquish control of the VGA ACPI device.
|
||||
@@ -407,7 +415,9 @@
|
||||
device->driver_data = NULL;
|
||||
}
|
||||
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0)
|
||||
return status;
|
||||
+#endif
|
||||
}
|
||||
|
||||
static void nv_acpi_event(acpi_handle handle, u32 event_type, void *data)
|
||||
@@ -0,0 +1,106 @@
|
||||
--- a/kernel/nv-mmap.c 2023-05-03 11:48:48.481814709 +0200
|
||||
+++ b/kernel/nv-mmap.c 2023-05-03 11:51:39.220313386 +0200
|
||||
@@ -312,7 +312,11 @@
|
||||
goto done;
|
||||
}
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
|
||||
+ vm_flags_set(vma, VM_IO);
|
||||
+#else
|
||||
vma->vm_flags |= VM_IO;
|
||||
+#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -363,8 +367,13 @@
|
||||
|
||||
NV_PRINT_AT(NV_DBG_MEMINFO, at);
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
|
||||
+ vm_flags_set(vma, VM_IO | VM_LOCKED | VM_RESERVED);
|
||||
+ vm_flags_set(vma, VM_DONTEXPAND | VM_DONTDUMP);
|
||||
+#else
|
||||
vma->vm_flags |= (VM_IO | VM_LOCKED | VM_RESERVED);
|
||||
vma->vm_flags |= (VM_DONTEXPAND | VM_DONTDUMP);
|
||||
+#endif
|
||||
}
|
||||
|
||||
if (status == 0)
|
||||
@@ -374,8 +383,13 @@
|
||||
if ((prot & NV_PROTECT_WRITEABLE) == 0)
|
||||
{
|
||||
vma->vm_page_prot = NV_PGPROT_READ_ONLY(vma->vm_page_prot);
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
|
||||
+ vm_flags_clear(vma, VM_WRITE);
|
||||
+ vm_flags_clear(vma, VM_MAYWRITE);
|
||||
+#else
|
||||
vma->vm_flags &= ~VM_WRITE;
|
||||
vma->vm_flags &= ~VM_MAYWRITE;
|
||||
+#endif
|
||||
}
|
||||
|
||||
vma->vm_ops = &nv_vm_ops;
|
||||
--- a/kernel/uvm/nvidia_uvm_lite.c 2023-05-03 12:00:17.508256190 +0200
|
||||
+++ b/kernel/uvm/nvidia_uvm_lite.c 2023-05-03 12:03:59.160897071 +0200
|
||||
@@ -1524,10 +1524,17 @@
|
||||
|
||||
vma->vm_ops = &uvmlite_vma_ops;
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
|
||||
+ // Prohibit copying the vma on fork().
|
||||
+ vm_flags_set(vma, VM_DONTCOPY);
|
||||
+ // Prohibt mremap() that would expand the vma.
|
||||
+ vm_flags_set(vma, VM_DONTEXPAND);
|
||||
+#else
|
||||
// Prohibit copying the vma on fork().
|
||||
vma->vm_flags |= VM_DONTCOPY;
|
||||
// Prohibt mremap() that would expand the vma.
|
||||
vma->vm_flags |= VM_DONTEXPAND;
|
||||
+#endif
|
||||
|
||||
// Other cases of vma modification are detected in _mmap_open().
|
||||
|
||||
@@ -1546,9 +1553,15 @@
|
||||
return -EINVAL;
|
||||
|
||||
vma->vm_ops = &counters_vma_ops;
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
|
||||
+ vm_flags_clear(vma, VM_MAYWRITE);
|
||||
+ // prevent vm_insert_page from modifying the vma's flags:
|
||||
+ vm_flags_set(vma, VM_MIXEDMAP);
|
||||
+#else
|
||||
vma->vm_flags &= ~VM_MAYWRITE;
|
||||
// prevent vm_insert_page from modifying the vma's flags:
|
||||
vma->vm_flags |= VM_MIXEDMAP;
|
||||
+#endif
|
||||
ret = 0;
|
||||
}
|
||||
UVM_DBG_PRINT_RL("vma 0x%p [0x%p, 0x%p) ret %d pgoff"
|
||||
@@ -2527,8 +2540,13 @@
|
||||
// Subsequent access from userspace after the pages are unmapped will cause
|
||||
// a SIGSEGV.
|
||||
//
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
|
||||
+ vm_flags_clear(vma, VM_READ|VM_MAYREAD);
|
||||
+ vm_flags_clear(vma, VM_WRITE|VM_MAYWRITE);
|
||||
+#else
|
||||
vma->vm_flags &= ~(VM_READ|VM_MAYREAD);
|
||||
vma->vm_flags &= ~(VM_WRITE|VM_MAYWRITE);
|
||||
+#endif
|
||||
}
|
||||
|
||||
//
|
||||
@@ -2536,8 +2554,13 @@
|
||||
//
|
||||
static void _set_vma_accessible(struct vm_area_struct * vma)
|
||||
{
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
|
||||
+ vm_flags_set(vma, VM_READ|VM_MAYREAD);
|
||||
+ vm_flags_set(vma, VM_WRITE|VM_MAYWRITE);
|
||||
+#else
|
||||
vma->vm_flags |= (VM_READ|VM_MAYREAD);
|
||||
vma->vm_flags |= (VM_WRITE|VM_MAYWRITE);
|
||||
+#endif
|
||||
}
|
||||
|
||||
//
|
||||
@@ -0,0 +1,75 @@
|
||||
diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
|
||||
--- a/kernel/conftest.sh 2023-09-09 04:19:11.170064889 +0000
|
||||
+++ b/kernel/conftest.sh 2023-09-09 04:21:10.593482047 +0000
|
||||
@@ -1977,6 +1977,30 @@
|
||||
return
|
||||
fi
|
||||
|
||||
+ # Conftest #4: check if vma arg was dropped
|
||||
+ # Return if available.
|
||||
+ # Fall through to default case if absent.
|
||||
+
|
||||
+ 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
|
||||
+ echo "#define NV_GET_USER_PAGES_DROPPED_VMA" | append_conftest "functions"
|
||||
+ echo "#undef NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS" | append_conftest "functions"
|
||||
+ echo "#undef NV_GET_USER_PAGES_HAS_TASK_STRUCT" | append_conftest "functions"
|
||||
+ rm -f conftest$$.o
|
||||
+ return
|
||||
+ fi
|
||||
+
|
||||
|
||||
echo "#define NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS" | append_conftest "functions"
|
||||
echo "#define NV_GET_USER_PAGES_HAS_TASK_STRUCT" | append_conftest "functions"
|
||||
@@ -1985,6 +2009,8 @@
|
||||
;;
|
||||
|
||||
get_user_pages_remote)
|
||||
+ echo "#define NV_GET_USER_PAGES_REMOTE_UNUSED" | append_conftest "functions"
|
||||
+ return
|
||||
#
|
||||
# Determine if the function get_user_pages_remote() is
|
||||
# present and has write/force parameters.
|
||||
diff -Naur a/kernel/nv-linux.h b/kernel/nv-linux.h
|
||||
--- a/kernel/nv-linux.h 2023-09-09 04:19:11.163398218 +0000
|
||||
+++ b/kernel/nv-linux.h 2023-09-09 04:21:36.163499676 +0000
|
||||
@@ -2205,7 +2205,11 @@
|
||||
if (force)
|
||||
flags |= FOLL_FORCE;
|
||||
|
||||
- return get_user_pages(start, nr_pages, flags, pages, vmas);
|
||||
+ #if defined(NV_GET_USER_PAGES_DROPPED_VMA)
|
||||
+ return get_user_pages(start, nr_pages, flags, pages);
|
||||
+ #else
|
||||
+ return get_user_pages(start, nr_pages, flags, pages, vmas);
|
||||
+ #endif
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -2231,6 +2235,8 @@
|
||||
* 2016 Dec 14:5b56d49fc31dbb0487e14ead790fc81ca9fb2c99
|
||||
*/
|
||||
|
||||
+#if defined(NV_GET_USER_PAGES_REMOTE_UNUSED)
|
||||
+#else
|
||||
#if defined(NV_GET_USER_PAGES_REMOTE_PRESENT)
|
||||
#if defined (NV_GET_USER_PAGES_REMOTE_HAS_WRITE_AND_FORCE_ARGS)
|
||||
#define NV_GET_USER_PAGES_REMOTE get_user_pages_remote
|
||||
@@ -2295,5 +2301,6 @@
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
#endif /* _NV_LINUX_H_ */
|
||||
@@ -0,0 +1,14 @@
|
||||
diff -Naur a/kernel/nv-drm.c b/kernel/nv-drm.c
|
||||
--- a/kernel/nv-drm.c 2023-11-05 03:19:26.555143512 +0000
|
||||
+++ b/kernel/nv-drm.c 2023-11-05 03:19:26.555143512 +0000
|
||||
@@ -520,8 +520,9 @@
|
||||
#elif LINUX_VERSION_CODE <= KERNEL_VERSION(5, 10, 0)
|
||||
.gem_free_object_unlocked = nv_gem_free,
|
||||
#endif
|
||||
-
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0)
|
||||
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
|
||||
+#endif
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 10, 0)
|
||||
.gem_prime_export = drm_gem_prime_export,
|
||||
.gem_prime_get_sg_table = nv_gem_prime_get_sg_table,
|
||||
@@ -0,0 +1,11 @@
|
||||
diff -Naur a/kernel/conftest.sh b/kernel/conftest.sh
|
||||
--- a/kernel/conftest.sh 2024-03-17 06:12:58.410530788 +0000
|
||||
+++ b/kernel/conftest.sh 2024-03-17 06:12:58.410530788 +0000
|
||||
@@ -1573,6 +1573,7 @@
|
||||
;;
|
||||
|
||||
drm_available)
|
||||
+ return
|
||||
#
|
||||
# Determine if the DRM subsystem is usable
|
||||
#
|
||||
@@ -22,9 +22,19 @@
|
||||
<AdditionalFile owner="root" permission="0644" target="kernel-5.11.patch">0005-kernel-5.11.patch</AdditionalFile>
|
||||
<AdditionalFile owner="root" permission="0644" target="kernel-5.14.patch">0006-kernel-5.14.patch</AdditionalFile>
|
||||
<AdditionalFile owner="root" permission="0644" target="kernel-5.15.patch">0008-fix-5.15.patch</AdditionalFile>
|
||||
|
||||
<AdditionalFile owner="root" permission="0644" target="kernel-5.16.patch">0008-kernel-5.16.patch</AdditionalFile>
|
||||
<AdditionalFile owner="root" permission="0644" target="kernel-5.17.patch">0009-kernel-5.17.patch</AdditionalFile>
|
||||
<AdditionalFile owner="root" permission="0644" target="kernel-5.18.patch">0010-kernel-5.18.patch</AdditionalFile>
|
||||
<AdditionalFile owner="root" permission="0644" target="kernel-6.0.patch">0011-kernel-6.0.patch</AdditionalFile>
|
||||
<AdditionalFile owner="root" permission="0644" target="kernel-6.2.patch">0012-kernel-6.2.patch</AdditionalFile>
|
||||
<AdditionalFile owner="root" permission="0644" target="kernel-6.3.patch">0013-kernel-6.3.patch</AdditionalFile>
|
||||
<AdditionalFile owner="root" permission="0644" target="kernel-6.5.patch">0014-kernel-6.5.patch</AdditionalFile>
|
||||
<AdditionalFile owner="root" permission="0644" target="kernel-6.6.patch">0015-kernel-6.6.patch</AdditionalFile>
|
||||
<AdditionalFile owner="root" permission="0644" target="kernel-6.8.patch">0016-kernel-6.8.patch</AdditionalFile>
|
||||
</AdditionalFiles>
|
||||
<BuildDependencies>
|
||||
<Dependency version="5.15.158">kernel-module-headers</Dependency>
|
||||
<Dependency version="6.6.30">kernel-module-headers</Dependency>
|
||||
</BuildDependencies>
|
||||
</Source>
|
||||
|
||||
@@ -33,7 +43,7 @@
|
||||
<IsA>driver</IsA>
|
||||
<Summary>Kernel module for NVIDIA driver 340.xx releases</Summary>
|
||||
<RuntimeDependencies>
|
||||
<Dependency version="5.15.158">kernel</Dependency>
|
||||
<Dependency version="6.6.30">kernel</Dependency>
|
||||
</RuntimeDependencies>
|
||||
<Files>
|
||||
<Path fileType="library" permanent="true">/lib/modules</Path>
|
||||
|
||||
Reference in New Issue
Block a user