From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0064.outbound.protection.outlook.com [104.47.38.64]) by dpdk.org (Postfix) with ESMTP id 2FD9A2B94 for ; Fri, 31 Mar 2017 21:35:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=guVtWzHltWG8dbtfoQzr3PhNx0JnjDD8/z5glDxZNqU=; b=V5i/h1zgIHhmaVg6jf2/E+U09k5vs5truB/rK+iT63F/LvM6aOUjlM1bWaTuhfZJ+h7TAwyRE7XBFaqG4JKzojAlE4oOsbN/rl9susJ9anC0dic4SGpgtKk4jTFOprH6cW3iDLjnw4BrC6avbbqFJ5M6808ABE+nNQ2OotT8w/s= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost.localdomain (14.140.2.178) by BY1PR0701MB1723.namprd07.prod.outlook.com (10.162.111.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.991.14; Fri, 31 Mar 2017 19:35:41 +0000 From: Jerin Jacob To: dev@dpdk.org Cc: thomas.monjalon@6wind.com, bruce.richardson@intel.com, harry.van.haaren@intel.com, hemant.agrawal@nxp.com, gage.eads@intel.com, nipun.gupta@nxp.com, santosh.shukla@caviumnetworks.com, Jerin Jacob Date: Sat, 1 Apr 2017 01:04:29 +0530 Message-Id: <1490988905-12584-3-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1490988905-12584-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1488562101-6658-1-git-send-email-jerin.jacob@caviumnetworks.com> <1490988905-12584-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: MAXPR01CA0058.INDPRD01.PROD.OUTLOOK.COM (10.164.146.158) To BY1PR0701MB1723.namprd07.prod.outlook.com (10.162.111.142) X-MS-Office365-Filtering-Correlation-Id: 0921d71f-9bcb-48d0-d31b-08d4786d2032 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:BY1PR0701MB1723; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 3:4C+IRteWMyKFqeHBDLoVX8HgCcWGGIQua6ykylCor2DqMaZGX0WM5P88mR/UTOQSyptJqkKbYnY1iuQQh227zHzksGxEgV/DhcT9wtY3RO6gXe6nfkDTp4P2KsaoOfyjSTRcxGl92zL2kX0EJnQDXNKbPohcU6WLl1MsxPs0M3gpmNrZvOb9HLJKgdjXlfom2aYuRYgSTuYbb7w4ZpskeDo8VPQ0DFRgZIDU05QoougiJJX1wpSqZEl8tM432/jp+ZXcvyoHjS17lVtpX7bH5Zy+hEPOFWuWHpCyUGoDLl2zam3P8z9WsWhJCm6AOh2qyWMNH+YdmyOvvojZTm5EJQ==; 25:9Q2EExMPaXv6BPx5a/5gzN/sFSmz2+j7gbbpNXiozta+8Etgxr+XtMAI8TeIA/NbaCha0+DJbT3cyDLHARWj1k0tBfKWy5UmV6ksWFbbkDvdV3RUpcC0Pxo42S2Rvm2C4knxf4/vPUi+PSNzT/7ZIfmqdVaXstKRitIChkhJ5W8pMcV/cFeT4qMpA6Tm1BpYdWbcR/eLeXUBDQSIxJT6LRf/OrVe4FXYD8EQbtHSQ/wM8sfeM/Fqxd25Utfa98GYbZyS8b7AHWz5nxp+u6/MW3Pn/5mmF0N9nTXW3J2aip6xHVz6GtDO/DfA4nHHGnv1oPKczntw+DNOtO7uh2JT9QXbUToyVm5Vjmx6dcYY3bLtNyFthx3S1likBiuWSpW3l+vcVhM+6YNqfL0w2kvClysFsI52mkfyVYd02xyxRj8Ol8FEVuvIumks1ks6hw+Fe4VpYrzj49mFmIOtbWL8bw== X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 31:6jIvAE3qQ+7jjvGoocUJM4sQd58HE9MLKNUQx11UTokoeHlAo1VNb1iQ5KyOhoGh1OjpjaIEGML+p0XvcvPl71APWD3eD3ekBYIFq6cqIkqMq/H5ix3e14HIsCAPp76w4dKNiKk7FUHaTHEe/onpcf2ef7IT42hoXYexDCr6p7CAZ76M15NW59PE7GI/SEQMBx+STJhYNJ6KhkfGOTnUpW/Il6DaejIVyVeVEffkZAU=; 20:vBekqj89vO25nr7xA56nlP+dnhZA5S0xNXXF7gEu0FqIBetq1qtJjzavvNmRsDU18AL6ek3iDMCIeSSLQ4lPQ733ymMb28sHiyuAF/VbdRi/RDvTp2qnwXJ9pGsdBjz0RvSHOnugBFNkwqmpaMecsBezChPz1aOZq4ZJaWqwXef0/zAK8n0frhPUqt1FdbkLRvXtQTwML0j6PecUYSw3AACeCT+52JUw2Welhu848do37jOeA9gFtTUDmHnVfkGMMOEa2QO9tOp3MRJiJTcHJod4q9lslLyHu+XdSvtk29tHccHY0MkE6ZuywVJqzAmWL+E626xMFuqG9izE3ZbBbSEqDh7QcYKtq7wIl8JKo/F3kt7qJuOIIBabkpT5GSk3Hc7qU1gQrtX5l45MBxxVCbDD+wPOI/Ey1iIGZQsBFF3fjv0CPPNGEoVy+YYfHC8HaQUGd0UIsOLq+3bcFne/tYOS4kUyG3Zzv/nsaDv+mIQRjafd+GmYvLhGOigvhhJuvr52bXSwcY6prZ1TZWF7QQbGc/cdJnQC0HMJovHnGqLnsn7g65We0qg7VgdvC+IdcmkhHO4iGR1IaHaGOEhAMWIt5EXsldL+T1p048XHMSo= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(93006095)(3002001)(6041248)(20161123555025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(20161123560025)(20161123564025)(6072148); SRVR:BY1PR0701MB1723; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1723; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 4:2nWELMKar3ueFXe7SoVjIqelXomX64HTpuY2HlCeZkGopVFns9hukjYnZqRZm2kXcOCJD4Ygyw6ONU3D5dNDJU7PgkBKJ0j3Kqy28ERIKUSNoM0HsQ/btjDD4PYs+RJ1H+UroqlcSMmpF6Mo7j+3q9GmEl1hEEEovk8rTW7x7k6PG4S56CHncsoRK3g+xmK0OXvan97lomcd0BNjCSuXK4qT1JvsofpYxWu+hqPYyjDdpevYYYZTo7yOg3RuKukPzw/xhoEOyuQ6F+eounffCuz95/NHrn7Fgmb45MKxatTNlkXR3q9XOgTZ8PfMJ3qWWq2NTO9C4jcLPOgWpyg6L2N56nAjVjoCmS8jyGtiBXaxBtb60DBqvbIAN9LZINFEJqLb5eCbK4mV1LzRwC/XmpBMwlxBKDzGAKlmlt0BYUir3ZU26k6Z/+6Dl4zO6/6EP0wTXPIVWr1wl79iDmEIl7nj2B/1znvq7+opn/OYKCXBwdXJGYs1+vXKZxheX75zuuLVuTu0BI7BbTTE4zo3/cOm5NtiQteyyi4Xok6r6YWgob0GZ7J2W8BONkL3Qkg9gM4eL5O9Pho4RpcYYiWc7WJ+PyzxkHvJmK+RpSyKbFD+aJhh3KJqRow1FW/zoM2Y3OISfwSaHOi/qUqUCnLDKbBPk2CsaC0SQgPvAEU17ZM3+4OJbbSGjGfIhsRkuK03NpPL25zP99dlUcoy871Smu1Rs5FJNNOXvBtQzKTHVXGr9octcIj7mAlhcietSbQ4 X-Forefront-PRVS: 02638D901B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(39450400003)(39410400002)(39400400002)(39850400002)(39840400002)(38730400002)(8676002)(53376002)(107886003)(110136004)(50466002)(189998001)(305945005)(6506006)(36756003)(50226002)(25786009)(48376002)(6666003)(966004)(575784001)(8656002)(6486002)(7736002)(2950100002)(5660300001)(53936002)(81156014)(81166006)(3846002)(42882006)(6916009)(6306002)(6116002)(6512007)(42186005)(33646002)(2361001)(2351001)(76176999)(50986999)(5003940100001)(47776003)(2906002)(5009440100003)(4326008)(66066001)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1723; H:localhost.localdomain; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0701MB1723; 23:jCnVsQqGEFSD3owwfFc63L3eeOGpX6O3e9RTrKB?= =?us-ascii?Q?W4nGdofjg2yQNZ33pU7fiOthATyVjvN0YHF9yvFdtkzw2I+bW30MKbpOEkCa?= =?us-ascii?Q?17Ozez3S5sprQjNLICf/AADkW6PNryiS8OQyZ+9Myk2qW3spTvX7TyHTABb0?= =?us-ascii?Q?sWCPtf6+l2LnEvhwGbt/xn7XGr8LZDAxz1MvJuLkX+0YpdWRbLX0glDwvPNe?= =?us-ascii?Q?CGRRz5stCdEg9mzLOVo6ck1uGPNjCizA3q+tgT11JOYdw2THMFCkuEn8CIkp?= =?us-ascii?Q?QMAFbCGf6y5S8o/o2EY9dJmYbaDVXdIuRq6FGMQUaPLVIySx7jPNtQbOGHUc?= =?us-ascii?Q?zZiRuQ8YBBT8DKnTGy+RP3BX+FTiGGhjl6KXVAMmzab3hKD2lUFcx8q2SQpi?= =?us-ascii?Q?bhifMpulrTiftrm9YDkx9HKwk9eGWKVEyB/Xm82tTe+0ZNlIHt6dc4Gbn9sx?= =?us-ascii?Q?PibToWoDE9aPMTQcl9Ze/y+TAKM5vaHJMgetZ3Obvs2Z3fgV7uMyC0pCOmeK?= =?us-ascii?Q?GKGL/CUxSLf65HFahJ7OOT+2v6ULChc+b/6Ul47VoPvFoQs0XqMGw1eqvUfm?= =?us-ascii?Q?li0Xt5j0f/7MGiwAgMien9DNWV7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LPttN+Fpu+nDc43FCbzWZGyzWfQcmL+mEIGa7W2AMRPxc3eMD8Bi2KycBeNeov1M7+RlO0AWsOuH1541/+h10hnIlX6F2zDZE6UFxe1BTHLMb80Be9PzjLQ6KrjYH3N9lx7P0814s+yRxhV7ObmcnZuzX3qWgIOD0a4FaKtig08/LQmb0A==; 5:nVTseaBMsfyqS+Akt57VcXOWorik4tXFpQn+J0vYEA7tc2Z9siGV56nSs6LV8YIJn3RV4SBPXsaH468m/jrlZdeXiwIX2/JtzqzgtTmtoOMhPZ5NChu5mBqTXF947iIZG4QFSxByOmRssuR3lpNZ1DXwwiXG3fd5lpyHDh5i0Z0=; 24:vCGA5z0LCvssePV7My9/8nVE8P1IjvHL2p//9ygXEvdm87desp6NwzBdMGCKRU2dryB6wDtD3YAW8KfyecZH4gboIQu5cisxTGSpxGFSVzo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 7:T4/ecO/inDRMpU4FVl7CoXzsssHPNOLb2czPmrqWvDrNP5UD+BliMCtUEOHyD82/TpBfUc7JvFRCQsLLYRlLvXMGDMSdztMuALKSV0gU3OtMmSbhkW2rhCrbN72tMF9trSaPyZmLG4XPdXBU7suJHze+q9zwMCDjMKaT3JNt0VAoqFDDWe81CwzHTh74CKW0hdVdZJbDJe+CkLgUz7bX83cervvkrwx7n+8Cr9sUKznwbh7RLiT/0mjiVEVMJ0KE2dEOF8xVZVGew2uy6HB7S3gJsKcWfLaUP4rCaGk8BoTzsisl3ZDXY2D7dlnzOL/yOc47crS+/QnJGYHc3SCxOA== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2017 19:35:41.9272 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1723 Subject: [dpdk-dev] [PATCH v2 02/38] event/octeontx: probe ssovf pcie devices 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: , X-List-Received-Date: Fri, 31 Mar 2017 19:35:48 -0000 An event device consists of event queues and event ports. On Octeontx HW, each event queues(sso group/ssovf) and event ports(sso hws/ssowvf) are enumerated as separate SRIOV VF PCIe device. In order to expose as an event device, On PCIe probe, the driver stores the information associated with the PCIe device and later with vdev infrastructure creates event device with earlier probed PCIe VF devices. Signed-off-by: Jerin Jacob Signed-off-by: Santosh Shukla Acked-by: Gage Eads --- v2: -- git comment enhancement. Added the missing space(Gage) http://dpdk.org/dev/patchwork/patch/21364/ --- drivers/event/octeontx/ssovf_evdev.h | 24 ++++++++++ drivers/event/octeontx/ssovf_probe.c | 86 ++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h index ce6b7d4..809eed1 100644 --- a/drivers/event/octeontx/ssovf_evdev.h +++ b/drivers/event/octeontx/ssovf_evdev.h @@ -34,6 +34,7 @@ #define __SSOVF_EVDEV_H__ #include +#include #define EVENTDEV_NAME_OCTEONTX_PMD event_octeontx @@ -54,4 +55,27 @@ RTE_LOG(ERR, EVENTDEV, "[%s] %s() " fmt "\n", \ RTE_STR(EVENTDEV_NAME_OCTEONTX_PMD), __func__, ## args) +#define PCI_VENDOR_ID_CAVIUM 0x177D +#define PCI_DEVICE_ID_OCTEONTX_SSOGRP_VF 0xA04B + +#define SSO_MAX_VHGRP (64) + +/* SSO VF register offsets */ +#define SSO_VHGRP_QCTL (0x010ULL) +#define SSO_VHGRP_INT (0x100ULL) +#define SSO_VHGRP_INT_W1S (0x108ULL) +#define SSO_VHGRP_INT_ENA_W1S (0x110ULL) +#define SSO_VHGRP_INT_ENA_W1C (0x118ULL) +#define SSO_VHGRP_INT_THR (0x140ULL) +#define SSO_VHGRP_INT_CNT (0x180ULL) +#define SSO_VHGRP_XAQ_CNT (0x1B0ULL) +#define SSO_VHGRP_AQ_CNT (0x1C0ULL) +#define SSO_VHGRP_AQ_THR (0x1E0ULL) +#define SSO_VHGRP_PF_MBOX(x) (0x200ULL | ((x) << 3)) + +/* BAR2 */ +#define SSO_VHGRP_OP_ADD_WORK0 (0x00ULL) +#define SSO_VHGRP_OP_ADD_WORK1 (0x08ULL) + + #endif /* __SSOVF_EVDEV_H__ */ diff --git a/drivers/event/octeontx/ssovf_probe.c b/drivers/event/octeontx/ssovf_probe.c index 9412878..713329c 100644 --- a/drivers/event/octeontx/ssovf_probe.c +++ b/drivers/event/octeontx/ssovf_probe.c @@ -30,3 +30,89 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include +#include +#include +#include +#include + +#include "ssovf_evdev.h" + +struct ssovf_res { + uint16_t domain; + uint16_t vfid; + void *bar0; + void *bar2; +}; + +struct ssodev { + uint8_t total_ssovfs; + struct ssovf_res grp[SSO_MAX_VHGRP]; +}; +static struct ssodev sdev; + +/* SSOVF pcie device aka event queue probe */ + +static int +ssovf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) +{ + uint64_t val; + uint16_t vfid; + uint8_t *idreg; + struct ssovf_res *res; + + RTE_SET_USED(pci_drv); + + /* For secondary processes, the primary has done all the work */ + if (rte_eal_process_type() != RTE_PROC_PRIMARY) + return 0; + + if (pci_dev->mem_resource[0].addr == NULL || + pci_dev->mem_resource[2].addr == NULL) { + ssovf_log_err("Empty bars %p %p", + pci_dev->mem_resource[0].addr, + pci_dev->mem_resource[2].addr); + return -ENODEV; + } + idreg = pci_dev->mem_resource[0].addr; + idreg += SSO_VHGRP_AQ_THR; + val = rte_read64(idreg); + + /* Write back the default value of aq_thr */ + rte_write64((1ULL << 33) - 1, idreg); + vfid = (val >> 16) & 0xffff; + if (vfid >= SSO_MAX_VHGRP) { + ssovf_log_err("Invalid vfid (%d/%d)", vfid, SSO_MAX_VHGRP); + return -EINVAL; + } + + res = &sdev.grp[vfid]; + res->vfid = vfid; + res->bar0 = pci_dev->mem_resource[0].addr; + res->bar2 = pci_dev->mem_resource[2].addr; + res->domain = val & 0xffff; + + sdev.total_ssovfs++; + rte_wmb(); + ssovf_log_dbg("Domain=%d group=%d total_ssovfs=%d", res->domain, + res->vfid, sdev.total_ssovfs); + return 0; +} + +static const struct rte_pci_id pci_ssovf_map[] = { + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, + PCI_DEVICE_ID_OCTEONTX_SSOGRP_VF) + }, + { + .vendor_id = 0, + }, +}; + +static struct rte_pci_driver pci_ssovf = { + .id_table = pci_ssovf_map, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING, + .probe = ssovf_probe, +}; + +RTE_PMD_REGISTER_PCI(octeontx_ssovf, pci_ssovf); -- 2.5.5