[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v9 11/22] cpu: introduce CPUClass::virtio_is_big_end
From: |
Greg Kurz |
Subject: |
[Qemu-devel] [PATCH v9 11/22] cpu: introduce CPUClass::virtio_is_big_endian() |
Date: |
Tue, 24 Jun 2014 19:33:21 +0200 |
User-agent: |
StGit/0.17-dirty |
If we want to support targets that can change endianness (modern PPC and
ARM for the moment), we need to add a per-CPU class method to be called
from the virtio code. The virtio_ prefix in the name is a hint for people
to avoid misusage (aka. anywhere but from the virtio code).
The default behaviour is to return the compile-time default target
endianness.
Suggested-by: Peter Maydell <address@hidden>
Signed-off-by: Greg Kurz <address@hidden>
---
Changes since v8:
- removed the globally visible cpu_virtio_is_big_endian() helper (code is
now called directly from virtio, see next patch)
include/qom/cpu.h | 1 +
qom/cpu.c | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 4b352a2..1aafbf5 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -116,6 +116,7 @@ typedef struct CPUClass {
CPUUnassignedAccess do_unassigned_access;
void (*do_unaligned_access)(CPUState *cpu, vaddr addr,
int is_write, int is_user, uintptr_t retaddr);
+ bool (*virtio_is_big_endian)(CPUState *cpu);
int (*memory_rw_debug)(CPUState *cpu, vaddr addr,
uint8_t *buf, int len, bool is_write);
void (*dump_state)(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
diff --git a/qom/cpu.c b/qom/cpu.c
index fada2d4..b32dd0a 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -196,6 +196,11 @@ static int cpu_common_gdb_write_register(CPUState *cpu,
uint8_t *buf, int reg)
return 0;
}
+bool target_words_bigendian(void);
+static bool cpu_common_virtio_is_big_endian(CPUState *cpu)
+{
+ return target_words_bigendian();
+}
void cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
int flags)
@@ -334,6 +339,7 @@ static void cpu_class_init(ObjectClass *klass, void *data)
k->write_elf64_note = cpu_common_write_elf64_note;
k->gdb_read_register = cpu_common_gdb_read_register;
k->gdb_write_register = cpu_common_gdb_write_register;
+ k->virtio_is_big_endian = cpu_common_virtio_is_big_endian;
dc->realize = cpu_common_realizefn;
/*
* Reason: CPUs still need special care by board code: wiring up
- [Qemu-devel] [PATCH v9 02/22] virtio-serial: don't migrate the config space, (continued)
- [Qemu-devel] [PATCH v9 02/22] virtio-serial: don't migrate the config space, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 03/22] virtio: introduce device specific migration calls, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 04/22] virtio-net: implement per-device migration calls, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 05/22] virtio-blk: implement per-device migration calls, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 06/22] virtio-serial: implement per-device migration calls, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 07/22] virtio-balloon: implement per-device migration calls, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 08/22] virtio-rng: implement per-device migration calls, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 09/22] virtio: add subsections to the migration stream, Greg Kurz, 2014/06/24
- Re: [Qemu-devel] [PATCH v9 00/22] legacy virtio support for cross-endian targets, Michael S. Tsirkin, 2014/06/24
- [Qemu-devel] [PATCH v9 10/22] exec: introduce target_words_bigendian() helper, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 11/22] cpu: introduce CPUClass::virtio_is_big_endian(),
Greg Kurz <=
- [Qemu-devel] [PATCH v9 12/22] virtio: add endian-ambivalent support to VirtIODevice, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 13/22] virtio: memory accessors for endian-ambivalent targets, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 14/22] virtio: allow byte swapping for vring, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 15/22] virtio-net: use virtio wrappers to access headers, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 16/22] virtio-balloon: use virtio wrappers to access page frame numbers, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 17/22] virtio-blk: use virtio wrappers to access headers, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 18/22] virtio-scsi: use virtio wrappers to access headers, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 19/22] virtio-serial-bus: use virtio wrappers to access headers, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 20/22] virtio-9p: use virtio wrappers to access headers, Greg Kurz, 2014/06/24
- [Qemu-devel] [PATCH v9 21/22] target-ppc: enable virtio endian ambivalent support, Greg Kurz, 2014/06/24