Message ID | 20220303230131.2103-7-shameerali.kolothum.thodi@huawei.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | vfio/hisilicon: add ACC live migration driver | expand |
> 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. > > Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com> Acked-by: Zhou Wang <wangzhou1@hisilicon.com> Best, Zhou > --- > 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(+) > > diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b/drivers/crypto/hisilicon/hpre/hpre_main.c > index 3589d8879b5e..36ab30e9e654 100644 > --- a/drivers/crypto/hisilicon/hpre/hpre_main.c > +++ b/drivers/crypto/hisilicon/hpre/hpre_main.c > @@ -1190,6 +1190,12 @@ static struct pci_driver hpre_pci_driver = { > .driver.pm = &hpre_pm_ops, > }; > > +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()) > diff --git a/drivers/crypto/hisilicon/sec2/sec_main.c b/drivers/crypto/hisilicon/sec2/sec_main.c > index 311a8747b5bf..421a405ca337 100644 > --- a/drivers/crypto/hisilicon/sec2/sec_main.c > +++ b/drivers/crypto/hisilicon/sec2/sec_main.c > @@ -1088,6 +1088,12 @@ static struct pci_driver sec_pci_driver = { > .driver.pm = &sec_pm_ops, > }; > > +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()) > diff --git a/drivers/crypto/hisilicon/zip/zip_main.c b/drivers/crypto/hisilicon/zip/zip_main.c > index 66decfe07282..4534e1e107d1 100644 > --- a/drivers/crypto/hisilicon/zip/zip_main.c > +++ b/drivers/crypto/hisilicon/zip/zip_main.c > @@ -1012,6 +1012,12 @@ static struct pci_driver hisi_zip_pci_driver = { > .driver.pm = &hisi_zip_pm_ops, > }; > > +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()) > diff --git a/include/linux/hisi_acc_qm.h b/include/linux/hisi_acc_qm.h > index 6a6477c34666..00f2a4db8723 100644 > --- a/include/linux/hisi_acc_qm.h > +++ b/include/linux/hisi_acc_qm.h > @@ -476,4 +476,9 @@ void hisi_qm_pm_init(struct hisi_qm *qm); > int hisi_qm_get_dfx_access(struct hisi_qm *qm); > void hisi_qm_put_dfx_access(struct hisi_qm *qm); > void hisi_qm_regs_dump(struct seq_file *s, struct debugfs_regset32 *regset); > + > +/* 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 >
> -----Original Message----- > From: Wangzhou (B) > Sent: 04 March 2022 09:41 > To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>; > kvm@vger.kernel.org; linux-kernel@vger.kernel.org; > linux-crypto@vger.kernel.org > Cc: linux-pci@vger.kernel.org; alex.williamson@redhat.com; jgg@nvidia.com; > cohuck@redhat.com; mgurtovoy@nvidia.com; yishaih@nvidia.com; Linuxarm > <linuxarm@huawei.com>; liulongfang <liulongfang@huawei.com>; Zengtao (B) > <prime.zeng@hisilicon.com>; Jonathan Cameron > <jonathan.cameron@huawei.com> > Subject: Re: [PATCH v8 6/9] hisi_acc_vfio_pci: Add helper to retrieve the struct > pci_driver > > > 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. > > > > Signed-off-by: Shameer Kolothum > <shameerali.kolothum.thodi@huawei.com> > > Acked-by: Zhou Wang <wangzhou1@hisilicon.com> Thanks. [+cc Zaibo] for hpre/sec part > > Best, > Zhou > > > --- > > 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(+) > > > > diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c > b/drivers/crypto/hisilicon/hpre/hpre_main.c > > index 3589d8879b5e..36ab30e9e654 100644 > > --- a/drivers/crypto/hisilicon/hpre/hpre_main.c > > +++ b/drivers/crypto/hisilicon/hpre/hpre_main.c > > @@ -1190,6 +1190,12 @@ static struct pci_driver hpre_pci_driver = { > > .driver.pm = &hpre_pm_ops, > > }; > > > > +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()) > > diff --git a/drivers/crypto/hisilicon/sec2/sec_main.c > b/drivers/crypto/hisilicon/sec2/sec_main.c > > index 311a8747b5bf..421a405ca337 100644 > > --- a/drivers/crypto/hisilicon/sec2/sec_main.c > > +++ b/drivers/crypto/hisilicon/sec2/sec_main.c > > @@ -1088,6 +1088,12 @@ static struct pci_driver sec_pci_driver = { > > .driver.pm = &sec_pm_ops, > > }; > > > > +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()) > > diff --git a/drivers/crypto/hisilicon/zip/zip_main.c > b/drivers/crypto/hisilicon/zip/zip_main.c > > index 66decfe07282..4534e1e107d1 100644 > > --- a/drivers/crypto/hisilicon/zip/zip_main.c > > +++ b/drivers/crypto/hisilicon/zip/zip_main.c > > @@ -1012,6 +1012,12 @@ static struct pci_driver hisi_zip_pci_driver = { > > .driver.pm = &hisi_zip_pm_ops, > > }; > > > > +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()) > > diff --git a/include/linux/hisi_acc_qm.h b/include/linux/hisi_acc_qm.h > > index 6a6477c34666..00f2a4db8723 100644 > > --- a/include/linux/hisi_acc_qm.h > > +++ b/include/linux/hisi_acc_qm.h > > @@ -476,4 +476,9 @@ void hisi_qm_pm_init(struct hisi_qm *qm); > > int hisi_qm_get_dfx_access(struct hisi_qm *qm); > > void hisi_qm_put_dfx_access(struct hisi_qm *qm); > > void hisi_qm_regs_dump(struct seq_file *s, struct debugfs_regset32 > *regset); > > + > > +/* 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 > >
On 2022/3/4 7:01, Shameer Kolothum wrote: > 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. > > Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.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(+) > > diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b/drivers/crypto/hisilicon/hpre/hpre_main.c > index 3589d8879b5e..36ab30e9e654 100644 > --- a/drivers/crypto/hisilicon/hpre/hpre_main.c > +++ b/drivers/crypto/hisilicon/hpre/hpre_main.c > @@ -1190,6 +1190,12 @@ static struct pci_driver hpre_pci_driver = { > .driver.pm = &hpre_pm_ops, > }; > > +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()) > diff --git a/drivers/crypto/hisilicon/sec2/sec_main.c b/drivers/crypto/hisilicon/sec2/sec_main.c > index 311a8747b5bf..421a405ca337 100644 > --- a/drivers/crypto/hisilicon/sec2/sec_main.c > +++ b/drivers/crypto/hisilicon/sec2/sec_main.c > @@ -1088,6 +1088,12 @@ static struct pci_driver sec_pci_driver = { > .driver.pm = &sec_pm_ops, > }; > > +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()) > diff --git a/drivers/crypto/hisilicon/zip/zip_main.c b/drivers/crypto/hisilicon/zip/zip_main.c > index 66decfe07282..4534e1e107d1 100644 > --- a/drivers/crypto/hisilicon/zip/zip_main.c > +++ b/drivers/crypto/hisilicon/zip/zip_main.c > @@ -1012,6 +1012,12 @@ static struct pci_driver hisi_zip_pci_driver = { > .driver.pm = &hisi_zip_pm_ops, > }; > > +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()) > diff --git a/include/linux/hisi_acc_qm.h b/include/linux/hisi_acc_qm.h > index 6a6477c34666..00f2a4db8723 100644 > --- a/include/linux/hisi_acc_qm.h > +++ b/include/linux/hisi_acc_qm.h > @@ -476,4 +476,9 @@ void hisi_qm_pm_init(struct hisi_qm *qm); > int hisi_qm_get_dfx_access(struct hisi_qm *qm); > void hisi_qm_put_dfx_access(struct hisi_qm *qm); > void hisi_qm_regs_dump(struct seq_file *s, struct debugfs_regset32 *regset); > + > +/* 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 > Hi Shameer, It looks good to me for this movement. Acked-by: Kai Ye <yekai13@huawei.com> Thanks, Kai
On 2022/3/4 7:01, Shameer Kolothum wrote: > 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. > > Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.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(+) > Acked-by: Longfang Liu <liulongfang@huawei.com> Thanks, Longfang. > diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b/drivers/crypto/hisilicon/hpre/hpre_main.c > index 3589d8879b5e..36ab30e9e654 100644 > --- a/drivers/crypto/hisilicon/hpre/hpre_main.c > +++ b/drivers/crypto/hisilicon/hpre/hpre_main.c > @@ -1190,6 +1190,12 @@ static struct pci_driver hpre_pci_driver = { > .driver.pm = &hpre_pm_ops, > }; > > +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()) > diff --git a/drivers/crypto/hisilicon/sec2/sec_main.c b/drivers/crypto/hisilicon/sec2/sec_main.c > index 311a8747b5bf..421a405ca337 100644 > --- a/drivers/crypto/hisilicon/sec2/sec_main.c > +++ b/drivers/crypto/hisilicon/sec2/sec_main.c > @@ -1088,6 +1088,12 @@ static struct pci_driver sec_pci_driver = { > .driver.pm = &sec_pm_ops, > }; > > +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()) > diff --git a/drivers/crypto/hisilicon/zip/zip_main.c b/drivers/crypto/hisilicon/zip/zip_main.c > index 66decfe07282..4534e1e107d1 100644 > --- a/drivers/crypto/hisilicon/zip/zip_main.c > +++ b/drivers/crypto/hisilicon/zip/zip_main.c > @@ -1012,6 +1012,12 @@ static struct pci_driver hisi_zip_pci_driver = { > .driver.pm = &hisi_zip_pm_ops, > }; > > +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()) > diff --git a/include/linux/hisi_acc_qm.h b/include/linux/hisi_acc_qm.h > index 6a6477c34666..00f2a4db8723 100644 > --- a/include/linux/hisi_acc_qm.h > +++ b/include/linux/hisi_acc_qm.h > @@ -476,4 +476,9 @@ void hisi_qm_pm_init(struct hisi_qm *qm); > int hisi_qm_get_dfx_access(struct hisi_qm *qm); > void hisi_qm_put_dfx_access(struct hisi_qm *qm); > void hisi_qm_regs_dump(struct seq_file *s, struct debugfs_regset32 *regset); > + > +/* 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 >
diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b/drivers/crypto/hisilicon/hpre/hpre_main.c index 3589d8879b5e..36ab30e9e654 100644 --- a/drivers/crypto/hisilicon/hpre/hpre_main.c +++ b/drivers/crypto/hisilicon/hpre/hpre_main.c @@ -1190,6 +1190,12 @@ static struct pci_driver hpre_pci_driver = { .driver.pm = &hpre_pm_ops, }; +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()) diff --git a/drivers/crypto/hisilicon/sec2/sec_main.c b/drivers/crypto/hisilicon/sec2/sec_main.c index 311a8747b5bf..421a405ca337 100644 --- a/drivers/crypto/hisilicon/sec2/sec_main.c +++ b/drivers/crypto/hisilicon/sec2/sec_main.c @@ -1088,6 +1088,12 @@ static struct pci_driver sec_pci_driver = { .driver.pm = &sec_pm_ops, }; +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()) diff --git a/drivers/crypto/hisilicon/zip/zip_main.c b/drivers/crypto/hisilicon/zip/zip_main.c index 66decfe07282..4534e1e107d1 100644 --- a/drivers/crypto/hisilicon/zip/zip_main.c +++ b/drivers/crypto/hisilicon/zip/zip_main.c @@ -1012,6 +1012,12 @@ static struct pci_driver hisi_zip_pci_driver = { .driver.pm = &hisi_zip_pm_ops, }; +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()) diff --git a/include/linux/hisi_acc_qm.h b/include/linux/hisi_acc_qm.h index 6a6477c34666..00f2a4db8723 100644 --- a/include/linux/hisi_acc_qm.h +++ b/include/linux/hisi_acc_qm.h @@ -476,4 +476,9 @@ void hisi_qm_pm_init(struct hisi_qm *qm); int hisi_qm_get_dfx_access(struct hisi_qm *qm); void hisi_qm_put_dfx_access(struct hisi_qm *qm); void hisi_qm_regs_dump(struct seq_file *s, struct debugfs_regset32 *regset); + +/* 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
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. Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.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(+)