[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 5/5] vfio-user: Fix config space access byte order
|
From: |
Jag Raman |
|
Subject: |
Re: [PATCH v6 5/5] vfio-user: Fix config space access byte order |
|
Date: |
Tue, 28 Nov 2023 14:39:43 +0000 |
> 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
>
- [PATCH v6 0/5] Support message-based DMA in vfio-user server, Mattias Nissler, 2023/11/01
- [PATCH v6 1/5] softmmu: Per-AddressSpace bounce buffering, Mattias Nissler, 2023/11/01
- [PATCH v6 2/5] softmmu: Support concurrent bounce buffers, Mattias Nissler, 2023/11/01
- [PATCH v6 4/5] vfio-user: Message-based DMA support, Mattias Nissler, 2023/11/01
- [PATCH v6 5/5] vfio-user: Fix config space access byte order, Mattias Nissler, 2023/11/01
- Re: [PATCH v6 5/5] vfio-user: Fix config space access byte order,
Jag Raman <=
- [PATCH v6 3/5] Update subprojects/libvfio-user, Mattias Nissler, 2023/11/01