From patchwork Sat Jun 28 16:45:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 365286 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 26CFF1400B5 for ; Sun, 29 Jun 2014 02:46:14 +1000 (EST) Received: from localhost ([::1]:55317 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0vlU-0002mQ-9q for incoming@patchwork.ozlabs.org; Sat, 28 Jun 2014 12:46:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46070) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0vky-00028Z-RZ for qemu-devel@nongnu.org; Sat, 28 Jun 2014 12:45:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X0vks-0005gg-Qs for qemu-devel@nongnu.org; Sat, 28 Jun 2014 12:45:40 -0400 Received: from mail-pa0-x22e.google.com ([2607:f8b0:400e:c03::22e]:35317) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0vks-0005gW-JS; Sat, 28 Jun 2014 12:45:34 -0400 Received: by mail-pa0-f46.google.com with SMTP id eu11so6154088pac.5 for ; Sat, 28 Jun 2014 09:45:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZFZRfym7CskviHPZ3GHRVPWzXxN2Q1Xer2l1KU++G5s=; b=Bia0XPqMxsv/Q2U+9ZbBT3/qrA8/UHwcDN91PJZBkJ/979iNa2raBs6A8aFO8sFnuw BwDlQmXHSEKyQcZA30eyvwlPumMFwao5EKM42wWed3JMfc06L9MigeVAkHuIOoaVZBRx v3vD4Pi7k5REFyFyeUEH8pNUg4l7+3DGlMvtr8g7iPILGNA/nkbl1hyCH9hPQ3hyBj/6 prS+DPardyU5M0WDWHXH0IMIiRq5jNh95xha9KYO0nEYAtxQiLhIy+FLGj4tZUTni8qc EhCsRAu0uwkkLicxOYk+SIBq3s7jihNCZ1CMnNITpQ5DCxQZrQHpmVWKXOeJo4w3xwNW KE3Q== X-Received: by 10.68.250.3 with SMTP id yy3mr40139014pbc.56.1403973933543; Sat, 28 Jun 2014 09:45:33 -0700 (PDT) Received: from pike.twiddle.home (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPSA id vc5sm70043713pac.19.2014.06.28.09.45.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 28 Jun 2014 09:45:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 28 Jun 2014 09:45:27 -0700 Message-Id: <1403973928-9717-2-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1403973928-9717-1-git-send-email-rth@twiddle.net> References: <1403973928-9717-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::22e Cc: Aldy Hernandez , qemu-ppc@nongnu.org, agraf@suse.de Subject: [Qemu-devel] [PATCH 1/2] target-ppc: Change default cpu for ppc64le-linux-user 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 The default, 970fx, doesn't support MSR_LE. So even though we set LE in ppc_cpu_reset, it gets cleared again in hreg_store_msr. Error out if a user-selected cpu model doesn't support LE. Cc: Aldy Hernandez Signed-off-by: Richard Henderson --- The warning one gets from the unimplemented insns from tcg is perhaps unfortunate, but it's better than silently dropping the MSR_LE bit and interpreting the first few insns with the wrong endianness and generating SIGILL. One could, perhaps, simply return false from need_byteswap. But then the value of MSR would still be wrong, and I can imagine that would affect gdb's interpretation of the current mode. r~ --- linux-user/main.c | 10 +++++++--- target-ppc/translate_init.c | 4 ++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/linux-user/main.c b/linux-user/main.c index 900a17f..058b08c 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -3901,11 +3901,15 @@ int main(int argc, char **argv, char **envp) #elif defined TARGET_OPENRISC cpu_model = "or1200"; #elif defined(TARGET_PPC) -#ifdef TARGET_PPC64 +# ifdef TARGET_PPC64 +# ifdef TARGET_WORDS_BIGENDIAN cpu_model = "970fx"; -#else +# else + cpu_model = "POWER7"; +# endif +# else cpu_model = "750"; -#endif +# endif #else cpu_model = "any"; #endif diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c index 85581c9..72128d8 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -9538,6 +9538,10 @@ static void ppc_cpu_reset(CPUState *s) #endif #if !defined(TARGET_WORDS_BIGENDIAN) msr |= (target_ulong)1 << MSR_LE; /* Little-endian user mode */ + if (!((env->msr_mask >> MSR_LE) & 1)) { + fprintf(stderr, "Selected CPU does not support little-endian.\n"); + exit(1); + } #endif #endif