[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 24/37] exec: introduce target_words_bigendian() helpe
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 24/37] exec: introduce target_words_bigendian() helper |
Date: |
Sun, 29 Jun 2014 19:59:28 +0300 |
From: Greg Kurz <address@hidden>
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>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
include/hw/virtio/virtio.h | 6 ++++++
exec.c | 8 ++------
hw/virtio/virtio-pci.c | 3 ---
3 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 3505ce5..9000ee2 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -255,4 +255,10 @@ void virtio_queue_set_host_notifier_fd_handler(VirtQueue
*vq, bool assign,
bool set_handler);
void virtio_queue_notify_vq(VirtQueue *vq);
void virtio_irq(VirtQueue *vq);
+
+bool target_words_bigendian(void);
+static inline bool virtio_is_big_endian(void)
+{
+ return target_words_bigendian();
+}
#endif
diff --git a/exec.c b/exec.c
index a94c583..18d6c35 100644
--- a/exec.c
+++ b/exec.c
@@ -2759,14 +2759,12 @@ 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);
+bool target_words_bigendian(void)
{
#if defined(TARGET_WORDS_BIGENDIAN)
return true;
@@ -2775,8 +2773,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 57e1e61..e11f759 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);
--
MST
- [Qemu-devel] [PULL 14/37] vhost-user: typo fixups, (continued)
- [Qemu-devel] [PULL 14/37] vhost-user: typo fixups, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 15/37] virtio-net: byteswap virtio-net header, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 17/37] virtio: introduce device specific migration calls, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 16/37] virtio-serial: don't migrate the config space, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 18/37] virtio-net: implement per-device migration calls, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 19/37] virtio-blk: implement per-device migration calls, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 20/37] virtio-serial: implement per-device migration calls, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 21/37] virtio-balloon: implement per-device migration calls, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 22/37] virtio-rng: implement per-device migration calls, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 23/37] virtio: add subsections to the migration stream, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 24/37] exec: introduce target_words_bigendian() helper,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 25/37] cpu: introduce CPUClass::virtio_is_big_endian(), Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 26/37] virtio: add endian-ambivalent support to VirtIODevice, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 27/37] virtio: memory accessors for endian-ambivalent targets, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 28/37] virtio: allow byte swapping for vring, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 29/37] virtio-net: use virtio wrappers to access headers, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 30/37] virtio-balloon: use virtio wrappers to access page frame numbers, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 31/37] virtio-blk: use virtio wrappers to access headers, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 32/37] virtio-scsi: use virtio wrappers to access headers, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 33/37] virtio-serial-bus: use virtio wrappers to access headers, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 34/37] virtio-9p: use virtio wrappers to access headers, Michael S. Tsirkin, 2014/06/29