From patchwork Tue Jun 7 01:36:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 9159691 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 6A92560572 for ; Tue, 7 Jun 2016 01:37:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5ADF425E13 for ; Tue, 7 Jun 2016 01:37:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F7212833E; Tue, 7 Jun 2016 01:37:59 +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 7956825E13 for ; Tue, 7 Jun 2016 01:37:56 +0000 (UTC) Received: from localhost ([::1]:46367 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bA5xq-0000uB-JR for patchwork-qemu-devel@patchwork.kernel.org; Mon, 06 Jun 2016 21:37:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55655) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bA5xN-0000sA-Hc for qemu-devel@nongnu.org; Mon, 06 Jun 2016 21:37:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bA5xI-0005FE-Ir for qemu-devel@nongnu.org; Mon, 06 Jun 2016 21:37:25 -0400 Received: from gate.crashing.org ([63.228.1.57]:48385) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bA5xI-0005Eo-8t; Mon, 06 Jun 2016 21:37:20 -0400 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id u571arYU010287; Mon, 6 Jun 2016 20:36:55 -0500 Message-ID: <1465263413.23889.6.camel@kernel.crashing.org> From: Benjamin Herrenschmidt To: qemu-ppc@nongnu.org Date: Tue, 07 Jun 2016 11:36:53 +1000 X-Mailer: Evolution 3.18.5.2 (3.18.5.2-1.fc23) Mime-Version: 1.0 X-MIME-Autoconverted: from 8bit to base64 by gate.crashing.org id u571arYU010287 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 63.228.1.57 Subject: [Qemu-devel] [PATCH 2/6] ppc: POWER7 has lq/stq instructions and stq need to check ISA version 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: =?ISO-8859-1?Q?C=E9dric?= Le Goater , qemu-devel@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The PPC_64BX instruction flag is used for a couple of newer instructions currently on POWER8 but our implementation for them works for POWER7 too (and already does the proper checking of what is permitted) with one exception: stq needs to check the ISA version. This fixes the latter and add the instructions to POWER7 Signed-off-by: Benjamin Herrenschmidt ---  target-ppc/translate.c      | 5 ++++-  target-ppc/translate_init.c | 2 +-  2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/target-ppc/translate.c b/target-ppc/translate.c index ab5862f..b34289f 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -3047,10 +3047,13 @@ static void gen_std(DisasContext *ctx)        rs = rS(ctx->opcode);      if ((ctx->opcode & 0x3) == 0x2) { /* stq */ -          bool legal_in_user_mode = (ctx->insns_flags2 & PPC2_LSQ_ISA207) != 0;          bool le_is_supported = (ctx->insns_flags2 & PPC2_LSQ_ISA207) != 0;   +        if (!(ctx->insns_flags & PPC_64BX)) { +            gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); +        } +          if (!legal_in_user_mode && ctx->pr) {              gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);              return; diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c index ad6f2f3..a1db500 100644 --- a/target-ppc/translate_init.c +++ b/target-ppc/translate_init.c @@ -8377,7 +8377,7 @@ POWERPC_FAMILY(POWER7)(ObjectClass *oc, void *data)                         PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |                         PPC_MEM_SYNC | PPC_MEM_EIEIO |                         PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | -                       PPC_64B | PPC_64H | PPC_ALTIVEC | +                       PPC_64B | PPC_64H | PPC_64BX | PPC_ALTIVEC |                         PPC_SEGMENT_64B | PPC_SLBI |                         PPC_POPCNTB | PPC_POPCNTWD;      pcc->insns_flags2 = PPC2_VSX | PPC2_DFP | PPC2_DBRX | PPC2_ISA205 |