Blob Blame History Raw
From 442fbc099b839551f8576723da22c1269cc695ce Mon Sep 17 00:00:00 2001
From: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Date: Tue, 8 Mar 2022 18:48:59 +0000
Subject: [PATCH] hisi_acc_vfio_pci: Add helper to retrieve the struct
 pci_driver
Git-commit: 442fbc099b839551f8576723da22c1269cc695ce
Patch-mainline: v5.18-rc1
References: jsc#PED-1109

struct pci_driver pointer is an input into the pci_iov_get_pf_drvdata().
Introduce helpers to retrieve the ACC PF dev struct pci_driver pointers
as we use this in ACC vfio migration driver.

Acked-by: Zhou Wang <wangzhou1@hisilicon.com>
Acked-by: Kai Ye <yekai13@huawei.com>
Acked-by: Longfang Liu <liulongfang@huawei.com>
Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Link: https://lore.kernel.org/r/20220308184902.2242-7-shameerali.kolothum.thodi@huawei.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Acked-by: Chester Lin <clin@suse.com>
---
 drivers/crypto/hisilicon/hpre/hpre_main.c |    6 ++++++
 drivers/crypto/hisilicon/sec2/sec_main.c  |    6 ++++++
 drivers/crypto/hisilicon/zip/zip_main.c   |    6 ++++++
 include/linux/hisi_acc_qm.h               |    5 +++++
 4 files changed, 23 insertions(+)

--- a/drivers/crypto/hisilicon/hpre/hpre_main.c
+++ b/drivers/crypto/hisilicon/hpre/hpre_main.c
@@ -1079,6 +1079,12 @@ static struct pci_driver hpre_pci_driver
 	.shutdown		= hisi_qm_dev_shutdown,
 };
 
+struct pci_driver *hisi_hpre_get_pf_driver(void)
+{
+	return &hpre_pci_driver;
+}
+EXPORT_SYMBOL_GPL(hisi_hpre_get_pf_driver);
+
 static void hpre_register_debugfs(void)
 {
 	if (!debugfs_initialized())
--- a/drivers/crypto/hisilicon/sec2/sec_main.c
+++ b/drivers/crypto/hisilicon/sec2/sec_main.c
@@ -1024,6 +1024,12 @@ static struct pci_driver sec_pci_driver
 	.shutdown = hisi_qm_dev_shutdown,
 };
 
+struct pci_driver *hisi_sec_get_pf_driver(void)
+{
+	return &sec_pci_driver;
+}
+EXPORT_SYMBOL_GPL(hisi_sec_get_pf_driver);
+
 static void sec_register_debugfs(void)
 {
 	if (!debugfs_initialized())
--- a/drivers/crypto/hisilicon/zip/zip_main.c
+++ b/drivers/crypto/hisilicon/zip/zip_main.c
@@ -949,6 +949,12 @@ static struct pci_driver hisi_zip_pci_dr
 	.shutdown		= hisi_qm_dev_shutdown,
 };
 
+struct pci_driver *hisi_zip_get_pf_driver(void)
+{
+	return &hisi_zip_pci_driver;
+}
+EXPORT_SYMBOL_GPL(hisi_zip_get_pf_driver);
+
 static void hisi_zip_register_debugfs(void)
 {
 	if (!debugfs_initialized())
--- a/include/linux/hisi_acc_qm.h
+++ b/include/linux/hisi_acc_qm.h
@@ -468,4 +468,9 @@ void hisi_qm_dev_shutdown(struct pci_dev
 void hisi_qm_wait_task_finish(struct hisi_qm *qm, struct hisi_qm_list *qm_list);
 int hisi_qm_alg_register(struct hisi_qm *qm, struct hisi_qm_list *qm_list);
 void hisi_qm_alg_unregister(struct hisi_qm *qm, struct hisi_qm_list *qm_list);
+
+/* Used by VFIO ACC live migration driver */
+struct pci_driver *hisi_sec_get_pf_driver(void);
+struct pci_driver *hisi_hpre_get_pf_driver(void);
+struct pci_driver *hisi_zip_get_pf_driver(void);
 #endif