From patchwork Wed Jan 18 22:38:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artyom Tarasenko X-Patchwork-Id: 716879 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3v3hnD13jzz9t23 for ; Thu, 19 Jan 2017 09:42:40 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="dPiGPn/S"; dkim-atps=neutral Received: from localhost ([::1]:44794 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cTyw9-0000my-Gs for incoming@patchwork.ozlabs.org; Wed, 18 Jan 2017 17:42:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36675) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cTysp-0006Go-QQ for qemu-devel@nongnu.org; Wed, 18 Jan 2017 17:39:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cTysl-0002Vk-2O for qemu-devel@nongnu.org; Wed, 18 Jan 2017 17:39:11 -0500 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:34267) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cTysk-0002VK-Sw for qemu-devel@nongnu.org; Wed, 18 Jan 2017 17:39:07 -0500 Received: by mail-wm0-x241.google.com with SMTP id c85so7555317wmi.1 for ; Wed, 18 Jan 2017 14:39:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TJpZyBzat5edWBY0CrOkvkuKYWdczxUhw62Pj9zIb28=; b=dPiGPn/SQrZiWYI8HjgGveCZMQwk/2sph3JovGmbE0wXdIbTdlUlB9chnrrIQwLspt 4q+XPaG6yHXrv+LCZFQtR59bhBjQPqSrBMogM1Xrvm/rtaPJ/U0rqyacKbEe5zbGsGEh qaY8sSQTMLQqRdCOxOXQA4SyE4RFa9P2MIYp/2aDX9YyHukV54ZCbpHqxSqd3SoLle6e sIN+0z29BmxJYdc7zbWx+BZUkO5MQHQLi/aWx+iCTwe3f7SRIlYKYPW3/Sjb1U8igaUi N1UIbrzH0y8+gkejkpnEqaJ3n1NBrn3cGoXBj/+7g5FGKqn5ogALQb6QdDqs+ciAxdbK fb4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TJpZyBzat5edWBY0CrOkvkuKYWdczxUhw62Pj9zIb28=; b=YI0EQL9um7G+NpezY8WRFTAvodF0wJ3o7rbeaUnmpBS1XPjJLsa01UY9tf/OxEJ96G gF9J8tS9vAie64h2F9SVR64bCromUrC8nHR88EWxSB6Y/eAub8WcQ8f/dOEyNoUwXjWU JSke52m9K895IuDtpaWjThqStOPm2WT9E1EDYZz4wb8XAgN0NQNur6WhxF9CBNhILWHR J5lei31GFv57wrX9TEI0HdSLSGHT/lckD+GU6kOjl9KwAnVPdT4DoBuHtIKSsFp0LS3H IQRoYbujST5fUz93DgE6cB0mHw7ZH3Xd3nxyexoc0XJzHLGUC+oFQd3+AT/ZhMJ17yPc CYNg== X-Gm-Message-State: AIkVDXJgWfreL9bMrQvOcS8uGObadD89OybDqsTXgFH1PoNJFUMeJayLcMSpqJYlvYc2xw== X-Received: by 10.28.178.16 with SMTP id b16mr24637253wmf.83.1484779145785; Wed, 18 Jan 2017 14:39:05 -0800 (PST) Received: from localhost (x4e33e2b8.dyn.telefonica.de. [78.51.226.184]) by smtp.gmail.com with ESMTPSA id r6sm7961807wmd.4.2017.01.18.14.39.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jan 2017 14:39:05 -0800 (PST) From: Artyom Tarasenko To: peter.maydell@linaro.org Date: Wed, 18 Jan 2017 23:38:14 +0100 Message-Id: <1484779123-18968-2-git-send-email-atar4qemu@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1484779123-18968-1-git-send-email-atar4qemu@gmail.com> References: <1484779123-18968-1-git-send-email-atar4qemu@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 01/30] target-sparc: ignore MMU-faults if MMU is disabled in hypervisor 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: mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, Artyom Tarasenko , rth@twiddle.net Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" while IMMU/DMMU is disabled - ignore MMU-faults in hypervisorv mode or if CPU doesn't have hypervisor - signal TT_INSN_REAL_TRANSLATION_MISS/TT_DATA_REAL_TRANSLATION_MISS otherwise Signed-off-by: Artyom Tarasenko --- target/sparc/cpu.h | 2 ++ target/sparc/ldst_helper.c | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h index 601c018..e815a19 100644 --- a/target/sparc/cpu.h +++ b/target/sparc/cpu.h @@ -68,6 +68,8 @@ #define TT_DATA_ACCESS 0x32 #define TT_UNALIGNED 0x34 #define TT_PRIV_ACT 0x37 +#define TT_INSN_REAL_TRANSLATION_MISS 0x3e +#define TT_DATA_REAL_TRANSLATION_MISS 0x3f #define TT_EXTINT 0x40 #define TT_IVEC 0x60 #define TT_TMISS 0x64 diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c index a0171f7..e479efd 100644 --- a/target/sparc/ldst_helper.c +++ b/target/sparc/ldst_helper.c @@ -1664,14 +1664,25 @@ void sparc_cpu_unassigned_access(CPUState *cs, hwaddr addr, { SPARCCPU *cpu = SPARC_CPU(cs); CPUSPARCState *env = &cpu->env; - int tt = is_exec ? TT_CODE_ACCESS : TT_DATA_ACCESS; #ifdef DEBUG_UNASSIGNED printf("Unassigned mem access to " TARGET_FMT_plx " from " TARGET_FMT_lx "\n", addr, env->pc); #endif - cpu_raise_exception_ra(env, tt, GETPC()); + if (is_exec) { /* XXX has_hypervisor */ + if (env->lsu & (IMMU_E)) { + cpu_raise_exception_ra(env, TT_CODE_ACCESS, GETPC()); + } else if (cpu_has_hypervisor(env) && !(env->hpstate & HS_PRIV)) { + cpu_raise_exception_ra(env, TT_INSN_REAL_TRANSLATION_MISS, GETPC()); + } + } else { + if (env->lsu & (DMMU_E)) { + cpu_raise_exception_ra(env, TT_DATA_ACCESS, GETPC()); + } else if (cpu_has_hypervisor(env) && !(env->hpstate & HS_PRIV)) { + cpu_raise_exception_ra(env, TT_DATA_REAL_TRANSLATION_MISS, GETPC()); + } + } } #endif #endif