Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2659214imu; Thu, 29 Nov 2018 08:18:36 -0800 (PST) X-Google-Smtp-Source: AFSGD/WoSCQohWL6TwitS8h8jfd/JWokwi949TzwsEQEDbiEdfzeRTfAs+20uw7REXEEybjCHu2U X-Received: by 2002:a63:8e43:: with SMTP id k64mr1752808pge.346.1543508316268; Thu, 29 Nov 2018 08:18:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543508316; cv=none; d=google.com; s=arc-20160816; b=F6fC/fSTLdFtr17F5mmwcs7RWOuMugNPJb6vIk/y16ZNpSzg4X1uq7L1uBun/EbBW3 gdvqu1UXm31eolzuczwyvnOOD2N5TejT5UcSCfQctMwkL8Cldr8XAGOG86jEmj+DMBn+ 7P1osELO89HN/2yGu4bMVbpfK65g1TPX/T4R4j592Byq/LvTsxVOsugiXNK5DGQyNGxu CQs0HlToA+rYBy9m0cQfHuT83SGhHqwuKckdh82yPYRtY5F7o20DV+5JFOJTSXouJGjT RaUoveZ3+tEAm1FYAjeUXzwxVehgMspwBSa4ueaAekFgNr9mUl3rjf/pV/9ozVXUUlwv Qusg== 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:dkim-signature; bh=G54T+5sk6bFuEzUiWI+1yMrD5NhH22z54h6GsTDnDwI=; b=bVT7bQRE4h3jOsUpAv0YYdSaF1A0abhqhQiwV+fAXn99ROTfoK+y7suKJMC1re87h0 YZCoJdMoeEEk//ginVpUVMhzbtYVvqE7RmT84OlKtjII9bcqSSHRgVihOzUJHGGZe5Bo LZcqInoVjMOdAtpSOaqkb8M/IKHPzeUOELBARkzPitSN+YN1OXW5OzjXd4Uz3ApQfW7s fmGr5PLu2cICPSSfgHw9GIHw/B3up6zqknk1+nAN2W9KupcrTQkwWiCsZ0D9m3oGnKWR WWvSoru2VHDqPZ4NCkyzCWuqexy+NiZTnI8M3QmHBmT5cXaCZhS5x+SxKsdp2hz06Rvx hTXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=f1StIL2v; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v9si2451362pgo.23.2018.11.29.08.17.54; Thu, 29 Nov 2018 08:18:36 -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; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=f1StIL2v; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728554AbeK3DUY (ORCPT + 99 others); Thu, 29 Nov 2018 22:20:24 -0500 Received: from pandora.armlinux.org.uk ([78.32.30.218]:39908 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728255AbeK3DUX (ORCPT ); Thu, 29 Nov 2018 22:20:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=G54T+5sk6bFuEzUiWI+1yMrD5NhH22z54h6GsTDnDwI=; b=f1StIL2vd+aZG0lWDUjey7mIu D4B6Q4p8e00zFjBP4riywI2PlJN7AwIcdTxtJBGZ30PKYmkQF961aG0a7b3e9SZn4idaVxCEvgpYN yZz0tGD6f4CWDk6sexveDfJPqvA9213cjE0vkcb0j6HWJxo8zSjIZ5k1uLrfamF0m9tD8=; Received: from n2100.armlinux.org.uk ([fd8f:7570:feb6:1:214:fdff:fe10:4f86]:38357) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) (envelope-from ) id 1gSOxL-0003Hc-A6; Thu, 29 Nov 2018 16:14:23 +0000 Received: from linux by n2100.armlinux.org.uk with local (Exim 4.90_1) (envelope-from ) id 1gSOx7-0002HX-1U; Thu, 29 Nov 2018 16:14:09 +0000 Date: Thu, 29 Nov 2018 16:14:01 +0000 From: Russell King - ARM Linux To: Nathan Chancellor Cc: Will Deacon , Jens Axboe , Julien Thierry , Catalin Marinas , "linux-kernel@vger.kernel.org" , Nick Desaulniers , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH] arm64: io: specify asm operand width for __iormb() Message-ID: <20181129161401.GY30658@n2100.armlinux.org.uk> 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. > > 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"); \ > ^ > > > > > diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h > > index d42d00d8d5b6..13befec8b64e 100644 > > --- a/arch/arm64/include/asm/io.h > > +++ b/arch/arm64/include/asm/io.h > > @@ -117,7 +117,7 @@ static inline u64 __raw_readq(const volatile void __iomem *addr) > > */ \ > > asm volatile("eor %0, %1, %1\n" \ > > "cbnz %0, ." \ > > - : "=r" (tmp) : "r" (v) : "memory"); \ > > + : "=r" (tmp) : "r" (unsigned long)(v) : "memory"); \ The parens around the passed value are part of the asm() syntax, which is: "contraint" (expression) so should be: + : "=r" (tmp) : "r" ((unsigned long)(v)) : "memory"); \ -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up