From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0049.outbound.protection.outlook.com [104.47.34.49]) by dpdk.org (Postfix) with ESMTP id D58722C4F for ; Thu, 15 Dec 2016 07:05: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=tr/vBMC/iEhjuxYSnRghKQW4ak2BM6KTE1j3XVpSI7c=; b=iQGWyi1rjZGcJcUA6WWj9kelG4E4jh0bHJTNa5bLwG2IcBdWKLkWxtBIAaQy3ps2XVnWGGnFQ9L01jZzS3DhbHKNRTzJk1Z6q5dpJ/iQmS6Jp2H7hHZXHUdX5lTgFH1pWiPgly2aKBozJZaW1aIAHVP1ysYgIkJC6OW2uz7Z4u8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.localdomain (122.166.153.127) by BLUPR0701MB1716.namprd07.prod.outlook.com (10.163.85.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.771.8; Thu, 15 Dec 2016 06:05:16 +0000 Date: Thu, 15 Dec 2016 11:34:55 +0530 From: Jerin Jacob To: Hemant Agrawal CC: , , , , Cristian Sovaiala Message-ID: <20161215060453.GA19354@localhost.localdomain> References: <1480875447-23680-1-git-send-email-hemant.agrawal@nxp.com> <1480875447-23680-3-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1480875447-23680-3-git-send-email-hemant.agrawal@nxp.com> User-Agent: Mutt/1.7.1 (2016-10-04) X-Originating-IP: [122.166.153.127] X-ClientProxiedBy: PN1PR01CA0019.INDPRD01.PROD.OUTLOOK.COM (10.164.137.26) To BLUPR0701MB1716.namprd07.prod.outlook.com (10.163.85.142) X-MS-Office365-Filtering-Correlation-Id: f2b4735c-6a3f-47b3-0286-08d424b05884 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BLUPR0701MB1716; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1716; 3:HsAao8ZEPEzMjSY9eFG8qg1+3MvzbetIcsOV4JiTc0FDQ0MhxzcbtGuoihUxd2WphGsIinGuj3n7z9k2EX3n9D+VZfzoEjv4ZF8sPqniTvU1Vf+AzjgHTjmY3lZsnaEwBpcC5dYFBe8S8mV81hsETvjdEWjVO0WeIDOUdeY6dGli/sO/1/7xJQSJEDxQYWsqb+Xii083ATDfvhQVHG186L8qTwyfLa12SfBtLm6JjBa6n5fCHw+sxho61cCSkaqyHKHQnLFPQVLwOPogmF3ZKg== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1716; 25:3BsILif00U+E5rp9pbdonDgG395D2aFY2K9PSEepxqejSWZWaPmcd5LrRHAimBM9stnWuH0X4zmQSaTwaQFgyboDzyaMtPJq6/pXVVUz1fiRrTXtW2MH09jJbgquArL5Nsc61KZ0MOs4zXrft/O9Nz3/fseXGVg52t++fHNUrB4/lkROT6uq2MhC8pIvbAHdKnuEpUKzARvVhpjrZ58g2/Q+52z3QXaoCMrhT0L6tQRjq7cJQzUsA0zAGZ5NeINXP6Vj7R24vq3YViYbY8lFGAUb6oEbnTEVeuq6A4Z8q304i4U83lB083mZA2AYJjtSy85TCDwnu+GgMRIpuWDYRUjpB9zAs0iZmnsTY2KMYvHNgQeNWqEHHR0w2ZvYcoLPqQzSgGoiJxx5x9ctLgWCe/DtAXt48XjtzhDM0TWnDVXR0u+tiukh1ZC2Seqw6xx4daNrDUbSx8efbn0/wMCi/CrNSQ52UlXMD7L5aVs5wW/4AADNNKh03zkSfCfOKmnKQOjZrA2PNBE6vzqErtIBoPueK02XRZE0jmsfH7FT+6Nhw/hV+AGWkNEy4iRgIqWiHPa/oaEpoK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yQQXW7FgNR28eB5f7N7E+vVO4jKSEnTauSibbwQeZIOyrdTuHOVfgouUIL0R/V/BEe8213kVHZSvA7vMYzkfqJlrk/KOia2qJqyH4KNTTViY33uxtcY2qgK877DIlTAVj8imNB9ZqUrowu/vjs2KN7JDy/qeIe01INljm/MPbX6TLP3lzL4WcgseJhA9HgQef9bX1avG7UTnDM= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123560025)(20161123555025)(20161123558021)(20161123562025)(20161123564025)(6072148); SRVR:BLUPR0701MB1716; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1716; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1716; 4:T8GkUDTJlJaSrVA/CQY4/7qygp08giM4WcJb899Knh7keg4m3lx+a3JChF8DLmqqeXavX3q++kCBPo2wage6u+3XsQeFPBWPA58r1U376lB7t46Bg0lU3okzODpe8PAuXWTavLWfKtBJgXZ87W/FKRdlpnIPfqHmPoz8M0NDxK7e+b59DW8WvkevGFEPJXcDJMg0wshLz5UvI4qQjJzCFm6HvGAxvKVKZsWxfI9gvf0s+aphPQBUPlHmpsJqkOCQMPvwbhuTQ66+hCCMnigujiceGqQc/qBDPBKLLfLqX0K/Ja+e5bssEseNSzuN3WA5+OZpolShSwYUdgLUS91gVWpSUMAa6dNXFL9hiKGGXhX28IuT2xqAVeobodBbwITehiORMbg1M9waaxZLjGLkIRoqo7JHLEGbPmw6FZZk31J+iPGsmd1GZV65b1G4d2Zg45VVgJjQo+qn5jLr2adSXZYW2STuWO7K+U/QnGl8WbMC9/kvUvfjvZTOwFkWYRjqUjaNqjkFgNWXhOrl8mcULag2xrwrzJfV2CtFOu9Tub6/wpL6NA0s2VRFESI00RIXnoCP3U2WVPsO0e2M5HDNeXk+3kCWm0wTfP/SA8rxoL+m9/9dSDbj5TQZJrFeS0XuLSHe+ciUYzIIFpheEYn9MBpRsFW0cErigQRhCjY2Iepz8zebc67SoYvyyaEmeB1M X-Forefront-PRVS: 0157DEB61B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(39410400002)(39450400003)(39840400002)(199003)(189002)(24454002)(50466002)(106356001)(15395725005)(33656002)(5660300001)(97756001)(46406003)(105586002)(68736007)(81156014)(8676002)(305945005)(92566002)(25786008)(81166006)(42186005)(9686002)(101416001)(8666005)(76176999)(50986999)(54356999)(4326007)(7736002)(61506002)(97736004)(4001350100001)(189998001)(2906002)(38730400001)(6916009)(1076002)(6116002)(23726003)(47776003)(6506006)(229853002)(83506001)(6666003)(42882006)(66066001)(3846002)(110136003)(2950100002)(18370500001)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1716; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0701MB1716; 23:+Yre3pco467KSAP41cU8U+8XSG7gn1osSjTqMmP?= =?us-ascii?Q?5W5Gtis/zLHMzzkBHBO9TddSN7X4mYjLIcHYHty3wuaCdVDtxRUY92PbAZR+?= =?us-ascii?Q?t+oWK+2BfUqz5VhnIcNQkrOtnUHqq8O/VqN6yCOaChM4LD87vmaFYsR71vqI?= =?us-ascii?Q?fEZyuLdBVavvMyGdtlle1kioBBmTVgQZRJwmmo0zQF6zUVmZw9w2AKXfl6tM?= =?us-ascii?Q?F2nBHUrt1sx94qfW19wEUpbJFKgaU7G1zSIWo7zAOmyJmiuLtP30bIpKXvVZ?= =?us-ascii?Q?vE8hZMiLw6vmLOtMCblFu36+nRGEMAmqadRaiqsyalb7ew09dNkb3u8OrRqY?= =?us-ascii?Q?JR1JRfq6L33QNVeIurO7hd6A+w5fzia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ii?Q?lH6Mf/YWyeaLq+3Zipt6O5g/8wtMUNKiZbUaa8xSpevY4cr6ke7FSrJMdl92?= =?us-ascii?Q?oDPmvqfaMWo/Dwe+1ZHUTkQHAQYD81UZBZtSw57Tlqw/blclJvUasgqZ3VqK?= =?us-ascii?Q?ggaEfQQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1716; 6:+dUN0tYXaQuP4uXZuvml7K6aJ7bM8PiKxCI+55onFG3SDU/ADrc4aKGc6ZY4SMvpEb5swoPAjNf9OgBPp/2DvRCbhvxBM08gkO9krF4U1yCLtSok4tcVwoULLSrJHbzeYKV0LlJwzXaxLj+nT39v51T7uIRPvzpqkYVWhga2Ctqn4vK3laPbjbhaAD7kspgj7twAOVBVudGLtxdxnFm83tUrJDIhakNBxKdsd008h7MwRgp/FVVeudhW/GeRwImiyRYBUva5XvCmctSilK0f3T/w2/0M1o6HMNMiLuVkU4IoNjHil1fnhmS5tRwAgWbr42KGNX0LWmD0pFWIFThNYTrMja89+xcPvixfnCo7w9i0JspzNubKyZhFdwDVdihwBUtTB4qLe00H2/1MS0Q2/L+mi23uBcogB9Wnb8tF9aU=; 5:xq4r1BP5NOMjuZPfMT0TsN2z/8tHskP8xvQ/uA9iNbhGIxfNLcsdbBFNlrKysA3Xmneh48d5RYbCTd1Qjr3Cs+1Q8sKBbjHrhlXoMTYLLMq1XknLrbBzNil26CS1KgWCQnpYhRSxIPdHaFTQoo6yKg==; 24:56Tvu8VyGGMNyMS9yFrIW3kpF2ULk7dNER7P0A61eggFrpg15K6oW3d30lEhqPEf4Wzp1ectPxxSOHoJPeAGfeq/FXNdX14gnTMVcn6fu/U= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1716; 7:LEmkA6ntM4x2ofnGJ5lKrrnHBcvVGf5fPUX+tx2NzeiWT9wuZil4/HErCMU5vJUcu6RtDwLwoBRe+kmfKDm4FkLuS3ybOGvjTzwjVyYdTJrPSLsbl5MrZI6q6sKrUH4FfQS/yMmqmM82QN2frumuUUMvzDW/iOS0PBZpGZJTMy+kAFC+c9SxumoSMZmAQMPVX8PiwOR9g1IPmhQc0PYi6v0C4Mit5scnB7aazwVJ61IeF0GJxte0qwNGEM7HQreuNLXSCVSLrMTcPH75pSdYWdcKmliNhgecmEBoRKPRGnTEiJw9R0rpRWzan4ZEo6Tu7fsKFrjMH+pgJZ7JcvTPSNc+8Vf8bqnko26l4DHU/7g2qa5Fu9SQSkfI2qVwlLHQGn/JxD49zLEwhAWNtiu2tALbELf7VbLTZnmJqEKLsRuIHxrcC0SNFe19V4v7Pj1LQAIkqReaWTFlymgxQSFlLw== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2016 06:05:16.1943 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1716 Subject: Re: [dpdk-dev] [PATCH 02/32] drivers/common: introducing dpaa2 mc driver 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: Thu, 15 Dec 2016 06:05:21 -0000 On Sun, Dec 04, 2016 at 11:46:57PM +0530, Hemant Agrawal wrote: > This patch intoduces the DPAA2 MC(Management complex Driver) > > This driver is common to be used by various DPAA2 net, crypto > and other drivers > > Signed-off-by: Cristian Sovaiala > [Hemant:rebase and conversion to library for DPDK] > Signed-off-by: Hemant Agrawal > +#ifndef _FSL_MC_SYS_H > +#define _FSL_MC_SYS_H > + > +#ifdef __linux_driver__ > + > +#include > +#include > +#include > + > +struct fsl_mc_io { > + void *regs; > +}; > + > +#ifndef ENOTSUP > +#define ENOTSUP 95 > +#endif > + > +#define ioread64(_p) readq(_p) > +#define iowrite64(_v, _p) writeq(_v, _p) > + > +#else /* __linux_driver__ */ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define cpu_to_le64(x) __cpu_to_le64(x) > +#ifndef dmb > +#define dmb() {__asm__ __volatile__("" : : : "memory"); } > +#endif Better to use DPDK macros here. > +#define __iormb() dmb() > +#define __iowmb() dmb() > +#define __arch_getq(a) (*(volatile unsigned long *)(a)) > +#define __arch_putq(v, a) (*(volatile unsigned long *)(a) = (v)) > +#define __arch_putq32(v, a) (*(volatile unsigned int *)(a) = (v)) > +#define readq(c) \ > + ({ uint64_t __v = __arch_getq(c); __iormb(); __v; }) > +#define writeq(v, c) \ > + ({ uint64_t __v = v; __iowmb(); __arch_putq(__v, c); __v; }) > +#define writeq32(v, c) \ > + ({ uint32_t __v = v; __iowmb(); __arch_putq32(__v, c); __v; }) > +#define ioread64(_p) readq(_p) > +#define iowrite64(_v, _p) writeq(_v, _p) > +#define iowrite32(_v, _p) writeq32(_v, _p) Hopefully, we can clean all this once rte_read32 and rte_write32 becomes mainline http://dpdk.org/dev/patchwork/patch/17935/ > +#define __iomem > + > +struct fsl_mc_io { > + void *regs; > +}; > + > +#ifndef ENOTSUP > +#define ENOTSUP 95 > +#endif > + > +/*GPP is supposed to use MC commands with low priority*/ > +#define CMD_PRI_LOW 0 /*!< Low Priority command indication */ > + > +struct mc_command; > + > +int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd); > + > +#endif /* __linux_driver__ */ > + > +#endif /* _FSL_MC_SYS_H */ > + > +/** User space framework uses MC Portal in shared mode. Following change > +* introduces lock in MC FLIB > +*/ > + > +/** > +* The mc_spinlock_t type. > +*/ > +typedef struct { > + volatile int locked; /**< lock status 0 = unlocked, 1 = locked */ > +} mc_spinlock_t; > + > +/** > +* A static spinlock initializer. > +*/ > +static mc_spinlock_t mc_portal_lock = { 0 }; > + > +static inline void mc_pause(void) {} > + > +static inline void mc_spinlock_lock(mc_spinlock_t *sl) > +{ > + while (__sync_lock_test_and_set(&sl->locked, 1)) > + while (sl->locked) > + mc_pause(); > +} > + > +static inline void mc_spinlock_unlock(mc_spinlock_t *sl) > +{ > + __sync_lock_release(&sl->locked); > +} > + DPDK spinlock can be used here.