From patchwork Tue Apr 27 15:31:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 51086 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 30E44B6EEB for ; Wed, 28 Apr 2010 01:36:12 +1000 (EST) Received: from localhost ([127.0.0.1]:48008 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O6mpV-0003pm-HD for incoming@patchwork.ozlabs.org; Tue, 27 Apr 2010 11:36:09 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O6mkt-0002KF-9H for qemu-devel@nongnu.org; Tue, 27 Apr 2010 11:31:23 -0400 Received: from [140.186.70.92] (port=41010 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O6mkr-0002Ia-Cu for qemu-devel@nongnu.org; Tue, 27 Apr 2010 11:31:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O6mki-0001sc-W8 for qemu-devel@nongnu.org; Tue, 27 Apr 2010 11:31:19 -0400 Received: from smtp27.orange.fr ([80.12.242.94]:50465) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O6mki-0001ro-Mj for qemu-devel@nongnu.org; Tue, 27 Apr 2010 11:31:12 -0400 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2728.orange.fr (SMTP Server) with ESMTP id 982B91C00605; Tue, 27 Apr 2010 17:31:11 +0200 (CEST) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2728.orange.fr (SMTP Server) with ESMTP id 8A33F1C006D7; Tue, 27 Apr 2010 17:31:11 +0200 (CEST) Received: from tmonjalo-laptop (LPuteaux-156-15-47-90.w82-127.abo.wanadoo.fr [82.127.74.90]) by mwinf2728.orange.fr (SMTP Server) with ESMTP id 58F161C0062F; Tue, 27 Apr 2010 17:31:11 +0200 (CEST) X-ME-UUID: 20100427153111364.58F161C0062F@mwinf2728.orange.fr From: Thomas Monjalon To: qemu-devel@nongnu.org Date: Tue, 27 Apr 2010 17:31:09 +0200 Message-Id: X-Mailer: git-send-email 1.7.1 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Blue Swirl Subject: [Qemu-devel] [PATCH v2 4/5] target-ppc: fix RFI by clearing upper bytes of MSR X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Thomas Monjalon Since commit 2ada0ed, "Return From Interrupt" is broken for PPC processors because the upper bits (POW, TGPR, ILE) of MSR were not cleared. Below is a representation of MSR bits: 0 .. 12 13 14 15 16 .. 23 24 .. 31 ————— POW TGPR ILE EE PR FP ME FE0 SE BE FE1 CE IP IR DR —— RI LE Only the 2 lower bytes (16-31) of MSR are saved to SRR1 before an interrupt. So only these bytes should be restored and the upper ones (0-15) cleared. But, referring to commit 2ada0ed, clearing all the upper bytes breaks Altivec. The compromise is to clear the well known bits (13-15). Regarding RFID, since the 32 lower bits of MSR are the same in 64-bit, the same mask as RFI should apply to RFID. Signed-off-by: Thomas Monjalon Cc: Blue Swirl --- target-ppc/op_helper.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c index 8f2ee98..2bf2ce1 100644 --- a/target-ppc/op_helper.c +++ b/target-ppc/op_helper.c @@ -1646,20 +1646,20 @@ static inline void do_rfi(target_ulong nip, target_ulong msr, void helper_rfi (void) { do_rfi(env->spr[SPR_SRR0], env->spr[SPR_SRR1], - ~((target_ulong)0x0), 1); + ~((target_ulong)0x00070000), 1); } #if defined(TARGET_PPC64) void helper_rfid (void) { do_rfi(env->spr[SPR_SRR0], env->spr[SPR_SRR1], - ~((target_ulong)0x0), 0); + ~((target_ulong)0x00070000), 0); } void helper_hrfid (void) { do_rfi(env->spr[SPR_HSRR0], env->spr[SPR_HSRR1], - ~((target_ulong)0x0), 0); + ~((target_ulong)0x00070000), 0); } #endif #endif