Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: hisilicon - qm updates BAR configuration

On new platforms greater than QM_HW_V3, the configuration region for the
live migration function of the accelerator device is no longer
placed in the VF, but is instead placed in the PF.

Therefore, the configuration region of the live migration function
needs to be opened when the QM driver is loaded. When the QM driver
is uninstalled, the driver needs to clear this configuration.

Signed-off-by: Longfang Liu <liulongfang@huawei.com>
Reviewed-by: Shameer Kolothum <shameerkolothum@gmail.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Link: https://lore.kernel.org/r/20251030015744.131771-2-liulongfang@huawei.com
Signed-off-by: Alex Williamson <alex@shazbot.org>

authored by

Longfang Liu and committed by
Alex Williamson
4868d2d5 abe7d636

+30
+27
drivers/crypto/hisilicon/qm.c
··· 3019 3019 pci_release_mem_regions(pdev); 3020 3020 } 3021 3021 3022 + static void hisi_mig_region_clear(struct hisi_qm *qm) 3023 + { 3024 + u32 val; 3025 + 3026 + /* Clear migration region set of PF */ 3027 + if (qm->fun_type == QM_HW_PF && qm->ver > QM_HW_V3) { 3028 + val = readl(qm->io_base + QM_MIG_REGION_SEL); 3029 + val &= ~QM_MIG_REGION_EN; 3030 + writel(val, qm->io_base + QM_MIG_REGION_SEL); 3031 + } 3032 + } 3033 + 3034 + static void hisi_mig_region_enable(struct hisi_qm *qm) 3035 + { 3036 + u32 val; 3037 + 3038 + /* Select migration region of PF */ 3039 + if (qm->fun_type == QM_HW_PF && qm->ver > QM_HW_V3) { 3040 + val = readl(qm->io_base + QM_MIG_REGION_SEL); 3041 + val |= QM_MIG_REGION_EN; 3042 + writel(val, qm->io_base + QM_MIG_REGION_SEL); 3043 + } 3044 + } 3045 + 3022 3046 static void hisi_qm_pci_uninit(struct hisi_qm *qm) 3023 3047 { 3024 3048 struct pci_dev *pdev = qm->pdev; 3025 3049 3026 3050 pci_free_irq_vectors(pdev); 3051 + hisi_mig_region_clear(qm); 3027 3052 qm_put_pci_res(qm); 3028 3053 pci_disable_device(pdev); 3029 3054 } ··· 5750 5725 goto err_free_qm_memory; 5751 5726 5752 5727 qm_cmd_init(qm); 5728 + hisi_mig_region_enable(qm); 5753 5729 5754 5730 return 0; 5755 5731 ··· 5889 5863 } 5890 5864 5891 5865 qm_cmd_init(qm); 5866 + hisi_mig_region_enable(qm); 5892 5867 hisi_qm_dev_err_init(qm); 5893 5868 /* Set the doorbell timeout to QM_DB_TIMEOUT_CFG ns. */ 5894 5869 writel(QM_DB_TIMEOUT_SET, qm->io_base + QM_DB_TIMEOUT_CFG);
+3
include/linux/hisi_acc_qm.h
··· 99 99 100 100 #define QM_DEV_ALG_MAX_LEN 256 101 101 102 + #define QM_MIG_REGION_SEL 0x100198 103 + #define QM_MIG_REGION_EN BIT(0) 104 + 102 105 /* uacce mode of the driver */ 103 106 #define UACCE_MODE_NOUACCE 0 /* don't use uacce */ 104 107 #define UACCE_MODE_SVA 1 /* use uacce sva mode */