From patchwork Mon May 1 21:26:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 9706881 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 6F552602B5 for ; Mon, 1 May 2017 21:26:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E76828307 for ; Mon, 1 May 2017 21:26:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50D2128338; Mon, 1 May 2017 21:26: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=-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 D016928307 for ; Mon, 1 May 2017 21:26:56 +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=uj+gTMKphuMcfsEltRs+JTF8biIMxKJJvT1i5z64kKQ=; b=tbc wXx0AjfQMWyfQon52vfLGk4962ZRLs+s7MoV1b65y1/Qely+oIsyplQZya+P4olew6zv1yOA1Lbby KUZuxWmLfgBJj+jELn4gSZ6IZeMNjAMF/4HPVx1CLPvPh0KUsLhpkX0CknLYSZ5fcw6Vxnh9J1QLR NYHHBeTJ5Otp47elORGiL1Rl1VMrMgHKQMl1uABecwFKSvmjDeVtHxHti9X0uuL3rSWAgHG1Ldj78 pmoyeV/eh2cbJikfjCDKdR762/h8JHn+sUVmUxt8o0yn3NcM+TuZvJelAYrrOBRHCCkg+BplbDpr9 axyoEQ0TMzu2kM6sfJRQAaVpUN6bYsQ==; 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 1d5IqM-0007xv-Fy; Mon, 01 May 2017 21:26:54 +0000 Received: from mail-pf0-f169.google.com ([209.85.192.169]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d5IqI-0007ui-Kv for linux-arm-kernel@lists.infradead.org; Mon, 01 May 2017 21:26:52 +0000 Received: by mail-pf0-f169.google.com with SMTP id e64so42042630pfd.1 for ; Mon, 01 May 2017 14:26:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=rrZgIV/NfBSFfJ/+VIUb6n1bLvqXbGOggyG9tVdcfs4=; b=mwiCj67zvb089EaW9wC7QqBVzDX1oLudhcLchcb0hPMYC3niCjH6k+fsYIFRMHXQIP 2Zeq6gNjonWYBMJ00keqTYm3K853wt1PQXGkEV8AoxOmsziNb9YGYIYOQFnkpA/pT1Fc ukYoFCXAiReaZlwaRJKuHUzU4y2fwQKO67gChlHXSlzSjPc9s+/nl66qJWxvKF8PIWY/ TKZM92VIvNha127h7UPKnWc5Lf6m9K5CEAXnelRMgYUyAZzRQtUGT67iMnP0YzTFSwVU gL1PCkiqtgFEg18s+9ceK6sbXueQuZAyn6KFL2cFTuTb8/+jECLphao77FkNDCXbM0Xf HDHw== X-Gm-Message-State: AN3rC/5kbJ+frYn7fOR+eXhUDpf3HQb/xoUVRb/+Sd8X6e3RKxyPC6Ah QDurLvHHplenqx1B X-Received: by 10.98.65.69 with SMTP id o66mr28040974pfa.221.1493673988967; Mon, 01 May 2017 14:26:28 -0700 (PDT) Received: from mka.mtv.corp.google.com ([172.22.64.162]) by smtp.gmail.com with ESMTPSA id w3sm16325671pfw.67.2017.05.01.14.26.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 May 2017 14:26:28 -0700 (PDT) From: Matthias Kaehlcke To: Catalin Marinas , Will Deacon , Mark Rutland , Ard Biesheuvel , Christoffer Dall , Marc Zyngier , Vladimir Murzin Subject: [PATCH] arm64: Fix multiple 'asm-operand-widths' warnings Date: Mon, 1 May 2017 14:26:22 -0700 Message-Id: <20170501212622.153720-1-mka@chromium.org> X-Mailer: git-send-email 2.13.0.rc0.306.g87b477812d-goog X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170501_142650_716805_A22A141D X-CRM114-Status: GOOD ( 12.33 ) 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: Grant Grundler , linux-kernel@vger.kernel.org, Greg Hackmann , Michael Davidson , Matthias Kaehlcke , 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 clang raises 'asm-operand-widths' warnings in inline assembly code when the size of an operand is < 64 bits and the operand width is unspecified. Most warnings are raised in macros, i.e. the datatype of the operand may vary. Forcing the use of an x register through the 'x' operand modifier would silence the warning however it involves the risk that for operands < 64 bits 'unused' bits may be assigned to 64-bit values (more details at http://lists.infradead.org/pipermail/linux-arm-kernel/2017-April/503816.html). Instead we cast the operand to 64 bits, which also forces the use of a x register, but without the unexpected behavior. In gic_write_bpr1() use write_sysreg_s() to write the register. This aligns the functions with others in this header and fixes an 'asm-operand-widths' warning. Signed-off-by: Matthias Kaehlcke Acked-by: Marc Zyngier --- arch/arm64/include/asm/arch_gicv3.h | 2 +- arch/arm64/include/asm/barrier.h | 2 +- arch/arm64/include/asm/uaccess.h | 2 +- arch/arm64/kernel/armv8_deprecated.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/arch_gicv3.h b/arch/arm64/include/asm/arch_gicv3.h index f37e3a21f6e7..9092d612d8c2 100644 --- a/arch/arm64/include/asm/arch_gicv3.h +++ b/arch/arm64/include/asm/arch_gicv3.h @@ -166,7 +166,7 @@ static inline void gic_write_sre(u32 val) static inline void gic_write_bpr1(u32 val) { - asm volatile("msr_s " __stringify(ICC_BPR1_EL1) ", %0" : : "r" (val)); + write_sysreg_s(val, ICC_BPR1_EL1); } #define gic_read_typer(c) readq_relaxed(c) diff --git a/arch/arm64/include/asm/barrier.h b/arch/arm64/include/asm/barrier.h index 4e0497f581a0..1248401b07ab 100644 --- a/arch/arm64/include/asm/barrier.h +++ b/arch/arm64/include/asm/barrier.h @@ -60,7 +60,7 @@ do { \ break; \ case 8: \ asm volatile ("stlr %1, %0" \ - : "=Q" (*p) : "r" (v) : "memory"); \ + : "=Q" (*p) : "r" ((__u64)v) : "memory"); \ break; \ } \ } while (0) diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h index 5308d696311b..7db143689694 100644 --- a/arch/arm64/include/asm/uaccess.h +++ b/arch/arm64/include/asm/uaccess.h @@ -302,7 +302,7 @@ do { \ " .previous\n" \ _ASM_EXTABLE(1b, 3b) \ : "+r" (err) \ - : "r" (x), "r" (addr), "i" (-EFAULT)) + : "r" ((__u64)x), "r" (addr), "i" (-EFAULT)) #define __put_user_err(x, ptr, err) \ do { \ diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8_deprecated.c index 657977e77ec8..79b9fef48b14 100644 --- a/arch/arm64/kernel/armv8_deprecated.c +++ b/arch/arm64/kernel/armv8_deprecated.c @@ -306,7 +306,7 @@ do { \ _ASM_EXTABLE(0b, 4b) \ _ASM_EXTABLE(1b, 4b) \ : "=&r" (res), "+r" (data), "=&r" (temp), "=&r" (temp2) \ - : "r" (addr), "i" (-EAGAIN), "i" (-EFAULT), \ + : "r" ((__u64)addr), "i" (-EAGAIN), "i" (-EFAULT), \ "i" (__SWP_LL_SC_LOOPS) \ : "memory"); \ uaccess_disable(); \