From: Cornelia Huck <cohuck@redhat.com>
To: Matthew Rosato <mjrosato@linux.ibm.com>
Cc: "Thomas Huth" <thuth@redhat.com>,
"Alex Williamson" <alex.williamson@redhat.com>,
"Pierre Morel" <pmorel@linux.ibm.com>,
"David Hildenbrand" <david@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
qemu-devel@nongnu.org, "Halil Pasic" <pasic@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@de.ibm.com>,
qemu-s390x@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: Re: [PATCH for-5.2] s390x/pci: fix endianness issues
Date: Wed, 18 Nov 2020 08:49:47 +0100 [thread overview]
Message-ID: <20201118084947.172002fe.cohuck@redhat.com> (raw)
In-Reply-To: <f4f665ad-c499-7824-bfd7-78b75b6216c4@linux.ibm.com>
On Tue, 17 Nov 2020 14:49:53 -0500
Matthew Rosato <mjrosato@linux.ibm.com> wrote:
> On 11/17/20 2:21 PM, Thomas Huth wrote:
> > On 17/11/2020 18.13, Cornelia Huck wrote:
> >> zPCI control blocks are big endian, we need to take care that we
> >> do proper accesses in order not to break tcg guests on little endian
> >> hosts.
> >>
> >> 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")
> >
> > This fixes the problem with my old Fedora 28 under TCG, too, but... do we
> > really want to store this information in big endian on the QEMU side (e.g.
> > in the QTAILQ lists)? ... that smells like trouble again in the future...
> >
> > I think it would be better if we rather replace all those memcpy() functions
> > in the patches that you cited in the "Fixes:" lines above with code that
> > changes the endianess when we copy the date from QEMU space to guest space
> > and vice versa. What do you think?
>
> Hmm, that's actually a fair point... Such an approach would have the
> advantage of avoiding weird lines like the following:
>
> memory_region_add_subregion(&pbdev->iommu->mr,
> - pbdev->pci_group->zpci_group.msia,
> + ldq_p(&pbdev->pci_group->zpci_group.msia),
> &pbdev->msix_notify_mr);
>
>
> And would keep messing with endianness largely contained to the code
> that handles CLPs. It does take away the niceness of being able to
> gather the CLP response in one fell memcpy but... It's not like these
> are done very often (device init).
>
Not opposed to it, can try to put a patch together and see what it
looks like. As long as we get this into 5.2 :)
next prev parent reply other threads:[~2020-11-18 7:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-17 17:13 [PATCH for-5.2] s390x/pci: fix endianness issues Cornelia Huck
2020-11-17 17:59 ` Philippe Mathieu-Daudé
2020-11-17 18:19 ` Matthew Rosato
2020-11-17 18:30 ` Philippe Mathieu-Daudé
2020-11-17 18:39 ` Thomas Huth
2020-11-17 18:49 ` Philippe Mathieu-Daudé
2020-11-17 19:23 ` Thomas Huth
2020-11-17 19:20 ` Matthew Rosato
2020-11-17 19:21 ` Thomas Huth
2020-11-17 19:49 ` Matthew Rosato
2020-11-18 7:49 ` Cornelia Huck [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-11-18 8:51 Cornelia Huck
2020-11-18 8:53 ` Cornelia Huck
2020-11-18 9:38 ` Thomas Huth
2020-11-18 10:19 ` Cornelia Huck
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=20201118084947.172002fe.cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=david@redhat.com \
--cc=mjrosato@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=philmd@redhat.com \
--cc=pmorel@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@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 NNTP newsgroup(s).