From patchwork Mon Jan 22 03:41:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 125310 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp948045ljf; Sun, 21 Jan 2018 20:00:33 -0800 (PST) X-Google-Smtp-Source: AH8x227omVb5bDaPvgbYlh3ryJjguOa30FQrG8loIBfkNZ9aaiaPTibt6NGWk6G75MilfFcjIppr X-Received: by 10.129.88.70 with SMTP id m67mr6003651ywb.352.1516593632901; Sun, 21 Jan 2018 20:00:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516593632; cv=none; d=google.com; s=arc-20160816; b=WdbmR0JU7BcJTN+oOn/2lLw/k3frRKenLiWhW33JmPv7vn1gDTmxFHMYm05JHG7NfL CJ9pyzNaO8Z0hION6N/RaI0/pgLEli+g838XZbRZhV04fRTTdVPw/79s5PP0GVWEuYtN NfU3mGcYDOMMxYgCtwIElWBKP7iJgi3oubspRUQZhApuKXZ8eZ3obD882zWaJLc6glaY jc114HTATdLO0BsoI+hO2+qVKDbuBptxX8HZvi1whxCCDPdIbTH/AF5snFM2PIWXTVfZ fGAEkaqeTXxQD8F4BJ7auNmHSrcalPpBl8z+Wsw8Y9B6gN3Mh6VYhHnP3+WQl7mROISx JeOQ== 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=YqGaWrSkk8n2CzVQlDNC4wooKg9lp5QRQVhVZ9nZ7po=; b=P8pRjl+X5TZsQ+/SAcXgZGVsaHnyGL6zjTs5dOnZjb/3WTDyWDO5jgU5vbX5yPxx2+ HmkWogdysl6mQvV658qvBGxEPW5KLMqJs3Owcd0GGNZldoVwOoK156w4B/KZEnoGPxu7 c/2t9IkbXBvJ63AnPRoxr5EB0LwFBQXlB8MC3BunM8EU0OT+bK9ewnhZfetBPJSwgSHa SnRAXcnVB1ZWtGVUKTdoatmnyNEGu5+IaI4I64vOO5hqIkBqURRFFTJhSAJRhDTTq9eb 7Frwr8SHIk/EXSY2qYIwW/fzuuKaMUgWcB3Z7VkJn5gioBLMscPN1rYzfV58ZQnC7uSu mWow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=G+nYNg+z; 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 f27si585867ybj.291.2018.01.21.20.00.32 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 21 Jan 2018 20:00:32 -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=G+nYNg+z; 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]:41723 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edTHc-00018F-Ad for patch@linaro.org; Sun, 21 Jan 2018 23:00:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60278) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1edT0Y-0005eJ-F7 for qemu-devel@nongnu.org; Sun, 21 Jan 2018 22:42:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1edT0X-0006aZ-F6 for qemu-devel@nongnu.org; Sun, 21 Jan 2018 22:42:54 -0500 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]:43968) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1edT0X-0006a8-8j for qemu-devel@nongnu.org; Sun, 21 Jan 2018 22:42:53 -0500 Received: by mail-pg0-x241.google.com with SMTP id n17so6074665pgf.10 for ; Sun, 21 Jan 2018 19:42:53 -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=YqGaWrSkk8n2CzVQlDNC4wooKg9lp5QRQVhVZ9nZ7po=; b=G+nYNg+zaQZoYBpK3vtDSf6BjaYQDJ3mdKsk/UyL3oH9s0GHTKHnIROKHlpNgpBYGB f/U78VM9UbPIHMRb4JU5ZgNORY2rL21dcOvgCafrTZtfILlgfMo0t/mcN9E7e81ZTE/2 dmRT2nUw4uh7b13SZgAqT6aim/QqIlAyx0FNE= 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=YqGaWrSkk8n2CzVQlDNC4wooKg9lp5QRQVhVZ9nZ7po=; b=b4elLlirEVSZJ5/IKBw6ueUqG+B9SktKZ1QjZ7UFDI2hD6ZWIeDgxfkMmF04ndcnN9 xxWMvFvUzlaig3/g/Zq8x20cZSNKkLhbPlHTlwu0zV3rGdmvApO2I5H/BI05JHEmhL22 EXYTXojvg5uYLT4wBFv1r2dRM4Jfw01aTAx1rrm5tcboQk63m/01nCujuZJ+Jq215WGL vFy9fzw76G6Bse9DQKP4uqBi6nC9ZF7PRPtj/s+wr4Y/vEFEMTVPhOPASPM2F3mbnCnx fXuX0sJ/6hgrEuh1AcV7pvvPOyuXY5HQ6J+en4H/n9CCqe6Qe5T2u47w0xbmGSOPzi7I ZMpA== X-Gm-Message-State: AKwxytd9pOJARideJWHA9or8L1UFtjxuQbDkFLqjQg21qBqbm8srkzs6 sAG43aS2M76EhJcZ3URYu15sqA0N9+k= X-Received: by 10.99.115.16 with SMTP id o16mr6165543pgc.362.1516592571890; Sun, 21 Jan 2018 19:42:51 -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 z125sm182023pfz.27.2018.01.21.19.42.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 21 Jan 2018 19:42:51 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 21 Jan 2018 19:41:56 -0800 Message-Id: <20180122034217.19593-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180122034217.19593-1-richard.henderson@linaro.org> References: <20180122034217.19593-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::241 Subject: [Qemu-devel] [PULL 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 9d4bf132d6..b5e2e35908 100644 --- a/target/hppa/mem_helper.c +++ b/target/hppa/mem_helper.c @@ -268,4 +268,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 af84f4d55f..44e566837d 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -2386,6 +2386,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[] = { @@ -2409,6 +2445,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 };