From patchwork Thu Mar 12 19:41:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 184504 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp950718ile; Thu, 12 Mar 2020 12:42:49 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsWXOG0hJB5k+dbqHcowswNEw125rxjGxPr7+bTDaf0737kXDWe21izM030DY1vZ4pqs5IX X-Received: by 2002:a0c:e803:: with SMTP id y3mr8877006qvn.233.1584042169591; Thu, 12 Mar 2020 12:42:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584042169; cv=none; d=google.com; s=arc-20160816; b=vljTdnrSYqdMQlFu8wyA5fNtsguNtxek/RApkXXbSopFcpzvMEgDHuW3Ah1Jzod0Wc XpVMQFCgpJxsyrrqKgVzPAsmyzPQza4E6s40bptKSEXrRIZyYhw488oUeIFwt+vRcy99 ypasQDRibFTRwQg7ueMPf1sbqemVBG4tVWl/wwFKLF3E0IgenfHGhA3UZ6ukcMALCq7Q 0s69uymrJ46imY9t8PeqHludD08Q73PFI3O7GwvwPNIp7sdJOVEkiHBiN/KwzF7GSdM+ 3prm2IK/oBZGr2GxhwZ/bhcv3U+cxEGLU2LBI5gkgGyCMClHF+6NR1CWBVdb8jZFPcfj +obw== 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=KU/VVN1rk+40NYMvd20F10ZZXWCOkzDc6Y3oZJm23Fo=; b=0/OYKdHHj+Qqq+e6iIXVedt288/g6XiXX4L2fIDcr8q+mAETlkEwOshq06+Z1yj31T YgYY1Yc/eAS1uqpybu+OYfwr9lc+sYG1PvfDX/nqWHkHxDmpjgll2VqCX3S9l6oKm+xM ySNIOTvmW6WA7f97h+r/JKxVGu5xl1lUja9QMMdFyQ019AWPbp6Hvx+spmRfPwBXfpcD M/r4f6UK94QeiFT0SNTxww9HPrEs7K30Jxr4SdQABQV89XPboWv0ndfIj6Nqf4pg8tWx rF8R6naQ6BCNVc1F2WaYiAnTTLtJ9zdbZVUopx3Qt7RWes5Tch1MvEXSsFAFtSzxJq/T aNAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Cz2ajr5/"; 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 c39si3544364qta.25.2020.03.12.12.42.49 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Mar 2020 12:42:49 -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="Cz2ajr5/"; 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]:48642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCTjF-0004m0-1v for patch@linaro.org; Thu, 12 Mar 2020 15:42:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45006) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCTit-0004cj-G0 for qemu-devel@nongnu.org; Thu, 12 Mar 2020 15:42:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCTis-0001hb-HB for qemu-devel@nongnu.org; Thu, 12 Mar 2020 15:42:27 -0400 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:35525) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jCTis-0001gg-C2 for qemu-devel@nongnu.org; Thu, 12 Mar 2020 15:42:26 -0400 Received: by mail-pl1-x643.google.com with SMTP id g6so3078474plt.2 for ; Thu, 12 Mar 2020 12:42:26 -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=KU/VVN1rk+40NYMvd20F10ZZXWCOkzDc6Y3oZJm23Fo=; b=Cz2ajr5/QhOAnzaaP6LKFM/3V0FBVWWtBqjbIelavFdcxqV1qnJgcG7tdIVS6WSv9T C4NDHG5s254YD00fYJ9ultRocjlZjJF0NUe//z7LgtxCX14jFzS2eggRfCKZzmKx8RsU 49ibsWAqiaXa+x5hWr7PTQyWi4WuMd3mlcmqYftWf5CqRCg8av1mbyFrWtt76pnSEmWc cdR9fK4xrFhl+9JK4OaPicpSsUUckh6jOfL0nBHTWZ5CvD/upDTj336VTyP1qpTax5GN tYFhQYge8gIwebyMQg7LP5fOsTyJLrWuEI1k/heKgFxZByjrar28TVLMD3UocDus+oJO bnmg== 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=KU/VVN1rk+40NYMvd20F10ZZXWCOkzDc6Y3oZJm23Fo=; b=bsPR1Sku2s4g6c8VPPu4lO2xhRzgdPK1Y65Bz4BEIriR6oDF9eDbGtzovdW5UF6jdM oRWCdF/DphLij/LtcqXj1uH0SFyD9D5LRDtoRfPZJeei99Ku0Ki2CAAdP7WXPfXUsLpy /Ve76HOeyqVzjdPug1DoI7hD3U4MTakN+sz6zNFZ9ly+GtuH8s+1j6LAMWA2aTwU35O9 Ylb+b82Kx4Tcqza2NnBbXihCX/3OHxPEA1IbJD+rqctvpWzCgbkkG3fE/hn9aNCev2+X Aa0fs+FbZN0wLXqgjXd2w4LnZw07BR/9s1fuwC2s99kpaKzId0gQuDpBYwJorxV9N5tu kbEg== X-Gm-Message-State: ANhLgQ3wYWhqJLM7nK0uJc95Cm8/rfJa/gVrCa5ErqnK4E2karIBGdm+ SFJVLYYWsEHKjFZUknVMh2pRdFamhGA= X-Received: by 2002:a17:90a:5d85:: with SMTP id t5mr5788826pji.126.1584042144949; Thu, 12 Mar 2020 12:42:24 -0700 (PDT) Received: from localhost.localdomain (97-126-123-70.tukw.qwest.net. [97.126.123.70]) by smtp.gmail.com with ESMTPSA id g69sm6824842pje.34.2020.03.12.12.42.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2020 12:42:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 03/42] target/arm: Add support for MTE to SCTLR_ELx Date: Thu, 12 Mar 2020 12:41:40 -0700 Message-Id: <20200312194219.24406-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200312194219.24406-1-richard.henderson@linaro.org> References: <20200312194219.24406-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::643 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, alex.bennee@linaro.org 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. Signed-off-by: Richard Henderson --- target/arm/helper.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) -- 2.20.1 diff --git a/target/arm/helper.c b/target/arm/helper.c index d04fc0a140..97272502ce 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -4680,6 +4680,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. @@ -4687,13 +4703,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));