From patchwork Sun Jan 28 23:15:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 126112 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp1984155ljd; Sun, 28 Jan 2018 15:37:15 -0800 (PST) X-Google-Smtp-Source: AH8x225cVuOe4Z60EB+FerApv/byEIw+jPzPEuX+kr1AQTvnU9SNTxjJCN/MEIwg0zVpr8nRMkzA X-Received: by 10.129.81.22 with SMTP id f22mr15940358ywb.233.1517182635144; Sun, 28 Jan 2018 15:37:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517182635; cv=none; d=google.com; s=arc-20160816; b=ulqOKTIF2Hw8IRmwwKNGeuIx2wxZ5HdUAap+63q29XOTz5RJFWJCDRaQY04Mlrn1Ty Rworx1NULxE9rrjhGVxSJwJZaHWqwPQkzDWieUDYQ+XBzvdLVpcVb2Ias1WKmVohS+ho 48ryVs4K1g6i1lX/BFDdSevEsy++4sorJpiah9o0koevZ2tYoTdqCN86hj+BRJ4+9OCo oWKB9ZqiE1onAJRu8I7cpWBRLqh71bKdpPbMZP1C2ZCrErQm9N//3YUYAMRD/w8NmnpH 5vEMYJa7C6KbXV7ULtMrSXSs4HeqDSqNX6JH1pjvbhhCT839Ol2J5p42FB7LsTietwKB UGgg== 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=y2bUQfhJAxjVMnWycTeRIbRUxRE5+Dgre/9GBry8JSM=; b=smarZA21XJtXT5+e/rb2F1ukA8ceOriBB80m/96kbNLm0zRlPay3sET+OxH7eZj4Jp cVtFd3BssKQOILiA8s1HC4aZEuUUBhncKWjanEmH5xheqNOpT6z5gQ1yU+aQdGKZh6xw oQ35dOeiPZ+Ms5/AYRC5F+whCwMHvJnHWhL9SCWYj0z0MEFkl4vutxfgxtJ9Fma0lou1 ctZxX86Vxv4TPDJNnoZghlhICCm2HwRHvKQuXtr8jnay21TrGSdWOScVCKQyItl2Q+Ki knPP+VKEgU1kYLBis4OpXQWFKGGyasTE4bdN0Y8bld1ZAlUHrG0q//0nhgkPHC1Adyne 626w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=J7z/jhTZ; 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 y188si1819362ywc.710.2018.01.28.15.37.14 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 28 Jan 2018 15:37:15 -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=J7z/jhTZ; 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]:45033 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1efwVe-0001D0-FO for patch@linaro.org; Sun, 28 Jan 2018 18:37:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1efwBI-0002xX-2U for qemu-devel@nongnu.org; Sun, 28 Jan 2018 18:16:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1efwBD-00006e-3u for qemu-devel@nongnu.org; Sun, 28 Jan 2018 18:16:12 -0500 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:36869) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1efwBC-00005y-Td for qemu-devel@nongnu.org; Sun, 28 Jan 2018 18:16:07 -0500 Received: by mail-pg0-x244.google.com with SMTP id z17so3006742pgc.4 for ; Sun, 28 Jan 2018 15:16:06 -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=y2bUQfhJAxjVMnWycTeRIbRUxRE5+Dgre/9GBry8JSM=; b=J7z/jhTZ8yKuvmKeDvcFnpdvH2i0uc99cSRH7cEY8HwnTFYlYLXQCf0QtHQfC73sdG 9jtKHJBlAV4+8fq7M0bptIjqKa7cODSbYE/rxNQvzBF33c5I1oma4V9j+kjqDIHnBumK +H/jh1owvG1IAT5iYHTnoPlE10YjYjTgc89Sk= 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=y2bUQfhJAxjVMnWycTeRIbRUxRE5+Dgre/9GBry8JSM=; b=p2lLHbh6sU/iSB/kKtozot/RjZOuqEgGp6+9oKAHavm+ycylLuapw1u2TEO56Ixb/8 U3m1a4csDzZCEtVE7ViY6bGxjfv2MUVDw4Zz69Lf8o1/JWUWQRJmx64bor3VZvhPyzXp VKzvgmtJZ8RD/EmG0eC2HlWekYmYFJUjjficQh00cxc/szPsJPNxUEc4zlw4FaP2qcEe AX0wpwPbe4co8s4DEcQkJxJry+hev8LZ+/SVSjfqdcYSkj2nXTqtrQuI0STY4AYwGybH 9CrDzSZW0R1AWpMymdxY7srOdwz1rHf/tw2UVKXYoacwiuhD7Sj2SCoWyPohW0LCtJZ9 RcMA== X-Gm-Message-State: AKwxytfk5B3E0CrKSNlQ32jSX5YaikiCmLy+N2VaO6JbyQF1NNQ9w35M 1LwGQo9ArdkdKb+5a0xbnx8J//ahahw= X-Received: by 10.98.35.203 with SMTP id q72mr25162592pfj.40.1517181365629; Sun, 28 Jan 2018 15:16:05 -0800 (PST) Received: from cloudburst.twiddle.net (174-21-6-47.tukw.qwest.net. [174.21.6.47]) by smtp.gmail.com with ESMTPSA id r27sm26949344pfj.75.2018.01.28.15.16.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Jan 2018 15:16:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 28 Jan 2018 15:15:07 -0800 Message-Id: <20180128231528.22719-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180128231528.22719-1-richard.henderson@linaro.org> References: <20180128231528.22719-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:c05::244 Subject: [Qemu-devel] [PULL v4 22/43] target/hppa: Implement P*TLB and P*TLBE insns 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We now have all of the TLB manipulation instructions. Signed-off-by: Richard Henderson --- target/hppa/helper.h | 2 ++ target/hppa/mem_helper.c | 37 +++++++++++++++++++++++++++++++++++++ target/hppa/translate.c | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+) -- 2.14.3 diff --git a/target/hppa/helper.h b/target/hppa/helper.h index d412093914..f059ddf3b9 100644 --- a/target/hppa/helper.h +++ b/target/hppa/helper.h @@ -88,4 +88,6 @@ DEF_HELPER_FLAGS_2(write_eiem, TCG_CALL_NO_RWG, void, env, tr) DEF_HELPER_FLAGS_2(swap_system_mask, TCG_CALL_NO_RWG, tr, env, tr) 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) #endif diff --git a/target/hppa/mem_helper.c b/target/hppa/mem_helper.c index 47f630d268..df245533e4 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -277,4 +277,41 @@ void HELPER(itlbp)(CPUHPPAState *env, target_ulong addr, target_ureg reg) ent->t = extract32(reg, 29, 1); ent->entry_valid = 1; } + +/* Purge (Insn/Data) TLB. This is explicitly page-based, and is + synchronous across all processors. */ +static void ptlb_work(CPUState *cpu, run_on_cpu_data data) +{ + CPUHPPAState *env = cpu->env_ptr; + target_ulong addr = (target_ulong) data.target_ptr; + hppa_tlb_entry *ent = hppa_find_tlb(env, addr); + + if (ent && ent->entry_valid) { + hppa_flush_tlb_ent(env, ent); + } +} + +void HELPER(ptlb)(CPUHPPAState *env, target_ulong addr) +{ + CPUState *src = CPU(hppa_env_get_cpu(env)); + CPUState *cpu; + run_on_cpu_data data = RUN_ON_CPU_TARGET_PTR(addr); + + CPU_FOREACH(cpu) { + if (cpu != src) { + async_run_on_cpu(cpu, ptlb_work, data); + } + } + async_safe_run_on_cpu(src, ptlb_work, data); +} + +/* Purge (Insn/Data) TLB entry. This affects an implementation-defined + number of pages/entries (we choose all), and is local to the cpu. */ +void HELPER(ptlbe)(CPUHPPAState *env) +{ + CPUState *src = CPU(hppa_env_get_cpu(env)); + + memset(env->tlb, 0, sizeof(env->tlb)); + tlb_flush_by_mmuidx(src, 0xf); +} #endif /* CONFIG_USER_ONLY */ diff --git a/target/hppa/translate.c b/target/hppa/translate.c index c02d107041..5b77688fc0 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -2397,6 +2397,42 @@ static DisasJumpType trans_ixtlbx(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_pxtlbx(DisasContext *ctx, uint32_t insn, + const DisasInsn *di) +{ + unsigned m = extract32(insn, 5, 1); + unsigned sp; + unsigned rx = extract32(insn, 16, 5); + unsigned rb = extract32(insn, 21, 5); + unsigned is_data = insn & 0x1000; + unsigned is_local = insn & 0x40; + TCGv_tl addr; + TCGv_reg ofs; + + if (is_data) { + sp = extract32(insn, 14, 2); + } else { + sp = ~assemble_sr3(insn); + } + + CHECK_MOST_PRIVILEGED(EXCP_PRIV_OPR); + nullify_over(ctx); + + form_gva(ctx, &addr, &ofs, rb, rx, 0, 0, sp, m, false); + if (m) { + save_gpr(ctx, rb, ofs); + } + if (is_local) { + gen_helper_ptlbe(cpu_env); + } else { + gen_helper_ptlb(cpu_env, addr); + } + + /* Exit TB for TLB change if mmu is enabled. */ + return nullify_end(ctx, !is_data && (ctx->base.tb->flags & PSW_C) + ? DISAS_IAQ_N_STALE : DISAS_NEXT); +} #endif /* !CONFIG_USER_ONLY */ static const DisasInsn table_mem_mgmt[] = { @@ -2420,6 +2456,10 @@ static const DisasInsn table_mem_mgmt[] = { { 0x04000040u, 0xfc001fffu, trans_ixtlbx }, /* iitlba */ { 0x04001000u, 0xfc001fffu, trans_ixtlbx }, /* idtlbp */ { 0x04001040u, 0xfc001fffu, trans_ixtlbx }, /* idtlba */ + { 0x04000200u, 0xfc001fdfu, trans_pxtlbx }, /* pitlb */ + { 0x04000240u, 0xfc001fdfu, trans_pxtlbx }, /* pitlbe */ + { 0x04001200u, 0xfc001fdfu, trans_pxtlbx }, /* pdtlb */ + { 0x04001240u, 0xfc001fdfu, trans_pxtlbx }, /* pdtlbe */ #endif };