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: 9669931 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 7040260364 for ; Fri, 7 Apr 2017 16:42:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61A9226490 for ; Fri, 7 Apr 2017 16:42:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 566B32793B; Fri, 7 Apr 2017 16:42:26 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DDF8626490 for ; Fri, 7 Apr 2017 16:42:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=K5ISxLHZooo5lYGDcgLZb3gPhS0aJ1xhCyEf77n2De0=; b=RW+ 3cTWIm4x7Zt5EkhczSxMLjOys2KX9m5IXia2YWioibhywnYIYyZZ6X9Dn4VMrx/26DnSPbuynDvWh g50K84XtzKqUQpdEYelvIfkIwZqz7CPH1g/Is4dEKfdkbhTXyB3IkJvBhR2AJcbn+Qu2Deai8a/DO ZbA8drcSlbtTBlNg69+A+PxBW2v3W2aB0H7TshEj+973BjsKS9HYqKNSB7urjCz6if800SkDJtyrX PMbH/VwTzlgoWupfhbjHdgcT7omnR1SwTA0vnc6IuGi2it5y3ajqgRLBZHzjVyVhgcT2fqHrD9FiY W4+gj2zIt4129j64yL4o/GmEZIy5qwg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cwWxk-0001Jq-OD; Fri, 07 Apr 2017 16:42:16 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cwWxg-0001Ae-Dw for linux-arm-kernel@lists.infradead.org; Fri, 07 Apr 2017 16:42:14 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 9C0F160A52; 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170407_094212_547332_F5E2D687 X-CRM114-Status: GOOD ( 11.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "James E.J. Bottomley" , "Martin K. Petersen" , Chaitra P B , linux-arm-msm@vger.kernel.org, Sathya Prakash , open list , Sinan Kaya , Suganath Prabu Subramani , "open list:LSILOGIC MPT FUSION DRIVERS FC/SAS/SPI" , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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; }