mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
gpu: host1x: Add conftest support
Instead of relying on kernel version to determine if certain functions or structure are present in the kernel, use the conftest.sh script to test which functions, structures, etc are present at compile time. This is beneficial for working with 3rd party Linux kernels that may have back-ported upstream changes into their kernel and so the kernel version checks do not work. Bug 4119327 Change-Id: I56281fa5d95862338bd8a43d6e22225c27590462 Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2984422 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
5a26b0ef9d
commit
ae64ed46c8
@@ -5,6 +5,8 @@
|
|||||||
* Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <nvidia/conftest.h>
|
||||||
|
|
||||||
#include <linux/anon_inodes.h>
|
#include <linux/anon_inodes.h>
|
||||||
#include <linux/cdev.h>
|
#include <linux/cdev.h>
|
||||||
#include <linux/file.h>
|
#include <linux/file.h>
|
||||||
@@ -415,10 +417,10 @@ static const struct file_operations dev_file_fops = {
|
|||||||
.compat_ioctl = dev_file_ioctl,
|
.compat_ioctl = dev_file_ioctl,
|
||||||
};
|
};
|
||||||
|
|
||||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))
|
#if defined(NV_CLASS_STRUCT_DEVNODE_HAS_CONST_DEV_ARG) /* Linux v6.2 */
|
||||||
static char *host1x_fence_devnode(struct device *dev, umode_t *mode)
|
|
||||||
#else
|
|
||||||
static char *host1x_fence_devnode(const struct device *dev, umode_t *mode)
|
static char *host1x_fence_devnode(const struct device *dev, umode_t *mode)
|
||||||
|
#else
|
||||||
|
static char *host1x_fence_devnode(struct device *dev, umode_t *mode)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
*mode = 0666;
|
*mode = 0666;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
* Copyright (c) 2010-2013, NVIDIA Corporation.
|
* Copyright (c) 2010-2013, NVIDIA Corporation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <nvidia/conftest.h>
|
||||||
|
|
||||||
#include <asm/cacheflush.h>
|
#include <asm/cacheflush.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
@@ -106,7 +107,7 @@ static int host1x_pushbuffer_init(struct push_buffer *pb)
|
|||||||
|
|
||||||
pb->dma = iova_dma_addr(&host1x->iova, alloc);
|
pb->dma = iova_dma_addr(&host1x->iova, alloc);
|
||||||
err = iommu_map(host1x->domain, pb->dma, pb->phys, size,
|
err = iommu_map(host1x->domain, pb->dma, pb->phys, size,
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
|
#if defined(NV_IOMMU_MAP_HAS_GFP_ARG) /* Linux v6.3 */
|
||||||
IOMMU_READ, GFP_KERNEL);
|
IOMMU_READ, GFP_KERNEL);
|
||||||
#else
|
#else
|
||||||
IOMMU_READ);
|
IOMMU_READ);
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ endef
|
|||||||
# provided by the module-specific Kbuild files.
|
# provided by the module-specific Kbuild files.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += class_struct_devnode_has_const_dev_arg
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_thermal_of_zone_register
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_thermal_of_zone_register
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_aperture_remove_framebuffers_has_drm_driver_arg
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_aperture_remove_framebuffers_has_drm_driver_arg
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_driver_struct_has_irq_enabled_arg
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_driver_struct_has_irq_enabled_arg
|
||||||
|
|||||||
@@ -6293,6 +6293,26 @@ compile_test() {
|
|||||||
compile_check_conftest "$CODE" "NV_CRYPTO_PRESENT" "" "symbols"
|
compile_check_conftest "$CODE" "NV_CRYPTO_PRESENT" "" "symbols"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
class_struct_devnode_has_const_dev_arg)
|
||||||
|
#
|
||||||
|
# Determine if the 'class' structure devnode function pointer
|
||||||
|
# has const 'struct dev' argument.
|
||||||
|
#
|
||||||
|
# Commit 43a7206b0963 ("driver core: class: make class_register()
|
||||||
|
# take a const *") updated the class_register function to take a
|
||||||
|
# const class structure in Linux v6.2.
|
||||||
|
#
|
||||||
|
CODE="
|
||||||
|
#include <linux/device.h>
|
||||||
|
#include <linux/device/class.h>
|
||||||
|
#include <linux/types.h>
|
||||||
|
void conftest_class_struct_devnode_has_const_dev_arg(struct class *c) {
|
||||||
|
char *(*fn)(const struct device *dev, umode_t *mode) = c->devnode;
|
||||||
|
}"
|
||||||
|
|
||||||
|
compile_check_conftest "$CODE" "NV_CLASS_STRUCT_DEVNODE_HAS_CONST_DEV_ARG" "" "types"
|
||||||
|
;;
|
||||||
|
|
||||||
devm_thermal_of_zone_register)
|
devm_thermal_of_zone_register)
|
||||||
#
|
#
|
||||||
# Determine whether devm_thermal_of_zone_register is present.
|
# Determine whether devm_thermal_of_zone_register is present.
|
||||||
|
|||||||
Reference in New Issue
Block a user