From patchwork Fri Jul 2 09:58:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shameerali Kolothum Thodi X-Patchwork-Id: 469502 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp1221197jao; Fri, 2 Jul 2021 02:59:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTJj23YN5FcBRsVCap3etbOrzRzG5qBA1iVSuJS5i0W3dWUU+o+MuaItjVn46oishDkqoQ X-Received: by 2002:aa7:c857:: with SMTP id g23mr5499945edt.100.1625219992082; Fri, 02 Jul 2021 02:59:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625219992; cv=none; d=google.com; s=arc-20160816; b=K/L8JnvqyFJm9OhIZmE2Sqm0azFV2gqvsG84lB2hW9zhGsg8E0f5/bEX/d3pGM8aAw IsDberzH/UOODSI5BEgsK86qe97nxaTc11upd+HQBrUON9VPg8LHxHuuBGiIs+AanwWz BdgyLXPn+Pyxpj4j3j1jpbWQ89x1GzYx90E51EctlCDqkkQBT9Aa9DYFRU0DnGh29Yq2 jJ06DVQzpYW5oBes+TKvULfklUCRhX91YygpWeKvKAibLik/FJizjpOaXI2ijhy0RVXW 5WRGPA0mJvppHwS93dGCaX+xUMskCbTsdvAUsvxveWpnNV5n4ln8Z1kPchDZwh8Rvfxi FV0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=2NqxSlBj9tu33rc1qliJhOgqTsjy2W/a5+ZWqQ8ZbLY=; b=guMYHT8KlZeG6RfEIH1bpguGbhHxqDCOWk5sKjcHL3QrJ2zolN4uu3nvCwuaUVdFXA T6bWqs/bzZwkSt130RkUUEc23Y/9qumkX50C9vr+fICOQL/XXGJzna8iyFr1uojJa29Z WHudj+Syd+6m7kIvTNO0ceS3vOvXls9LDM13CSMccUc1go6RsFsPuqJcUGKImaCSYMC1 JmD6ejaWNESQqOcMezQyRIk9NdiqQzL3/nP8s9/aDsHL/ws/nXEupl9m+ejX6kwsXv2Y OYybKXieiiFO/wO2kuFURaUJC/G3x7oEyCgWpA5i+Kthxl6wS9Fpa0x220UJWaHiULD+ 1Ouw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y17si2506728edr.239.2021.07.02.02.59.51; Fri, 02 Jul 2021 02:59:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231466AbhGBKCU (ORCPT + 3 others); Fri, 2 Jul 2021 06:02:20 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3345 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231800AbhGBKCR (ORCPT ); Fri, 2 Jul 2021 06:02:17 -0400 Received: from fraeml737-chm.china.huawei.com (unknown [172.18.147.207]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4GGVfK0tKFz6GBCj; Fri, 2 Jul 2021 17:49:13 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml737-chm.china.huawei.com (10.206.15.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Fri, 2 Jul 2021 11:59:43 +0200 Received: from A2006125610.china.huawei.com (10.47.85.147) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Fri, 2 Jul 2021 10:59:37 +0100 From: Shameer Kolothum To: , , CC: , , , , , , , , Subject: [RFC v2 3/4] crypto: hisilicon/qm - Export mailbox functions for common use Date: Fri, 2 Jul 2021 10:58:48 +0100 Message-ID: <20210702095849.1610-4-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20210702095849.1610-1-shameerali.kolothum.thodi@huawei.com> References: <20210702095849.1610-1-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.47.85.147] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Longfang Liu Export QM mailbox functions so that they can be used from HiSilicon ACC vfio live migration driver in follow-up patch. Signed-off-by: Longfang Liu Signed-off-by: Shameer Kolothum --- drivers/crypto/hisilicon/qm.c | 8 +++++--- drivers/crypto/hisilicon/qm.h | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index ce439a0c66c9..87fc0199705e 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -492,7 +492,7 @@ static bool qm_qp_avail_state(struct hisi_qm *qm, struct hisi_qp *qp, } /* return 0 mailbox ready, -ETIMEDOUT hardware timeout */ -static int qm_wait_mb_ready(struct hisi_qm *qm) +int qm_wait_mb_ready(struct hisi_qm *qm) { u32 val; @@ -500,6 +500,7 @@ static int qm_wait_mb_ready(struct hisi_qm *qm) val, !((val >> QM_MB_BUSY_SHIFT) & 0x1), POLL_PERIOD, POLL_TIMEOUT); } +EXPORT_SYMBOL_GPL(qm_wait_mb_ready); /* 128 bit should be written to hardware at one time to trigger a mailbox */ static void qm_mb_write(struct hisi_qm *qm, const void *src) @@ -523,8 +524,8 @@ static void qm_mb_write(struct hisi_qm *qm, const void *src) : "memory"); } -static int qm_mb(struct hisi_qm *qm, u8 cmd, dma_addr_t dma_addr, u16 queue, - bool op) +int qm_mb(struct hisi_qm *qm, u8 cmd, dma_addr_t dma_addr, u16 queue, + bool op) { struct qm_mailbox mailbox; int ret = 0; @@ -563,6 +564,7 @@ static int qm_mb(struct hisi_qm *qm, u8 cmd, dma_addr_t dma_addr, u16 queue, atomic64_inc(&qm->debug.dfx.mb_err_cnt); return ret; } +EXPORT_SYMBOL_GPL(qm_mb); static void qm_db_v1(struct hisi_qm *qm, u16 qn, u8 cmd, u16 index, u8 priority) { diff --git a/drivers/crypto/hisilicon/qm.h b/drivers/crypto/hisilicon/qm.h index acefdf8b3a50..18b010d5452d 100644 --- a/drivers/crypto/hisilicon/qm.h +++ b/drivers/crypto/hisilicon/qm.h @@ -396,6 +396,10 @@ pci_ers_result_t hisi_qm_dev_slot_reset(struct pci_dev *pdev); void hisi_qm_reset_prepare(struct pci_dev *pdev); void hisi_qm_reset_done(struct pci_dev *pdev); +int qm_wait_mb_ready(struct hisi_qm *qm); +int qm_mb(struct hisi_qm *qm, u8 cmd, dma_addr_t dma_addr, u16 queue, + bool op); + struct hisi_acc_sgl_pool; struct hisi_acc_hw_sgl *hisi_acc_sg_buf_map_to_hw_sgl(struct device *dev, struct scatterlist *sgl, struct hisi_acc_sgl_pool *pool,