qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Daniel Henrique Barboza" <danielhb413@gmail.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	qemu-devel@nongnu.org, "BALATON Zoltan" <balaton@eik.bme.hu>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Alistair Francis" <alistair@alistair23.me>,
	"Jason Wang" <jasowang@redhat.com>,
	"Cédric Le Goater" <clg@kaod.org>, "Greg Kurz" <groug@kaod.org>,
	qemu-arm@nongnu.org,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	qemu-ppc@nongnu.org
Subject: Re: [RFC PATCH-for-8.0 2/3] hw/ppc/spapr: Replace tswap64(HPTE) by cpu_to_be64(HPTE)
Date: Wed, 21 Dec 2022 12:16:12 +1100	[thread overview]
Message-ID: <Y6JeXJn1qCkeIzuz@yekko> (raw)
In-Reply-To: <CAFEAcA9CUtdLXKPOqC0uRCyA0xQFZ_SrJ62SSDvPKESaxL3X2A@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2979 bytes --]

On Mon, Dec 19, 2022 at 10:39:40AM +0000, Peter Maydell wrote:
> On Mon, 19 Dec 2022 at 06:35, David Gibson <david@gibson.dropbear.id.au> wrote:
> >
> > On Fri, Dec 16, 2022 at 09:39:19PM +0000, Peter Maydell wrote:
> > > On Fri, 16 Dec 2022 at 19:11, Daniel Henrique Barboza
> > > <danielhb413@gmail.com> wrote:
> > > >
> > > >
> > > >
> > > > On 12/13/22 10:51, Peter Maydell wrote:
> > > > Yes, most if not all accesses are being handled as "target endian", even
> > > > though the target is always big endian.
> >
> > So "target is always big endian" is pretty misleading for POWER.  We
> > always define "TARGET_BIG_ENDIAN" in qemu, but for at least 10 years
> > the CPUs have been capable of running in either big endian or little
> > endian mode (selected at runtime).  Some variants can choose
> > endianness on a per-page basis.  Since the creation of the ISA it's
> > had "byte reversed" load and store instructions that let it use little
> > endian for specific memory accesses.
> 
> Yeah, this is like Arm (and for the purposes of this thread
> I meant essentially "TARGET_BIG_ENDIAN is always defined").

Ok.

> > Really the whole notion of an ISA having an "endianness" doesn't make
> > a lot of sense - it's an individual load or store to memory that has
> > an endianness which can depend on a bunch of factors.  When these
> > macros were created, an ISA nearly always used the same endianness,
> > but that's not really true any more - not just for POWER, but for a
> > bunch of targets.  So from that point of view, I think getting rid of
> > tswap() - particularly one that has compile time semantics, rather
> > than behaviour which can depend on cpu mode/state is a good idea.
> 
> I tend to think of the TARGET_BIG_ENDIAN/not setting as being
> something like "CPU bus endianness". At least for Arm, when you
> put the CPU into BE mode it pretty much means "the CPU byteswaps
> the data when it comes in/out", AIUI.

Hmm, I guess.  We're not really modelling down to the level of bus
byte lanes, though, so I'm not really convinced that's a meaningful
definition in the context of qemu.

> > I believe that even when running in little-endian mode, the hash page
> > tables are encoded in big-endian, so I think the proposed change makes
> > sense.
> 
> OK. I still think we should consistently change all the places that are
> accessing this data structure, though, not just half of them.

Yes, that makes sense.  Although what exactly constitutes "this data
structure" is a bit complex here.  If we mean just the spapr specific
"external HPT", then there are only a few more references to it.  If
we mean all instances of a powerpc hashed page table, then there are a
bunch more in the cpu target code.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-12-21  1:38 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-13 12:52 [RFC PATCH-for-8.0 0/3] hw/ppc: Remove tswap() calls Philippe Mathieu-Daudé
2022-12-13 12:52 ` [RFC PATCH-for-8.0 1/3] hw/ppc: Replace tswap32() by const_le32() Philippe Mathieu-Daudé
2022-12-13 16:00   ` Richard Henderson
2022-12-13 16:10     ` Philippe Mathieu-Daudé
2022-12-13 16:14       ` Richard Henderson
2022-12-13 16:21         ` Peter Maydell
2022-12-13 16:27           ` Richard Henderson
2022-12-13 16:53             ` Cédric Le Goater
2022-12-13 17:23               ` Peter Maydell
2022-12-13 17:51                 ` Edgar E. Iglesias
2022-12-13 18:09                 ` BALATON Zoltan
2022-12-13 21:37                   ` Peter Maydell
2022-12-13 18:13                 ` Cédric Le Goater
2023-05-17 10:51                   ` Thomas Huth
2022-12-13 12:52 ` [RFC PATCH-for-8.0 2/3] hw/ppc/spapr: Replace tswap64(HPTE) by cpu_to_be64(HPTE) Philippe Mathieu-Daudé
2022-12-13 13:51   ` Peter Maydell
2022-12-16 19:10     ` Daniel Henrique Barboza
2022-12-16 21:39       ` Peter Maydell
2022-12-19  6:31         ` David Gibson
2022-12-19 10:39           ` Peter Maydell
2022-12-21  1:16             ` David Gibson [this message]
2022-12-21 12:33               ` Peter Maydell
2022-12-21 16:03                 ` Cédric Le Goater
2022-12-21 22:15                   ` Peter Maydell
2022-12-22  1:56                     ` David Gibson
2022-12-13 12:52 ` [RFC PATCH-for-8.0 3/3] hw/net/xilinx_ethlite: Replace tswap32() by be32_to_cpu() Philippe Mathieu-Daudé
2022-12-13 13:53   ` Peter Maydell
2022-12-13 13:54     ` Edgar E. Iglesias
2022-12-13 14:18       ` Peter Maydell
2022-12-13 14:23         ` Edgar E. Iglesias
2022-12-13 15:22           ` Peter Maydell
2022-12-13 15:41             ` Edgar E. Iglesias
2024-04-22 12:46     ` Philippe Mathieu-Daudé
2022-12-13 16:56 ` [RFC PATCH-for-8.0 0/3] hw/ppc: Remove tswap() calls Cédric Le Goater

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=Y6JeXJn1qCkeIzuz@yekko \
    --to=david@gibson.dropbear.id.au \
    --cc=alex.bennee@linaro.org \
    --cc=alistair@alistair23.me \
    --cc=balaton@eik.bme.hu \
    --cc=clg@kaod.org \
    --cc=danielhb413@gmail.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=groug@kaod.org \
    --cc=jasowang@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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).