From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60451) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1ISJ-0000u2-DA for qemu-devel@nongnu.org; Sun, 29 Jun 2014 13:00:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1ISE-0003W8-FC for qemu-devel@nongnu.org; Sun, 29 Jun 2014 12:59:55 -0400 Date: Sun, 29 Jun 2014 20:00:10 +0300 From: "Michael S. Tsirkin" Message-ID: <1404060115-27410-36-git-send-email-mst@redhat.com> References: <1404060115-27410-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1404060115-27410-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 35/37] target-ppc: enable virtio endian ambivalent support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-ppc@nongnu.org, Alexander Graf , Anthony Liguori , Greg Kurz From: Greg Kurz 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 --- target-ppc/cpu.h | 2 ++ target-ppc/translate_init.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h index 08ae527..b64c652 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 a3bb336..2ab2810 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"; } -- MST