From patchwork Fri Feb 12 18:48:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 381869 Delivered-To: patch@linaro.org Received: by 2002:a02:b18a:0:0:0:0:0 with SMTP id t10csp3194249jah; Fri, 12 Feb 2021 11:16:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJxP4tWwu87DWTG7y8VmJIEKx0ik8/NPUKDbGfwQNjGmuVLX//s8jPAeWMLC3ROXtgTEwE+Y X-Received: by 2002:a25:7585:: with SMTP id q127mr6255134ybc.216.1613157415066; Fri, 12 Feb 2021 11:16:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613157415; cv=none; d=google.com; s=arc-20160816; b=sQbTS2FD0zxyPRsEBM4NRj1DnbOgrr+EbA9iq+UFYiaMeonBSwi6C4VL52ZGNHC013 P4TkeayeBVEWpeRSn7Ct9RVDagNqgmqPffa0vE5e6YJTMr/7sZRL0y83/qGWlSzA7at6 wBBXDkeHDn8/C42R9XQJFro6EoVnPMMcCeQ/uMMgr0BtZwhu0tHRgCdQ5Kphp+e+2Apj BdoPYeft7ZgP/jJR31a2+7QJ/EQQ71yxt4SUzSGzolPNg7Z6KgMPw2ZZJ7UAzVKmh9gj 7W1E5gpuxcdxrVyw2gZN0wNWbxcEWo9pBQ67d1BnlbN3G8cI3LBHnD1EiCd3c9oKLwOe TYMg== 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=6BEpequXM+1RtdDCCQs/VCcQkfY8dHZtljwHQUWFfvU=; b=a87RXqHq4m1AbL1pX2mSEhv3LCHmS62WDkZ0ETLDlGyQVtz1D9UYLREbzvjSl0Hmbm KVKvgY3vYpwoY0Sq6ol2FdapkENCLvSm7B9b7sEQ0FvPDHRzgx5Y8QIkj6CYATss66EF BlfbONvGcYBMdQYZgZj7BrsYlxY9wdED6bW8I22sxXDj6LjRnFBWDJ9pHJ5d70b9iW8i 40Vbq2SK3RCsTzFDodmttxjKkwGysRVj3gyam3bLT+rg3l2BbhIsEyV7Br2OsmZvF6fQ xBhl3U2yQiEE7H23Kp28EOsrOc2AvDmVGrgkzMlyNwhSAmNMDDt5PvLP6ab29LnqIjtl r4ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HYUrqoy5; 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 j198si9386791ybj.27.2021.02.12.11.16.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Feb 2021 11:16:55 -0800 (PST) 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=HYUrqoy5; 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]:37998 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAdvy-0007dx-7j for patch@linaro.org; Fri, 12 Feb 2021 14:16:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39592) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAdVa-0001rr-6M for qemu-devel@nongnu.org; Fri, 12 Feb 2021 13:49:38 -0500 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:33164) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lAdVV-0007rX-HN for qemu-devel@nongnu.org; Fri, 12 Feb 2021 13:49:36 -0500 Received: by mail-pg1-x529.google.com with SMTP id z68so270827pgz.0 for ; Fri, 12 Feb 2021 10:49:33 -0800 (PST) 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=6BEpequXM+1RtdDCCQs/VCcQkfY8dHZtljwHQUWFfvU=; b=HYUrqoy5OcyexQZ5qRj29T448YjzI9m7LzOdZ8gtgOH1g4KpiyPPpS9A270W7Wo1zH rcgcb9ed50UlkFM/dJdf4e+ua8RsdKYcMBsecidbocP7hQpIIQKVUy2z0lzNy7xC9zeu XWW4jUHw/QQccVOpyNVpEZ4O4nHLrBJAG6ZTb2kX6jZ8cucj27SniOkeuuy8/YcUhXCt 2H/DBM682E5rqeFoGb9skiaDJ/Wmm6PWzr+i/FiFExKYW3z6KOkHx5iyrQURWxHlbeSs 67ka14OG7JYu49yvApA5uByf2xzgFliyNX4OTQ3peoXgGpmbcQyz1K3GuOsX1GsbKtVQ KyAw== 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=6BEpequXM+1RtdDCCQs/VCcQkfY8dHZtljwHQUWFfvU=; b=Yiavf5C5gLfgqk+MGWuZGba41b1Nem5JR1mC0aW3egRaIGtiPufrU3VylHxCPMZSic yK0gFPoe2v4fP/UQnPjjk6PvqXgxinFhLRxpNG+cFBpc74wNwmt+c7aYGW47ziE+Ylch xlma99ks1PRFgj3gaBaHtXdMmQcyC7BA2r3ICskWq66Ky6pr/yry8sFlFAqRaEgyUClI 17pWbtQddF2IprEUEBdpubOB58YdugDSeZVk0zLnAmAZI5LhSSConxKibqjVFw0A2xGf egqr4Rw/Z6z9mVNq3GCWGCLuk0MBoy7KvCvjh8WKd/MjE9qVekvrNZKwTMe7jnW7onKT +uzQ== X-Gm-Message-State: AOAM533h+5cu5xxHZZab13cZGYmjurqML1wWP7zDwUG1Q4GdIj6moKvF HyRXyBKVl3E+YkUViJz57BtW3nRj/D9bMw== X-Received: by 2002:a63:ee55:: with SMTP id n21mr4416423pgk.372.1613155772319; Fri, 12 Feb 2021 10:49:32 -0800 (PST) Received: from localhost.localdomain (174-21-150-71.tukw.qwest.net. [174.21.150.71]) by smtp.gmail.com with ESMTPSA id k5sm9427618pfi.31.2021.02.12.10.49.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Feb 2021 10:49:31 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v7 22/31] target/arm: Use the proper TBI settings for linux-user Date: Fri, 12 Feb 2021 10:48:53 -0800 Message-Id: <20210212184902.1251044-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210212184902.1251044-1-richard.henderson@linaro.org> References: <20210212184902.1251044-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x529.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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We were fudging TBI1 enabled to speed up the generated code. Now that we've improved the code generation, remove this. Also, tidy the comment to reflect the current code. The pauth test was testing a kernel address (-1) and making incorrect assumptions about TBI1; stick to userland addresses. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/internals.h | 4 ++-- target/arm/cpu.c | 10 +++------- tests/tcg/aarch64/pauth-2.c | 1 - 3 files changed, 5 insertions(+), 10 deletions(-) -- 2.25.1 diff --git a/target/arm/internals.h b/target/arm/internals.h index b251fe4450..112bbb14f0 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1425,9 +1425,9 @@ static inline bool tcma_check(uint32_t desc, int bit55, int ptr_tag) */ static inline uint64_t useronly_clean_ptr(uint64_t ptr) { - /* TBI is known to be enabled. */ #ifdef CONFIG_USER_ONLY - ptr = sextract64(ptr, 0, 56); + /* TBI0 is known to be enabled, while TBI1 is disabled. */ + ptr &= sextract64(ptr, 0, 56); #endif return ptr; } diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 5cf6c056c5..70cfcbc918 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -205,14 +205,10 @@ static void arm_cpu_reset(DeviceState *dev) env->vfp.zcr_el[1] = MIN(cpu->sve_max_vq - 1, 3); } /* - * Enable TBI0 and TBI1. While the real kernel only enables TBI0, - * turning on both here will produce smaller code and otherwise - * make no difference to the user-level emulation. - * - * In sve_probe_page, we assume that this is set. - * Do not modify this without other changes. + * Enable TBI0 but not TBI1. + * Note that this must match useronly_clean_ptr. */ - env->cp15.tcr_el[1].raw_tcr = (3ULL << 37); + env->cp15.tcr_el[1].raw_tcr = (1ULL << 37); #else /* Reset into the highest available EL */ if (arm_feature(env, ARM_FEATURE_EL3)) { diff --git a/tests/tcg/aarch64/pauth-2.c b/tests/tcg/aarch64/pauth-2.c index 9bba0beb63..978652ede3 100644 --- a/tests/tcg/aarch64/pauth-2.c +++ b/tests/tcg/aarch64/pauth-2.c @@ -53,7 +53,6 @@ void do_test(uint64_t value) int main() { do_test(0); - do_test(-1); do_test(0xda004acedeadbeefull); return 0; }