fix kae_driver build error

This commit is contained in:
wang_yue111 2020-11-11 17:33:49 +08:00
parent 9f532c4e81
commit 0e678b6ff9
8 changed files with 150 additions and 69 deletions

View File

@ -1,66 +0,0 @@
diff -Nur kae_driver-1.2.8.old/uacce/uacce.c kae_driver-1.2.8/uacce/uacce.c
--- kae_driver-1.2.8.old/kae_driver/uacce/uacce.c 2020-02-03 16:15:12.585798416 +0800
+++ kae_driver-1.2.8/kae_driver/uacce/uacce.c 2020-02-03 16:16:25.797131365 +0800
@@ -969,7 +969,7 @@
if (is_to_free_region)
uacce_destroy_region(q, qfr);
}
-#ifdef CONFIG_IOMMU_SVA
+#ifdef CONFIG_IOMMU_SVA2
if (uacce->flags & UACCE_DEV_SVA)
iommu_sva_unbind_device(uacce->pdev, q->pasid);
#endif
@@ -1019,7 +1019,7 @@
int ret;
int pasid = 0;
-#ifdef CONFIG_IOMMU_SVA
+#ifdef CONFIG_IOMMU_SVA2
if (uacce->flags & UACCE_DEV_PASID) {
ret = iommu_sva_bind_device(uacce->pdev, current->mm, &pasid,
IOMMU_SVA_FEAT_IOPF, NULL);
@@ -1052,7 +1052,7 @@
return 0;
err_unbind:
-#ifdef CONFIG_IOMMU_SVA
+#ifdef CONFIG_IOMMU_SVA2
if (uacce->flags & UACCE_DEV_PASID)
iommu_sva_unbind_device(uacce->pdev, pasid);
#endif
@@ -1557,7 +1557,7 @@
return 0;
}
-#ifndef CONFIG_IOMMU_SVA
+#ifndef CONFIG_IOMMU_SVA2
static int uacce_dev_match(struct device *dev, void *data)
{
if (dev->parent == data)
@@ -1732,7 +1732,7 @@
uacce->ops->get_available_instances =
uacce_default_get_available_instances;
-#ifndef CONFIG_IOMMU_SVA
+#ifndef CONFIG_IOMMU_SVA2
ret = uacce_set_iommu_domain(uacce);
if (ret)
return ret;
@@ -1745,7 +1745,7 @@
}
if (uacce->flags & UACCE_DEV_PASID) {
-#ifdef CONFIG_IOMMU_SVA
+#ifdef CONFIG_IOMMU_SVA2
ret = iommu_sva_init_device(uacce->pdev, IOMMU_SVA_FEAT_IOPF,
0, 0, NULL);
if (ret) {
@@ -1780,7 +1780,7 @@
return -EAGAIN;
}
-#ifdef CONFIG_IOMMU_SVA
+#ifdef CONFIG_IOMMU_SVA2
iommu_sva_shutdown_device(uacce->pdev);
#else
uacce_unset_iommu_domain(uacce);

View File

@ -0,0 +1,22 @@
From 690b5230ec25237c82630ec7c3766381b2a8c467 Mon Sep 17 00:00:00 2001
From: wang_yue111 <648774160@qq.com>
Date: Wed, 11 Nov 2020 14:43:58 +0800
Subject: [PATCH] fix Makefile compilation failed
---
kae_driver/hisilicon/Makefile | 1 -
1 file changed, 1 deletion(-)
diff --git a/kae_driver/hisilicon/Makefile b/kae_driver-1.3.9/kae_driver/hisilicon/Makefile
index c766a09..eafceb9 100644
--- a/kae_driver/hisilicon/Makefile
+++ b/kae_driver/hisilicon/Makefile
@@ -1,5 +1,4 @@
# SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_CRYPTO_DEV_HISI_SEC) += sec/
obj-$(CONFIG_CRYPTO_DEV_HISI_QM) += hisi_qm.o
hisi_qm-objs = qm.o sgl.o
obj-$(CONFIG_CRYPTO_DEV_HISI_ZIP) += zip/
--
2.23.0

View File

@ -0,0 +1,47 @@
From 41654427d727cdc7e5f63ed148265054d530998b Mon Sep 17 00:00:00 2001
From: wang_yue111 <648774160@qq.com>
Date: Wed, 11 Nov 2020 15:15:21 +0800
Subject: [PATCH] fix value not ignored as itought to be
---
kae_driver/hisilicon/rde/rde_main.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/kae_driver/hisilicon/rde/rde_main.c b/KAEdriver-1.3.9/kae_driver/hisilicon/rde/rde_main.c
index bdc4c55..f900369 100644
--- a/kae_driver/hisilicon/rde/rde_main.c
+++ b/kae_driver/hisilicon/rde/rde_main.c
@@ -479,7 +479,7 @@ static int hisi_rde_chn_debug_init(struct hisi_qm *qm)
{
struct device *dev = &qm->pdev->dev;
struct debugfs_regset32 *regset, *regset_ooo;
- struct dentry *tmp_d, *tmp;
+ struct dentry *tmp_d;
char buf[HRDE_DBGFS_VAL_MAX_LEN];
int ret;
@@ -497,9 +497,7 @@ static int hisi_rde_chn_debug_init(struct hisi_qm *qm)
regset->regs = hrde_dfx_regs;
regset->nregs = ARRAY_SIZE(hrde_dfx_regs);
regset->base = qm->io_base;
- tmp = debugfs_create_regset32("chn_regs", 0444, tmp_d, regset);
- if (!tmp)
- return -ENOENT;
+ debugfs_create_regset32("chn_regs", 0444, tmp_d, regset);
regset_ooo = devm_kzalloc(dev, sizeof(*regset_ooo), GFP_KERNEL);
if (!regset_ooo)
@@ -507,9 +505,7 @@ static int hisi_rde_chn_debug_init(struct hisi_qm *qm)
regset_ooo->regs = hrde_ooo_dfx_regs;
regset_ooo->nregs = ARRAY_SIZE(hrde_ooo_dfx_regs);
regset_ooo->base = qm->io_base;
- tmp = debugfs_create_regset32("ooo_regs", 0444, tmp_d, regset_ooo);
- if (!tmp)
- return -ENOENT;
+ debugfs_create_regset32("ooo_regs", 0444, tmp_d, regset_ooo);
return 0;
}
--
2.23.0

View File

@ -0,0 +1,34 @@
From 47c1fc7609ad25b54896c8715eff0e05b45d9956 Mon Sep 17 00:00:00 2001
From: wang_yue111 <648774160@qq.com>
Date: Wed, 11 Nov 2020 14:13:19 +0800
Subject: [PATCH] fix vm_fault_t conflict error
---
kae_driver/uacce/uacce.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kae_driver/uacce/uacce.c b/KAEdriver-1.3.9/kae_driver/uacce/uacce.c
index 0ce0702..f897456 100644
--- a/kae_driver/uacce/uacce.c
+++ b/kae_driver/uacce/uacce.c
@@ -14,6 +14,7 @@
#include "../include_linux/uacce.h"
#include <linux/wait.h>
#include <linux/eventpoll.h>
+#include <linux/version.h>
static struct class *uacce_class;
static DEFINE_IDR(uacce_idr);
@@ -31,7 +32,9 @@ static DECLARE_RWSEM(uacce_qs_lock);
static const struct file_operations uacce_fops;
static void uacce_put_queue(struct uacce_queue *q);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,1,0)
typedef int vm_fault_t;
+#endif
typedef unsigned int __poll_t;
/* match with enum uacce_qfrt */
--
2.23.0

Binary file not shown.

BIN
kae_driver-1.3.9.tar.gz Normal file

Binary file not shown.

View File

@ -2,8 +2,8 @@
Name: kae_driver Name: kae_driver
Summary: Kunpeng Accelerator Engine Kernel Driver Summary: Kunpeng Accelerator Engine Kernel Driver
Version: 1.2.10 Version: 1.3.9
Release: 4 Release: 1
License: GPL-2.0 License: GPL-2.0
Source: %{name}-%{version}.tar.gz Source: %{name}-%{version}.tar.gz
Vendor: Huawei Corporation Vendor: Huawei Corporation
@ -14,7 +14,10 @@ Conflicts: %{name} < %{version}-%{release}
Provides: %{name} = %{version}-%{release} Provides: %{name} = %{version}-%{release}
BuildRequires: kernel-devel, gcc, make BuildRequires: kernel-devel, gcc, make
ExclusiveArch: aarch64 ExclusiveArch: aarch64
Patch0000: change-sva-macros-to-version2.patch Patch0001: fix-vm_fault_t-conflict.patch
Patch0002: fix-Makefile-compilation-failed.patch
Patch0003: fix-value-not-ignored-as-it-ought-to-be.patch
Patch0004: support-kernel-5.7.0-compation.patch
%define kernel_version %(uname -r) %define kernel_version %(uname -r)
%define kae_driver_path %{_builddir}/%{name}-%{version}/%{name} %define kae_driver_path %{_builddir}/%{name}-%{version}/%{name}
@ -233,6 +236,9 @@ echo "hisi_rde modules uninstalled"
%config(noreplace) /etc/modprobe.d/hisi_rde.conf %config(noreplace) /etc/modprobe.d/hisi_rde.conf
%changelog %changelog
* Wed Nov 11 2020 wangyue <wangyue92@huawei.com> - 1.3.9-1
- Fix kae_driver build error on kernel 5.10
* Sun Mar 15 2020 zhangtao <zhangtao221@huawei.com> 1.2.10-3 * Sun Mar 15 2020 zhangtao <zhangtao221@huawei.com> 1.2.10-3
- specify aarch64 compilation - specify aarch64 compilation

View File

@ -0,0 +1,38 @@
From b3dd45f0dc62148045cdbdc52dbaac6c7f136efe Mon Sep 17 00:00:00 2001
From: wang_yue111 <648774160@qq.com>
Date: Wed, 11 Nov 2020 15:43:59 +0800
Subject: [PATCH] fix pci_cleanup_aer_uncorrect_error_status renamed to pci_aer_clear_nonfatal_status since kernel 5.7.0
---
kae_driver/hisilicon/qm.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/kae_driver/hisilicon/qm.c b/KAEdriver-1.3.9/kae_driver/hisilicon/qm.c
index 35aa107..601b9c2 100644
--- a/kae_driver/hisilicon/qm.c
+++ b/kae_driver/hisilicon/qm.c
@@ -13,6 +13,7 @@
#include <linux/seq_file.h>
#include "qm.h"
#include "qm_usr_if.h"
+#include <linux/version.h>
/* eq/aeq irq enable */
#define QM_VF_AEQ_INT_SOURCE 0x0
@@ -4127,8 +4128,11 @@ pci_ers_result_t hisi_qm_dev_slot_reset(struct pci_dev *pdev)
return PCI_ERS_RESULT_RECOVERED;
pci_info(pdev, "Requesting reset due to PCI error\n");
- pci_cleanup_aer_uncorrect_error_status(pdev);
-
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0)
+ pci_aer_clear_nonfatal_status(pdev);
+#else
+ pci_cleanup_aer_uncorrect_error_status(pdev);
+#endif
/* reset pcie device controller */
ret = hisi_qm_controller_reset(qm);
if (ret) {
--
2.23.0