From patchwork Fri Jun 26 03:31:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 191760 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp103639ilg; Thu, 25 Jun 2020 20:34:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjg7ZDkZeKMiHEzschrrKemjEryKZwQrn6iVkxlawsS15J61MbdN6rUVlaVLXrB3lB/2Qd X-Received: by 2002:a25:c646:: with SMTP id k67mr1829016ybf.110.1593142453551; Thu, 25 Jun 2020 20:34:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593142453; cv=none; d=google.com; s=arc-20160816; b=I/bSvdly4NpZcCerudnba70b2Oj6og8ARmLyNpI1F7SqGfK5q4dMeihNY4GmqbENg0 HQoPLD3onFRMAwfVO4S8QBw8wX60gBele+iYRwcCcjIkR1fUmb9Fnh0Yk1Dayog2XnVI 26wiIsK5iZAKYuzu2HvP+D85H5gwKMrOLVfBu8uuvP24ze+/kfvIEGUtZ7pzi7h3ddiI SnFiD3UJCs6puuHHVrRgCmVI93Ev4sl0P153kpIzBpLEsawdjnHzrAszcCDr1XgbuzYv F3Ibs4mWw1k44tsHNiVtSyBXmYOmnNdog5DrVG4bOQTbAaAOkq8PpwYtQJEQzru59ZvW 1tVQ== 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=r7ZWCjGSdE3t8eVWB1H7NNMmr6L15ID6WNII/0JoIpavS/TJkEUTc+bVMjk7buWMLe WZ405HzkAw1/LQkh9OpewMwhiDFb1rfHmZ5ys3oAo1xIozNH6+AMau6KKbMte9jKGUYO jGnmjVZL5eBVdeJ+wvs1QpIYX51QhI7jcJN9Vl/LqqBhBMsv7RE4vufzqYSRT0dt1AjH NF6+Y1I4qzenc1Tgs+oDfHi+WN+emfE6u0RLtlNHrbpuOaXvRnB2KynwgOJ2hXZlw7Vr XRaRf5fVXzsr49jpvWEOCFTE6vEn5f/A+HVemjDzcPxyzGIlViFhh00lt+MGlmPbPisp nl+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KVwiFYAq; 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 e127si23934432ybf.458.2020.06.25.20.34.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Jun 2020 20:34:13 -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=KVwiFYAq; 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]:33974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jof81-0003rO-03 for patch@linaro.org; Thu, 25 Jun 2020 23:34:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41794) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jof5l-0007kl-VE for qemu-devel@nongnu.org; Thu, 25 Jun 2020 23:31:53 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:38701) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jof5k-0001ii-Eo for qemu-devel@nongnu.org; Thu, 25 Jun 2020 23:31:53 -0400 Received: by mail-pf1-x442.google.com with SMTP id x207so4059959pfc.5 for ; Thu, 25 Jun 2020 20:31:52 -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=KVwiFYAqhie8JlXC/CLOjQ713UderJ6XXowbCerHsc2qnFPmXZyiVcDhJDYMNm2mDb 3MO7/Wr0xBQ7pIlf77bA3FkcsLFpbBOdyhctaIGeHD7aN5feP6bqBc+lAMF9qK0GPf+q 5ZgE4wdOL2cKF/zoFTrVLJkS5JE1npTfqxUl/3GAN7DKun/lLtfHod/sRR/avdiG+9VT nlx+mfwMwi6k25WqeaFi92fskF7uIflUtUTMmhfG376idewT9MGeTjMwLozZWrgkr/PH mAs06No4Q3y3AnPVG88VB4y47mczg8qWADbFUoIMoqBf+r8EY/HxxsdkIX1hJX7ixFrD nnTg== 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=kY1ctVEPxoNq1508HNRU/tWkeaZ/JutjQXjRkUrNiEDVx+bGQbWbUhTAb9qYP30y+B leMfIN3q4bZUB7Gp8j20qCGrUjIzU/OvcXMUf/mW1DRqXvEWoWBlm78S4TrI2ULE7Ism lVZqrBToDSaXFDsTA87ISD6rgszhKnGeCpmf8+oExRq2FcbWMG0z+sPp77ad9SJv2bxx IRhh14rg2dUG5uz93a/zsC7pkwJfW8j4+FQWq7hiq9y9yBiE7hrbRqpGau9EquWgEssW 9xht/g+Tea/GnsQDMH99yOHbRECLTX4q9ZqG6Qr1+5g7RUfcRbElxRwU4iPFWvCG8ssp 3K7g== X-Gm-Message-State: AOAM530WzYDpfOLArAjFp2udoQi53lot7wC57rzor/UDT+oTIN5N5dwO U2EBN8g7/aulJ/OXBz3nbgEDT5kjb/0= X-Received: by 2002:a63:580c:: with SMTP id m12mr906307pgb.446.1593142310713; Thu, 25 Jun 2020 20:31:50 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id y27sm1605256pgc.56.2020.06.25.20.31.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jun 2020 20:31:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 03/46] target/arm: Add support for MTE to SCTLR_ELx Date: Thu, 25 Jun 2020 20:31:01 -0700 Message-Id: <20200626033144.790098-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200626033144.790098-1-richard.henderson@linaro.org> References: <20200626033144.790098-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::442; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x442.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));