diff options
author | Longfang Liu <liulongfang@huawei.com> | 2022-03-08 18:49:00 +0000 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2022-03-15 11:34:09 -0600 |
commit | 1e459b25081d4f939b8a1fb4c71dab0cec8f974a (patch) | |
tree | 015eecc968e0af452559aff3ff3304286612ecba /drivers/crypto/hisilicon/qm.c | |
parent | 442fbc099b839551f8576723da22c1269cc695ce (diff) | |
download | linux-1e459b25081d4f939b8a1fb4c71dab0cec8f974a.tar.gz linux-1e459b25081d4f939b8a1fb4c71dab0cec8f974a.tar.bz2 linux-1e459b25081d4f939b8a1fb4c71dab0cec8f974a.zip |
crypto: hisilicon/qm: Set the VF QM state register
We use VF QM state register to record the status of the QM configuration
state. This will be used in the ACC migration driver to determine whether
we can safely save and restore the QM data.
Signed-off-by: Longfang Liu <liulongfang@huawei.com>
Acked-by: Zhou Wang <wangzhou1@hisilicon.com>
Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Link: https://lore.kernel.org/r/20220308184902.2242-8-shameerali.kolothum.thodi@huawei.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/crypto/hisilicon/qm.c')
-rw-r--r-- | drivers/crypto/hisilicon/qm.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index c88e013371af..6a8776db38b5 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -3492,6 +3492,12 @@ static void hisi_qm_pci_uninit(struct hisi_qm *qm) pci_disable_device(pdev); } +static void hisi_qm_set_state(struct hisi_qm *qm, u8 state) +{ + if (qm->ver > QM_HW_V2 && qm->fun_type == QM_HW_VF) + writel(state, qm->io_base + QM_VF_STATE); +} + /** * hisi_qm_uninit() - Uninitialize qm. * @qm: The qm needed uninit. @@ -3520,6 +3526,7 @@ void hisi_qm_uninit(struct hisi_qm *qm) dma_free_coherent(dev, qm->qdma.size, qm->qdma.va, qm->qdma.dma); } + hisi_qm_set_state(qm, QM_NOT_READY); up_write(&qm->qps_lock); qm_irq_unregister(qm); @@ -3745,6 +3752,7 @@ int hisi_qm_start(struct hisi_qm *qm) if (!ret) atomic_set(&qm->status.flags, QM_START); + hisi_qm_set_state(qm, QM_READY); err_unlock: up_write(&qm->qps_lock); return ret; |