From nobody Wed Oct 8 11:01:16 2025 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11FF6241131; Mon, 30 Jun 2025 08:55:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751273722; cv=none; b=l1925li6VMJ5o+g0XvtFXGjVpG4Ripp1NWTII7r4k0m/FrgyJMUgKlaoECud1mJPWipxjksVYcn7lRzMHnD7Vof+W/S4DPleKKqQU+F62pmpk4FYRBrQ+AJN4RnpRXlI9Q0CLkveM/zMfhcEMdRg9IZOnN6S7GZiYWZ54v6hmmk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751273722; c=relaxed/simple; bh=pVGjvRbxhDhOFJx/CIYWm7ID6m+27homdmRLKClr78I=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=A9on4WTETWXSpscqZedJD+RMS4LM1JbpB+/3jMkHHR+kG8zNNf5kieI89eGucyrNGL+DAPwBT0z+XVncywpEuBtdM5ER8r+CNy/pTwnVYRaa+VgqGGiGN4KIuWIw1zUvSSNL2qajDGxo/vYO0l1V3xWKpoJF6jUtQCPgqf0R1gs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4bW0MN44HjztSk9; Mon, 30 Jun 2025 16:54:08 +0800 (CST) Received: from dggpemf500015.china.huawei.com (unknown [7.185.36.143]) by mail.maildlp.com (Postfix) with ESMTPS id BE8CE180087; Mon, 30 Jun 2025 16:55:16 +0800 (CST) Received: from huawei.com (10.50.165.33) by dggpemf500015.china.huawei.com (7.185.36.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 30 Jun 2025 16:55:16 +0800 From: Longfang Liu To: , , , CC: , , , Subject: [PATCH v5 2/3] migration: qm updates BAR configuration Date: Mon, 30 Jun 2025 16:54:01 +0800 Message-ID: <20250630085402.7491-3-liulongfang@huawei.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20250630085402.7491-1-liulongfang@huawei.com> References: <20250630085402.7491-1-liulongfang@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemf500015.china.huawei.com (7.185.36.143) Content-Type: text/plain; charset="utf-8" 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 Acked-by: Herbert Xu Reviewed-by: Shameer Kolothum --- drivers/crypto/hisilicon/qm.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index d3f5d108b898..0a8888304e15 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -242,6 +242,9 @@ #define QM_QOS_MAX_CIR_U 6 #define QM_AUTOSUSPEND_DELAY 3000 =20 +#define QM_MIG_REGION_SEL 0x100198 +#define QM_MIG_REGION_EN 0x1 + /* abnormal status value for stopping queue */ #define QM_STOP_QUEUE_FAIL 1 #define QM_DUMP_SQC_FAIL 3 @@ -3004,11 +3007,36 @@ static void qm_put_pci_res(struct hisi_qm *qm) pci_release_mem_regions(pdev); } =20 +static void hisi_mig_region_clear(struct hisi_qm *qm) +{ + u32 val; + + /* Clear migration region set of PF */ + if (qm->fun_type =3D=3D QM_HW_PF && qm->ver > QM_HW_V3) { + val =3D readl(qm->io_base + QM_MIG_REGION_SEL); + val &=3D ~BIT(0); + writel(val, qm->io_base + QM_MIG_REGION_SEL); + } +} + +static void hisi_mig_region_enable(struct hisi_qm *qm) +{ + u32 val; + + /* Select migration region of PF */ + if (qm->fun_type =3D=3D QM_HW_PF && qm->ver > QM_HW_V3) { + val =3D readl(qm->io_base + QM_MIG_REGION_SEL); + val |=3D QM_MIG_REGION_EN; + writel(val, qm->io_base + QM_MIG_REGION_SEL); + } +} + static void hisi_qm_pci_uninit(struct hisi_qm *qm) { struct pci_dev *pdev =3D qm->pdev; =20 pci_free_irq_vectors(pdev); + hisi_mig_region_clear(qm); qm_put_pci_res(qm); pci_disable_device(pdev); } @@ -5630,6 +5658,7 @@ int hisi_qm_init(struct hisi_qm *qm) goto err_free_qm_memory; =20 qm_cmd_init(qm); + hisi_mig_region_enable(qm); =20 return 0; =20 --=20 2.24.0