From patchwork Fri Dec 29 06:31:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 122901 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4330412qgn; Thu, 28 Dec 2017 22:44:36 -0800 (PST) X-Google-Smtp-Source: ACJfBoteS3JSpExatO8RPKZkbO6UDx4fx+BtzII/NJ/Qxyia4zjipJkz52sY5hZWJQ5Nl1s6VOTL X-Received: by 10.37.1.9 with SMTP id 9mr13732460ybb.186.1514529876628; Thu, 28 Dec 2017 22:44:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514529876; cv=none; d=google.com; s=arc-20160816; b=w55lvGC5+V8BnAZ/zrdzgPIc795KE8cw6HPh16GBeCo/rwitpr8/Kwmc0V4/PNN2mv WbwuM0ekk4YTfSPv6CyReMP605Ahyec03Xfb15pwZ2SiaPx7UHafz1H9+F0IUsBBe8J6 2JHcYzP+DXKyC+HxG0L9TuAnrn7TspphH/q+FtVd3YdnD38KOq+7er3uJu5GXhX6VIcx WNpgLjJbktbubS97CS1vhjOLWzFJHcIFXGuZgxKvP7VNqsvfOzN6g7Z+c16KIhlYurO/ pDEoLgRkEiP5Y9J1t3h31nyie3Q6yJCTjI/WX1mCr/NYHjA4TLnkZPj9ASI2c3Lh33gn CQ4g== 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=hEwv2hTLNhQ7DpGGZifp3uMw1zFof7ZdHPmwD1VCcw4=; b=boUdYXhoyUH4cUVvb7o3kB4hpLgiF3N+uYoOzzU/fIx2ayFhH0HYXGVUu4W5UX3axD tWSI5mT+6gdPZP4/2CZNDPFn1VIB4EyaIH4U0qgMJSxEdiEFYiJZvkGlTDUHlbQob9Bh 5vQlY7c3TC+LdMDyMJ0/DRxM9Nnw80uCdKlKs4r4SO3T+GeFi/JXbZ4OzulL/lR447tq 4MVP2iwYyvnRu+RKGxQ8r/YKborgHjWqe73Iw6khVOh1u88nuUAd7jy4Ij0L6+GrH6ZU sRvvkXiUuUbyRh8usfOfJg4YN30YFyAypjXkrYG/vjOo052pwaX8Bbo3kqQrR26NJ9X6 yxEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=BkHTwmud; 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 n74si6765809ywd.456.2017.12.28.22.44.36 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 28 Dec 2017 22:44:36 -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=BkHTwmud; 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]:56990 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eUoPE-0004AW-3P for patch@linaro.org; Fri, 29 Dec 2017 01:44:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eUoDN-00036k-8l for qemu-devel@nongnu.org; Fri, 29 Dec 2017 01:32:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eUoDM-0004n4-5s for qemu-devel@nongnu.org; Fri, 29 Dec 2017 01:32:21 -0500 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:36035) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eUoDM-0004mf-0P for qemu-devel@nongnu.org; Fri, 29 Dec 2017 01:32:20 -0500 Received: by mail-pg0-x242.google.com with SMTP id k134so20702353pga.3 for ; Thu, 28 Dec 2017 22:32:19 -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=hEwv2hTLNhQ7DpGGZifp3uMw1zFof7ZdHPmwD1VCcw4=; b=BkHTwmudfmMqtxcQ6/521Idj2kAthmDkA5Lq8BW0++KxPuYLxawPuIJ7uaTI1gk/aT ExfdlVmovYUbV4Swur/qpGi80UvrEdftw/+MFgwmGzGpbuL099VDQt1B7gCNUXyS2Hav Tn51gT8tV0U8YuTvuFFWClNw+gSLFKg4Zn6yU= 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=hEwv2hTLNhQ7DpGGZifp3uMw1zFof7ZdHPmwD1VCcw4=; b=YAMIFoZGK2q+uOAjUXU5u5DQntbO62wb4QMKwAILmN0FTkuOq36UothE2J/z8VxcPr afcMvP6ilVmcSP68TTAT8t/gm+vp/lD9dolwD1W0W79btDkieZt9m01Jn73TJ+WiFUVc MtjnssxnluIH1xXVhKxwRbmTGpaClug90o6AGFNggzmGSkFeK2K2mKYtuIaVfGRhfDBb 34xVU+I1SofAJHeOcKTG9ByETTmi9puz+EFODihdBXkHeYbgbcNNVwqA3G+dQrq2xFdx /3Wfys0P1IfXZAJxSdKGu0qQs0zpOmfnb575U1i7m6TanYDrhHGDzE2dxmR9655pvWmM aVWQ== X-Gm-Message-State: AKGB3mJgN/XdyXEHkJxdMX3H8495YEpMlYooKUoJd//rFTCmaqJkciQ2 3tASqOAUWvw+38Rt4UcQaex/KomabYc= X-Received: by 10.98.223.217 with SMTP id d86mr34443946pfl.190.1514529138680; Thu, 28 Dec 2017 22:32:18 -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.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Dec 2017 22:32:17 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 28 Dec 2017 22:31:30 -0800 Message-Id: <20171229063145.29167-24-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:c05::242 Subject: [Qemu-devel] [PATCH 23/38] 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: deller@gmx.de 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 13ac727583..2c3c582913 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -2388,6 +2388,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[] = { @@ -2411,6 +2447,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 };