From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: kvm@vger.kernel.org,
Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>,
Alexander Graf <agraf@suse.de>,
linux-kernel@vger.kernel.org,
Alex Williamson <alex.williamson@redhat.com>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] vfio: Fix endianness handling for emulated BARs
Date: Wed, 25 Jun 2014 07:54:37 +1000 [thread overview]
Message-ID: <1403646877.4587.184.camel@pasglop> (raw)
In-Reply-To: <53A98C38.8020205@ozlabs.ru>
On Wed, 2014-06-25 at 00:33 +1000, Alexey Kardashevskiy wrote:
>
> I do not understand why @val is considered LE here and need to be
> converted
> to CPU. Really. I truly believe it should be cpu_to_le32().
No. Both are slightly wrong semantically but le32_to_cpu() is less
wrong :-)
iowrite32 supposedly takes a "cpu" value as argument and writes an "le"
value. So if anything, you need something that converts to a "cpu" value
before you call iowrite32.
Now it's still slightly wrong because the "input" to le32_to_cpu() is
supposed to be an "LE" value but of course here it's not, it's a "cpu"
value too :-)
But yes, I agree with aw here, either do nothing or stick a set of
iowriteXX_native or something equivalent in the generic iomap header,
define them in term of iowrite32be/iowrite32 based on the compile time
endian of the arch.
Hitting asm-generic/iomap.h I think will cover all archs except ARM.
For ARM, just hack arch/arm/asm/io.h
Cheers,
Ben.
WARNING: multiple messages have this Message-ID (diff)
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: Alex Williamson <alex.williamson@redhat.com>,
Alexander Graf <agraf@suse.de>,
linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org,
Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Subject: Re: [PATCH] vfio: Fix endianness handling for emulated BARs
Date: Wed, 25 Jun 2014 07:54:37 +1000 [thread overview]
Message-ID: <1403646877.4587.184.camel@pasglop> (raw)
In-Reply-To: <53A98C38.8020205@ozlabs.ru>
On Wed, 2014-06-25 at 00:33 +1000, Alexey Kardashevskiy wrote:
>
> I do not understand why @val is considered LE here and need to be
> converted
> to CPU. Really. I truly believe it should be cpu_to_le32().
No. Both are slightly wrong semantically but le32_to_cpu() is less
wrong :-)
iowrite32 supposedly takes a "cpu" value as argument and writes an "le"
value. So if anything, you need something that converts to a "cpu" value
before you call iowrite32.
Now it's still slightly wrong because the "input" to le32_to_cpu() is
supposed to be an "LE" value but of course here it's not, it's a "cpu"
value too :-)
But yes, I agree with aw here, either do nothing or stick a set of
iowriteXX_native or something equivalent in the generic iomap header,
define them in term of iowrite32be/iowrite32 based on the compile time
endian of the arch.
Hitting asm-generic/iomap.h I think will cover all archs except ARM.
For ARM, just hack arch/arm/asm/io.h
Cheers,
Ben.
next prev parent reply other threads:[~2014-06-24 21:54 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-18 11:36 [PATCH] vfio: Fix endianness handling for emulated BARs Alexey Kardashevskiy
2014-06-18 11:36 ` Alexey Kardashevskiy
2014-06-18 18:35 ` Alex Williamson
2014-06-18 18:35 ` Alex Williamson
2014-06-19 0:50 ` Alexey Kardashevskiy
2014-06-19 0:50 ` Alexey Kardashevskiy
2014-06-19 1:50 ` Alexey Kardashevskiy
2014-06-19 1:50 ` Alexey Kardashevskiy
2014-06-19 1:50 ` Alexey Kardashevskiy
2014-06-19 1:50 ` Alexey Kardashevskiy
2014-06-19 3:48 ` Alexey Kardashevskiy
2014-06-19 3:48 ` Alexey Kardashevskiy
2014-06-19 5:30 ` Bharat.Bhushan
2014-06-19 5:30 ` Bharat.Bhushan
2014-06-19 5:30 ` Bharat.Bhushan
2014-06-19 6:17 ` Alexey Kardashevskiy
2014-06-19 6:17 ` Alexey Kardashevskiy
2014-06-20 3:21 ` Alex Williamson
2014-06-20 3:21 ` Alex Williamson
2014-06-20 3:21 ` Alex Williamson
2014-06-20 14:14 ` Alexey Kardashevskiy
2014-06-20 14:14 ` Alexey Kardashevskiy
2014-06-20 23:16 ` Benjamin Herrenschmidt
2014-06-20 23:16 ` Benjamin Herrenschmidt
2014-06-20 23:16 ` Benjamin Herrenschmidt
2014-06-20 23:12 ` Benjamin Herrenschmidt
2014-06-20 23:12 ` Benjamin Herrenschmidt
2014-06-20 23:12 ` Benjamin Herrenschmidt
2014-06-24 10:11 ` Alexey Kardashevskiy
2014-06-24 10:11 ` Alexey Kardashevskiy
2014-06-24 10:41 ` Alexander Graf
2014-06-24 10:41 ` Alexander Graf
2014-06-24 12:50 ` Alexey Kardashevskiy
2014-06-24 12:50 ` Alexey Kardashevskiy
2014-06-24 12:52 ` Alexander Graf
2014-06-24 12:52 ` Alexander Graf
2014-06-24 13:01 ` Alexey Kardashevskiy
2014-06-24 13:01 ` Alexey Kardashevskiy
2014-06-24 13:22 ` Alexander Graf
2014-06-24 13:22 ` Alexander Graf
2014-06-24 14:21 ` Alex Williamson
2014-06-24 14:21 ` Alex Williamson
2014-06-24 14:33 ` Alexey Kardashevskiy
2014-06-24 14:33 ` Alexey Kardashevskiy
2014-06-24 14:40 ` David Laight
2014-06-24 14:40 ` David Laight
2014-06-24 14:40 ` David Laight
2014-06-24 14:43 ` Alex Williamson
2014-06-24 14:43 ` Alex Williamson
2014-06-24 16:26 ` Alexey Kardashevskiy
2014-06-24 16:26 ` Alexey Kardashevskiy
2014-06-24 21:54 ` Benjamin Herrenschmidt [this message]
2014-06-24 21:54 ` Benjamin Herrenschmidt
2014-06-25 2:43 ` Alexey Kardashevskiy
2014-06-25 2:43 ` Alexey Kardashevskiy
2014-06-24 21:46 ` Benjamin Herrenschmidt
2014-06-24 21:46 ` Benjamin Herrenschmidt
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=1403646877.4587.184.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=alex.williamson@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=nikunj@linux.vnet.ibm.com \
/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.