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 0DAE4A0543; Fri, 8 Jul 2022 02:17:13 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CBCD042B93; Fri, 8 Jul 2022 02:16:15 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id DFE99427F7 for ; Fri, 8 Jul 2022 02:16:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657239368; x=1688775368; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=IAQVFbRmAo4pPnuItFMjTXNblh73foMnpBJ//NElnBU=; b=h8nfIkV10Hf2ufCG3J2QZsOjC+IIAjufr659fIwMfL5uRNhNXjNpF7V0 h5Uv3kY5vkfCm8LeioqVOPqUo0tsYtMtiTf/tyiNQXAwuwf77l1N2Uz86 Fe7WH2JamH6li/UNSv0M1k3N6uaUe+5u/BIvk+xNrP+B0cx7QH2hCbg2h ipwZlMlAr5WJvPZbz1BLkxmL3dVGWOsWRNNHTvGBPXTxNWfs/+hK0L/21 3+Xv5A3Q7MTQSocAUVhOiX2oNUELDlWPZFKw54YGvFaCHb0F/cts1qDM4 W92Io2OOq21wzj64AI8zOhvIYuhO8PWSixsTVUtX4qvsZdp3ekJZFWG1V Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10401"; a="264563092" X-IronPort-AV: E=Sophos;i="5.92,253,1650956400"; d="scan'208";a="264563092" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2022 17:16:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,253,1650956400"; d="scan'208";a="591387556" Received: from skx-5gnr-sc12-4.sc.intel.com ([172.25.69.210]) by orsmga007.jf.intel.com with ESMTP; 07 Jul 2022 17:16:05 -0700 From: Nicolas Chautru To: dev@dpdk.org, thomas@monjalon.net, gakhil@marvell.com, hemant.agrawal@nxp.com, trix@redhat.com Cc: maxime.coquelin@redhat.com, mdr@ashroe.eu, bruce.richardson@intel.com, david.marchand@redhat.com, stephen@networkplumber.org, Nicolas Chautru Subject: [PATCH v1 09/10] baseband/acc200: add device status and vf2pf comms Date: Thu, 7 Jul 2022 17:01:42 -0700 Message-Id: <1657238503-143836-10-git-send-email-nicolas.chautru@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1657238503-143836-1-git-send-email-nicolas.chautru@intel.com> References: <1657238503-143836-1-git-send-email-nicolas.chautru@intel.com> 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 Add support to expose the device status seen from the host through v2pf mailbox communication. Signed-off-by: Nicolas Chautru --- drivers/baseband/acc200/rte_acc200_pmd.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/baseband/acc200/rte_acc200_pmd.c b/drivers/baseband/acc200/rte_acc200_pmd.c index ecfbc7a..856ea1c 100644 --- a/drivers/baseband/acc200/rte_acc200_pmd.c +++ b/drivers/baseband/acc200/rte_acc200_pmd.c @@ -262,6 +262,31 @@ acc200_conf->q_fft.aq_depth_log2); } +static inline void +acc200_vf2pf(struct acc200_device *d, unsigned int payload) +{ + acc200_reg_write(d, HWVfHiVfToPfDbellVf, payload); +} + +/* Request device status information */ +static inline uint32_t +acc200_device_status(struct rte_bbdev *dev) +{ + struct acc200_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, ACC200_VF2PF_STATUS_REQUEST); + reg = acc200_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 = acc200_reg_read(d, HWVfHiPfToVfDbellVf); + time_out++; + } + /* printf("DevStatus %x %s %d\n", reg, rte_bbdev_device_status_str(reg), time_out); */ + return reg; +} + static void free_base_addresses(void **base_addrs, int size) { @@ -704,6 +729,7 @@ /* Mark as configured properly */ d->configured = true; + acc200_vf2pf(d, ACC200_VF2PF_USING_VF); rte_bbdev_log_debug( "ACC200 (%s) configured sw_rings = %p, sw_rings_iova = %#" @@ -1214,6 +1240,8 @@ /* 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; -- 1.8.3.1