From patchwork Fri Dec 29 06:31:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 122908 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4334354qgn; Thu, 28 Dec 2017 22:49:47 -0800 (PST) X-Google-Smtp-Source: ACJfBov5yVd+7qnqn9PUjk6n+W9zJ59xkNY1f+TOwwqN8BhtmZ7QziKkAUq+ZmSljFiRNuJo+2qj X-Received: by 10.37.210.74 with SMTP id j71mr9873467ybg.235.1514530187462; Thu, 28 Dec 2017 22:49:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514530187; cv=none; d=google.com; s=arc-20160816; b=vwg2x0xQxZ94Fw7Sy+s3I87miFbG5I3uuKOLLrYyq4V5gzbAuZhBVjaDjbOucSwmnC axobPhhRqu3A0orqIoY8qUIEakSPGxX6EgLqQUrSz0QzXdXwSPtyC5HJX8SesThSX6+B hMq3nq9RdmuSg6ng0HgEV5FWtQnQUmPNrMrYSuPKOdreGeZ/DLsiFXuIjfxNjp0CTQgG n9BxZkjdv+jGMUOJL/veZ9+mtYuJVHQuodGIEp6GWbpLQv7BtgD/xqoBNr7g9PTdV8Qj xlqptVvDvfFzVUyDcXzYP9IMx+Qn8aRsESR78GW4bvjEbGT4asmbs1Xit282ppapOc6g ZjgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=+us8RmkLBnBl/vZMzW4reA81r/U10xADoedk+XnCXdY=; b=C+TfCpYfQI1qjkHL3PVRyf1nbihTNf1Ewu+iatE1DroZtFX5ayj0kStXuEw+T8uiv7 yPjiG9sw2jdEVKf7oFjL9N5mRqSi8Kze2jatWcZW9vytXaZ4cseBNyq48oGIGVu877VL 83r1Q77M44i0rGSIClBW+EiQgHKjVkSGyVxoKqsrQAhXxtU4i2Y+liQKI/lnJOkhzT+J klwG91yAxfuYFp0AdtIpb6EWwJIRkh59Hd5LzDX3a+kpdYCVNfNiK3JS5Trm0guLcwFG dRRmcQfdDW9ZORodJT7ifdmvNbkwX4OPwj/Qa7zAv3PP/UpzaQUAdVqwwQ08raE+DLFV 1Xkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Hc5UqLQs; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id r16si4433843ybc.718.2017.12.28.22.49.47 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 28 Dec 2017 22:49:47 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Hc5UqLQs; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57029 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eUoUE-00014T-Q9 for patch@linaro.org; Fri, 29 Dec 2017 01:49:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eUoDP-0003FH-SW for qemu-devel@nongnu.org; Fri, 29 Dec 2017 01:32:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eUoDO-0004oO-Kn for qemu-devel@nongnu.org; Fri, 29 Dec 2017 01:32:23 -0500 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:33814) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eUoDO-0004nx-Db for qemu-devel@nongnu.org; Fri, 29 Dec 2017 01:32:22 -0500 Received: by mail-pf0-x243.google.com with SMTP id a90so21833572pfk.1 for ; Thu, 28 Dec 2017 22:32:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+us8RmkLBnBl/vZMzW4reA81r/U10xADoedk+XnCXdY=; b=Hc5UqLQswTt1v7ElH+mlbjM0TqkVtH4NgBYD3vQyAO7dPWpOr4xTMnmYA6ZFW8Tbco N7JIP52kEharQ9qu+im1MPuLlu4MtWHizM8bUEMngAfWCEyX5Oy4djXVU2PlS+r22IYF jBeRHFtkewdXPIsjexcwG0OOh1vGgSh8GkJXc= 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=+us8RmkLBnBl/vZMzW4reA81r/U10xADoedk+XnCXdY=; b=KA0X/fJsWu5Umx+G13g8HAXJN0ETvSThHSQwD4BdiXs25uMJa+rv40LmmwnBe7N9pj DF38/gM4VIzAvBOHUMe7MU95RQuvj/b8+1ItrYqv/Kq+VhoDrz2WnpC4nm6oHe/LCTCI 4SV7IYb4MuNi9qa4uljYGRGO0jjn1UT2yPykIEOT2XWz7eTFJY9ahcV2Bnr19XiwG9et 5D0qT/XQBQYX28iBLrwKRp+4H+7kUMZh12mBd3QII/o+osaPjIMzzEoJjJqSfrpTIYYh VgUgFRKNIVKMjeXks1m1LtpqSv6Qb7ILgf3qhM8GSZ86di4TjLKU3UznL9tDQweNTioP JnRQ== X-Gm-Message-State: AKGB3mL0i/dgRo29A7kSxI8sVRtpZQYHzQVMJmlrCaz444/pDAC08eQA IWqICf1zx4d9HGwGmQ5fTlovB2t0e8E= X-Received: by 10.98.204.198 with SMTP id j67mr34379744pfk.41.1514529141200; Thu, 28 Dec 2017 22:32:21 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-183-164.tukw.qwest.net. [97.113.183.164]) by smtp.gmail.com with ESMTPSA id c28sm76539063pfe.69.2017.12.28.22.32.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Dec 2017 22:32:20 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 28 Dec 2017 22:31:32 -0800 Message-Id: <20171229063145.29167-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171229063145.29167-1-richard.henderson@linaro.org> References: <20171229063145.29167-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::243 Subject: [Qemu-devel] [PATCH 25/38] target/hppa: Implement LPA 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: deller@gmx.de Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- target/hppa/cpu.h | 1 + target/hppa/helper.h | 1 + target/hppa/mem_helper.c | 13 +++++++++++++ target/hppa/op_helper.c | 10 +++++----- target/hppa/translate.c | 30 ++++++++++++++++++++++++++++++ 5 files changed, 50 insertions(+), 5 deletions(-) -- 2.14.3 diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 156dbfd761..c072f55d31 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -346,5 +346,6 @@ int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx, extern const MemoryRegionOps hppa_io_eir_ops; void hppa_cpu_alarm_timer(void *); #endif +void QEMU_NORETURN hppa_dynamic_excp(CPUHPPAState *env, int excp, uintptr_t ra); #endif /* HPPA_CPU_H */ diff --git a/target/hppa/helper.h b/target/hppa/helper.h index f059ddf3b9..1e733b7926 100644 --- a/target/hppa/helper.h +++ b/target/hppa/helper.h @@ -90,4 +90,5 @@ DEF_HELPER_FLAGS_3(itlba, TCG_CALL_NO_RWG, void, env, tl, tr) DEF_HELPER_FLAGS_3(itlbp, TCG_CALL_NO_RWG, void, env, tl, tr) DEF_HELPER_FLAGS_2(ptlb, TCG_CALL_NO_RWG, void, env, tl) DEF_HELPER_FLAGS_1(ptlbe, TCG_CALL_NO_RWG, void, env) +DEF_HELPER_FLAGS_2(lpa, TCG_CALL_NO_WG, tr, env, tl) #endif diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index b5e2e35908..9d93894019 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -305,4 +305,17 @@ void HELPER(ptlbe)(CPUHPPAState *env) memset(env->tlb, 0, sizeof(env->tlb)); tlb_flush_by_mmuidx(src, 0xf); } + +target_ureg HELPER(lpa)(CPUHPPAState *env, target_ulong addr) +{ + hwaddr phys; + int prot, excp; + + excp = hppa_get_physical_address(env, addr, MMU_KERNEL_IDX, + MMU_DATA_LOAD, &phys, &prot); + if (excp == EXCP_DTLB_MISS) { + hppa_dynamic_excp(env, EXCP_NA_DTLB_MISS, GETPC()); + } + return phys; +} #endif /* CONFIG_USER_ONLY */ diff --git a/target/hppa/op_helper.c b/target/hppa/op_helper.c index 6d19cab6c9..d270f94e31 100644 --- a/target/hppa/op_helper.c +++ b/target/hppa/op_helper.c @@ -34,7 +34,7 @@ void QEMU_NORETURN HELPER(excp)(CPUHPPAState *env, int excp) cpu_loop_exit(cs); } -static void QEMU_NORETURN dynexcp(CPUHPPAState *env, int excp, uintptr_t ra) +void QEMU_NORETURN hppa_dynamic_excp(CPUHPPAState *env, int excp, uintptr_t ra) { HPPACPU *cpu = hppa_env_get_cpu(env); CPUState *cs = CPU(cpu); @@ -46,14 +46,14 @@ static void QEMU_NORETURN dynexcp(CPUHPPAState *env, int excp, uintptr_t ra) void HELPER(tsv)(CPUHPPAState *env, target_ureg cond) { if (unlikely((target_sreg)cond < 0)) { - dynexcp(env, EXCP_OVERFLOW, GETPC()); + hppa_dynamic_excp(env, EXCP_OVERFLOW, GETPC()); } } void HELPER(tcond)(CPUHPPAState *env, target_ureg cond) { if (unlikely(cond)) { - dynexcp(env, EXCP_COND, GETPC()); + hppa_dynamic_excp(env, EXCP_COND, GETPC()); } } @@ -237,7 +237,7 @@ static void update_fr0_op(CPUHPPAState *env, uintptr_t ra) env->fr[0] = (uint64_t)shadow << 32; if (hard_exp & shadow) { - dynexcp(env, EXCP_ASSIST, ra); + hppa_dynamic_excp(env, EXCP_ASSIST, ra); } } @@ -645,7 +645,7 @@ target_ureg HELPER(swap_system_mask)(CPUHPPAState *env, target_ureg nsm) /* ??? On second reading this condition simply seems to be undefined rather than a diagnosed trap. */ if (nsm & ~psw & PSW_Q) { - dynexcp(env, EXCP_ILL, GETPC()); + hppa_dynamic_excp(env, EXCP_ILL, GETPC()); } env->psw = (psw & ~PSW_SM) | (nsm & PSW_SM); return psw & PSW_SM; diff --git a/target/hppa/translate.c b/target/hppa/translate.c index ef953cd1d5..ec61c57e55 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -2424,6 +2424,35 @@ static DisasJumpType trans_pxtlbx(DisasContext *ctx, uint32_t insn, return nullify_end(ctx, !is_data && (ctx->base.tb->flags & PSW_C) ? DISAS_IAQ_N_STALE : DISAS_NEXT); } + +static DisasJumpType trans_lpa(DisasContext *ctx, uint32_t insn, + const DisasInsn *di) +{ + unsigned rt = extract32(insn, 0, 5); + unsigned m = extract32(insn, 5, 1); + unsigned sp = extract32(insn, 14, 2); + unsigned rx = extract32(insn, 16, 5); + unsigned rb = extract32(insn, 21, 5); + TCGv_tl vaddr; + TCGv_reg ofs, paddr; + + CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR); + nullify_over(ctx); + + form_gva(ctx, &vaddr, &ofs, rb, rx, 0, 0, sp, m, false); + + paddr = tcg_temp_new(); + gen_helper_lpa(paddr, cpu_env, vaddr); + + /* Note that physical address result overrides base modification. */ + if (m) { + save_gpr(ctx, rb, ofs); + } + save_gpr(ctx, rt, paddr); + tcg_temp_free(paddr); + + return nullify_end(ctx, DISAS_NEXT); +} #endif /* !CONFIG_USER_ONLY */ static const DisasInsn table_mem_mgmt[] = { @@ -2451,6 +2480,7 @@ static const DisasInsn table_mem_mgmt[] = { { 0x04000240u, 0xfc001fdfu, trans_pxtlbx }, /* pitlbe */ { 0x04001200u, 0xfc001fdfu, trans_pxtlbx }, /* pdtlb */ { 0x04001240u, 0xfc001fdfu, trans_pxtlbx }, /* pdtlbe */ + { 0x04001340u, 0xfc003fc0u, trans_lpa }, #endif };