Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S947177AbdDTTf4 (ORCPT ); Thu, 20 Apr 2017 15:35:56 -0400 Received: from mail-cys01nam02on0049.outbound.protection.outlook.com ([104.47.37.49]:6848 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S947109AbdDTTfP (ORCPT ); Thu, 20 Apr 2017 15:35:15 -0400 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; From: Haiying Wang To: , , CC: , , Haiying Wang Subject: [PATCH 2/3] bus: fsl-mc: dpio: enable qbman CENA portal memory access Date: Thu, 20 Apr 2017 15:34:17 -0400 Message-ID: <1492716858-24509-3-git-send-email-Haiying.Wang@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1492716858-24509-1-git-send-email-Haiying.Wang@nxp.com> References: <1492716858-24509-1-git-send-email-Haiying.Wang@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131371905127389076;(91ab9b29-cfa4-454e-5278-08d120cd25b8);() X-Forefront-Antispam-Report: CIP:192.88.158.2;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(336005)(39410400002)(39380400002)(39850400002)(39400400002)(39860400002)(39840400002)(39450400003)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(9170700003)(38730400002)(39060400002)(189998001)(85426001)(8676002)(48376002)(105606002)(106466001)(77096006)(8656002)(50466002)(2950100002)(36756003)(4326008)(2906002)(54906002)(2201001)(50226002)(86362001)(47776003)(8936002)(53936002)(50986999)(5003940100001)(104016004)(81166006)(76176999)(5660300001)(305945005)(356003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM2PR0301MB0606;H:az84smr01.freescale.net;FPR:;SPF:Fail;MLV:ovrnspm;A:1;MX:1;PTR:InfoDomainNonexistent;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD031;1:vxSuz+Pk5+Rx59oJQK8igK8dH/ytBQMD3X9qAomLdg7oS4nDjmKu1GMJhEGpqUeBJmg+W7mV7OnNtPU5lP9bGQDr8ja+9wMdWwj0RTJeU3MYcbneglsrnO9ForC8wmT2z5/rrvAK3KZpZ7CZkvT46VlisMBgQF+DlwVkQGJjetX3jlrR/uA2yqjD48ja3Xj/gMW3Ip2O0rsmGI+LvZbWpyrqgwzAqi4zL1a6rarX0rN91SUM8/eQ3c1y6NbAVrJ8QnnOx5hq3Xg9dzNEbAWi79pBsncdqcyWPCn7hJMJQQZ6t/w/G2+ZlltygvLgcljpBGlRdsXIWqSyzlZVZ+3eyUTsHVUbJyZ3Ch8Fr9cRXbwL7D7j1XCgb65sR4+tNsl3a1BxvyXFGvSGSMpldkvaPaPbgGcFJ36ah3bWEaNz1Q5dfKdPYWqDWag67ZcVijRizzGXg7MWKzgz47te2IapFyxOd/Hy9yc2BDudgXMn5y/RfnQdTq7X9LLhWox4Hd+xR/hlc+Zym/NUJwyWQCiHa9GtdpeNRF5hilC5XZWLpR13rf8Nczjc21H8OYfzb8LPIgKW9J5ekcrBS9UMVbRe6XdrM9dWho9DNqQDFYRIVu/JlRTcw1YJ0nV4lkAWV73Qqyi+hwzZbf5v9aYv+j5Fi/JDnBWY7tcxwqlDtfJAo+CY/8PT6qyT5ytFp/MIEk2DXE1rkRBU5K9/I3Q3Fm4WTukgWA+lBEVnTZNvUNUy6Xc= MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5fe79bbb-69ab-4fbe-d4d2-08d488245d07 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131430075)(201703131517081);SRVR:DM2PR0301MB0606; X-Microsoft-Exchange-Diagnostics: 1;DM2PR0301MB0606;3:wu/uU4Oy28+oyIPA3+csP5bgMbcR98S3vRmX9Yt6+9t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F67+OQslksvEhgELSjBgrnzKj8WNEXhLWZrcy8ga1ZtoR00EhcePGx4GAYBtn8Jt5UX3BIEHkG9oz2p7agO47cWWx1QT X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6095135)(601004)(2401047)(13023025)(13024025)(13018025)(13017025)(13015025)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(6055026)(6096035)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123565025)(20161123556025)(20161123561025)(20161123563025);SRVR:DM2PR0301MB0606;BCL:0;PCL:0;RULEID:(400006);SRVR:DM2PR0301MB0606; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM2PR0301MB0606;4:IpIJ26e1a/iRHDK7Ds1U4ko38DdPbw9AxPIt3vxy?= =?us-ascii?Q?gRxbcEIDoMQ2Qp2xQ9L99NB4eXT7irLEbjiDAIuJ3tIveCTSygl5zBKqGeob?= =?us-ascii?Q?weksfrqfVf9fYrq5duVwQK8Vqe3O9VOUuDDP92FAC/+zSLEHjLQVyHeJDi9M?= =?us-ascii?Q?oddEtULbWnRSOqwSCyuyu9SECFo0+UsOscXmR3a6i26aR0YUP7WPlM7otzwA?= =?us-ascii?Q?y/RorovgLmuAJQtrLHhix3eowmI8PuF/hegyujB8RwC4dfj6P0XsqvCjbvt0?= =?us-ascii?Q?fdotYpaQqvl5YtQl6ghEzFLMee9JdIMVm+2ERW0DBCZ2+kJR0jYQX22h5plz?= =?us-ascii?Q?WX+u2l8XrJwdfl3WNCdkY8I9kmSC28LBv5n+iq5wXbszKcuf457ue+5Rw0vK?= =?us-ascii?Q?R2AQ0HeHaEHHZr4Id4Ltiaui7BynxyfHLTDSiCeiRup2W2DbW5mKQnWPD5bG?= =?us-ascii?Q?zqd5JQktRiiP76p4yblPleXi08/95jbJGrk608OEBAwkT6NOQnfPK3r0Eb0k?= =?us-ascii?Q?JK6Xu7PNd9p8iQzdmp3vyAlYZBT2JTjPbT+QW5MrV6h41mFEOnwxeOLchFe9?= =?us-ascii?Q?RxvngCx0I2upq3qkoUX/EiP8MgcQbZhX2n2mbqFqZuzPnFn86ew9Dw31qZ65?= =?us-ascii?Q?vuWIN2RZbTQDrYxsuW1qQVK7WnL8d57yBrSpdxstWwocA5PI9/ToYmRV5LyC?= =?us-ascii?Q?iOgHrUz0xlh5viXf0KcU1TTkyWqCuCNYOCwPemkVuGJteGCTuEGcIwjtN3ds?= =?us-ascii?Q?PmO/SPPqLpd2Ar7q/Al1Kmqatz1d5zugcBlVaz8vwQtmar/iKwGaFyy4zXoi?= =?us-ascii?Q?CKrZiuF4uFqcAYGGxmk2YcWWVFntO4RF3DHOtwH1lhqN/4gJuZRCsFgb+tMH?= =?us-ascii?Q?1qPqeJmYafCtnoQ7NLssp35ubUXid2hVjRqiXZ2LH6WnALOnqrZYrPYe1G4C?= =?us-ascii?Q?WmALOzO2w92ih/ocdEh6a0cvSjubmm6ZY1ug0PoDpw=3D=3D?= X-Forefront-PRVS: 02830F0362 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM2PR0301MB0606;23:EJ1Pz0fkQHrVRWEmRnmgohPAG8W6Y8067Ygjs3w?= =?us-ascii?Q?G1lhOdVN8g6VwUeCQM0SjZQILjWU1ABl6tpN+oSj3PlL5qopVh+6z2NNXPAR?= =?us-ascii?Q?egoLAp6xt+aTdXdi0EaD0oLlyLwiLxgynEz0krFv2JeSCMITKAv1cKwYgjt/?= =?us-ascii?Q?etgSBHRmNpB1PI78RVTrIie3n+lOAzK4+Uvl7z9hipPeKUTWL8b/fHlYOET+?= =?us-ascii?Q?mI+XkTxPCWI1U2ljwM1xm5XhjPmlnzr1oJPeCOrU/cM38habOBisG91KA74x?= =?us-ascii?Q?/rldaBtyCS6Ix9N2AWSQCrwoMv2zV7an2e77FQyEbJpOwwffzrCryVsddl1E?= =?us-ascii?Q?jRl/X8GW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w3bMTiRGOB7+4VZ2TlCpv/+ZZEMUH8ZhllgKH/Ec1PsIGq2a2ef1C37bEwUlXvUc/iH5Q0gLtiwhx8LE6QWb2rUNaPMxCgGtk1DbJu6mIv8JvTNLeL7+zf10e1EVy3awN2z7gw5vNdH2OVLsG4MftLwkTg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2017 19:35:12.4893 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[192.88.158.2];Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0301MB0606 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3684 Lines: 109 Once we enable the cacheable portal memory, we need to do cache flush for enqueue, vdq, buffer release, and management commands, as well as invalidate and prefetch for the valid bit of management command response and next index of dqrr. Signed-off-by: Haiying Wang --- drivers/staging/fsl-mc/bus/dpio/qbman-portal.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c index 2a3ea29..e16121c 100644 --- a/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c +++ b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c @@ -99,6 +99,14 @@ enum qbman_sdqcr_fc { qbman_sdqcr_fc_up_to_3 = 1 }; +#define dccvac(p) { asm volatile("dc cvac, %0;" : : "r" (p) : "memory"); } +#define dcivac(p) { asm volatile("dc ivac, %0" : : "r"(p) : "memory"); } +static inline void qbman_inval_prefetch(struct qbman_swp *p, uint32_t offset) +{ + dcivac(p->addr_cena + offset); + prefetch(p->addr_cena + offset); +} + /* Portal Access */ static inline u32 qbman_read_register(struct qbman_swp *p, u32 offset) @@ -189,7 +197,7 @@ struct qbman_swp *qbman_swp_init(const struct qbman_swp_desc *d) p->addr_cinh = d->cinh_bar; reg = qbman_set_swp_cfg(p->dqrr.dqrr_size, - 1, /* Writes Non-cacheable */ + 0, /* Writes cacheable */ 0, /* EQCR_CI stashing threshold */ 3, /* RPM: Valid bit mode, RCR in array mode */ 2, /* DCM: Discrete consumption ack mode */ @@ -315,6 +323,7 @@ void qbman_swp_mc_submit(struct qbman_swp *p, void *cmd, u8 cmd_verb) dma_wmb(); *v = cmd_verb | p->mc.valid_bit; + dccvac(cmd); } /* @@ -325,6 +334,7 @@ void *qbman_swp_mc_result(struct qbman_swp *p) { u32 *ret, verb; + qbman_inval_prefetch(p, QBMAN_CENA_SWP_RR(p->mc.valid_bit)); ret = qbman_get_cmd(p, QBMAN_CENA_SWP_RR(p->mc.valid_bit)); /* Remove the valid-bit - command completed if the rest is non-zero */ @@ -435,6 +445,7 @@ int qbman_swp_enqueue(struct qbman_swp *s, const struct qbman_eq_desc *d, /* Set the verb byte, have to substitute in the valid-bit */ dma_wmb(); p->verb = d->verb | EQAR_VB(eqar); + dccvac(p); return 0; } @@ -627,6 +638,7 @@ int qbman_swp_pull(struct qbman_swp *s, struct qbman_pull_desc *d) /* Set the verb byte, have to substitute in the valid-bit */ p->verb = d->verb | s->vdq.valid_bit; s->vdq.valid_bit ^= QB_VALID_BIT; + dccvac(p); return 0; } @@ -680,8 +692,7 @@ const struct dpaa2_dq *qbman_swp_dqrr_next(struct qbman_swp *s) s->dqrr.next_idx, pi); s->dqrr.reset_bug = 0; } - prefetch(qbman_get_cmd(s, - QBMAN_CENA_SWP_DQRR(s->dqrr.next_idx))); + qbman_inval_prefetch(s, QBMAN_CENA_SWP_DQRR(s->dqrr.next_idx)); } p = qbman_get_cmd(s, QBMAN_CENA_SWP_DQRR(s->dqrr.next_idx)); @@ -696,8 +707,7 @@ const struct dpaa2_dq *qbman_swp_dqrr_next(struct qbman_swp *s) * knew from reading PI. */ if ((verb & QB_VALID_BIT) != s->dqrr.valid_bit) { - prefetch(qbman_get_cmd(s, - QBMAN_CENA_SWP_DQRR(s->dqrr.next_idx))); + qbman_inval_prefetch(s, QBMAN_CENA_SWP_DQRR(s->dqrr.next_idx)); return NULL; } /* @@ -720,7 +730,7 @@ const struct dpaa2_dq *qbman_swp_dqrr_next(struct qbman_swp *s) (flags & DPAA2_DQ_STAT_EXPIRED)) atomic_inc(&s->vdq.available); - prefetch(qbman_get_cmd(s, QBMAN_CENA_SWP_DQRR(s->dqrr.next_idx))); + qbman_inval_prefetch(s, QBMAN_CENA_SWP_DQRR(s->dqrr.next_idx)); return p; } @@ -848,6 +858,7 @@ int qbman_swp_release(struct qbman_swp *s, const struct qbman_release_desc *d, */ dma_wmb(); p->verb = d->verb | RAR_VB(rar) | num_buffers; + dccvac(p); return 0; } -- 2.7.4