mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
drivers: Use conftest for vm_flags
The conftest script has a test for checking if the vm_area struct has a const vm_flags member. So enable this test and use the definition generated in the appropriate drivers. Bug 4374520 Change-Id: I0e7bd105fe8a821b0af23c0a5553b8d4468fa8c4 Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3026924 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
732a0db90e
commit
d0e427c6e1
3
Makefile
3
Makefile
@@ -26,9 +26,6 @@ endif
|
|||||||
# Legacy GPIO support is removed in Linux v6.3
|
# Legacy GPIO support is removed in Linux v6.3
|
||||||
ifeq ($(shell test $(LINUX_VERSION) -ge $(LINUX_VERSION_6_3); echo $$?),0)
|
ifeq ($(shell test $(LINUX_VERSION) -ge $(LINUX_VERSION_6_3); echo $$?),0)
|
||||||
export CONFIG_TEGRA_GPIO_LEGACY_DISABLE=y
|
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
|
endif
|
||||||
|
|
||||||
# Changes done in Linux 6.4 onwards
|
# Changes done in Linux 6.4 onwards
|
||||||
|
|||||||
@@ -584,8 +584,7 @@ int __tegra_gem_mmap(struct drm_gem_object *gem, struct vm_area_struct *vma)
|
|||||||
* and set the vm_pgoff (used as a fake buffer offset by DRM)
|
* and set the vm_pgoff (used as a fake buffer offset by DRM)
|
||||||
* to 0 as we want to map the whole buffer.
|
* to 0 as we want to map the whole buffer.
|
||||||
*/
|
*/
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)) \
|
#if defined(NV_VM_AREA_STRUCT_HAS_CONST_VM_FLAGS) /* Linux v6.3 */
|
||||||
|| (defined(CONFIG_TEGRA_SYSTEM_TYPE_ACK) && (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)))
|
|
||||||
vm_flags_clear(vma, VM_PFNMAP);
|
vm_flags_clear(vma, VM_PFNMAP);
|
||||||
#else
|
#else
|
||||||
vma->vm_flags &= ~VM_PFNMAP;
|
vma->vm_flags &= ~VM_PFNMAP;
|
||||||
@@ -603,8 +602,7 @@ int __tegra_gem_mmap(struct drm_gem_object *gem, struct vm_area_struct *vma)
|
|||||||
} else {
|
} else {
|
||||||
pgprot_t prot = vm_get_page_prot(vma->vm_flags);
|
pgprot_t prot = vm_get_page_prot(vma->vm_flags);
|
||||||
|
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)) \
|
#if defined(NV_VM_AREA_STRUCT_HAS_CONST_VM_FLAGS) /* Linux v6.3 */
|
||||||
|| (defined(CONFIG_TEGRA_SYSTEM_TYPE_ACK) && (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)))
|
|
||||||
vm_flags_set(vma, VM_MIXEDMAP);
|
vm_flags_set(vma, VM_MIXEDMAP);
|
||||||
vm_flags_clear(vma, VM_PFNMAP);
|
vm_flags_clear(vma, VM_PFNMAP);
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
#include <linux/printk.h>
|
#include <linux/printk.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/version.h>
|
|
||||||
#include <linux/wait.h>
|
#include <linux/wait.h>
|
||||||
|
|
||||||
#include <uapi/misc/nvscic2c-pcie-ioctl.h>
|
#include <uapi/misc/nvscic2c-pcie-ioctl.h>
|
||||||
@@ -345,7 +344,7 @@ endpoint_fops_mmap(struct file *filp, struct vm_area_struct *vma)
|
|||||||
}
|
}
|
||||||
|
|
||||||
vma->vm_pgoff = 0;
|
vma->vm_pgoff = 0;
|
||||||
#if defined(NV_VM_FLAG_SET_API_AVAILABLE) || (defined(CONFIG_TEGRA_SYSTEM_TYPE_ACK) && (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)))
|
#if defined(NV_VM_AREA_STRUCT_HAS_CONST_VM_FLAGS) /* Linux v6.3 */
|
||||||
vm_flags_set(vma, VM_DONTCOPY);
|
vm_flags_set(vma, VM_DONTCOPY);
|
||||||
#else
|
#else
|
||||||
vma->vm_flags |= (VM_DONTCOPY); // fork() not supported.
|
vma->vm_flags |= (VM_DONTCOPY); // fork() not supported.
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#define pr_fmt(fmt) "nvscic2c-pcie: stream-ext: " fmt
|
#define pr_fmt(fmt) "nvscic2c-pcie: stream-ext: " fmt
|
||||||
|
|
||||||
|
#include <nvidia/conftest.h>
|
||||||
|
|
||||||
#include <linux/anon_inodes.h>
|
#include <linux/anon_inodes.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/errno.h>
|
#include <linux/errno.h>
|
||||||
@@ -15,7 +17,6 @@
|
|||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/syscalls.h>
|
#include <linux/syscalls.h>
|
||||||
#include <linux/tegra-pcie-edma.h>
|
#include <linux/tegra-pcie-edma.h>
|
||||||
#include <linux/version.h>
|
|
||||||
|
|
||||||
#include <uapi/misc/nvscic2c-pcie-ioctl.h>
|
#include <uapi/misc/nvscic2c-pcie-ioctl.h>
|
||||||
|
|
||||||
@@ -294,7 +295,7 @@ fops_mmap(struct file *filep, struct vm_area_struct *vma)
|
|||||||
memaddr = stream_obj->aper;
|
memaddr = stream_obj->aper;
|
||||||
|
|
||||||
vma->vm_pgoff = 0;
|
vma->vm_pgoff = 0;
|
||||||
#if defined(NV_VM_FLAG_SET_API_AVAILABLE) || (defined(CONFIG_TEGRA_SYSTEM_TYPE_ACK) && (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)))
|
#if defined(NV_VM_AREA_STRUCT_HAS_CONST_VM_FLAGS) /* Linux v6.3 */
|
||||||
vm_flags_set(vma, VM_DONTCOPY);
|
vm_flags_set(vma, VM_DONTCOPY);
|
||||||
#else
|
#else
|
||||||
vma->vm_flags |= (VM_DONTCOPY);
|
vma->vm_flags |= (VM_DONTCOPY);
|
||||||
|
|||||||
@@ -452,8 +452,7 @@ int __nvmap_map(struct nvmap_handle *h, struct vm_area_struct *vma)
|
|||||||
}
|
}
|
||||||
priv->handle = h;
|
priv->handle = h;
|
||||||
|
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)) \
|
#if defined(NV_VM_AREA_STRUCT_HAS_CONST_VM_FLAGS) /* Linux v6.3 */
|
||||||
|| (defined(CONFIG_TEGRA_SYSTEM_TYPE_ACK) && (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)))
|
|
||||||
vm_flags_set(vma, VM_SHARED | VM_DONTEXPAND |
|
vm_flags_set(vma, VM_SHARED | VM_DONTEXPAND |
|
||||||
VM_DONTDUMP | VM_DONTCOPY |
|
VM_DONTDUMP | VM_DONTCOPY |
|
||||||
(h->heap_pgalloc ? 0 : VM_PFNMAP));
|
(h->heap_pgalloc ? 0 : VM_PFNMAP));
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_of_get_dai_name_has_index_arg
|
|||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tc_taprio_qopt_offload_struct_has_cmd
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tc_taprio_qopt_offload_struct_has_cmd
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_dev_iommu_get_stream_id
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_dev_iommu_get_stream_id
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_ivc_struct_has_iosys_map
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_ivc_struct_has_iosys_map
|
||||||
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += vm_area_struct_has_const_vm_flags
|
||||||
NV_CONFTEST_GENERIC_COMPILE_TESTS += is_export_symbol_present_drm_gem_prime_fd_to_handle
|
NV_CONFTEST_GENERIC_COMPILE_TESTS += is_export_symbol_present_drm_gem_prime_fd_to_handle
|
||||||
NV_CONFTEST_GENERIC_COMPILE_TESTS += is_export_symbol_present_drm_gem_prime_handle_to_fd
|
NV_CONFTEST_GENERIC_COMPILE_TESTS += is_export_symbol_present_drm_gem_prime_handle_to_fd
|
||||||
NV_CONFTEST_MACRO_COMPILE_TESTS ?=
|
NV_CONFTEST_MACRO_COMPILE_TESTS ?=
|
||||||
|
|||||||
Reference in New Issue
Block a user