From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 7707CA0471 for ; Mon, 17 Jun 2019 17:59:11 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 083431BF9E; Mon, 17 Jun 2019 17:56:55 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id C3BF11BF7E for ; Mon, 17 Jun 2019 17:56:38 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5HFprCR001049 for ; Mon, 17 Jun 2019 08:56:38 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=n1xcanczaEm3ZsFWV80fck8NwkLNoZDh4TsLVHPcXrU=; b=WK2VFf+hU4aNF4LDuRg075JL9/o9IpTWbWDWCqRxf/gHnUo51KvIQa3mMeXMbrvTVc3s Rzq4RjUxIVWPHMFEG0xi0hvtmndRMIJkj9Yfb3mSapoRvfjhru8baSDkOW3Qjp+5lMNM AN8rTURYpIygYuIhK2q0Yg+KogC/MaR5F1F2S1YYq+IBChOl9KLkmJfDKVkTFvRU0vwq 3pmcGzknKbPu3gFI9fwK3bVuDJGbgffX1+5WjWB7u3zGJOAg5qM80FGOcFVq6Z8xS27G krO3KO3jVO5ZFo9xLsluaXxCWOHPlX0/XsYt9b/t2+KuPc1PLGToxJFt7C/h841m1/oc CQ== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 2t506hyaxv-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 17 Jun 2019 08:56:38 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Mon, 17 Jun 2019 08:56:25 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Mon, 17 Jun 2019 08:56:25 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id 229DA3F704A; Mon, 17 Jun 2019 08:56:23 -0700 (PDT) From: To: , Jerin Jacob , Nithin Dabilpuram , Vamsi Attunuru Date: Mon, 17 Jun 2019 21:25:22 +0530 Message-ID: <20190617155537.36144-13-jerinj@marvell.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190617155537.36144-1-jerinj@marvell.com> References: <20190601014905.45531-1-jerinj@marvell.com> <20190617155537.36144-1-jerinj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-17_07:, , signatures=0 Subject: [dpdk-dev] [PATCH v3 12/27] common/octeontx2: add VF mailbox IRQ and msg handler X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" From: Jerin Jacob This patch adds support for PF <-> VF mailbox interrupt mailbox message interrupt handling. Signed-off-by: Jerin Jacob --- drivers/common/octeontx2/otx2_dev.c | 78 ++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 2 deletions(-) diff --git a/drivers/common/octeontx2/otx2_dev.c b/drivers/common/octeontx2/otx2_dev.c index efb28a9d2..c5f7d5078 100644 --- a/drivers/common/octeontx2/otx2_dev.c +++ b/drivers/common/octeontx2/otx2_dev.c @@ -291,6 +291,24 @@ otx2_process_msgs(struct otx2_dev *dev, struct otx2_mbox *mbox) rte_wmb(); } +static void +otx2_pf_vf_mbox_irq(void *param) +{ + struct otx2_dev *dev = param; + uint64_t intr; + + intr = otx2_read64(dev->bar2 + RVU_VF_INT); + if (intr == 0) + return; + + otx2_write64(intr, dev->bar2 + RVU_VF_INT); + otx2_base_dbg("Irq 0x%" PRIx64 "(pf:%d,vf:%d)", intr, dev->pf, dev->vf); + if (intr) + /* First process all configuration messages */ + otx2_process_msgs(dev, dev->mbox); + +} + static void otx2_af_pf_mbox_irq(void *param) { @@ -310,7 +328,7 @@ otx2_af_pf_mbox_irq(void *param) } static int -mbox_register_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev) +mbox_register_pf_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev) { struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; int i, rc; @@ -359,8 +377,41 @@ mbox_register_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev) return rc; } +static int +mbox_register_vf_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev) +{ + struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; + int rc; + + /* Clear irq */ + otx2_write64(~0ull, dev->bar2 + RVU_VF_INT_ENA_W1C); + + /* MBOX interrupt PF <-> VF */ + rc = otx2_register_irq(intr_handle, otx2_pf_vf_mbox_irq, + dev, RVU_VF_INT_VEC_MBOX); + if (rc) { + otx2_err("Fail to register PF<->VF mbox irq"); + return rc; + } + + /* HW enable intr */ + otx2_write64(~0ull, dev->bar2 + RVU_VF_INT); + otx2_write64(~0ull, dev->bar2 + RVU_VF_INT_ENA_W1S); + + return rc; +} + +static int +mbox_register_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev) +{ + if (otx2_dev_is_vf(dev)) + return mbox_register_vf_irq(pci_dev, dev); + else + return mbox_register_pf_irq(pci_dev, dev); +} + static void -mbox_unregister_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev) +mbox_unregister_pf_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev) { struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; int i; @@ -388,6 +439,29 @@ mbox_unregister_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev) /* MBOX interrupt AF <-> PF */ otx2_unregister_irq(intr_handle, otx2_af_pf_mbox_irq, dev, RVU_PF_INT_VEC_AFPF_MBOX); + +} + +static void +mbox_unregister_vf_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev) +{ + struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; + + /* Clear irq */ + otx2_write64(~0ull, dev->bar2 + RVU_VF_INT_ENA_W1C); + + /* Unregister the interrupt handler */ + otx2_unregister_irq(intr_handle, otx2_pf_vf_mbox_irq, dev, + RVU_VF_INT_VEC_MBOX); +} + +static void +mbox_unregister_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev) +{ + if (otx2_dev_is_vf(dev)) + return mbox_unregister_vf_irq(pci_dev, dev); + else + return mbox_unregister_pf_irq(pci_dev, dev); } static void -- 2.21.0