[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v8 09/20] exec: introduce target_words_bigendian
From: |
Greg Kurz |
Subject: |
Re: [Qemu-devel] [PATCH v8 09/20] exec: introduce target_words_bigendian() helper |
Date: |
Fri, 13 Jun 2014 14:05:35 +0200 |
On Fri, 13 Jun 2014 13:41:42 +0200
Alexander Graf <address@hidden> wrote:
>
> On 13.06.14 13:21, Greg Kurz wrote:
> > We currently have a virtio_is_big_endian() helper that provides the target
> > endianness to the virtio code. As of today, the helper returns a fixed
> > compile-time value. Of course, this will have to change if we want to
> > support target endianness changes at run-time.
> >
> > Let's move the TARGET_WORDS_BIGENDIAN bits out to a new helper and have
> > virtio_is_big_endian() implemented on top of it.
> >
> > This patch doesn't change any functionality.
> >
> > Signed-off-by: Greg Kurz <address@hidden>
> > ---
> > exec.c | 11 +----------
> > hw/virtio/virtio-pci.c | 3 ---
> > include/exec/cpu-common.h | 1 +
> > include/hw/virtio/virtio.h | 5 +++++
> > 4 files changed, 7 insertions(+), 13 deletions(-)
> >
> > diff --git a/exec.c b/exec.c
> > index 4e179a6..a7d4431 100644
> > --- a/exec.c
> > +++ b/exec.c
> > @@ -2738,14 +2738,7 @@ int cpu_memory_rw_debug(CPUState *cpu, target_ulong
> > addr,
> > }
> > #endif
> >
> > -#if !defined(CONFIG_USER_ONLY)
> > -
> > -/*
> > - * A helper function for the _utterly broken_ virtio device model to find
> > out if
> > - * it's running on a big endian machine. Don't do this at home kids!
> > - */
> > -bool virtio_is_big_endian(void);
> > -bool virtio_is_big_endian(void)
> > +bool target_words_bigendian(void)
> > {
> > #if defined(TARGET_WORDS_BIGENDIAN)
> > return true;
> > @@ -2754,8 +2747,6 @@ bool virtio_is_big_endian(void)
> > #endif
> > }
> >
> > -#endif
> > -
> > #ifndef CONFIG_USER_ONLY
> > bool cpu_physical_memory_is_io(hwaddr phys_addr)
> > {
> > diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> > index ce97514..390c8d2 100644
> > --- a/hw/virtio/virtio-pci.c
> > +++ b/hw/virtio/virtio-pci.c
> > @@ -89,9 +89,6 @@
> > /* Flags track per-device state like workarounds for quirks in older
> > guests. */
> > #define VIRTIO_PCI_FLAG_BUS_MASTER_BUG (1 << 0)
> >
> > -/* HACK for virtio to determine if it's running a big endian guest */
> > -bool virtio_is_big_endian(void);
> > -
> > static void virtio_pci_bus_new(VirtioBusState *bus, size_t bus_size,
> > VirtIOPCIProxy *dev);
> >
> > diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
> > index a21b65a..eb798c1 100644
> > --- a/include/exec/cpu-common.h
> > +++ b/include/exec/cpu-common.h
> > @@ -122,4 +122,5 @@ void qemu_ram_foreach_block(RAMBlockIterFunc func, void
> > *opaque);
> >
> > #endif
> >
> > +bool target_words_bigendian(void);
>
> Please don't make this function globally available - usually no code in
> hw/ should know about this except for virtio. Put it in a virtio header
> instead.
>
>
> Alex
>
Oops... sure I'll fix that.
--
Gregory Kurz address@hidden
address@hidden
Software Engineer @ IBM/Meiosys http://www.ibm.com
Tel +33 (0)562 165 496
"Anarchy is about taking complete responsibility for yourself."
Alan Moore.
- Re: [Qemu-devel] [PATCH v8 01/20] virtio-serial: don't migrate the config space, (continued)
- [Qemu-devel] [PATCH v8 02/20] virtio: introduce device specific migration calls, Greg Kurz, 2014/06/13
- [Qemu-devel] [PATCH v8 03/20] virtio-net: implement per-device migration calls, Greg Kurz, 2014/06/13
- [Qemu-devel] [PATCH v8 04/20] virtio-blk: implement per-device migration calls, Greg Kurz, 2014/06/13
- [Qemu-devel] [PATCH v8 05/20] virtio-serial: implement per-device migration calls, Greg Kurz, 2014/06/13
- [Qemu-devel] [PATCH v8 06/20] virtio-balloon: implement per-device migration calls, Greg Kurz, 2014/06/13
- [Qemu-devel] [PATCH v8 07/20] virtio-rng: implement per-device migration calls, Greg Kurz, 2014/06/13
- [Qemu-devel] [PATCH v8 08/20] virtio: add subsections to the migration stream, Greg Kurz, 2014/06/13
- [Qemu-devel] [PATCH v8 09/20] exec: introduce target_words_bigendian() helper, Greg Kurz, 2014/06/13
- [Qemu-devel] [PATCH v8 10/20] cpu: introduce CPUClass::virtio_is_big_endian(), Greg Kurz, 2014/06/13
- [Qemu-devel] [PATCH v8 11/20] virtio: add endian-ambivalent support to VirtIODevice, Greg Kurz, 2014/06/13
[Qemu-devel] [PATCH v8 12/20] virtio: memory accessors for endian-ambivalent targets, Greg Kurz, 2014/06/13
[Qemu-devel] [PATCH v8 13/20] virtio: allow byte swapping for vring, Greg Kurz, 2014/06/13