From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 60B1CA0C4B; Sat, 30 Oct 2021 12:41:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7E090410F6; Sat, 30 Oct 2021 12:40:55 +0200 (CEST) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by mails.dpdk.org (Postfix) with ESMTP id 97AA040E09 for ; Sat, 30 Oct 2021 12:40:52 +0200 (CEST) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4HhG4s1YLcz8tyN; Sat, 30 Oct 2021 18:39:25 +0800 (CST) Received: from dggpeml500024.china.huawei.com (7.185.36.10) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Sat, 30 Oct 2021 18:40:50 +0800 Received: from localhost.localdomain (10.67.165.24) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Sat, 30 Oct 2021 18:40:49 +0800 From: Chengwen Feng To: CC: Date: Sat, 30 Oct 2021 18:36:18 +0800 Message-ID: <20211030103619.29924-6-fengchengwen@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211030103619.29924-1-fengchengwen@huawei.com> References: <20211030103619.29924-1-fengchengwen@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH 5/6] dma/hisilicon: support multi-process X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch add multi-process support for Kunpeng DMA devices. Signed-off-by: Chengwen Feng --- drivers/dma/hisilicon/hisi_dmadev.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/dma/hisilicon/hisi_dmadev.c b/drivers/dma/hisilicon/hisi_dmadev.c index d03967cae3..05066b4d0e 100644 --- a/drivers/dma/hisilicon/hisi_dmadev.c +++ b/drivers/dma/hisilicon/hisi_dmadev.c @@ -392,8 +392,10 @@ hisi_dma_stop(struct rte_dma_dev *dev) static int hisi_dma_close(struct rte_dma_dev *dev) { - /* The dmadev already stopped */ - hisi_dma_free_iomem(dev->data->dev_private); + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + /* The dmadev already stopped */ + hisi_dma_free_iomem(dev->data->dev_private); + } return 0; } @@ -815,11 +817,13 @@ hisi_dma_create(struct rte_pci_device *pci_dev, uint8_t queue_id, hw->cq_head_reg = hisi_dma_queue_regaddr(hw, HISI_DMA_QUEUE_CQ_HEAD_REG); - ret = hisi_dma_reset_hw(hw); - if (ret) { - HISI_DMA_LOG(ERR, "%s init device fail!", name); - (void)rte_dma_pmd_release(name); - return -EIO; + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + ret = hisi_dma_reset_hw(hw); + if (ret) { + HISI_DMA_LOG(ERR, "%s init device fail!", name); + (void)rte_dma_pmd_release(name); + return -EIO; + } } dev->state = RTE_DMA_DEV_READY; @@ -872,7 +876,8 @@ hisi_dma_probe(struct rte_pci_driver *pci_drv __rte_unused, return ret; HISI_DMA_LOG(DEBUG, "%s read PCI revision: 0x%x", name, revision); - hisi_dma_init_gbl(pci_dev->mem_resource[2].addr, revision); + if (rte_eal_process_type() == RTE_PROC_PRIMARY) + hisi_dma_init_gbl(pci_dev->mem_resource[2].addr, revision); for (i = 0; i < HISI_DMA_MAX_HW_QUEUES; i++) { ret = hisi_dma_create(pci_dev, i, revision); -- 2.33.0