From patchwork Mon Apr 2 18:10:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 10320133 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 1321A60375 for ; Mon, 2 Apr 2018 18:10:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0258B28A44 for ; Mon, 2 Apr 2018 18:10:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E8C6228A4C; Mon, 2 Apr 2018 18:10:49 +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=ham 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 6FA9B28A44 for ; Mon, 2 Apr 2018 18:10:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753177AbeDBSKs (ORCPT ); Mon, 2 Apr 2018 14:10:48 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:48990 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753030AbeDBSKr (ORCPT ); Mon, 2 Apr 2018 14:10:47 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 062206081A; Mon, 2 Apr 2018 18:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522692647; bh=B62/sFeRiDwOYW5ZX08hlViVI1q7DO+Kcxpop8wMsLM=; h=From:To:Cc:Subject:Date:From; b=BcRXbXHJ6sqOBIp/rkeTa4vjn5EhCxxcEqdOwobardwW422nFK+vogA61zPo3Y8X8 377aXJRznVSXIAJKMEmhNceqpO5cL9iD8oMEbe4mjQVO89NZl76xXK3O/2wuwi/Eby cgkW/77vGVjKKmo4SGolQHyIL4DjZl+Awgt8V/f4= 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 11AED60591; Mon, 2 Apr 2018 18:10:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522692646; bh=B62/sFeRiDwOYW5ZX08hlViVI1q7DO+Kcxpop8wMsLM=; h=From:To:Cc:Subject:Date:From; b=S10APZ6OE8JPyMJOmA7DWTYVvDSLe40yqb9LBZxtf6rap+JnpWkuPwGgkkAdAqkzX 2qk0XNXdH3mPK/SW3XcKXbpmnqR1vePKCEiZYhsXDuXfBWO/32n7IbywQl8RPyVQ9c ifSBFQsz8mgRCuCyJdJ3Rw6KCqMkBqvO26dFKtF4= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 11AED60591 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-mips@vger.kernel.org, timur@codeaurora.org, sulrich@codeaurora.org Cc: arnd@arndb.de, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sinan Kaya , Ralf Baechle , James Hogan , Paul Burton , linux-mips@linux-mips.org, linux-kernel@vger.kernel.org Subject: [PATCH] MIPS: io: add a barrier after readX() Date: Mon, 2 Apr 2018 14:10:32 -0400 Message-Id: <1522692633-24304-1-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP While a barrier is present in writeX() function before the register write, a similar barrier is missing in the readX() function after the register read. This could allow register accesses following readX() to observe stale data. Signed-off-by: Sinan Kaya Reported-by: Arnd Bergmann --- arch/mips/include/asm/io.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index 0cbf3af..7f9068d 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -377,6 +377,7 @@ static inline type pfx##read##bwlq(const volatile void __iomem *mem) \ BUG(); \ } \ \ + war_io_reorder_wmb(); \ return pfx##ioswab##bwlq(__mem, __val); \ }