On Wed, 18 Nov 2020 11:42:02 +0100
Cornelia Huck <[email protected]> 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 <[email protected]>
> ---
>
> 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.
>
> ---
> 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(-)
Queued to s390-fixes.