qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-ppc] [PATCH v3 1/6] libqos: add PPC64 PCI support


From: Greg Kurz
Subject: Re: [Qemu-ppc] [PATCH v3 1/6] libqos: add PPC64 PCI support
Date: Wed, 5 Oct 2016 21:33:06 +0200

On Wed, 5 Oct 2016 09:34:05 +0200
Greg Kurz <address@hidden> wrote:
> On Wed, 5 Oct 2016 12:14:05 +1100
> David Gibson <address@hidden> wrote:
> [...]
> You convinced me. The tswaps in qtest.c are toxic and should be removed.
> 
> Thanks for the clarification.
> 

Rewind. Cedric and I spent the whole day thinking about that, based on
Peter's inputs. The conclusion is: the qtest accelerator replaces the
real world CPU and and the test program simulates what the CPU actually
does when running the guest driver code in a specific situation.

If the guest driver performs a store to the device, and the CPU and
device have different endianness, cpu_to_xxYY() in the driver code
boils down to bswapYY(). Doing things like writel(cpu_to_beYY()) in
the test program is thus wrong since it involves the host endianness,
and the test program no longer simulates what the real CPU would do.
The test program must hence do writel(bswapYY()) and send that to qtest.

If the host endianness differs from the simulated CPU, the value is in
wrong order and must be byteswapped before being handed over to the memory
layer.

This explains why qtest calls tswapYY() before cpu_physical_memory_write().

Cheers.

--
Greg

Attachment: pgpxKbbxa0QLn.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]