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: 880580 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ztCLV5vdzz9sWX for ; Sat, 3 Mar 2018 02:06:26 +1100 (AEDT) Received: from localhost ([::1]:35639 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ermGO-0000yw-Sj for incoming@patchwork.ozlabs.org; Fri, 02 Mar 2018 10:06:24 -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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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;