From patchwork Mon Mar 15 18:46:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 400550 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp3692271jai; Mon, 15 Mar 2021 12:16:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGvmbZv2zZKeijs6OiaFer6Crd7GQTUtMaCPrasubUv2UUMWx8YVVRTCONr6ZpnQ0Xb5WG X-Received: by 2002:a92:5411:: with SMTP id i17mr882074ilb.22.1615835804176; Mon, 15 Mar 2021 12:16:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615835804; cv=none; d=google.com; s=arc-20160816; b=Kfsv4VfBCpQw+e56+vlCxlylhN8cMxmeNqFoTGep5muMQlKGRVnV8tcWY8e+c0+/1a ay8P9yvq/zcKbacdjbFlGUzJhLA5uWPOarDAo//wX2TrRHDoWvHEOQbW4Lc3UN++/cjP GY967XQgarCq1QODM03ynxr8+wOmD2IsJEHdMB+tXq9k2orw8nL2sdJcqLVFo1rLARBg LpCnR7S0DBi9Eexc0gGFZ5QM0vcQQyesspcZX21Ugw7OfQ9BUS+Z0aoVcPSniP4LGID7 njI5jQose9iT3/F3ufN6t1iebbO1PAu+Ngk4hyhMoizvoEBZ5+07GOt4QIE763uLB5PQ vpFQ== 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=Fm4BN1FAYzcobXIUNrNdXuRiaQp/Ku74cUVfr1tQ2mY=; b=rYgUFhR5wlblitKuSmlBnI+XpOOJ+ONtfj/e2BbOkbC+zvuLxhyS/kqI9eWsKGjX6l Fxi8SBtl9+DtY+QYJBSQ0Y61qw3RpX/BFicI7153BlDq2Yvn6NOWuREtg33PjFNq/QiO GNKyI5eZ2VjkylryVpf3TO+izcp8Txo0llLrqdIOmNeTwobGOu5WdF4CMdS8Sq7hrAMa w8UhfTMANX37ykmfPoXp0KC1aflCeOjtGadnpuIWfTRDvj0q3Kpk4c0vexfXWu3NRRbO klIXXudCJhsijhrWFNOsPUQo3p6e/4SxADcB51RxGlpJqHa5GM+rOPHmn9BZ1R/bw5xB dZ9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QIvrSSM9; 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=pass (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 a4si11656577jat.82.2021.03.15.12.16.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 15 Mar 2021 12:16:44 -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=pass header.i=@linaro.org header.s=google header.b=QIvrSSM9; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLshn-0003T8-Lw for patch@linaro.org; Mon, 15 Mar 2021 15:16:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49132) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLsEd-0007Th-Gb for qemu-devel@nongnu.org; Mon, 15 Mar 2021 14:46:35 -0400 Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]:33427) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lLsEb-0001eY-18 for qemu-devel@nongnu.org; Mon, 15 Mar 2021 14:46:35 -0400 Received: by mail-oi1-x233.google.com with SMTP id d16so26194279oic.0 for ; Mon, 15 Mar 2021 11:46:32 -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=Fm4BN1FAYzcobXIUNrNdXuRiaQp/Ku74cUVfr1tQ2mY=; b=QIvrSSM9JV3wxnwkIyzHEaJvSEsMMEboCtxDdhqBzyXSDDU0KF0qEfehXtqbDk9kIB zZPmNzXqZ60iEWoAuRa856Ja8x2pa+ZAxXhbTIuEQVg6PA8P389xRGAKn99FMoqIJXn1 8Zg+TmUI6L8u/Nb8HGVcsCkDpAOVG+6F6anYi0qvpKb5XLb/ng0+LnVE2ib3TEVqdz4d 2pOGkk/hphZdYlKwduetaMEGslss5UqDIsHdGiFCrKRWMppQYLE9CoJ/xHwA4qPpr8sr r4TZc9SxP1GDIlbxmtDghIbSjogUg/LAHVHWWrxn5oiJGqUJWAGRHWcJfO1avZMChKef YNug== 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=Fm4BN1FAYzcobXIUNrNdXuRiaQp/Ku74cUVfr1tQ2mY=; b=X4OlCZuVOmpYAEYuARkM42VoAQQ8fekBs9/sEfEmxkfUqsJQM9YPcob5gzBIsgulQ1 h7PDXF+4NsMh7HVXO/LXZ1M4gfE8TKt9Xfgee60uo7nV/csXH+eyn173EFbzWNFH+C9w oXHrgZVcJC/PvWWOsMA9Ks0rB+7kZuTDFnR6s/nrktK3jv7BTkK66qThg1OCwQa0ycoW HDxJAAeUGC3AVRx/W4dR/h4K6y+quIBVR06PwpVnTa5EoXf//8euRqE2I9C6BdjwPJrZ UOGnPVg3EV6UGY1nSO+8FKeStgq/2ZbAYmMTPWtMAzd7BKtbftA8d0Gl7erFdYNgIUgi A9Yg== X-Gm-Message-State: AOAM533p8YC3EVp96DKLt27NmzLo1oOTqVr5rv6aDPqzBSSlsaSyj98E QeygcdAuhERqbLfXcLi6ffXT3GDwqUY/UVft X-Received: by 2002:aca:dcc6:: with SMTP id t189mr365118oig.9.1615833991818; Mon, 15 Mar 2021 11:46:31 -0700 (PDT) Received: from localhost.localdomain (fixed-187-189-51-144.totalplay.net. [187.189.51.144]) by smtp.gmail.com with ESMTPSA id o25sm7519851otk.11.2021.03.15.11.46.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Mar 2021 11:46:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v4 11/17] target/ppc: Put LPCR[GTSE] in hflags Date: Mon, 15 Mar 2021 12:46:09 -0600 Message-Id: <20210315184615.1985590-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210315184615.1985590-1-richard.henderson@linaro.org> References: <20210315184615.1985590-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::233; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x233.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=unavailable 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. 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 Reviewed-by: David Gibson diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h index 2abaf56869..07a4331eec 100644 --- a/target/ppc/cpu.h +++ b/target/ppc/cpu.h @@ -603,6 +603,7 @@ enum { HFLAGS_TM = 8, /* computed from MSR_TM */ HFLAGS_BE = 9, /* MSR_BE -- from elsewhere on embedded ppc */ HFLAGS_SE = 10, /* MSR_SE -- from elsewhere on embedded ppc */ + HFLAGS_GTSE = 11, /* computed from SPR_LPCR[GTSE] */ HFLAGS_FP = 13, /* MSR_FP */ HFLAGS_SA = 22, /* MSR_SA */ HFLAGS_AP = 23, /* MSR_AP */ diff --git a/target/ppc/helper_regs.c b/target/ppc/helper_regs.c index c735540333..8479789e24 100644 --- a/target/ppc/helper_regs.c +++ b/target/ppc/helper_regs.c @@ -139,6 +139,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) {