From: Jag Raman <jag.raman@oracle.com>
To: Mattias Nissler <mnissler@rivosinc.com>
Cc: "Stefan Hajnoczi" <stefanha@redhat.com>,
"QEMU Developers" <qemu-devel@nongnu.org>,
"Peter Xu" <peterx@redhat.com>,
"john.levon@nutanix.com" <john.levon@nutanix.com>,
"David Hildenbrand" <david@redhat.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Elena Ufimtseva" <elena.ufimtseva@oracle.com>,
"Richard Henderson" <richard.henderson@linaro.org>
Subject: Re: [PATCH v6 5/5] vfio-user: Fix config space access byte order
Date: Tue, 28 Nov 2023 14:39:43 +0000 [thread overview]
Message-ID: <66A22F11-CBDA-4CBB-84C6-A06FED7D3499@oracle.com> (raw)
In-Reply-To: <20231101131611.775299-6-mnissler@rivosinc.com>
> On Nov 1, 2023, at 9:16 AM, Mattias Nissler <mnissler@rivosinc.com> wrote:
>
> PCI config space is little-endian, so on a big-endian host we need to
> perform byte swaps for values as they are passed to and received from
> the generic PCI config space access machinery.
>
> Signed-off-by: Mattias Nissler <mnissler@rivosinc.com>
Reviewed-by: Jagannathan Raman <jag.raman@oracle.com>
> ---
> hw/remote/vfio-user-obj.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/remote/vfio-user-obj.c b/hw/remote/vfio-user-obj.c
> index 9f5e385668..46a2036bd1 100644
> --- a/hw/remote/vfio-user-obj.c
> +++ b/hw/remote/vfio-user-obj.c
> @@ -281,7 +281,7 @@ static ssize_t vfu_object_cfg_access(vfu_ctx_t *vfu_ctx, char * const buf,
> while (bytes > 0) {
> len = (bytes > pci_access_width) ? pci_access_width : bytes;
> if (is_write) {
> - memcpy(&val, ptr, len);
> + val = ldn_le_p(ptr, len);
> pci_host_config_write_common(o->pci_dev, offset,
> pci_config_size(o->pci_dev),
> val, len);
> @@ -289,7 +289,7 @@ static ssize_t vfu_object_cfg_access(vfu_ctx_t *vfu_ctx, char * const buf,
> } else {
> val = pci_host_config_read_common(o->pci_dev, offset,
> pci_config_size(o->pci_dev), len);
> - memcpy(ptr, &val, len);
> + stn_le_p(ptr, len, val);
> trace_vfu_cfg_read(offset, val);
> }
> offset += len;
> --
> 2.34.1
>
next prev parent reply other threads:[~2023-11-28 14:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-01 13:16 [PATCH v6 0/5] Support message-based DMA in vfio-user server Mattias Nissler
2023-11-01 13:16 ` [PATCH v6 1/5] softmmu: Per-AddressSpace bounce buffering Mattias Nissler
2023-11-01 19:16 ` Peter Xu
2023-11-01 13:16 ` [PATCH v6 2/5] softmmu: Support concurrent bounce buffers Mattias Nissler
2023-11-01 19:18 ` Peter Xu
2023-11-01 13:16 ` [PATCH v6 3/5] Update subprojects/libvfio-user Mattias Nissler
2024-01-09 15:55 ` Jag Raman
2023-11-01 13:16 ` [PATCH v6 4/5] vfio-user: Message-based DMA support Mattias Nissler
2023-11-28 14:38 ` Jag Raman
2023-11-01 13:16 ` [PATCH v6 5/5] vfio-user: Fix config space access byte order Mattias Nissler
2023-11-28 14:39 ` Jag Raman [this message]
2024-02-09 17:39 ` [PATCH v6 0/5] Support message-based DMA in vfio-user server Jonathan Cameron via
2024-02-12 8:07 ` Mattias Nissler
2024-05-02 14:57 ` John Levon
2024-05-02 15:14 ` Peter Xu
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=66A22F11-CBDA-4CBB-84C6-A06FED7D3499@oracle.com \
--to=jag.raman@oracle.com \
--cc=david@redhat.com \
--cc=elena.ufimtseva@oracle.com \
--cc=john.levon@nutanix.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mnissler@rivosinc.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=stefanha@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).