From f0404e50f6ac846d8746c88f403fef8607ab7151 Mon Sep 17 00:00:00 2001 From: Mainak Sen Date: Thu, 17 Apr 2025 07:22:00 +0000 Subject: [PATCH] drm: tegra: Disable TEGRA_SYNCPT_INCR IOCTL for T264 platform Conditionally disabled the legacy TEGRA_SYNCPT_INCR IOCTL for T264 platforms since it's no longer needed. This IOCTL is superseded by the newer TEGRA_SYNCPOINT_INCREMENT IOCTL which provides better functionality and follows the modern API design. The conditional compilation helps reduce the attack surface on T264 platforms by removing legacy code paths that aren't needed. Use CONFIG_ARCH_TEGRA_264_SOC as the proper platform-specific flag to identify T264 platforms, as this is the standard architecture flag used throughout the codebase. This change affects: 1. The IOCTL definition in the tegra_drm_ioctls table 2. The IOCTL handler function implementation This improves code cleanliness by removing unnecessary legacy code on newer platforms while maintaining backward compatibility for older platforms that might depend on this IOCTL. Bug 5060574 Change-Id: Idd21d69ebd992f976770016b5805f7d6af89c88d Signed-off-by: Mainak Sen Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3342657 Reviewed-by: Sourab Gupta GVS: buildbot_gerritrpt --- configs/Makefile.config.embedded-linux | 1 + drivers/gpu/Makefile | 5 +++++ drivers/gpu/drm/tegra/drm.c | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/configs/Makefile.config.embedded-linux b/configs/Makefile.config.embedded-linux index 03844598..4a79184c 100644 --- a/configs/Makefile.config.embedded-linux +++ b/configs/Makefile.config.embedded-linux @@ -7,3 +7,4 @@ export NV_OOT_NVMAP_IN_EMBEDDED_LINUX=y subdir-ccflags-y += -DNV_CONFIG_NVMAP_IN_EMBEDDED_LINUX export NV_OOT_NVHOST_NATIVE_DIS=y +export NV_OOT_NVHOST_DISABLE_LEGACY_IOCTL=y diff --git a/drivers/gpu/Makefile b/drivers/gpu/Makefile index 040a5e67..a9c878a2 100644 --- a/drivers/gpu/Makefile +++ b/drivers/gpu/Makefile @@ -20,6 +20,11 @@ export CONFIG_TEGRA_DRM_NATIVE_DIS=y subdir-ccflags-y += -DCONFIG_TEGRA_DRM_NATIVE_DIS endif +ifeq ($(NV_OOT_NVHOST_DISABLE_LEGACY_IOCTL),y) +export CONFIG_TEGRA_DRM_DISABLE_LEGACY_IOCTL=y +subdir-ccflags-y += -DCONFIG_TEGRA_DRM_DISABLE_LEGACY_IOCTL +endif + ifdef CONFIG_DRM obj-m += drm/tegra/ endif diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 4fb594ac..295e78eb 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -412,6 +412,10 @@ static int tegra_syncpt_incr(struct drm_device *drm, void *data, struct drm_tegra_syncpt_incr *args = data; struct host1x_syncpt *sp; + /* Legacy IOCTL is not supported on tegra264 */ + if (of_machine_is_compatible("nvidia,tegra264")) + return -EINVAL; + sp = host1x_syncpt_get_by_id_noref(host1x, args->id); if (!sp) return -EINVAL;