[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 5/5] vfio-user: Fix config space access byte order
From: |
Mattias Nissler |
Subject: |
Re: [PATCH v3 5/5] vfio-user: Fix config space access byte order |
Date: |
Fri, 15 Sep 2023 12:24:17 +0200 |
On Thu, Sep 14, 2023 at 10:32 PM Stefan Hajnoczi <stefanha@redhat.com> wrote:
>
> On Thu, Sep 07, 2023 at 06:04:10AM -0700, Mattias Nissler 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>
> > ---
> > hw/remote/vfio-user-obj.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
>
> After some discussion about PCI Configuration Space endianness on IRC
> with aw, mcayland, and f4bug I am now happy with this patch:
>
> 1. Configuration space can only be accessed in 1-, 2-, or 4-byte
> accesses.
> 2. If it's a 2- or 4-byte access then your patch adds the missing
> little-endian conversion.
> 3. If it's a 1-byte access then there is (effectively) no byteswap in
> the code path and the pci_dev->config[] array is already
> little-endian.
Thanks for checking! This indeed relies on the
pci_host_config_{read,write}_common to be register-based access paths.
I have also experimentally verified that this works as expected using
a s390x build.
- [PATCH v3 4/5] vfio-user: Message-based DMA support, (continued)
- [PATCH v3 4/5] vfio-user: Message-based DMA support, Mattias Nissler, 2023/09/07
- [PATCH v3 3/5] Update subprojects/libvfio-user, Mattias Nissler, 2023/09/07
- [PATCH v3 1/5] softmmu: Per-AddressSpace bounce buffering, Mattias Nissler, 2023/09/07
- [PATCH v3 5/5] vfio-user: Fix config space access byte order, Mattias Nissler, 2023/09/07
- Re: [PATCH v3 0/5] Support message-based DMA in vfio-user server, Stefan Hajnoczi, 2023/09/14