Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2655920imu; Thu, 29 Nov 2018 08:15:41 -0800 (PST) X-Google-Smtp-Source: AFSGD/X5OhxliDF6RzNIWNZuEN5CZbJ6frJlxx5CluB55dHHH0uy3GRwa4C/5rMtDQIgeSEZkfBO X-Received: by 2002:a63:4d:: with SMTP id 74mr1804198pga.248.1543508141036; Thu, 29 Nov 2018 08:15:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543508141; cv=none; d=google.com; s=arc-20160816; b=uoXd9+5BDEksaa3GoTWRsCbsSzkr5ryGWdeFPb1LbdTVwTRFk4q8FxMIDvzRcg0+xH zuQDM7M+Ops82xsHsjZ9ikUwbPiw8Ps84gaEMc/nh7yxeQpraH5sZQ4/mPHiCtQ3j9YD x4enEu6OSRmQybegtBkNMumd7IjBPdFEHEHRkEeuxMUSJYBGXdaebAiBmWQhPjEvMptZ +h3ARE/n79aMUtc6KYXaqUAQDN+ROexuUmlzkZDpPG6hIt67OpeQf6u+6hpraeTCD5A2 a6v6AyC27Wq5G7t8On3gX/DyxKpknsuHNROO5zfbHHoztZAtqVRyVsllLHlZvTKDhdl1 CEWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=RpWiZFyPV+GG12uLMyBidS/H9vBUnZK7N/81HdXjrn4=; b=0jCWNPhTjZ9/Gcsg7XMvfCSu2/zQbAFHsEH0n+VVsghoEgf8ZZk+HKoq9H30QRAiZl n7tuu2ZXGEBdnLj6fm9TURyAW3SjnyM6+IiyEo2Swp8VDKvtVRGwXeLAt4+hp5xCsSfi uAginjXRxQplHoFbUdX1gBo2rHpbzLOXuX1pjd7SYJ+yGKe5uRGEHk6pLEpwOQhiz0vY Hm3N5LiqS8OzlJU/Se1lwH10Io83XoZVCMOrWR1PmZnEpZzNW0ygtuUyMsxdSMFWlVWi hn2rtw6LNFSkHKA/al7ir57vzsM+k2ZDUuVPOZSTD1sfUWI5SwDFs3he7gfgJvKZdGUk DtvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 97si2588730plb.3.2018.11.29.08.15.01; Thu, 29 Nov 2018 08:15:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729364AbeK3DTM (ORCPT + 99 others); Thu, 29 Nov 2018 22:19:12 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:38228 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728334AbeK3DTM (ORCPT ); Thu, 29 Nov 2018 22:19:12 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A506BA78; Thu, 29 Nov 2018 08:13:19 -0800 (PST) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 74C193F59C; Thu, 29 Nov 2018 08:13:19 -0800 (PST) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id EF35D1AE0FD4; Thu, 29 Nov 2018 16:13:37 +0000 (GMT) Date: Thu, 29 Nov 2018 16:13:37 +0000 From: Will Deacon To: Nathan Chancellor Cc: Julien Thierry , Nick Desaulniers , Catalin Marinas , Jens Axboe , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] arm64: io: specify asm operand width for __iormb() Message-ID: <20181129161337.GA21349@arm.com> References: <20181129041912.5918-1-nick.desaulniers@gmail.com> <20181129104902.GA2377@arm.com> <20181129161039.GA17063@flashbox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181129161039.GA17063@flashbox> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 29, 2018 at 09:10:39AM -0700, Nathan Chancellor wrote: > On Thu, Nov 29, 2018 at 10:49:03AM +0000, Will Deacon wrote: > > On Thu, Nov 29, 2018 at 09:03:54AM +0000, Julien Thierry wrote: > > > On 29/11/18 04:19, Nick Desaulniers wrote: > > > > Fixes the warning produced from Clang: > > > > ./include/asm-generic/io.h:711:9: warning: value size does not match > > > > register size specified by the constraint and modifier > > > > [-Wasm-operand-widths] > > > > return readl(addr); > > > > ^ > > > > ./arch/arm64/include/asm/io.h:149:58: note: expanded from macro 'readl' > > > > ^ > > > > ./include/asm-generic/io.h:711:9: note: use constraint modifier "w" > > > > ./arch/arm64/include/asm/io.h:149:50: note: expanded from macro 'readl' > > > > ^ > > > > ./arch/arm64/include/asm/io.h:118:25: note: expanded from macro '__iormb' > > > > asm volatile("eor %w0, %1, %1\n" \ > > > > ^ > > > > > > Why does the "eor %0, %1, %1" become "eor %w0, %1, %1" ? > > > The variable passed to the inline assembly for %0 is unsigned long, so > > > always 64-bits wide on arm64. Why is clang trying to use a 32-bit > > > register for it? > > Sorry, this was my fault, I accidentally added a w during testing to see > what constraints were valid (given that my assembly knowledge is nearly > non-existence so forgive the non-sensical experimentation) and I used > that message rather than the original one. This is the unadulterated one. Aha, that explains it. Thanks for clearing that up. > In file included from arch/arm64/kernel/asm-offsets.c:24: > In file included from ./include/linux/dma-mapping.h:11: > In file included from ./include/linux/scatterlist.h:9: > In file included from ./arch/arm64/include/asm/io.h:209: > ./include/asm-generic/io.h:695:9: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths] > return readb(addr); > ^ > ./arch/arm64/include/asm/io.h:147:58: note: expanded from macro 'readb' > #define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(__v); __v; }) > ^ > ./include/asm-generic/io.h:695:9: note: use constraint modifier "w" > ./arch/arm64/include/asm/io.h:147:50: note: expanded from macro 'readb' > #define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(__v); __v; }) > ^ > ./arch/arm64/include/asm/io.h:118:24: note: expanded from macro '__iormb' > asm volatile("eor %0, %1, %1\n" \ > ^ > > > > > Yeah, the message above looks bogus to me. I can see %1 being 32-bit for > > read[bwl], so maybe clang is just getting the diagnostic wrong. If so, > > I wonder if the following fixes the problem: > > > > This doesn't appear to work, I get this error: > > In file included from arch/arm64/kernel/asm-offsets.c:24: > In file included from ./include/linux/dma-mapping.h:11: > In file included from ./include/linux/scatterlist.h:9: > In file included from ./arch/arm64/include/asm/io.h:209: > ./include/asm-generic/io.h:695:9: error: expected expression > return readb(addr); > ^ > ./arch/arm64/include/asm/io.h:147:50: note: expanded from macro 'readb' > #define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(__v); __v; }) > ^ > ./arch/arm64/include/asm/io.h:120:28: note: expanded from macro '__iormb' > : "=r" (tmp) : "r" (unsigned long)(v) : "memory"); \ > ^ Can you try throwing another set of brackets around it, please? ((unsigned long)(v)) Will