From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0063.outbound.protection.outlook.com [104.47.32.63]) by dpdk.org (Postfix) with ESMTP id 33C44F961 for ; Fri, 3 Mar 2017 18:29:20 +0100 (CET) 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=renIYwRx/ZEAXWyHGjS/vN3rUoBrzA9SbGaCp9bmLWc=; b=UcJQoKiqq+/IuYKxKjpRpYcIHK2Ia5ouZr3la4Wj3fNu+cgMpqwTjhMHXQ2PT5zls/GdFX8hlFO9vrN1O9IOA6Wjcfv1qtNVB76BfqyxMv74eLUZVrUoiuCKTBIVa5KMzB9mDb+sCUPNuwJsUW2VW9R6bxQkUYy2029Zv2OTcdo= 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.localdomain (14.140.2.178) by BN3PR0701MB1719.namprd07.prod.outlook.com (10.163.39.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.933.12; Fri, 3 Mar 2017 17:29:15 +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: Fri, 3 Mar 2017 22:57:48 +0530 Message-Id: <1488562101-6658-7-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1488562101-6658-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1488562101-6658-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: BMXPR01CA0021.INDPRD01.PROD.OUTLOOK.COM (10.174.214.159) To BN3PR0701MB1719.namprd07.prod.outlook.com (10.163.39.18) X-MS-Office365-Filtering-Correlation-Id: 74d97e07-aa13-4171-b3f2-08d4625ad2a8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN3PR0701MB1719; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 3:4urpu44eDd/2mYbGAb6LgQM3LCvGLtqWGPjbHinzmrj0ty8Da7+OxzKtNzDKZKQ0FQp9k3M+KKql+fNL0K2B0MBmaMxMSBa/Y5B6arQ8iMimO87WFs4o76jqBqJbCVC5Ks8VXFVGsjVf+UuLt5auoXFi1tn44Lr+VdQYN/9GGbmdcBp+kDdxylxKGoJgRQz4zErPFIwPKL9uRli7dgWm8R3RiMWgG/N2EE9RPQPGzqXOxYndbr9kGWC1kSF4blzGJ39quGOsJABpD5e88L33ow==; 25:eQADBC3/fGjLbelN8DLynx0gmq6O5aY+aHJUg5mGKXXT74opFQGyZJXdgVup6+gF1GcMJDlEogHnRoieYPKHFeyafPUAvgAOG37LQK+OrbTb1O3upWJqtLkL85ovV69pH7YhTDVbkwShc9wBdZDcE1xloNE8I5Au51agxFkYib19gZD3DxBlqYjibjkpUgBKeI61tAG7pveo/KYLQuBQRUmRuINhgv8KREceVuka8cfKn2HnosxTIiTG5epvxYoYlfX1FU0+apCWlsK6Wpgo/Y+/MWTo7srcC5p6WjsFzQvro1if08pAVnCCqoJpeIqTcglV5Ym8xwkEiRiO8aMwKcpdY7emFjPesDwlKNk7zXwj8bdldgX/q7HDVo7tL5//3sASWHXfO+oM3YCC7BMA7H8A3f/cd3OD3KvT1dDJm/pSHfYx3YYbMowt8dZtkcxfMKW1ub232cRsXmk0PmEzFw== X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 31:dtoXERakvV8MoTtHEShDA91kcmvl3CUy+L1K4bPBKGbgpOYN+WG4cvsDOpT2iE1d3s+h5/XhL+10Ds6y2WN0uvrsjfG8joEBCz9OC5CcsLxiOzCgoZhLToyiTF7RxRJ2gAxqv40u2Oq37uExyphhhVT5sOMLQqunwIidjO8sLBF2Ni3xAm44pvAVDySHiPUxdNHPRYiaGe+pY6XC7zQwdk/cbVt4/ISCsRRlIairGOA=; 20:xRCw1BkOWxvprghxD1NgQS1nTVLFyhzMqFF0ZcaRILFepbHaqm9TnyDLKeDA7Saj/t6SI2s7gXK9NvYcsFeMKXOYJfIO8OhCCW+Gk2iyxrVjoyHNhqApA91SD7ii5wC/GCzr8f0/F1GJdJK/a/FubSiSg49877U1R+3H0BXbHaqOsCWxE4O/xCdgHV8JBuJ9QkXyaM87Wp+LLV5L5Zyq40jQVDxukAElj9/sbU13v38iv/OklFzxbB3ge/ArvsSLvEyoqciQzu+TBbf6FRoAKcHS5AKZFV3KUWryeJVium4NtfWTMsp3b9hMedfQ1YYJa2uOMgbL7YKeIHPw83VAijALlXLIINnNyo+cKsYF2IRKbyuNTDmbpwv/OegYgCNqhBUwNqv29tLAUu28XsbKTLT2eNtYMUr6VzyWFyTxG8NtqHobu55oa8owKbRNAF7xyTZM5d8CBX6V45OYrfaTs3tnhtfG7G418n3yfMxwQASCvVcgQ5hbyycJrKAjyphu0MeGaCBXt4B+qibt3sqH4ZC5qkpZlzVFhloIZ5X1UEQH77QcRmniNl0oKS4U7rnmGYFNnfa/zTjx+VRrqf9UuryKOPqQt9cxLrmsOMhYtYk= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6041248)(20161123555025)(20161123560025)(20161123562025)(20161123558025)(20161123564025)(6072148); SRVR:BN3PR0701MB1719; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0701MB1719; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 4:5Z5Yk/jnDfMM2KLnW2c/z86msOuZCFumu9X5WiTUl62AM9qU7Omp/r/yWBGYhXi53lUl75bvrjeXyjCy3WH+7PXA02OKtzsq4/1adsmYNDWgUeYnRc2BynaQ/3LV5SvVCkFS8HSjhIf2yu/dGx7YOyr9HBoq0BLeQTmEPEh47PM9CT7u7OD1IepSFxZM4U2vVU0sG97HMjtiFgs3j/VGHFDy9/VBQqQbQV4fPgFVAGX/TequaS/GKVvXNcGUGiM8qs0CCa38dzztKqXmnaw63U4tF+aHIwiLFHSCd52v/ntB1KqzsTB+bXWTTgm3VFvJ2jD6bgbY7Ao0Zan1sDd91oaVJuY8CuSJcySPHwwf+Zb4QZjc3gmLDPjh02ehiDc6xYIzi5BgWfu/Um1Su/CU9NOqjE+KWUuBJ4J+YXOjKUTQQVQExyj6Rj9O+kubGCoLqcGWBin5YIMBFG+FJTXoQ4HOeiJ4Y/oCPHCNbyVRTnI+XjxkcMd1U/6V9wgZI1VHfE4OUfWEzwGuG3oWv/QixfItaULeo/hjl+4Win2Bo98rIQohFD5hwVRzydimU5mZ3gSgVfg+1uR9theww21Ep7se4wleNcAWFKIZqtIi6zc= X-Forefront-PRVS: 0235CBE7D0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(39450400003)(3846002)(50986999)(6116002)(36756003)(81166006)(6512007)(97736004)(2361001)(2351001)(6506006)(575784001)(5660300001)(42186005)(50226002)(8676002)(6666003)(106356001)(8656002)(2950100002)(2906002)(25786008)(47776003)(6486002)(76176999)(33646002)(7736002)(107886003)(42882006)(66066001)(110136004)(4326008)(38730400002)(6916009)(305945005)(48376002)(92566002)(5009440100003)(5003940100001)(50466002)(189998001)(53936002)(7099028)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0701MB1719; H:localhost.localdomain.localdomain; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;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lr9fh4mdyWfxsr2KBYT24= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1719; 7:2twvJey7e+CDAmSsE6oNx9RG02T6VYS9H1EaXxv46i3nJBuBcJeMKR+s6WW5pyTajol94MKM5zepN+5EHVlc32nA/rj6B0uEkWOcgKGYUDglPZuCp0/b2iZEt6m4YcSOJsahoHio6CuHCxFXhX85JhlLMHSg34uCCnwEULm54+0BBQ+VvAumiPfmY/vehd9h1jWvO+EIxOMQ9AYqZdOss5UI21/8LD3gbeyOmU+gGAaX3xgU/mZD2zObSv29lIHx3ivPmeuLxfx9PoY2Ocd26V+uh1ShlDH+kFJ5rdzb01oSkkGhKNouIC2I8XHiDodgiuxzp2X+Cy8FQBcnnW8v8w== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2017 17:29:15.3338 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1719 Subject: [dpdk-dev] [PATCH 06/39] event/octeontx: probe ssowvf 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, 03 Mar 2017 17:29:21 -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 --- drivers/event/octeontx/ssovf_evdev.h | 28 ++++++++++++ drivers/event/octeontx/ssovf_probe.c | 86 ++++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h index 809eed1..0a3c76e 100644 --- a/drivers/event/octeontx/ssovf_evdev.h +++ b/drivers/event/octeontx/ssovf_evdev.h @@ -57,8 +57,10 @@ #define PCI_VENDOR_ID_CAVIUM 0x177D #define PCI_DEVICE_ID_OCTEONTX_SSOGRP_VF 0xA04B +#define PCI_DEVICE_ID_OCTEONTX_SSOWS_VF 0xA04D #define SSO_MAX_VHGRP (64) +#define SSO_MAX_VHWS (32) /* SSO VF register offsets */ #define SSO_VHGRP_QCTL (0x010ULL) @@ -77,5 +79,31 @@ #define SSO_VHGRP_OP_ADD_WORK0 (0x00ULL) #define SSO_VHGRP_OP_ADD_WORK1 (0x08ULL) +/* SSOW VF register offsets (BAR0) */ +#define SSOW_VHWS_GRPMSK_CHGX(x) (0x080ULL | ((x) << 3)) +#define SSOW_VHWS_TAG (0x300ULL) +#define SSOW_VHWS_WQP (0x308ULL) +#define SSOW_VHWS_LINKS (0x310ULL) +#define SSOW_VHWS_PENDTAG (0x340ULL) +#define SSOW_VHWS_PENDWQP (0x348ULL) +#define SSOW_VHWS_SWTP (0x400ULL) +#define SSOW_VHWS_OP_ALLOC_WE (0x410ULL) +#define SSOW_VHWS_OP_UPD_WQP_GRP0 (0x440ULL) +#define SSOW_VHWS_OP_UPD_WQP_GRP1 (0x448ULL) +#define SSOW_VHWS_OP_SWTAG_UNTAG (0x490ULL) +#define SSOW_VHWS_OP_SWTAG_CLR (0x820ULL) +#define SSOW_VHWS_OP_DESCHED (0x860ULL) +#define SSOW_VHWS_OP_DESCHED_NOSCH (0x870ULL) +#define SSOW_VHWS_OP_SWTAG_DESCHED (0x8C0ULL) +#define SSOW_VHWS_OP_SWTAG_NOSCHED (0x8D0ULL) +#define SSOW_VHWS_OP_SWTP_SET (0xC20ULL) +#define SSOW_VHWS_OP_SWTAG_NORM (0xC80ULL) +#define SSOW_VHWS_OP_SWTAG_FULL0 (0xCA0UL) +#define SSOW_VHWS_OP_SWTAG_FULL1 (0xCA8ULL) +#define SSOW_VHWS_OP_CLR_NSCHED (0x10000ULL) +#define SSOW_VHWS_OP_GET_WORK0 (0x80000ULL) +#define SSOW_VHWS_OP_GET_WORK1 (0x80008ULL) + +#define SSOW_BAR4_LEN (64 * 1024) #endif /* __SSOVF_EVDEV_H__ */ diff --git a/drivers/event/octeontx/ssovf_probe.c b/drivers/event/octeontx/ssovf_probe.c index 713329c..7033ff5 100644 --- a/drivers/event/octeontx/ssovf_probe.c +++ b/drivers/event/octeontx/ssovf_probe.c @@ -45,12 +45,98 @@ struct ssovf_res { void *bar2; }; +struct ssowvf_res { + uint16_t domain; + uint16_t vfid; + void *bar0; + void *bar2; + void *bar4; +}; + +struct ssowvf_identify { + uint16_t domain; + uint16_t vfid; +}; + struct ssodev { uint8_t total_ssovfs; + uint8_t total_ssowvfs; struct ssovf_res grp[SSO_MAX_VHGRP]; + struct ssowvf_res hws[SSO_MAX_VHWS]; }; + static struct ssodev sdev; +/* SSOWVF pcie device aka event port probe */ + +static int +ssowvf_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) +{ + uint16_t vfid; + struct ssowvf_res *res; + struct ssowvf_identify *id; + + 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 || + pci_dev->mem_resource[4].addr == NULL) { + ssovf_log_err("Empty bars %p %p %p", + pci_dev->mem_resource[0].addr, + pci_dev->mem_resource[2].addr, + pci_dev->mem_resource[4].addr); + return -ENODEV; + } + + if (pci_dev->mem_resource[4].len != SSOW_BAR4_LEN) { + ssovf_log_err("Bar4 len mismatch %d != %d", + SSOW_BAR4_LEN, (int)pci_dev->mem_resource[4].len); + return -EINVAL; + } + + id = pci_dev->mem_resource[4].addr; + vfid = id->vfid; + if (vfid >= SSO_MAX_VHWS) { + ssovf_log_err("Invalid vfid(%d/%d)", vfid, SSO_MAX_VHWS); + return -EINVAL; + } + + res = &sdev.hws[vfid]; + res->vfid = vfid; + res->bar0 = pci_dev->mem_resource[0].addr; + res->bar2 = pci_dev->mem_resource[2].addr; + res->bar4 = pci_dev->mem_resource[4].addr; + res->domain = id->domain; + + sdev.total_ssowvfs++; + rte_wmb(); + ssovf_log_dbg("Domain=%d hws=%d total_ssowvfs=%d", res->domain, + res->vfid, sdev.total_ssowvfs); + return 0; +} + +static const struct rte_pci_id pci_ssowvf_map[] = { + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, + PCI_DEVICE_ID_OCTEONTX_SSOWS_VF) + }, + { + .vendor_id = 0, + }, +}; + +static struct rte_pci_driver pci_ssowvf = { + .id_table = pci_ssowvf_map, + .drv_flags = RTE_PCI_DRV_NEED_MAPPING, + .probe = ssowvf_probe, +}; + +RTE_PMD_REGISTER_PCI(octeontx_ssowvf, pci_ssowvf); + /* SSOVF pcie device aka event queue probe */ static int -- 2.5.5