From patchwork Fri Apr 7 16:41:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 9669927 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 30CAB60364 for ; Fri, 7 Apr 2017 16:41:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24086285B6 for ; Fri, 7 Apr 2017 16:41:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18E3528621; Fri, 7 Apr 2017 16:41:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5DF5285B6 for ; Fri, 7 Apr 2017 16:41:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934313AbdDGQlz (ORCPT ); Fri, 7 Apr 2017 12:41:55 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:43824 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934188AbdDGQlx (ORCPT ); Fri, 7 Apr 2017 12:41:53 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id CB06760A3B; Fri, 7 Apr 2017 16:41:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1491583311; bh=LYE/w15qAynLjgX0hAQClcjXwVEjlVMIlk3Vt+M/3KU=; h=From:To:Cc:Subject:Date:From; b=ZzEyBSkakBdmk+nbUSYYnnSb9VfZKPcv5CZW7QOc4JCeVaA0WVyKI3VURl6DZLFHM vsMB7Kr0wtPsH7GnuXVu4kXPsAdZYPMOQ8089SyFe5anDBv2MH+ZyIEEwLAQhM51us kyucOVixdOQN/2vJE5Hd0LnIl4NyDlrtHFX5L0do= Received: from drakthul.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id CF92260A36; Fri, 7 Apr 2017 16:41:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1491583311; bh=LYE/w15qAynLjgX0hAQClcjXwVEjlVMIlk3Vt+M/3KU=; h=From:To:Cc:Subject:Date:From; b=ZzEyBSkakBdmk+nbUSYYnnSb9VfZKPcv5CZW7QOc4JCeVaA0WVyKI3VURl6DZLFHM vsMB7Kr0wtPsH7GnuXVu4kXPsAdZYPMOQ8089SyFe5anDBv2MH+ZyIEEwLAQhM51us kyucOVixdOQN/2vJE5Hd0LnIl4NyDlrtHFX5L0do= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org CF92260A36 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=okaya@codeaurora.org From: Sinan Kaya To: linux-scsi@vger.kernel.org, timur@codeaurora.org Cc: linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sinan Kaya , Sathya Prakash , Chaitra P B , Suganath Prabu Subramani , "James E.J. Bottomley" , "Martin K. Petersen" , MPT-FusionLinux.pdl@broadcom.com (open list:LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI)), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] scsi: mpt3sas: remove redundant wmb on arm/arm64 Date: Fri, 7 Apr 2017 12:41:45 -0400 Message-Id: <1491583306-20551-1-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Due to relaxed ordering requirements on multiple architectures, drivers are required to use wmb/rmb/mb combinations when they need to guarantee observability between the memory and the HW. The mpt3sas driver is already using wmb() for this purpose. However, it issues a writel following wmb(). writel() function on arm/arm64 arhictectures have an embedded wmb() call inside. This results in unnecessary performance loss and code duplication. The kernel has been updated to support relaxed read/write API to be supported across all architectures now. The right thing was to either call __raw_writel/__raw_readl or write_relaxed/read_relaxed for multi-arch compatibility. Signed-off-by: Sinan Kaya --- drivers/scsi/mpt3sas/mpt3sas_base.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 5b7aec5..6e42036 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -1026,8 +1026,8 @@ static int mpt3sas_remove_dead_ioc_func(void *arg) ioc->reply_free[ioc->reply_free_host_index] = cpu_to_le32(reply); wmb(); - writel(ioc->reply_free_host_index, - &ioc->chip->ReplyFreeHostIndex); + writel_relaxed(ioc->reply_free_host_index, + &ioc->chip->ReplyFreeHostIndex); } } @@ -1076,8 +1076,8 @@ static int mpt3sas_remove_dead_ioc_func(void *arg) wmb(); if (ioc->is_warpdrive) { - writel(reply_q->reply_post_host_index, - ioc->reply_post_host_index[msix_index]); + writel_relaxed(reply_q->reply_post_host_index, + ioc->reply_post_host_index[msix_index]); atomic_dec(&reply_q->busy); return IRQ_HANDLED; } @@ -1098,13 +1098,14 @@ static int mpt3sas_remove_dead_ioc_func(void *arg) * value in MSIxIndex field. */ if (ioc->combined_reply_queue) - writel(reply_q->reply_post_host_index | ((msix_index & 7) << - MPI2_RPHI_MSIX_INDEX_SHIFT), - ioc->replyPostRegisterIndex[msix_index/8]); + writel_relaxed(reply_q->reply_post_host_index | + ((msix_index & 7) << + MPI2_RPHI_MSIX_INDEX_SHIFT), + ioc->replyPostRegisterIndex[msix_index/8]); else - writel(reply_q->reply_post_host_index | (msix_index << - MPI2_RPHI_MSIX_INDEX_SHIFT), - &ioc->chip->ReplyPostHostIndex); + writel_relaxed(reply_q->reply_post_host_index | + (msix_index << MPI2_RPHI_MSIX_INDEX_SHIFT), + &ioc->chip->ReplyPostHostIndex); atomic_dec(&reply_q->busy); return IRQ_HANDLED; }