From patchwork Tue Mar 23 18:43:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 406945 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp4706081jai; Tue, 23 Mar 2021 11:54:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeSV2TFBGLtzrn0pLUGTk1tFn0y/K1IoZUrfdnS64qg3Udv01QB5zUYQy3d2l5vOQgGoGh X-Received: by 2002:a92:d686:: with SMTP id p6mr5960966iln.268.1616525665792; Tue, 23 Mar 2021 11:54:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616525665; cv=none; d=google.com; s=arc-20160816; b=k4lFUkb9RDeCer3+mKJyxDDuLVtR8gizlBf/2s5tDKj4FLbGk8tG46VwY3QdsP8DZb eWIbOx+Dw8TngcY3mQuKmv4IdhivD8bCViWxhmId9T8U0+6v539U2lOb2Ut70S/ff89h MrPEQ4Cy4jGTFXAzhQiEMIADcGkERIPancK15IdgEf+oZ65TLVOPG3Kw6SxwMrMNf7hO jyBhha+Lg/BSqx4WfgXUsNvlcAxBG44qXzQontT9JzX+CdS5iXsf12fFi9o8hHk3u+sK nETLcS/d3cgyEVOO7fw6SJ5louqkDTw1OfLrTVUZFOJ3HLujq+vsL1GynrDseUZOFW81 Au3w== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=0y0jim2Psup2n6cJG/ney9BoSyKMVklHs3Io6+sGx/4=; b=mZ+vjoRtnOYgOAXnuX+dSjMZVORXefzalrznjwjzgh0v0Xy+ixyv4EV4FH7qbLNye0 KV6DRJdUnFN+UghzpHnrrXV0M/QHpqN31IeWWXtHc53PzFeuSMYZrdIMC3o82hKku90p FIzLtp2hHUpDIoOgelNGqTScJAobvUOMzbQ0hp33FL8SGMBRYVRHzuPivwAAJXxyQ+ld 4P06nZy88HS6oqKvyZbIwwNujvcMDVPFBCiDLnFdZWCB87h6cJ1Ox07m5Gr9fNXWp3e0 LRlgoP8J+UgxjQjCFKrctN+6Aj3RfGc+f2JzaNXPDtmvm1jhJxVsQaH/2gPNNNdbhnny xTEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="sAfD/7jS"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id p7si2558677iol.88.2021.03.23.11.54.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Mar 2021 11:54:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="sAfD/7jS"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:48886 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lOmAb-0001Z4-8H for patch@linaro.org; Tue, 23 Mar 2021 14:54:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lOm0u-0008Ix-M3 for qemu-devel@nongnu.org; Tue, 23 Mar 2021 14:44:26 -0400 Received: from mail-oo1-xc34.google.com ([2607:f8b0:4864:20::c34]:45747) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lOm0P-0003i7-Aq for qemu-devel@nongnu.org; Tue, 23 Mar 2021 14:44:24 -0400 Received: by mail-oo1-xc34.google.com with SMTP id n6-20020a4ac7060000b02901b50acc169fso5176845ooq.12 for ; Tue, 23 Mar 2021 11:43:51 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=0y0jim2Psup2n6cJG/ney9BoSyKMVklHs3Io6+sGx/4=; b=sAfD/7jSD6Ksf0s8u8XkvBnDdPYJ+815xYmIH1Z29UZDcs3nM91npwhsOnHPGHnMHj RRP9wW5nBbbxxWc6+fy8gOHffOvqo/VNptFuSx8ZsAhZP8i1o5WLhRvbfaveM43/CtvL 1+gQfnfKz8fnFYb5xtNF+K1kdNeEuFtGpR7irw+7G5O34h1wO5mVgbjl85//v8X+sWio HDe5qAPt4vQClPUAmVhnnASrEuZkjcvhK/nlg+nZEh0LT4xD14axp8ZDpMNeuDD2Tlws 6x2ap1nNTQtPcjw67nbtUkj1as0EiLSyl85eCKntb59cxD1ugXUviePdxWdRWPQxFLvl GBIw== 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:mime-version:content-transfer-encoding; bh=0y0jim2Psup2n6cJG/ney9BoSyKMVklHs3Io6+sGx/4=; b=OZT957klICv6UVFwV6NVOkKglszhsVx+DApchZj2/DgvHNF1JXZifcQc/Uniu9zq6r iYm/4EEQDTMCrW9b+jgtIQNVw1gOT9H6w8yPA5AaUjMb2jnYrO9svK4WlIRtrnZncwI5 626H47vW8vKN2OVeLjO1wHAxiPRc5Ks02kBic8ObzE6NKp7XSVhSJdgcpsPjHjcxJbW7 GG3RbEVnH3BA7KZlW6o9KaQ+jv5hqlNcXYbCNyKWeNktm51049AA0vDdwe7On5sGW9vo XCEDUTaZDzHNFmYI61jDwu3vEWVdXdKHuDl+aK875O2FpHLbUJ+n7+YXPUhngnuns3m5 y9Xg== X-Gm-Message-State: AOAM530ukJBO6v2YSErH8FLceiwp9g8agx9VMEd4xe4/RlsfWx/lYh8F oAo/7C67+cUfY2E0D/y8PPzKx/LvGxxiABQL X-Received: by 2002:a4a:c706:: with SMTP id n6mr4918636ooq.19.1616525030973; Tue, 23 Mar 2021 11:43:50 -0700 (PDT) Received: from localhost.localdomain (171.189-204-159.bestelclientes.com.mx. [189.204.159.171]) by smtp.gmail.com with ESMTPSA id x23sm3902825ood.28.2021.03.23.11.43.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Mar 2021 11:43:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 06/10] target/ppc: Put LPCR[GTSE] in hflags Date: Tue, 23 Mar 2021 12:43:36 -0600 Message-Id: <20210323184340.619757-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210323184340.619757-1-richard.henderson@linaro.org> References: <20210323184340.619757-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c34; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc34.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Because this bit was not in hflags, the privilege check for tlb instructions was essentially random. Recompute hflags when storing to LPCR. Reviewed-by: David Gibson Signed-off-by: Richard Henderson --- target/ppc/cpu.h | 1 + target/ppc/helper_regs.c | 3 +++ target/ppc/mmu-hash64.c | 3 +++ target/ppc/translate.c | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index d5f362506a..3c28ddb331 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -596,6 +596,7 @@ enum { HFLAGS_LE = 0, /* MSR_LE -- comes from elsewhere on 601 */ HFLAGS_HV = 1, /* computed from MSR_HV and other state */ HFLAGS_64 = 2, /* computed from MSR_CE and MSR_SF */ + HFLAGS_GTSE = 3, /* computed from SPR_LPCR[GTSE] */ HFLAGS_DR = 4, /* MSR_DR */ HFLAGS_IR = 5, /* MSR_IR */ HFLAGS_SPE = 6, /* from MSR_SPE if cpu has SPE; avoid overlap w/ MSR_VR */ diff --git a/target/ppc/helper_regs.c b/target/ppc/helper_regs.c index e345966b6b..f85bb14d1d 100644 --- a/target/ppc/helper_regs.c +++ b/target/ppc/helper_regs.c @@ -149,6 +149,9 @@ void hreg_compute_hflags(CPUPPCState *env) if ((ppc_flags & POWERPC_FLAG_TM) && (msr & (1ull << MSR_TM))) { hflags |= 1 << HFLAGS_TM; } + if (env->spr[SPR_LPCR] & LPCR_GTSE) { + hflags |= 1 << HFLAGS_GTSE; + } #ifndef CONFIG_USER_ONLY if (!env->has_hv_mode || (msr & (1ull << MSR_HV))) { diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c index 0fabc10302..d517a99832 100644 --- a/target/ppc/mmu-hash64.c +++ b/target/ppc/mmu-hash64.c @@ -30,6 +30,7 @@ #include "exec/log.h" #include "hw/hw.h" #include "mmu-book3s-v3.h" +#include "helper_regs.h" /* #define DEBUG_SLB */ @@ -1125,6 +1126,8 @@ void ppc_store_lpcr(PowerPCCPU *cpu, target_ulong val) CPUPPCState *env = &cpu->env; env->spr[SPR_LPCR] = val & pcc->lpcr_mask; + /* The gtse bit affects hflags */ + hreg_compute_hflags(env); } void helper_store_lpcr(CPUPPCState *env, target_ulong val) diff --git a/target/ppc/translate.c b/target/ppc/translate.c index d48c554290..5e629291d3 100644 --- a/target/ppc/translate.c +++ b/target/ppc/translate.c @@ -7908,7 +7908,7 @@ static void ppc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) ctx->altivec_enabled = (hflags >> HFLAGS_VR) & 1; ctx->vsx_enabled = (hflags >> HFLAGS_VSX) & 1; ctx->tm_enabled = (hflags >> HFLAGS_TM) & 1; - ctx->gtse = !!(env->spr[SPR_LPCR] & LPCR_GTSE); + ctx->gtse = (hflags >> HFLAGS_GTSE) & 1; ctx->singlestep_enabled = 0; if ((hflags >> HFLAGS_SE) & 1) {