From: Greg Kurz Date: Tue, 24 Jun 2014 17:51:19 +0000 (+0200) Subject: target-ppc: enable virtio endian ambivalent support X-Git-Tag: qemu-xen-4.6.0-rc1~342^2~2 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=7826c2b2a46988c278fbea5e1e376cf783f8bc46;p=qemu-upstream-unstable.git target-ppc: enable virtio endian ambivalent support The device endianness is the cpu endianness at device reset time. Signed-off-by: Greg Kurz Reviewed-by: Alexander Graf Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h index 08ae527cb..b64c65295 100644 --- a/target-ppc/cpu.h +++ b/target-ppc/cpu.h @@ -29,6 +29,8 @@ #define TARGET_LONG_BITS 64 #define TARGET_PAGE_BITS 12 +#define TARGET_IS_BIENDIAN 1 + /* Note that the official physical address space bits is 62-M where M is implementation dependent. I've not looked up M for the set of cpus we emulate at the system level. */ diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c index a3bb336e1..2ab281069 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -9597,6 +9597,18 @@ static void ppc_cpu_reset(CPUState *s) tlb_flush(s, 1); } +#ifndef CONFIG_USER_ONLY +static bool ppc_cpu_is_big_endian(CPUState *cs) +{ + PowerPCCPU *cpu = POWERPC_CPU(cs); + CPUPPCState *env = &cpu->env; + + cpu_synchronize_state(cs); + + return !msr_le; +} +#endif + static void ppc_cpu_initfn(Object *obj) { CPUState *cs = CPU(obj); @@ -9692,6 +9704,9 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data) #else cc->gdb_core_xml_file = "power-core.xml"; #endif +#ifndef CONFIG_USER_ONLY + cc->virtio_is_big_endian = ppc_cpu_is_big_endian; +#endif dc->fw_name = "PowerPC,UNKNOWN"; }