From patchwork Thu Sep 8 07:32:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?C=C3=A9dric_Le_Goater?= X-Patchwork-Id: 9320741 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2178D6077F for ; Thu, 8 Sep 2016 09:20:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14E672974C for ; Thu, 8 Sep 2016 09:20:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0901E2974F; Thu, 8 Sep 2016 09:20:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C56E42974C for ; Thu, 8 Sep 2016 09:20:09 +0000 (UTC) Received: from localhost ([::1]:46546 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhvVA-0008TI-Fe for patchwork-qemu-devel@patchwork.kernel.org; Thu, 08 Sep 2016 05:20:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44164) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhtpc-0001Kl-Ua for qemu-devel@nongnu.org; Thu, 08 Sep 2016 03:33:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhtpZ-0006rW-R1 for qemu-devel@nongnu.org; Thu, 08 Sep 2016 03:33:08 -0400 Received: from 6.mo173.mail-out.ovh.net ([46.105.43.93]:58372) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhtpZ-0006r8-Lj for qemu-devel@nongnu.org; Thu, 08 Sep 2016 03:33:05 -0400 Received: from player711.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo173.mail-out.ovh.net (Postfix) with ESMTP id CA8F8100CA28 for ; Thu, 8 Sep 2016 09:33:04 +0200 (CEST) Received: from hermes.kaod.org.com (LFbn-1-2234-107.w90-76.abo.wanadoo.fr [90.76.55.107]) (Authenticated sender: clg@kaod.org) by player711.ha.ovh.net (Postfix) with ESMTPSA id 0E3243800BC; Thu, 8 Sep 2016 09:32:54 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-ppc@nongnu.org Date: Thu, 8 Sep 2016 09:32:42 +0200 Message-Id: <1473319962-27591-1-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Ovh-Tracer-Id: 1454381207144926035 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeeluddriedugddvkeeiucdltddurdefledtrddttddmucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 46.105.43.93 Subject: [Qemu-devel] [PATCH] ppc: restrict the use of the rfi instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Mark Cave-Ayland , Alexander Graf , qemu-devel@nongnu.org, Cedric Le Goater , David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Benjamin Herrenschmidt Power ISA 2.x has deleted the rfi instruction and rfid shoud be used instead on cpus following this instruction set or later. This will raise an invalid exception when rfi is used on such processors: Book3S 64-bit processors. Signed-off-by: Benjamin Herrenschmidt Reviewed-by: David Gibson [clg: the required fix in openbios, commit b747b6acc272 ('ppc: use rfid when running under a CPU from the 970 family.'), is now merged in qemu under commit 5cebd885d0d2 ('Update OpenBIOS images to b747b6a built from submodule.') ] Signed-off-by: Cédric Le Goater --- target-ppc/translate.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) Index: qemu-dgibson-for-2.8.git/target-ppc/translate.c =================================================================== --- qemu-dgibson-for-2.8.git.orig/target-ppc/translate.c +++ qemu-dgibson-for-2.8.git/target-ppc/translate.c @@ -3585,10 +3585,13 @@ static void gen_rfi(DisasContext *ctx) #if defined(CONFIG_USER_ONLY) GEN_PRIV; #else - /* FIXME: This instruction doesn't exist anymore on 64-bit server - * processors compliant with arch 2.x, we should remove it there, - * but we need to fix OpenBIOS not to use it on 970 first + /* This instruction doesn't exist anymore on 64-bit server + * processors compliant with arch 2.x */ + if (ctx->insns_flags & PPC_SEGMENT_64B) { + gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); + return; + } /* Restore CPU state */ CHK_SV; gen_update_cfar(ctx, ctx->nip - 4);