[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH for-5.2 v3] s390x/pci: fix endianness issues
From: |
Cornelia Huck |
Subject: |
Re: [PATCH for-5.2 v3] s390x/pci: fix endianness issues |
Date: |
Wed, 18 Nov 2020 16:00:32 +0100 |
On Wed, 18 Nov 2020 09:20:39 -0500
Matthew Rosato <mjrosato@linux.ibm.com> wrote:
> On 11/18/20 5:42 AM, Cornelia Huck wrote:
> > The zPCI group and function structures are big endian. However, we do
> > not consistently store them as big endian locally, and are missing some
> > conversions.
> >
> > Let's just store the structures as host endian instead and convert to
> > big endian when actually handling the instructions retrieving the data.
> >
> > Also fix the layout of ClpReqQueryPciGrp: g is actually only 8 bit. This
> > also fixes accesses on little endian hosts, and makes accesses on big
> > endian hosts consistent.
> >
> > Fixes: 28dc86a07299 ("s390x/pci: use a PCI Group structure")
> > Fixes: 9670ee752727 ("s390x/pci: use a PCI Function structure")
> > Fixes: 1e7552ff5c34 ("s390x/pci: get zPCI function info from host")
> > Signed-off-by: Cornelia Huck <cohuck@redhat.com>
> > ---
> >
> > v2->v3: added missing zpci_fn.flags copy, removed forgotten memcopy
> > v1->v2: switched to keeping the internal structures as host-endian
> >
> > Again, tested on x86 and s390x (tcg/kvm) with virtio-pci devices;
> > testing vfio-pci devices would be good.
>
> Thanks Connie, code looks good to me:
>
> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
>
> And I once again took this for a spin with vfio-pci, driving network and
> disk workloads using a fairly recent (5.10-rc3) kernel in host/guest. I
> also rolled back the host to an older kernel to drive the default clp
> paths with vfio -- Everything works fine. I also verified that a tcg
> guest on x86 using a virtio pci device can see it as expected (Lesson
> learned: I will make a point of testing against tcg moving forward). I
> further double-checked the live pfgid / g values going to/from the guest
> in all 3 environments since this structure was changed; everything looks
> good.
>
> So if you'd like:
>
> Tested-by: Matthew Rosato <mjrosato@linux.ibm.com>
Wonderful, thanks!
>
>
>
> >
> > ---
> > hw/s390x/s390-pci-bus.c | 10 +++++-----
> > hw/s390x/s390-pci-inst.c | 16 ++++++++++++++--
> > hw/s390x/s390-pci-vfio.c | 12 ++++++------
> > include/hw/s390x/s390-pci-clp.h | 8 ++++----
> > 4 files changed, 29 insertions(+), 17 deletions(-)