From patchwork Thu Aug 8 05:15:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rusty Russell X-Patchwork-Id: 265651 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 824202C009A for ; Thu, 8 Aug 2013 15:20:45 +1000 (EST) Received: from localhost ([::1]:55281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7IeR-0005wR-DV for incoming@patchwork.ozlabs.org; Thu, 08 Aug 2013 01:20:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7IcV-0002iq-En for qemu-devel@nongnu.org; Thu, 08 Aug 2013 01:18:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V7IcN-0000FQ-8w for qemu-devel@nongnu.org; Thu, 08 Aug 2013 01:18:43 -0400 Received: from ozlabs.org ([2402:b800:7003:1:1::1]:53864) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7IcM-0000E9-Ua for qemu-devel@nongnu.org; Thu, 08 Aug 2013 01:18:35 -0400 Received: by ozlabs.org (Postfix, from userid 1011) id F3ADB2C00BD; Thu, 8 Aug 2013 15:18:28 +1000 (EST) From: Rusty Russell To: qemu-devel@nongnu.org Date: Thu, 8 Aug 2013 14:45:43 +0930 Message-Id: <1375938949-22622-3-git-send-email-rusty@rustcorp.com.au> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1375938949-22622-1-git-send-email-rusty@rustcorp.com.au> References: <1375938949-22622-1-git-send-email-rusty@rustcorp.com.au> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2402:b800:7003:1:1::1 Cc: Rusty Russell Subject: [Qemu-devel] [PATCH 2/7] target-ppc: ppc64 targets can be either endian. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Rusty Russell --- configure | 1 + target-ppc/misc_helper.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/configure b/configure index ad32f87..cee32af 100755 --- a/configure +++ b/configure @@ -4217,6 +4217,7 @@ case "$target_name" in ppc64) TARGET_BASE_ARCH=ppc TARGET_ABI_DIR=ppc + echo "TARGET_VIRTIO_SWAPENDIAN=y" >> $config_target_mak gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml" ;; ppc64abi32) diff --git a/target-ppc/misc_helper.c b/target-ppc/misc_helper.c index 616aab6..b031586 100644 --- a/target-ppc/misc_helper.c +++ b/target-ppc/misc_helper.c @@ -20,6 +20,7 @@ #include "helper.h" #include "helper_regs.h" +#include "hw/virtio/virtio-access.h" /*****************************************************************************/ /* SPR accesses */ @@ -116,3 +117,10 @@ void ppc_store_msr(CPUPPCState *env, target_ulong value) { hreg_store_msr(env, value, 0); } + +/* Our virtio accesses are LE if the first CPU is LE when they touch + * it. We assume endian doesn't change after that! */ +bool virtio_swap_endian(void) +{ + return first_cpu->hflags & (1 << MSR_LE); +}