From patchwork Thu Oct 5 02:18:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chautru, Nicolas" X-Patchwork-Id: 132312 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9B3F1426BB; Thu, 5 Oct 2023 04:26:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9F9F8402EC; Thu, 5 Oct 2023 04:26:02 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 68AED4028A for ; Thu, 5 Oct 2023 04:25:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696472756; x=1728008756; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gULfhRMiK9uq/fLF561mdidHdSr5azIq+Az70OgOJKc=; b=Yv97NvonvH62fTb+xlZMDxaSsYo9LQF+sMRO4hKv7A+54GRucnMlnHlj GI/AB/8ksTcRe53lLtvVFXEROlwk+n1TmuovtbGSHR+dYt7AD2oyib+f4 pfKJAu6n9GdElN0Cl4jLZJPjf1nfFWoswLj7z5Yb5WxzAn4RAagmh89mF wb5mN4EgeNASEGXr73lNXAqyd522Ic1p9kdEFg2tz7oLhyiPIRj9LF6rs VlQinasvokbk4Mcugsda9FDnFiM2zBZdyoz/gWx19ERS/BupN9EUBEdEa Mi5sfHZ8UZH9corJQDedUSazTLKKsq4eidhqvsS3qUg4Dye+/iuPck7wK A==; X-IronPort-AV: E=McAfee;i="6600,9927,10853"; a="363657677" X-IronPort-AV: E=Sophos;i="6.03,201,1694761200"; d="scan'208";a="363657677" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Oct 2023 19:25:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10853"; a="781063018" X-IronPort-AV: E=Sophos;i="6.03,201,1694761200"; d="scan'208";a="781063018" Received: from spr-npg-bds1-eec2.sn.intel.com (HELO spr-npg-bds1-eec2..) ([10.233.181.123]) by orsmga008.jf.intel.com with ESMTP; 04 Oct 2023 19:25:54 -0700 From: Nicolas Chautru To: dev@dpdk.org, maxime.coquelin@redhat.com Cc: hemant.agrawal@nxp.com, david.marchand@redhat.com, hernan.vargas@intel.com, Nicolas Chautru Subject: [PATCH v4 04/12] baseband/acc: allocate FCW memory separately Date: Thu, 5 Oct 2023 02:18:46 +0000 Message-Id: <20231005021854.109096-5-nicolas.chautru@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231005021854.109096-1-nicolas.chautru@intel.com> References: <20231005021854.109096-1-nicolas.chautru@intel.com> MIME-Version: 1.0 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 This allows more flexibility to the FCW size for the unified driver. No actual functional change. Signed-off-by: Nicolas Chautru Reviewed-by: Maxime Coquelin --- drivers/baseband/acc/acc_common.h | 4 +++- drivers/baseband/acc/rte_vrb_pmd.c | 25 ++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/drivers/baseband/acc/acc_common.h b/drivers/baseband/acc/acc_common.h index afece863bc..653c7c935a 100644 --- a/drivers/baseband/acc/acc_common.h +++ b/drivers/baseband/acc/acc_common.h @@ -101,6 +101,7 @@ #define ACC_NUM_QGRPS_PER_WORD 8 #define ACC_MAX_NUM_QGRPS 32 #define ACC_RING_SIZE_GRANULARITY 64 +#define ACC_MAX_FCW_SIZE 128 /* Constants from K0 computation from 3GPP 38.212 Table 5.4.2.1-2 */ #define ACC_N_ZC_1 66 /* N = 66 Zc for BG 1 */ @@ -587,13 +588,14 @@ struct __rte_cache_aligned acc_queue { uint32_t aq_enqueued; /* Count how many "batches" have been enqueued */ uint32_t aq_dequeued; /* Count how many "batches" have been dequeued */ uint32_t irq_enable; /* Enable ops dequeue interrupts if set to 1 */ - struct rte_mempool *fcw_mempool; /* FCW mempool */ enum rte_bbdev_op_type op_type; /* Type of this Queue: TE or TD */ /* Internal Buffers for loopback input */ uint8_t *lb_in; uint8_t *lb_out; + uint8_t *fcw_ring; rte_iova_t lb_in_addr_iova; rte_iova_t lb_out_addr_iova; + rte_iova_t fcw_ring_addr_iova; int8_t *derm_buffer; /* interim buffer for de-rm in SDK */ struct acc_device *d; }; diff --git a/drivers/baseband/acc/rte_vrb_pmd.c b/drivers/baseband/acc/rte_vrb_pmd.c index 21c48e5c90..34195167d2 100644 --- a/drivers/baseband/acc/rte_vrb_pmd.c +++ b/drivers/baseband/acc/rte_vrb_pmd.c @@ -887,6 +887,25 @@ vrb_queue_setup(struct rte_bbdev *dev, uint16_t queue_id, goto free_companion_ring_addr; } + q->fcw_ring = rte_zmalloc_socket(dev->device->driver->name, + ACC_MAX_FCW_SIZE * d->sw_ring_max_depth, + RTE_CACHE_LINE_SIZE, conf->socket); + if (q->fcw_ring == NULL) { + rte_bbdev_log(ERR, "Failed to allocate fcw_ring memory"); + ret = -ENOMEM; + goto free_companion_ring_addr; + } + q->fcw_ring_addr_iova = rte_malloc_virt2iova(q->fcw_ring); + + /* For FFT we need to store the FCW separately */ + if (conf->op_type == RTE_BBDEV_OP_FFT) { + for (desc_idx = 0; desc_idx < d->sw_ring_max_depth; desc_idx++) { + desc = q->ring_addr + desc_idx; + desc->req.data_ptrs[0].address = q->fcw_ring_addr_iova + + desc_idx * ACC_MAX_FCW_SIZE; + } + } + q->qgrp_id = (q_idx >> VRB1_GRP_ID_SHIFT) & 0xF; q->vf_id = (q_idx >> VRB1_VF_ID_SHIFT) & 0x3F; q->aq_id = q_idx & 0xF; @@ -998,6 +1017,7 @@ vrb_queue_release(struct rte_bbdev *dev, uint16_t q_id) if (q != NULL) { /* Mark the Queue as un-assigned. */ d->q_assigned_bit_map[q->qgrp_id] &= (~0ULL - (1 << (uint64_t) q->aq_id)); + rte_free(q->fcw_ring); rte_free(q->companion_ring_addr); rte_free(q->lb_in); rte_free(q->lb_out); @@ -3232,7 +3252,10 @@ vrb_enqueue_fft_one_op(struct acc_queue *q, struct rte_bbdev_fft_op *op, output = op->fft.base_output.data; in_offset = op->fft.base_input.offset; out_offset = op->fft.base_output.offset; - fcw = &desc->req.fcw_fft; + + fcw = (struct acc_fcw_fft *) (q->fcw_ring + + ((q->sw_ring_head + total_enqueued_cbs) & q->sw_ring_wrap_mask) + * ACC_MAX_FCW_SIZE); vrb1_fcw_fft_fill(op, fcw); vrb1_dma_desc_fft_fill(op, &desc->req, input, output, &in_offset, &out_offset);