Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751338AbdGQNiG (ORCPT ); Mon, 17 Jul 2017 09:38:06 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:39588 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751278AbdGQNiF (ORCPT ); Mon, 17 Jul 2017 09:38:05 -0400 Subject: Re: [PATCH 2/7] staging: fsl-mc: use generic memory barriers To: laurentiu.tudor@nxp.com, gregkh@linuxfoundation.org, stuyoder@gmail.com Cc: devel@driverdev.osuosl.org, ruxandra.radulescu@nxp.com, arnd@arndb.de, marc.zyngier@arm.com, roy.pledge@nxp.com, linux-kernel@vger.kernel.org, agraf@suse.de, catalin.horghidan@nxp.com, ioana.ciornei@nxp.com, leoyang.li@nxp.com, bharat.bhushan@nxp.com, linux-arm-kernel@lists.infradead.org References: <20170717132646.3020-1-laurentiu.tudor@nxp.com> <20170717132646.3020-3-laurentiu.tudor@nxp.com> From: Robin Murphy Message-ID: <56caf454-3ca6-f07b-0930-b2a6b3d04cea@arm.com> Date: Mon, 17 Jul 2017 14:38:01 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170717132646.3020-3-laurentiu.tudor@nxp.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1999 Lines: 53 On 17/07/17 14:26, laurentiu.tudor@nxp.com wrote: > From: Laurentiu Tudor > > No need to use arch-specific memory barriers; switch to using generic > ones. The rmb()s were useless so drop them. > > Signed-off-by: Laurentiu Tudor > --- > drivers/staging/fsl-mc/bus/mc-sys.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/fsl-mc/bus/mc-sys.c b/drivers/staging/fsl-mc/bus/mc-sys.c > index a1704c3..012abd5 100644 > --- a/drivers/staging/fsl-mc/bus/mc-sys.c > +++ b/drivers/staging/fsl-mc/bus/mc-sys.c > @@ -127,7 +127,8 @@ static inline void mc_write_command(struct mc_command __iomem *portal, > /* copy command parameters into the portal */ > for (i = 0; i < MC_CMD_NUM_OF_PARAMS; i++) > __raw_writeq(cmd->params[i], &portal->params[i]); > - __iowmb(); > + /* ensure command params are committed before submitting it */ > + wmb(); > > /* submit the command by writing the header */ > __raw_writeq(cmd->header, &portal->header); AFAICS, just using writeq() here should ensure sufficient order against the previous iomem accessors, without the need for explicit barriers. Also, note that the __raw_*() variants aren't endian-safe, so consider updating things to *_relaxed() where ordering doesn't matter. Robin. > @@ -150,9 +151,7 @@ static inline enum mc_cmd_status mc_read_response(struct mc_command __iomem * > enum mc_cmd_status status; > > /* Copy command response header from MC portal: */ > - __iormb(); > resp->header = __raw_readq(&portal->header); > - __iormb(); > status = mc_cmd_hdr_read_status(resp); > if (status != MC_CMD_STATUS_OK) > return status; > @@ -160,7 +159,6 @@ static inline enum mc_cmd_status mc_read_response(struct mc_command __iomem * > /* Copy command response data from MC portal: */ > for (i = 0; i < MC_CMD_NUM_OF_PARAMS; i++) > resp->params[i] = __raw_readq(&portal->params[i]); > - __iormb(); > > return status; > } >