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 B89ECA00C3; Wed, 12 Oct 2022 20:01:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3515242BE7; Wed, 12 Oct 2022 20:00:21 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 2340142BC4 for ; Wed, 12 Oct 2022 20:00:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665597618; x=1697133618; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=r2QC3xwlrneUERJ3x/+Gn4xcXEHCDBYEzaRE3LnfTe4=; b=QcOCjE8FfzbMmW3iWwznlq7zcrH149nyg1VsNC0kO7IM6awodRUifbZV 06m8NVBoiUp4mJ8smRijJtSEFs5GMaXF2LyHGksgNjNnGwayTcLkI0eyx ybjgZO+HdHar0T2ysvhm4LvPD08ifMXVDPW653x/0SZPyYeNp6cHvyZvl AIPliUQAikWf/ednzTyul0Dn0ERjn+Khm1F8yneK9VFUOZj0NQsf2prhX Ku6NJqMht4xs9FHPHci9uYsEKDWq075kXXeqkhmtRaY7wUPjfqFgmeil1 sZwZq0MfAnWI7UL9nxLjPQdwZrL/3MTxd6zaAX77B4XmNqJ8VmbHJZf5e g==; X-IronPort-AV: E=McAfee;i="6500,9779,10498"; a="292193170" X-IronPort-AV: E=Sophos;i="5.95,179,1661842800"; d="scan'208";a="292193170" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2022 11:00:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10498"; a="657867367" X-IronPort-AV: E=Sophos;i="5.95,179,1661842800"; d="scan'208";a="657867367" Received: from unknown (HELO icx-npg-scs1-cp1.localdomain) ([10.233.180.245]) by orsmga008.jf.intel.com with ESMTP; 12 Oct 2022 11:00:08 -0700 From: Nicolas Chautru To: dev@dpdk.org, gakhil@marvell.com, maxime.coquelin@redhat.com Cc: 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 v12 12/16] baseband/acc: add device status and vf2pf comms Date: Wed, 12 Oct 2022 10:59:26 -0700 Message-Id: <20221012175930.7560-13-nicolas.chautru@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221012175930.7560-1-nicolas.chautru@intel.com> References: <20221012175930.7560-1-nicolas.chautru@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Added 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 | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/baseband/acc/rte_acc200_pmd.c b/drivers/baseband/acc/rte_acc200_pmd.c index 828e4a73cd..522603e095 100644 --- a/drivers/baseband/acc/rte_acc200_pmd.c +++ b/drivers/baseband/acc/rte_acc200_pmd.c @@ -211,6 +211,33 @@ fetch_acc200_config(struct rte_bbdev *dev) acc_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. */ static inline void acc200_check_ir(struct acc_device *acc200_dev) @@ -484,6 +511,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 = %#" @@ -1011,6 +1039,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; -- 2.37.1