Received: by 10.223.176.46 with SMTP id f43csp3550304wra; Mon, 22 Jan 2018 16:52:10 -0800 (PST) X-Google-Smtp-Source: AH8x225fFCha3GfwzUIcP82XOnHMKG+BLg+Gqn2YkjAjSxIY8shRsRjKDDU7C2MXlVAALBa7itEH X-Received: by 10.36.51.201 with SMTP id k192mr1252227itk.71.1516668730160; Mon, 22 Jan 2018 16:52:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516668730; cv=none; d=google.com; s=arc-20160816; b=uBmjr4aXfZflBmFUvRkK1xwYk+74wez0opViIpEWzIbg18Ohi3Zwz6X+1UeXYfTfxc fINREjdzrIXAnYFLmjFrs/Dr0rD3VaJtGEtMgCQt/6BfYBXtWJMZEApBI8WmUnO+E19s bPOF+ob8lReBehNG1EHGHu6swvQmdYfmF7C4/Q2bN1pTmC3hUNTn8SSUrICmPMv8w7ow dji7gySWBl5Z55u1JLBo3ljj4pRW1InCQp4YubHAr15VW/Sfp6A27Q7286vYi1zjbHJ7 tbo7aNojCqzdrqBSzHtdEf3AYKutBYGuZacQgx/VWpVfCWR9FDqYj+9kO301z5pLaik5 5eRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:from:cc:to:subject :content-transfer-encoding:mime-version:references:in-reply-to :user-agent:date:arc-authentication-results; bh=JbA68iKCoAnSE/7mznkWyEiI6ub+OXaxzrfwJepbTL8=; b=iN1dTEvdNh8rduBidgkQ7oJ5u80QfIAWTH66eL+PZaF0ywTUtiN4BDbnG/vrhylqFV YLGfdpNKLUwQjXTd4JeKFZUwKovhABHuERxC+urIHtn9RY7FfZN2hO62ifQ4qu6u21h7 /azOGCPjaHezQD9LWpq2hlVpA0t967F3LuWr0izjAXdI8ViP4lZf1JL/p+mTGaebJKK2 WPafPUQGEjjFDPNnhpaMq+5AoQ7m0HeOJll+VTI5aPsrm3rNzbK9LqfHr1nC7C5YMzN4 jr3wSDoa/gK40yec92XDxR8TSdxEoxFEcFCsIUJXrzaJka3uXWYIvy6C3ez9ePwlVjAK +faw== 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 i1si6828491ite.159.2018.01.22.16.51.56; Mon, 22 Jan 2018 16:52:10 -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 S1751346AbeAWAve convert rfc822-to-8bit (ORCPT + 99 others); Mon, 22 Jan 2018 19:51:34 -0500 Received: from terminus.zytor.com ([65.50.211.136]:32819 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751253AbeAWAvd (ORCPT ); Mon, 22 Jan 2018 19:51:33 -0500 Received: from nexus6.hos.anvin.org (c-24-5-245-234.hsd1.ca.comcast.net [24.5.245.234] (may be forged)) (authenticated bits=0) by mail.zytor.com (8.15.2/8.15.2) with ESMTPSA id w0N0l7hZ000756 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Mon, 22 Jan 2018 16:47:07 -0800 Date: Mon, 22 Jan 2018 16:46:59 -0800 User-Agent: K-9 Mail for Android In-Reply-To: <1516667578.153063.78.camel@intel.com> References: <20180119143322.16555-1-andriy.shevchenko@linux.intel.com> <1516667578.153063.78.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Subject: Re: [PATCH v1] x86/io: Define readq()/writeq() to use 64-bit type To: "Mehta, Sohil" , "tglx@linutronix.de" , "andriy.shevchenko@linux.intel.com" , "mingo@redhat.com" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" CC: "mitake@dcl.info.waseda.ac.jp" From: hpa@zytor.com Message-ID: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On January 22, 2018 4:32:14 PM PST, "Mehta, Sohil" wrote: >On Fri, 2018-01-19 at 16:33 +0200, Andy Shevchenko wrote: >> Since non atomic readq() and writeq() were added some of the drivers >> would like to use it in a manner of: >> >>  #include >> ... >>  pr_debug("Debug value of some register: %016llx\n", readq(addr)); >> >> However, lo_hi_readq() always returns __u64 data, while readq() >> on x86_64 defines it as unsigned long. and thus compiler warns >> about type mismatch, although they are both 64-bit on x86_64. >> >> Convert readq() and writeq() on x86 to operate on deterministic >> 64-bit type. The most of architectures in the kernel already are >> using >> either unsigned long long, or u64 type for readq() / writeq(). >> This change propagates consistency in that sense. >> >> While this is not an issue per se, though if someone wants to address >> it, >> the anchor could be the commit >> >>   797a796a13df ("asm-generic: architecture independent readq/writeq >> for 32bit environment") >> >> where non-atomic variants had been introduced. >> >> Note, there are only few users of above pattern and they will not be >> affected because they do cast returned value. The actual warning has >> been issued on not-yet-upstreamed code. >> >> Potentially we might get a new warnings if some 64-bit only code >> assigns returned value to unsigned long type of variable. This is >> assumed to be addressed on case-by-case basis. >> >> Reported-by: lkp >> Cc: Hitoshi Mitake >> Cc: "Mehta, Sohil" >> Signed-off-by: Andy Shevchenko >> --- >>  arch/x86/include/asm/io.h | 8 ++++---- >>  1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h >> index 95e948627fd0..365f5ba9222b 100644 >> --- a/arch/x86/include/asm/io.h >> +++ b/arch/x86/include/asm/io.h >> @@ -94,10 +94,10 @@ build_mmio_write(__writel, "l", unsigned int, >> "r", ) >>   >>  #ifdef CONFIG_X86_64 >>   >> -build_mmio_read(readq, "q", unsigned long, "=r", :"memory") >> -build_mmio_read(__readq, "q", unsigned long, "=r", ) >> -build_mmio_write(writeq, "q", unsigned long, "r", :"memory") >> -build_mmio_write(__writeq, "q", unsigned long, "r", ) >> +build_mmio_read(readq, "q", unsigned long long, "=r", :"memory") >> +build_mmio_read(__readq, "q", unsigned long long, "=r", ) >> +build_mmio_write(writeq, "q", unsigned long long, "r", :"memory") >> +build_mmio_write(__writeq, "q", unsigned long long, "r", ) >>   >>  #define readq_relaxed(a) __readq(a) >>  #define writeq_relaxed(v, a) __writeq(v, a) > >The patch works for me: > >Tested-by: Sohil Mehta > >Sohil Wouldn't simply u64 make more sense? -- Sent from my Android device with K-9 Mail. Please excuse my brevity.