diff --git a/Makefile b/Makefile index a3250d5a..cb273532 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,9 @@ endif # Legacy GPIO support is removed in Linux v6.3 ifeq ($(shell test $(LINUX_VERSION) -ge $(LINUX_VERSION_6_3); echo $$?),0) export CONFIG_TEGRA_GPIO_LEGACY_DISABLE=y + +# Setting VM flag via API vm_flags_set +subdir-ccflags-y += -DNV_VM_FLAG_SET_API_AVAILABLE endif # Changes done in Linux 6.4 onwards diff --git a/drivers/misc/nvscic2c-pcie/endpoint.c b/drivers/misc/nvscic2c-pcie/endpoint.c index f752954b..8a0b2a26 100644 --- a/drivers/misc/nvscic2c-pcie/endpoint.c +++ b/drivers/misc/nvscic2c-pcie/endpoint.c @@ -345,7 +345,7 @@ endpoint_fops_mmap(struct file *filp, struct vm_area_struct *vma) } vma->vm_pgoff = 0; -#if defined(CONFIG_TEGRA_SYSTEM_TYPE_ACK) && (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) +#if defined(NV_VM_FLAG_SET_API_AVAILABLE) || (defined(CONFIG_TEGRA_SYSTEM_TYPE_ACK) && (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))) vm_flags_set(vma, VM_DONTCOPY); #else vma->vm_flags |= (VM_DONTCOPY); // fork() not supported. diff --git a/drivers/misc/nvscic2c-pcie/stream-extensions.c b/drivers/misc/nvscic2c-pcie/stream-extensions.c index cad14962..4d6a4cd2 100644 --- a/drivers/misc/nvscic2c-pcie/stream-extensions.c +++ b/drivers/misc/nvscic2c-pcie/stream-extensions.c @@ -294,7 +294,7 @@ fops_mmap(struct file *filep, struct vm_area_struct *vma) memaddr = stream_obj->aper; vma->vm_pgoff = 0; -#if defined(CONFIG_TEGRA_SYSTEM_TYPE_ACK) && (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) +#if defined(NV_VM_FLAG_SET_API_AVAILABLE) || (defined(CONFIG_TEGRA_SYSTEM_TYPE_ACK) && (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))) vm_flags_set(vma, VM_DONTCOPY); #else vma->vm_flags |= (VM_DONTCOPY);