1 Star 0 Fork 0

周志华/goutil

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
nvidia-fix-linux-5.14.patch 1.97 KB
一键复制 编辑 原始数据 按行查看 历史
周志华 提交于 2024-01-23 11:18 . nvidia patch
From f18c541edc5e122b06b0c1e65d0a422f0b8109e7 Mon Sep 17 00:00:00 2001
From: Joan Bruguera <joanbrugueram@gmail.com>
Date: Fri, 2 Jul 2021 02:09:58 +0200
Subject: [PATCH] Tentative fix for NVIDIA 465.31 driver for Linux 5.14-rc1
---
common/inc/nv-time.h | 6 ++++++
nvidia-drm/nvidia-drm-drv.c | 4 ++++
2 files changed, 10 insertions(+)
diff --git a/common/inc/nv-time.h b/common/inc/nv-time.h
index dc80806..cc343a5 100644
--- a/common/inc/nv-time.h
+++ b/common/inc/nv-time.h
@@ -23,6 +23,7 @@
#ifndef __NV_TIME_H__
#define __NV_TIME_H__
+#include <linux/version.h>
#include "conftest.h"
#include <linux/sched.h>
#include <linux/delay.h>
@@ -205,7 +206,12 @@ static inline NV_STATUS nv_sleep_ms(unsigned int ms)
// the requested timeout has expired, loop until less
// than a jiffie of the desired delay remains.
//
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0))
current->state = TASK_INTERRUPTIBLE;
+#else
+ // Rel. commit "sched: Change task_struct::state" (Peter Zijlstra, Jun 11 2021)
+ WRITE_ONCE(current->__state, TASK_INTERRUPTIBLE);
+#endif
do
{
schedule_timeout(jiffies);
diff --git a/nvidia-drm/nvidia-drm-drv.c b/nvidia-drm/nvidia-drm-drv.c
index 84d4479..99ea552 100644
--- a/nvidia-drm/nvidia-drm-drv.c
+++ b/nvidia-drm/nvidia-drm-drv.c
@@ -20,6 +20,7 @@
* DEALINGS IN THE SOFTWARE.
*/
+#include <linux/version.h>
#include "nvidia-drm-conftest.h" /* NV_DRM_AVAILABLE and NV_DRM_DRM_GEM_H_PRESENT */
#include "nvidia-drm-priv.h"
@@ -903,9 +904,12 @@ static void nv_drm_register_drm_device(const nv_gpu_info_t *gpu_info)
dev->dev_private = nv_dev;
nv_dev->dev = dev;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0))
+ // Rel. commit "drm: Remove pdev field from struct drm_device" (Thomas Zimmermann, 3 May 2021)
if (device->bus == &pci_bus_type) {
dev->pdev = to_pci_dev(device);
}
+#endif
/* Register DRM device to DRM sub-system */
--
2.32.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zzhzyn/goutil.git
git@gitee.com:zzhzyn/goutil.git
zzhzyn
goutil
goutil
master

搜索帮助