From 84236d8fce1d1b99969d8d244156415947f6dd3d Mon Sep 17 00:00:00 2001 From: Kartik Rajput Date: Tue, 12 Sep 2023 12:20:29 +0530 Subject: [PATCH] gpu: nvgpu: Fix compilation issues with Kernel-6.5 Upstream commit "7e3f926bf453" [rcu/kvfree: Eliminate k[v]free_rcu() single argument macro] Removes the single-argument kvfree_rcu() and kfree_rcu() macros. Code that would have previously used these single-argument kvfree_rcu() and kfree_rcu() macros should instead use kvfree_rcu_mightsleep() or kfree_rcu_mightsleep(). Use kfree_rcu_mightsleep() instead of kfree_rcu() if using Kernel-6.5 or newer. Bug 4276500 Change-Id: I1adb4125c83019ea6c0e7d37175716ee7ed659cc Signed-off-by: Kartik Rajput Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2978710 (cherry picked from commit 2ede069c81db420c2d5fbd00bee4030fd943f3f7) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/3037021 Reviewed-by: Jonathan Hunter Reviewed-by: Laxman Dewangan Tested-by: Jonathan Hunter GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/os/linux/nvhost_host1x.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/nvgpu/os/linux/nvhost_host1x.c b/drivers/gpu/nvgpu/os/linux/nvhost_host1x.c index 5627d993e..177248d21 100644 --- a/drivers/gpu/nvgpu/os/linux/nvhost_host1x.c +++ b/drivers/gpu/nvgpu/os/linux/nvhost_host1x.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -134,7 +135,12 @@ static void nvgpu_host1x_work_func(struct work_struct *work) struct nvgpu_host1x_cb *host1x_cb = container_of(work, struct nvgpu_host1x_cb, work); host1x_cb->notifier(host1x_cb->notifier_data, 0); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 5, 0)) + kfree_rcu_mightsleep(host1x_cb); +#else kfree_rcu(host1x_cb); +#endif + } static void nvgpu_host1x_cb_func(struct dma_fence *f, struct dma_fence_cb *cb)