From patchwork Tue Jun 23 19:36:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 191493 Delivered-To: patch@linaro.org Received: by 2002:a92:1f07:0:0:0:0:0 with SMTP id i7csp2273272ile; Tue, 23 Jun 2020 12:38:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwfdoT+RTArseBau00ypFtJ+3K2qN8ZA+OUBGfDB6fMuwnmQ2vfuiNyxw0mjEQVjzXvq+P X-Received: by 2002:a25:b90e:: with SMTP id x14mr39841194ybj.8.1592941092105; Tue, 23 Jun 2020 12:38:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592941092; cv=none; d=google.com; s=arc-20160816; b=BavYKu28j0FF+oQQGiKkb+G4x/vr+gKbGCKhYvjAuTMeIRq8gqTeiGrZM9GMhI7viH GAf+e0WbVc3rFoKteGO5TE5wb55sM7BoiaND2oU4NlygaTpZcQuDoBkYl4RSuOVesvWf FOkiyM/ztYboLReTYbTOnBDNeabm++kgwLideHGOKEjlHszSaLVnUYa/WEe3h7+jhV28 ArW9WoB6htD9G8Ws/ft5hNGZS7T0JnxDC4SSRmeYmRYKQHc6NtLpXe9CAHnJLxKLA/MH cItdXzeB1jDjLZmvOpYGv9ACdAj6vVkxX3lFkUTNGnqsz0SjdxUzyyH4qnrObZJ41Ehr waqA== 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=EvczOnAfxPHKCoq8QmzQnZTQg2ANuenqwvd4b2Y4ULo=; b=josdjw3+ryYgoIYulJRKo0L3O7qWzT7mrsWaVrpmj0OdWJub1FrinD54BUb0PwuQ2g 9Xc6xXoaNleZOlxTVQLyYkS4X99Cm89QHQJWBTlZNsr6zfboa5kxJT94phlK4gh014Ar nAjr8AnPAJYWZka3Ga5g5dbdCTeAo7wb5Fj/N9Kygb+Z2yAhnSVVi1D/nO/TjhVs9mVt xSa1FWH1x8obUY1bPsKSn14wBouY950v1PakW97MfpmQYU0tmxyfePZZrsO16Oy0AvqD FS8AnJcqQLxXSxpJeiPj6YX8DyCzFw7XvSxSrFG9YDgerk/ZKY+SOFaBs4d6U0INx4/Y 82YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="C37wksQ/"; 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 196si16881628ybd.439.2020.06.23.12.38.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jun 2020 12:38:12 -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="C37wksQ/"; 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]:45932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnokF-0003jM-H9 for patch@linaro.org; Tue, 23 Jun 2020 15:38:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41514) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnojE-0003CK-5e for qemu-devel@nongnu.org; Tue, 23 Jun 2020 15:37:08 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:44299) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jnojC-0005Vc-Jv for qemu-devel@nongnu.org; Tue, 23 Jun 2020 15:37:07 -0400 Received: by mail-pg1-x543.google.com with SMTP id r18so4744pgk.11 for ; Tue, 23 Jun 2020 12:37:06 -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=EvczOnAfxPHKCoq8QmzQnZTQg2ANuenqwvd4b2Y4ULo=; b=C37wksQ/ia+O5QNVRIEnqHzhTbw+WDCqLPZFh/ejlfHjeToU0mEElUy6C0gNK5k1dT joJ05wjVAPEbqT8E0t/0cuLKHD2/omirCFN0wIC7/nF9RGnEiTfkRbfyrTjaXfIbGVH6 7IwK+TELeB0BjNwKqyKmvJZ5tI2HuX1dChPHdVomQbdpOhbU8KcMdCaNpZA6VKOeJeVq 5Lhh7jIiltMxmdyYi42KhKHPeWw0bAf/39hFL6fpuhC2jzsx+sq9TeVt94j0Pcs3frRN eQYDRnqjtR6CtUUcobqIoqjlvFHgD+ufaPyifvczodBBG4yNf+7lYMfDryPn5RzwEEUO eiGg== 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=EvczOnAfxPHKCoq8QmzQnZTQg2ANuenqwvd4b2Y4ULo=; b=J2bZCY4kFm2t37J8QrdAGv6UsVvOoM4JoaNEyxWZwFGK5f6Ris6mnbUZvFNsGq2u+P fvckirzSzpY08EnGzAjsWd/xcBoNQ9NmHJHboS7vd5OAXjVlxpwgJOcMzkQywhrQF0YW LyZhzo2O9eZqurFIxqspfFaXJLowBNpFTpTfAmUmm1OeavdOmtemG608cLiTsUei584d 7mPvQKRkBJaf2dlrExc2YR6jOlf3f25Mn6Lk8tBLsSwTvHXEWV9vw+FcT4yXlVgoeddX TKLIztkyz9NKfHqcteNVBkHuJmtZNN20iK2GyyqI3XxdZnbf7zvW7AelRiVpKIRMr651 1b4A== X-Gm-Message-State: AOAM530fUhQulhL00cHRebBUctN/XCLCjirYPaWB0Bx1irV3n1kVpr6v 95NgZXj0rbnraAO1LzDiA5LSRE6qifs= X-Received: by 2002:a63:80c8:: with SMTP id j191mr17689613pgd.38.1592941024867; Tue, 23 Jun 2020 12:37:04 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id p12sm17927642pfq.69.2020.06.23.12.37.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2020 12:37:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v8 03/45] target/arm: Add support for MTE to SCTLR_ELx Date: Tue, 23 Jun 2020 12:36:16 -0700 Message-Id: <20200623193658.623279-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200623193658.623279-1-richard.henderson@linaro.org> References: <20200623193658.623279-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::543; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x543.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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=_AUTOLEARN 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: peter.maydell@linaro.org, qemu-arm@nongnu.org, david.spickett@linaro.org, steplong@quicinc.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This does not attempt to rectify all of the res0 bits, but does clear the mte bits when not enabled. Since there is no high-part mapping of SCTLR, aa32 mode cannot write to these bits. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) -- 2.25.1 diff --git a/target/arm/helper.c b/target/arm/helper.c index a29f0a28d8..8a0fb01581 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -4698,6 +4698,22 @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri, { ARMCPU *cpu = env_archcpu(env); + if (arm_feature(env, ARM_FEATURE_PMSA) && !cpu->has_mpu) { + /* M bit is RAZ/WI for PMSA with no MPU implemented */ + value &= ~SCTLR_M; + } + + /* ??? Lots of these bits are not implemented. */ + + if (ri->state == ARM_CP_STATE_AA64 && !cpu_isar_feature(aa64_mte, cpu)) { + if (ri->opc1 == 6) { /* SCTLR_EL3 */ + value &= ~(SCTLR_ITFSB | SCTLR_TCF | SCTLR_ATA); + } else { + value &= ~(SCTLR_ITFSB | SCTLR_TCF0 | SCTLR_TCF | + SCTLR_ATA0 | SCTLR_ATA); + } + } + if (raw_read(env, ri) == value) { /* Skip the TLB flush if nothing actually changed; Linux likes * to do a lot of pointless SCTLR writes. @@ -4705,13 +4721,8 @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri, return; } - if (arm_feature(env, ARM_FEATURE_PMSA) && !cpu->has_mpu) { - /* M bit is RAZ/WI for PMSA with no MPU implemented */ - value &= ~SCTLR_M; - } - raw_write(env, ri, value); - /* ??? Lots of these bits are not implemented. */ + /* This may enable/disable the MMU, so do a TLB flush. */ tlb_flush(CPU(cpu));