From: "Mehta, Sohil" <sohil.mehta@intel.com>
To: "tglx@linutronix.de" <tglx@linutronix.de>,
"hpa@zytor.com" <hpa@zytor.com>,
"andriy.shevchenko@linux.intel.com"
<andriy.shevchenko@linux.intel.com>,
"mingo@redhat.com" <mingo@redhat.com>,
"x86@kernel.org" <x86@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "mitake@dcl.info.waseda.ac.jp" <mitake@dcl.info.waseda.ac.jp>
Subject: Re: [PATCH v1] x86/io: Define readq()/writeq() to use 64-bit type
Date: Tue, 23 Jan 2018 00:32:14 +0000 [thread overview]
Message-ID: <1516667578.153063.78.camel@intel.com> (raw)
In-Reply-To: <20180119143322.16555-1-andriy.shevchenko@linux.intel.com>
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 <io-64-nonatomic-lo-hi.h>
> ...
> 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 <lkp@intel.com>
> Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
> Cc: "Mehta, Sohil" <sohil.mehta@intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> 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.mehta@intel.com>
Sohil
next prev parent reply other threads:[~2018-01-23 0:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-19 14:33 [PATCH v1] x86/io: Define readq()/writeq() to use 64-bit type Andy Shevchenko
2018-01-23 0:32 ` Mehta, Sohil [this message]
2018-01-23 0:46 ` hpa
2018-01-23 8:32 ` Andy Shevchenko
2018-01-29 15:45 ` Andy Shevchenko
2018-02-13 16:58 ` [tip:x86/urgent] " tip-bot for Andy Shevchenko
2018-03-27 15:10 ` Andy Shevchenko
2018-03-31 10:19 ` Ingo Molnar
2018-03-31 10:22 ` Ingo Molnar
2018-03-31 12:06 ` Andy Shevchenko
2018-03-31 12:15 ` Andy Shevchenko
2018-03-31 18:45 ` Ingo Molnar
2018-04-02 14:55 ` Andy Shevchenko
2018-04-24 16:51 ` Andy Shevchenko
2018-03-31 12:05 ` Andy Shevchenko
2018-03-31 10:20 ` [tip:x86/platform] " tip-bot for Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1516667578.153063.78.camel@intel.com \
--to=sohil.mehta@intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mitake@dcl.info.waseda.ac.jp \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.