From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] arm:kvm remove len 8 for mmio read write buf
Date: Mon, 22 Dec 2014 11:51:27 +0000 [thread overview]
Message-ID: <549805BF.4080400@arm.com> (raw)
In-Reply-To: <1419247399-26113-2-git-send-email-van.freenix@gmail.com>
On 22/12/14 11:23, Peng Fan wrote:
> For arm 32 bit architecture, 8 bytes load/store operation in one instruction
> will not be generated by compiler.
Ever heard of lrdr/strd?
> And before invoke mmio_read_buf, there is a piece of code:
> "
> len = run->mmio.len;
> if (len > sizeof(unsigned long))
> return -EINVAL;
>
> data = mmio_read_buf(run->mmio.data, len);
> "
>
> This piece code also tells that len variable does not exceeds 4 bytes.
> So, remove 8 bytes assign in mmio_read_buf and mmio_write_buf.
NAK. This code is shared between arm and arm64. See commit f42798c.
M.
>
> Signed-off-by: Peng Fan <van.freenix@gmail.com>
> CC: Gleb Natapov <gleb@kernel.org>
> CC: Paolo Bonzini <pbonzini@redhat.com>
> CC: Christoffer Dall <christoffer.dall@linaro.org>
> CC: Marc Zyngier <marc.zyngier@arm.com>
> CC: Russell King <linux@arm.linux.org.uk>
> ---
> arch/arm/kvm/mmio.c | 10 ----------
> 1 file changed, 10 deletions(-)
>
> diff --git a/arch/arm/kvm/mmio.c b/arch/arm/kvm/mmio.c
> index 4cb5a93..953a819 100644
> --- a/arch/arm/kvm/mmio.c
> +++ b/arch/arm/kvm/mmio.c
> @@ -30,7 +30,6 @@ static void mmio_write_buf(char *buf, unsigned int len, unsigned long data)
> u8 byte;
> u16 hword;
> u32 word;
> - u64 dword;
> } tmp;
>
> switch (len) {
> @@ -46,10 +45,6 @@ static void mmio_write_buf(char *buf, unsigned int len, unsigned long data)
> tmp.word = data;
> datap = &tmp.word;
> break;
> - case 8:
> - tmp.dword = data;
> - datap = &tmp.dword;
> - break;
> }
>
> memcpy(buf, datap, len);
> @@ -61,7 +56,6 @@ static unsigned long mmio_read_buf(char *buf, unsigned int len)
> union {
> u16 hword;
> u32 word;
> - u64 dword;
> } tmp;
>
> switch (len) {
> @@ -76,10 +70,6 @@ static unsigned long mmio_read_buf(char *buf, unsigned int len)
> memcpy(&tmp.word, buf, len);
> data = tmp.word;
> break;
> - case 8:
> - memcpy(&tmp.dword, buf, len);
> - data = tmp.dword;
> - break;
> }
>
> return data;
>
--
Jazz is not dead. It just smells funny...
WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <marc.zyngier@arm.com>
To: Peng Fan <van.freenix@gmail.com>,
"christoffer.dall@linaro.org" <christoffer.dall@linaro.org>
Cc: "gleb@kernel.org" <gleb@kernel.org>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"linux@arm.linux.org.uk" <linux@arm.linux.org.uk>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] arm:kvm remove len 8 for mmio read write buf
Date: Mon, 22 Dec 2014 11:51:27 +0000 [thread overview]
Message-ID: <549805BF.4080400@arm.com> (raw)
In-Reply-To: <1419247399-26113-2-git-send-email-van.freenix@gmail.com>
On 22/12/14 11:23, Peng Fan wrote:
> For arm 32 bit architecture, 8 bytes load/store operation in one instruction
> will not be generated by compiler.
Ever heard of lrdr/strd?
> And before invoke mmio_read_buf, there is a piece of code:
> "
> len = run->mmio.len;
> if (len > sizeof(unsigned long))
> return -EINVAL;
>
> data = mmio_read_buf(run->mmio.data, len);
> "
>
> This piece code also tells that len variable does not exceeds 4 bytes.
> So, remove 8 bytes assign in mmio_read_buf and mmio_write_buf.
NAK. This code is shared between arm and arm64. See commit f42798c.
M.
>
> Signed-off-by: Peng Fan <van.freenix@gmail.com>
> CC: Gleb Natapov <gleb@kernel.org>
> CC: Paolo Bonzini <pbonzini@redhat.com>
> CC: Christoffer Dall <christoffer.dall@linaro.org>
> CC: Marc Zyngier <marc.zyngier@arm.com>
> CC: Russell King <linux@arm.linux.org.uk>
> ---
> arch/arm/kvm/mmio.c | 10 ----------
> 1 file changed, 10 deletions(-)
>
> diff --git a/arch/arm/kvm/mmio.c b/arch/arm/kvm/mmio.c
> index 4cb5a93..953a819 100644
> --- a/arch/arm/kvm/mmio.c
> +++ b/arch/arm/kvm/mmio.c
> @@ -30,7 +30,6 @@ static void mmio_write_buf(char *buf, unsigned int len, unsigned long data)
> u8 byte;
> u16 hword;
> u32 word;
> - u64 dword;
> } tmp;
>
> switch (len) {
> @@ -46,10 +45,6 @@ static void mmio_write_buf(char *buf, unsigned int len, unsigned long data)
> tmp.word = data;
> datap = &tmp.word;
> break;
> - case 8:
> - tmp.dword = data;
> - datap = &tmp.dword;
> - break;
> }
>
> memcpy(buf, datap, len);
> @@ -61,7 +56,6 @@ static unsigned long mmio_read_buf(char *buf, unsigned int len)
> union {
> u16 hword;
> u32 word;
> - u64 dword;
> } tmp;
>
> switch (len) {
> @@ -76,10 +70,6 @@ static unsigned long mmio_read_buf(char *buf, unsigned int len)
> memcpy(&tmp.word, buf, len);
> data = tmp.word;
> break;
> - case 8:
> - memcpy(&tmp.dword, buf, len);
> - data = tmp.dword;
> - break;
> }
>
> return data;
>
--
Jazz is not dead. It just smells funny...
next prev parent reply other threads:[~2014-12-22 11:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-22 11:23 [PATCH 1/2] arm:kvm correct prototype to make sparse happy Peng Fan
2014-12-22 11:23 ` Peng Fan
2014-12-22 11:23 ` [PATCH 2/2] arm:kvm remove len 8 for mmio read write buf Peng Fan
2014-12-22 11:23 ` Peng Fan
2014-12-22 11:51 ` Marc Zyngier [this message]
2014-12-22 11:51 ` Marc Zyngier
2014-12-22 14:20 ` Peng Fan
2014-12-22 14:20 ` Peng Fan
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=549805BF.4080400@arm.com \
--to=marc.zyngier@arm.com \
--cc=linux-arm-kernel@lists.infradead.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.