From patchwork Tue Jun 7 10:48:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 9160651 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 F30EA60467 for ; Tue, 7 Jun 2016 11:35:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E33D2265F9 for ; Tue, 7 Jun 2016 11:35:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7EC5281D2; Tue, 7 Jun 2016 11:35:49 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 307A1265F9 for ; Tue, 7 Jun 2016 11:35:49 +0000 (UTC) Received: from localhost ([::1]:48756 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAFIS-0006T4-8T for patchwork-qemu-devel@patchwork.kernel.org; Tue, 07 Jun 2016 07:35:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAEYf-00071F-L9 for qemu-devel@nongnu.org; Tue, 07 Jun 2016 06:48:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAEYZ-00057e-IY for qemu-devel@nongnu.org; Tue, 07 Jun 2016 06:48:29 -0400 Received: from ozlabs.org ([103.22.144.67]:49146) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAEYZ-000553-6i; Tue, 07 Jun 2016 06:48:23 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3rP7Zq14srz9t5s; Tue, 7 Jun 2016 20:48:17 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1465296499; bh=oMVPXlOydPQ0YowMW6NKHygshp4b/G+1LkoHeGr6HaQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A5ztbHVm8rPDlWMINhwFHNyRg7AmocAw9AVdxcPR3FJNV+OK6lnLstp5VVqDlp3ay ohD/BtzqSUj5DS0EOYegz+v5GSE+FN1JhauuOTOmg5efXqS6UQbAi74TXiRvgk3MGF 2+u7qKX+rlXuyypzbkyqiYjI2kc2b6Vvni1unQac= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 7 Jun 2016 20:48:13 +1000 Message-Id: <1465296493-10851-27-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465296493-10851-1-git-send-email-david@gibson.dropbear.id.au> References: <1465296493-10851-1-git-send-email-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PULL 26/26] ppc: Do not take exceptions on unknown SPRs in privileged mode 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: David Gibson , qemu-ppc@nongnu.org, agraf@suse.de, qemu-devel@nongnu.org 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 The architecture specifies that mtspr/mfspr on an unknown SPR number should act as a nop in privileged mode. I haven't removed the warning however as it can be useful for diagnosing. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: David Gibson --- target-ppc/translate.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/target-ppc/translate.c b/target-ppc/translate.c index 2ad4f4a..b689475 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -4351,7 +4351,10 @@ static inline void gen_op_mfspr(DisasContext *ctx) qemu_log("Trying to read invalid spr %d (0x%03x) at " TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - 4); } - gen_inval_exception(ctx, POWERPC_EXCP_INVAL_SPR); + /* Only generate an exception in user space, otherwise this is a nop */ + if (ctx->pr) { + gen_inval_exception(ctx, POWERPC_EXCP_INVAL_SPR); + } } } @@ -4503,7 +4506,11 @@ static void gen_mtspr(DisasContext *ctx) } fprintf(stderr, "Trying to write invalid spr %d (0x%03x) at " TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - 4); - gen_inval_exception(ctx, POWERPC_EXCP_INVAL_SPR); + + /* Only generate an exception in user space, otherwise this is a nop */ + if (ctx->pr) { + gen_inval_exception(ctx, POWERPC_EXCP_INVAL_SPR); + } } }