From patchwork Fri Mar 2 09:59:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederic Konrad X-Patchwork-Id: 10254917 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 0FF06602B5 for ; Fri, 2 Mar 2018 15:07:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3093289E9 for ; Fri, 2 Mar 2018 15:07:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E782A289EC; Fri, 2 Mar 2018 15:07:01 +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 EBEA8289E9 for ; Fri, 2 Mar 2018 15:07:00 +0000 (UTC) Received: from localhost ([::1]:35642 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ermGs-0001pO-MN for patchwork-qemu-devel@patchwork.kernel.org; Fri, 02 Mar 2018 10:06:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erhTW-0002N5-Aj for qemu-devel@nongnu.org; Fri, 02 Mar 2018 04:59:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1erhTT-00040k-8i for qemu-devel@nongnu.org; Fri, 02 Mar 2018 04:59:38 -0500 Received: from mel.act-europe.fr ([194.98.77.210]:53687 helo=smtp.eu.adacore.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1erhTT-00040O-0K for qemu-devel@nongnu.org; Fri, 02 Mar 2018 04:59:35 -0500 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 5D04281380; Fri, 2 Mar 2018 10:59:32 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at eu.adacore.com Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FBijRLSVwL1H; Fri, 2 Mar 2018 10:59:32 +0100 (CET) Received: from localhost.localdomain (unknown [46.218.167.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id A73D5815A8; Fri, 2 Mar 2018 10:59:31 +0100 (CET) From: KONRAD Frederic To: qemu-devel@nongnu.org Date: Fri, 2 Mar 2018 10:59:25 +0100 Message-Id: <1519984765-15748-1-git-send-email-konrad@adacore.com> X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 194.98.77.210 X-Mailman-Approved-At: Fri, 02 Mar 2018 10:03:33 -0500 Subject: [Qemu-devel] [PATCH] sparc: fix leon3 casa instruction when MMU is disabled 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: frederic.konrad@adacore.com, mark.cave-ayland@ilande.co.uk, rth@twiddle.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: KONRAD Frederic Since the commit af7a06bac7d3abb2da48ef3277d2a415772d2ae8: `casa [..](10), .., ..` (and probably others alternate space instructions) triggers a data access exception when the MMU is disabled. When we enter get_asi(...) dc->mem_idx is set to MMU_PHYS_IDX when the MMU is disabled. Just keep mem_idx unchanged in this case so we passthrough the MMU when it is disabled. Signed-off-by: KONRAD Frederic Reviewed-by: Richard Henderson --- Notes: Changes RFC -> V1: * emit the instruction with MMU_PHYS_IDX instead of checking that the MMU is enabled in get_physical_address(..) target/sparc/translate.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/sparc/translate.c b/target/sparc/translate.c index 71e0853..5aa367a 100644 --- a/target/sparc/translate.c +++ b/target/sparc/translate.c @@ -2093,6 +2093,11 @@ static DisasASI get_asi(DisasContext *dc, int insn, TCGMemOp memop) type = GET_ASI_BFILL; break; } + + /* MMU_PHYS_IDX is used when the MMU is disabled to passthrough the + * permissions check in get_physical_address(..). + */ + mem_idx = (dc->mem_idx == MMU_PHYS_IDX) ? MMU_PHYS_IDX : mem_idx; } else { gen_exception(dc, TT_PRIV_INSN); type = GET_ASI_EXCP;