Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1403243pxv; Fri, 2 Jul 2021 03:00:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxyhKTxxRiA+VOndAnJsWGZHLgaITffur4Ef6A7a/d11m7hBEE96bCaHrwXUOIqtp07IN8 X-Received: by 2002:a05:6602:58e:: with SMTP id v14mr3036400iox.181.1625220053207; Fri, 02 Jul 2021 03:00:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625220053; cv=none; d=google.com; s=arc-20160816; b=jJ/Uqxo3pShc1EFf2jNWQtE2gHDXxcBukPt82IF9zMnPLJ1lYdjN85b1soy1FBFVGw VuPotWyuvb55Bo4/lsJ+5LQslySmYlBfL6NuW67duxz9K5GUgdSjc+KB9eOiraGsHYJ2 pEJuTosuCUDEsnZDP1edgmpGa1zlu7V4LQpFX7h1Leph/yLIzWvWl+lRS5slOwCTSCN+ QmB9vUbQayXy12u1u+1s6HLKh/EqqV1NpHOeNM1c5DUtM8R8CK6vfWIMUaG7zgj5NEy0 yq01Sk8zqQeeyzUZf1ZqzC6B6MvqVeZ/C4poGKUOuyOkF1xM3K0/bhGDTMSOm8T4MgZW RQTA== 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 x13si2568432jas.89.2021.07.02.03.00.40; Fri, 02 Jul 2021 03:00:53 -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 + 99 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 Content-Type: text/plain 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(-) 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, -- 2.17.1