From patchwork Sat Sep 24 00:50:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chautru, Nicolas" X-Patchwork-Id: 116777 X-Patchwork-Delegate: gakhil@marvell.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 2725CA054F; Sat, 24 Sep 2022 02:52:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C299C42C17; Sat, 24 Sep 2022 02:51:07 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 1188D42BD7 for ; Sat, 24 Sep 2022 02:50: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=1663980657; x=1695516657; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ldke5dtiG9rAW/lUWDNT7/ph9zCA+oIm8ycFwMR5+Uc=; b=Dkk27Yll6cpUSxJTvC12/YWLKqDk+eyUIJchXMhnLZ9/EgCPEjiIxWEK NTXx4p+BzYnQxOw23VR5qNHkXpgi5xjQxR/YSEgexxUcO8IegRpxCy7Mp DmxcSntLUAT8ZUt5aCBVSvAA/Q8znFJdaQNkd5LdMlFdjnTKAgEEVuZvK /owLpRggdB0kp1TyA1SzNTCMwteWdCCE2uOtQYfTJC7K+ZlSojHmiBPDM tztNW8NvSxekY11Rmpi7ko7LF6Yu1AONG7PzB6v3DSoQ1/GfewW3HCxur U8UNq/H7yyoy1ENwlzeZtPFsQOeO/q1gLb+coiFaRo1dhUDU+d1HCxwCy g==; X-IronPort-AV: E=McAfee;i="6500,9779,10479"; a="283839127" X-IronPort-AV: E=Sophos;i="5.93,340,1654585200"; d="scan'208";a="283839127" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2022 17:50:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,340,1654585200"; d="scan'208";a="709504447" Received: from unknown (HELO icx-npg-scs1-cp1.localdomain) ([10.233.180.245]) by FMSMGA003.fm.intel.com with ESMTP; 23 Sep 2022 17:50:56 -0700 From: Nicolas Chautru To: dev@dpdk.org, thomas@monjalon.net Cc: maxime.coquelin@redhat.com, trix@redhat.com, mdr@ashroe.eu, bruce.richardson@intel.com, hemant.agrawal@nxp.com, david.marchand@redhat.com, stephen@networkplumber.org, hernan.vargas@intel.com, Nic Chautru Subject: [PATCH v6 12/14] baseband/acc: add device status and vf2pf comms Date: Fri, 23 Sep 2022 17:50:46 -0700 Message-Id: <20220924005048.20302-13-nicolas.chautru@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220924005048.20302-1-nicolas.chautru@intel.com> References: <20220924005048.20302-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 From: Nic Chautru Add support to expose the device status seen from the host through v2pf mailbox communication. Signed-off-by: Nic Chautru Reviewed-by: Maxime Coquelin --- drivers/baseband/acc/rte_acc200_pmd.c | 64 ++++++++++++++++++++------- 1 file changed, 47 insertions(+), 17 deletions(-) diff --git a/drivers/baseband/acc/rte_acc200_pmd.c b/drivers/baseband/acc/rte_acc200_pmd.c index 46027ff6af..cd3214f6c9 100644 --- a/drivers/baseband/acc/rte_acc200_pmd.c +++ b/drivers/baseband/acc/rte_acc200_pmd.c @@ -201,23 +201,50 @@ fetch_acc200_config(struct rte_bbdev *dev) rte_bbdev_log_debug( "%s Config LLR SIGN IN/OUT %s %s QG %u %u %u %u %u AQ %u %u %u %u %u Len %u %u %u %u %u\n", (d->pf_device) ? "PF" : "VF", - (acc_conf->input_pos_llr_1_bit) ? "POS" : "NEG", - (acc_conf->output_pos_llr_1_bit) ? "POS" : "NEG", - acc_conf->q_ul_4g.num_qgroups, - acc_conf->q_dl_4g.num_qgroups, - acc_conf->q_ul_5g.num_qgroups, - acc_conf->q_dl_5g.num_qgroups, - acc_conf->q_fft.num_qgroups, - acc_conf->q_ul_4g.num_aqs_per_groups, - acc_conf->q_dl_4g.num_aqs_per_groups, - acc_conf->q_ul_5g.num_aqs_per_groups, - acc_conf->q_dl_5g.num_aqs_per_groups, - acc_conf->q_fft.num_aqs_per_groups, - acc_conf->q_ul_4g.aq_depth_log2, - acc_conf->q_dl_4g.aq_depth_log2, - acc_conf->q_ul_5g.aq_depth_log2, - acc_conf->q_dl_5g.aq_depth_log2, - acc_conf->q_fft.aq_depth_log2); + (acc200_conf->input_pos_llr_1_bit) ? "POS" : "NEG", + (acc200_conf->output_pos_llr_1_bit) ? "POS" : "NEG", + acc200_conf->q_ul_4g.num_qgroups, + acc200_conf->q_dl_4g.num_qgroups, + acc200_conf->q_ul_5g.num_qgroups, + acc200_conf->q_dl_5g.num_qgroups, + acc200_conf->q_fft.num_qgroups, + acc200_conf->q_ul_4g.num_aqs_per_groups, + acc200_conf->q_dl_4g.num_aqs_per_groups, + acc200_conf->q_ul_5g.num_aqs_per_groups, + acc200_conf->q_dl_5g.num_aqs_per_groups, + acc200_conf->q_fft.num_aqs_per_groups, + acc200_conf->q_ul_4g.aq_depth_log2, + acc200_conf->q_dl_4g.aq_depth_log2, + acc200_conf->q_ul_5g.aq_depth_log2, + acc200_conf->q_dl_5g.aq_depth_log2, + acc200_conf->q_fft.aq_depth_log2); +} + +static inline void +acc200_vf2pf(struct acc_device *d, unsigned int payload) +{ + acc_reg_write(d, HWVfHiVfToPfDbellVf, payload); +} + +/* Request device status information */ +static inline uint32_t +acc200_device_status(struct rte_bbdev *dev) +{ + struct acc_device *d = dev->data->dev_private; + uint32_t reg, time_out = 0; + + if (d->pf_device) + return RTE_BBDEV_DEV_NOT_SUPPORTED; + + acc200_vf2pf(d, ACC_VF2PF_STATUS_REQUEST); + reg = acc_reg_read(d, HWVfHiPfToVfDbellVf); + while ((time_out < ACC200_STATUS_TO) && (reg == RTE_BBDEV_DEV_NOSTATUS)) { + usleep(ACC200_STATUS_WAIT); /*< Wait or VF->PF->VF Comms */ + reg = acc_reg_read(d, HWVfHiPfToVfDbellVf); + time_out++; + } + + return reg; } /* Checks PF Info Ring to find the interrupt cause and handles it accordingly */ @@ -496,6 +523,7 @@ acc200_setup_queues(struct rte_bbdev *dev, uint16_t num_queues, int socket_id) /* Mark as configured properly */ d->configured = true; + acc200_vf2pf(d, ACC_VF2PF_USING_VF); rte_bbdev_log_debug( "ACC200 (%s) configured sw_rings = %p, sw_rings_iova = %#" @@ -1022,6 +1050,8 @@ acc200_dev_info_get(struct rte_bbdev *dev, /* Read and save the populated config from ACC200 registers */ fetch_acc200_config(dev); + /* Check the status of device */ + dev_info->device_status = acc200_device_status(dev); /* Exposed number of queues */ dev_info->num_queues[RTE_BBDEV_OP_NONE] = 0;