From patchwork Sun Apr 17 17:43:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562817 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1852953map; Sun, 17 Apr 2022 10:49:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/zB3+rZJNJt4T4YAjyKfTyR9mIaoMa5aruRbBl6CitniX/zXmFfnOgRSf7F1/Y8M01IFQ X-Received: by 2002:a05:622a:4cd:b0:2e1:ec2f:8c22 with SMTP id q13-20020a05622a04cd00b002e1ec2f8c22mr5117058qtx.494.1650217749618; Sun, 17 Apr 2022 10:49:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650217749; cv=none; d=google.com; s=arc-20160816; b=Ll/uayoWX50piUgNYtwKzZyseD8b9xdOpEauIsQcXZgevn271v2XooLVmjLP1nM0LE ST+GPTjg03RaIuptVSPsyJcY3PJ9GxYLgdRYIUkAtuEHV4yohCYCxLvu5YTOvPrApUvm Ph3CWV1CsL86QglxiNZ1EQBlR7dl5/2Gg4hebqbeoB17DKr7iMtzJ6cZvYmPKX3LXG71 0OMiSGRd8y9DtFlJ04HgKAWK7WXpEaUnYKVfeOL7tBQ9DnubpUNvUvmojvKYxuvBlUQ8 2TjkiOZkNO7hR9IACeR7WY5+SN6j2mdI5eEyjNxJdB60g3NhP7OFh4KV9B2WQBjcwsC5 qgQw== 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=TnTEItSGWycbpaAmp+hDaYT95wtDnOp1XDNT2WSNp3w=; b=xN7J13gu8Pv0ppTPArxGLDIJxiXv3Rq0pDO6KeNsWIme1JL2qfoaxKAyCIzNdu198H GHWN9Cv54Ycf2/8Xykzap+vsbRwKH7C/kDjP4FTAAvkMuqz3f3dmeqF/LIqXIcPEiCX8 4r2GT0usbIkex2QzFBor2dtM9SjrSKu1CYUY5zBe9CySzeYtGnyVlYS8aYPVD0xNmtUe p5CRMukCoYD+URSQbuXn0KHyA+YWadfBrrGv2mW/v2DtQddgEHBujeiZl7yW1HKC2qdo pt3PEp/MqC72hFaNwWTpVna9qeFSyAuoFkoJoz1mGLPs1A5Iuj6zpMn+AcEniIjeXKak HdxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=E6Yq7Evf; 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 s17-20020a05622a179100b002ed4c5b4073si290962qtk.7.2022.04.17.10.49.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 10:49:09 -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=E6Yq7Evf; 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]:57978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng91J-0002sY-7e for patch@linaro.org; Sun, 17 Apr 2022 13:49:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47674) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8ws-0000dl-UR for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:35 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:36533) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8wq-0003Dt-Kf for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:34 -0400 Received: by mail-pl1-x635.google.com with SMTP id q3so10758682plg.3 for ; Sun, 17 Apr 2022 10:44:31 -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=TnTEItSGWycbpaAmp+hDaYT95wtDnOp1XDNT2WSNp3w=; b=E6Yq7Evf4C609rZ+2CIrPoceBE6G0loh0WZDqzcpW+M+S5jZQlgAu8P+9bJclkVmeW 2P7w4GLy/J9hHfie+DwTts7cb6w6DP5v3x/Dgse4HwT78iKzzmOyXkRgDHuH1TqQg/m2 HEz5VaFnMxCM5YcdgvwV7RxS9kRuK9Io+Xiu5MrRYYdNpY8Aje84cN3C9jUtce/TwLMi YH5RPauvCvXZ8FbX0wTqcO0bsTI6O/y84x0+ZcieUQ7iQVYSB7yKfSdoxV+nHs9D2QHV CpsUx+jOjI05ykwfaLnECbqysWqdBFqb3Srt1wECZCI9zp2/Ph1sxB5vRCgwDo7e9IFo OUzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TnTEItSGWycbpaAmp+hDaYT95wtDnOp1XDNT2WSNp3w=; b=cbAy4aZa2K+lSsgzA3v0uDM5qKLFoxJl6m91VqvPiDE3/i8g+1ywfRxHM0YywjWLlN P69SS8b2PlaQrvqai5hVVdaCSNJVdc9YF/w2MG5myxWuLxxOalvCa5bupHrftlEmVZay 96MUMMlWzj+bk7ZdJGJ/kHss0NfJRELSkUpd2UdT/6W+JuAlQ4Ql9TFsesU5pr4HNFu5 ggS3Ka6iVqtHfkw+4NJhUtlyO+GjpaY5XAXo32DWoq00mdevKcWf/0KqLdVAJDidVcw7 HWRsyyHjaDtEaqfwMnUzorywV9g/PK1Z2qVBKkK3wHvNCRFSKbYhBzTCdGbgzruikQz2 3HqQ== X-Gm-Message-State: AOAM530po5g6Kz9MwUWalfrNPzncO8O+hb8qGF40GUtaUpdMO3zFPaHY svsXuTmTtWHu/XBlzw8wA61nLU5cUDSTMQ== X-Received: by 2002:a17:90b:804:b0:1cb:be2d:e28f with SMTP id bk4-20020a17090b080400b001cbbe2de28fmr8942645pjb.21.1650217470376; Sun, 17 Apr 2022 10:44:30 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 01/60] tcg: Add tcg_constant_ptr Date: Sun, 17 Apr 2022 10:43:27 -0700 Message-Id: <20220417174426.711829-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Similar to tcg_const_ptr, defer to tcg_constant_{i32,i64}. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée --- include/tcg/tcg.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 73869fd9d0..cd6eaae410 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -1054,9 +1054,11 @@ TCGv_vec tcg_constant_vec_matching(TCGv_vec match, unsigned vece, int64_t val); #if UINTPTR_MAX == UINT32_MAX # define tcg_const_ptr(x) ((TCGv_ptr)tcg_const_i32((intptr_t)(x))) # define tcg_const_local_ptr(x) ((TCGv_ptr)tcg_const_local_i32((intptr_t)(x))) +# define tcg_constant_ptr(x) ((TCGv_ptr)tcg_constant_i32((intptr_t)(x))) #else # define tcg_const_ptr(x) ((TCGv_ptr)tcg_const_i64((intptr_t)(x))) # define tcg_const_local_ptr(x) ((TCGv_ptr)tcg_const_local_i64((intptr_t)(x))) +# define tcg_constant_ptr(x) ((TCGv_ptr)tcg_constant_i64((intptr_t)(x))) #endif TCGLabel *gen_new_label(void); From patchwork Sun Apr 17 17:43:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562819 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1853918map; Sun, 17 Apr 2022 10:51:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8Zq7g+wCgoA9y/TojMrNLNP8fVzVRsWfzKk8+s3Evvxw28NojhYnFrp0Tfg6zuGWP6F5b X-Received: by 2002:a05:6214:5189:b0:446:5077:7f75 with SMTP id kl9-20020a056214518900b0044650777f75mr3100728qvb.37.1650217889294; Sun, 17 Apr 2022 10:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650217889; cv=none; d=google.com; s=arc-20160816; b=JTv6gpRmyqIShzKiRPUyxzFIbN18Na0327EH8CM5h6zLJxfpfpKayibj8W+T7Gpqzz GPptxvDI1XckhdScVzw7udBMvqQxiwfKKnYzyuoz/Y/CHUDzmDoUixRMFwW4NovLphqH dqPatKmSVpFYPIqkTk1ZT9BV9atL9qoCq/Ucz/9Wwb33rpyGDiEOOjw+szF9sP6aRkN/ BH79J03lgwo5fG4fg4NOJe6/6ARNVzON2AReLkVArPAY0/4wwpHGhHW62ksFnYh0CUqW ouXgQ5XTjEX0jIqWTsIIK8I0bNWW0edeGms2ZJBodkXsZm4HTbWZYnEDdVKp9zdPb4N+ LLLg== 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=KMJqWCFFQ/5jg8W4iYwme8tmF7Vde2zNGH6ujSmTVXA=; b=DgWyBCqo3QkyXsH5CeTGN1JPSW0H/jK/ogRibBWoCK1LPgiop/tT7zJ4R8Y//yXTpO 26qRgzIbF62KWHdUmXXAE2mPElVT84hXHLKSafpSNVzUlARA5gzRJcQbvzSdLEFlq0UT AqmjAkgY89iW1C5VoonLRtbVpR1vhjSNAKA+KiIVzYEZEGn0mHcd1pBAg/WPf2LS57Ag XGaVfjjZ+in33QVWS/d3QCJsD+itxlm1TSmAwWg8djX03vZcg22YEhMgIPELyvrCV/l7 Y4mtrel8XOZHCJXeSDS3pwczFJGutOmgqCunnM05fglxVIL7stqTnV+b17D9qNToxidh rgLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="E/DaA9Jz"; 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 bp12-20020a05622a1b8c00b002e1fbf3bf25si2671711qtb.278.2022.04.17.10.51.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 10:51:29 -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="E/DaA9Jz"; 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]:36198 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng93Y-0007H2-Sg for patch@linaro.org; Sun, 17 Apr 2022 13:51:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47638) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8ws-0000dj-24 for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:35 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]:41513) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8wq-0003E5-Jb for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:33 -0400 Received: by mail-pg1-x532.google.com with SMTP id t13so14959232pgn.8 for ; Sun, 17 Apr 2022 10:44: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=KMJqWCFFQ/5jg8W4iYwme8tmF7Vde2zNGH6ujSmTVXA=; b=E/DaA9JzIYarK2hn6C1lG8rNsmjSrAw+ocrr0LWL51dOfsELU+1qvo5RgJIot+fiuj KHYJtb1F6HI4u4ovM0HqOpymS0h8wIAo5Rbrvm2X5p75VSAC6u/1Ondk9ZSV5ktdF90N UzZxhIN7fnvViDvRsHMtvM+p8g1Iej1WCErU2dAZdhrSnYJWJR8skVmWRAhwFbxp2sJr dEWCyN807QKZFm+l1GUeruZL8Nat1I1rmMqSfo1wDoiF/vtLuwjZAzeTRIuipAOZydCK znrQ/aP8t+tb1qZCBVeVCGAg1dhfpw/kbntQcJUHZBhBQqJpl2R2tkSUOZUY8ut1fmZR Md3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KMJqWCFFQ/5jg8W4iYwme8tmF7Vde2zNGH6ujSmTVXA=; b=nLQmAmxBIbwRZYfTdO5Gq24rF9ZDpzZgcQympj31VjTy7KkguEODhOS7gKykMTGMRF wrHFP1qgUA7v3MpfOjoYMaPDf3b0HLjUuvrTGMu6pWCzoXeiFBVl+/gu2gGPVwPWivOp GLLSCiPcbsShKqbocCO7E+jylhDrzIo/yX1HFvJKqLGn6zLusvuBo4ib909zxXPHsVus r2yJai1KBNa95DPqMda6KdbnS1n18O7+lqCydqIQbkU7EkHZGLRNQpaCoyWQYF5XtFoE 97nQ+Zp4dfjeO5uG2BDLLHlPb/0DodjhCy0q4p+uR38vYCwqhOFGdeUDR4nBsBl+Wh+q +PDg== X-Gm-Message-State: AOAM532Fel/Q2goYOPlZOuhftQzTeBgAUKaoP0K0RwxHelCH+Oqgp5ap 4ERQ9Wl8gVRam/VMiTZpEBhpEihMfsiVMQ== X-Received: by 2002:a05:6a00:2148:b0:4fa:92f2:bae3 with SMTP id o8-20020a056a00214800b004fa92f2bae3mr8391283pfk.69.1650217471292; Sun, 17 Apr 2022 10:44:31 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 02/60] target/arm: Update ISAR fields for ARMv8.8 Date: Sun, 17 Apr 2022 10:43:28 -0700 Message-Id: <20220417174426.711829-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.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, T_SCC_BODY_TEXT_LINE=-0.01, UPPERCASE_50_75=0.008 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Update isar fields per ARM DDI0487 H.a. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée --- v2: Add ID_AA64DFR0.HPMN0 --- target/arm/cpu.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 23879de5fa..9a29a4a215 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1933,6 +1933,7 @@ FIELD(ID_MMFR4, CCIDX, 24, 4) FIELD(ID_MMFR4, EVT, 28, 4) FIELD(ID_MMFR5, ETS, 0, 4) +FIELD(ID_MMFR5, NTLBPA, 4, 4) FIELD(ID_PFR0, STATE0, 0, 4) FIELD(ID_PFR0, STATE1, 4, 4) @@ -1985,6 +1986,16 @@ FIELD(ID_AA64ISAR1, SPECRES, 40, 4) FIELD(ID_AA64ISAR1, BF16, 44, 4) FIELD(ID_AA64ISAR1, DGH, 48, 4) FIELD(ID_AA64ISAR1, I8MM, 52, 4) +FIELD(ID_AA64ISAR1, XS, 56, 4) +FIELD(ID_AA64ISAR1, LS64, 60, 4) + +FIELD(ID_AA64ISAR2, WFXT, 0, 4) +FIELD(ID_AA64ISAR2, RPRES, 4, 4) +FIELD(ID_AA64ISAR2, GPA3, 8, 4) +FIELD(ID_AA64ISAR2, APA3, 12, 4) +FIELD(ID_AA64ISAR2, MOPS, 16, 4) +FIELD(ID_AA64ISAR2, BC, 20, 4) +FIELD(ID_AA64ISAR2, PAC_FRAC, 24, 4) FIELD(ID_AA64PFR0, EL0, 0, 4) FIELD(ID_AA64PFR0, EL1, 4, 4) @@ -2007,6 +2018,10 @@ FIELD(ID_AA64PFR1, SSBS, 4, 4) FIELD(ID_AA64PFR1, MTE, 8, 4) FIELD(ID_AA64PFR1, RAS_FRAC, 12, 4) FIELD(ID_AA64PFR1, MPAM_FRAC, 16, 4) +FIELD(ID_AA64PFR1, SME, 24, 4) +FIELD(ID_AA64PFR1, RNDR_TRAP, 28, 4) +FIELD(ID_AA64PFR1, CSV2_FRAC, 32, 4) +FIELD(ID_AA64PFR1, NMI, 36, 4) FIELD(ID_AA64MMFR0, PARANGE, 0, 4) FIELD(ID_AA64MMFR0, ASIDBITS, 4, 4) @@ -2033,6 +2048,11 @@ FIELD(ID_AA64MMFR1, SPECSEI, 24, 4) FIELD(ID_AA64MMFR1, XNX, 28, 4) FIELD(ID_AA64MMFR1, TWED, 32, 4) FIELD(ID_AA64MMFR1, ETS, 36, 4) +FIELD(ID_AA64MMFR1, HCX, 40, 4) +FIELD(ID_AA64MMFR1, AFP, 44, 4) +FIELD(ID_AA64MMFR1, NTLBPA, 48, 4) +FIELD(ID_AA64MMFR1, TIDCP1, 52, 4) +FIELD(ID_AA64MMFR1, CMOW, 56, 4) FIELD(ID_AA64MMFR2, CNP, 0, 4) FIELD(ID_AA64MMFR2, UAO, 4, 4) @@ -2059,7 +2079,10 @@ FIELD(ID_AA64DFR0, CTX_CMPS, 28, 4) FIELD(ID_AA64DFR0, PMSVER, 32, 4) FIELD(ID_AA64DFR0, DOUBLELOCK, 36, 4) FIELD(ID_AA64DFR0, TRACEFILT, 40, 4) +FIELD(ID_AA64DFR0, TRACEBUFFER, 44, 4) FIELD(ID_AA64DFR0, MTPMU, 48, 4) +FIELD(ID_AA64DFR0, BRBE, 52, 4) +FIELD(ID_AA64DFR0, HPMN0, 60, 4) FIELD(ID_AA64ZFR0, SVEVER, 0, 4) FIELD(ID_AA64ZFR0, AES, 4, 4) @@ -2081,6 +2104,7 @@ FIELD(ID_DFR0, PERFMON, 24, 4) FIELD(ID_DFR0, TRACEFILT, 28, 4) FIELD(ID_DFR1, MTPMU, 0, 4) +FIELD(ID_DFR1, HPMN0, 4, 4) FIELD(DBGDIDR, SE_IMP, 12, 1) FIELD(DBGDIDR, NSUHD_IMP, 14, 1) From patchwork Sun Apr 17 17:43:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562815 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1852223map; Sun, 17 Apr 2022 10:47:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjY2NaumNRs5LIelVUeGtc2MfT3+nkfRk+1XYfZO7vWxKa7bJgG1RgujV4BENdfvr2Uq1R X-Received: by 2002:a05:620a:bd5:b0:67d:15ed:2fcd with SMTP id s21-20020a05620a0bd500b0067d15ed2fcdmr4798266qki.81.1650217644874; Sun, 17 Apr 2022 10:47:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650217644; cv=none; d=google.com; s=arc-20160816; b=uaWrqS8Luq0/uTvdQjzlcjfPk00aTZtFnUcTU8esWs8nfUYDEr3kVlurSSITBc7nIQ PGuFKutmctfthAH7TjawEFpSAy0HjF1z1oFzBcNLP9Y9Ogw3hQaL9Q2zZV2V1AgFT/xD r/EEC6QHgVesSSfCeDUIM8LsNqnbw3sMqfDnv2Hx4ZpZnAUC5X0s5JmEZbr7wYmQ+oRW hTwbogL9801qRH6Zv36/4giv6t50ZB+6uBqGoepeoGFVKoSWL1oj1Nw4M4DjR6UiaZCS Ax7E5tlFMTvCi2E8ui+X4Msb2SOcNGuP9M0i3i/q4fe73aw3BBj5pes0wvMvnTzWV3p6 HWxQ== 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=ctao6OM4nQH5DOtD+RHJ8jgaq6PvH+d/+VQiChfQs3Y=; b=GHYJCK+IOZXeKUNdKBqoUEv1U4GuEi8KLDo+tCBwJc4bTNOmfDQL1yXIJgO+t9zn3M rY6N4HwrwhA7h1UEfwjexc84z/UD/mRrp1HBueOyFCEQ+Dj5HrREJNCEN1I1cZI4URVf BNzgRzt2RyzMzgq+SZUlg6xEZ16RL3bsYd4n0Ay41fsJ5QXGbm0AUXGSFKtyWooSruXv MhGOVAMXh9o6ym/oHZ+j4gxrM2lFrWKBAXSqYTk1doUveOUKLFLzyq+RRt4d+Dul0Zqp ZV5C7YbuXjzTrMbf1ArpamToA9bAsTaw3iDiHQXbimAaVVnF9f+3L7djLtXIRW/OQMFH JXMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lPQNaZrQ; 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 f23-20020ae9ea17000000b0069e71168634si1225037qkg.54.2022.04.17.10.47.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 10:47:24 -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=lPQNaZrQ; 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]:55154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng8zc-0000hE-9F for patch@linaro.org; Sun, 17 Apr 2022 13:47:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47682) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8wt-0000dn-7N for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:35 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:38743) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8wr-0003FC-I5 for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:34 -0400 Received: by mail-pj1-x1032.google.com with SMTP id s14-20020a17090a880e00b001caaf6d3dd1so15524693pjn.3 for ; Sun, 17 Apr 2022 10:44:33 -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=ctao6OM4nQH5DOtD+RHJ8jgaq6PvH+d/+VQiChfQs3Y=; b=lPQNaZrQHa0wXcZD1iwewNJ4tDzIuJ8474HPRZrXy6sg1jWo2CKRLueZPtSHYBTPRm yX865H9BIQnUIvQKPo8N2qWllwYQd2YA64+bM+Dfg1qEKGdH7x+JX/2zca4M658Gc2tu EMj6yZrUDai1QQq9iqjatgkBFNADbJwUheVk5abunrEU6w80OUZkQzYdYMbbkYgXA2Ex mzLB4Ugbab7FRIO1McRcuNE5IEfxhCM3bmKJ6Ahqct0/Hf48yP5X88KbtPM8KElA7BxT +TwI7qyijSUb0S+OQDOjQKoYoPDl0P0zXrFZWGvE+9FDaaw0Tsm0HHIz7DX2tfO7Sr6s iQhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ctao6OM4nQH5DOtD+RHJ8jgaq6PvH+d/+VQiChfQs3Y=; b=n2ylR4WwDu9T+1PIKEI+yNmpu/wtZRJge3zIU0NyJBh+pKbOhpvgxFdlSEaweV1q7v U2ejIy86gTtw3NIy9I9Im6R2tQ3aMOHfyPprDSJ5KGP+Xv7U+PHuM9TewCU74fULLqfk kdn1EuvOUUt0d2dFvl/jUfn9uUiYj92lsd3FsbbsJQmupKSQ7eSPjTEbNskJnKzt5tO5 OadKYvMws2mElGuYxITPudk844uEj0itZfwv5Fio/ZfCkYRh0rFYVOHbrlQbJ1TaBhQ5 Tp7DKlVzSu5CeRB4cCdRrqY6y27AmOUGqxfqSAIKeAoU8VOBfa2jQwFYPZJFdCl0ynGk +p1Q== X-Gm-Message-State: AOAM532V48LRWow+PnGCWrDS/9wfPVYTIJIaDDeui+JO423oCrmvX7jM y7gDhaJAMfZxOmdweBnOI01mjiiHFVf7Zg== X-Received: by 2002:a17:90b:4d01:b0:1d0:f39f:6073 with SMTP id mw1-20020a17090b4d0100b001d0f39f6073mr9068144pjb.175.1650217472216; Sun, 17 Apr 2022 10:44:32 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:31 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 03/60] target/arm: Update SCR_EL3 bits to ARMv8.8 Date: Sun, 17 Apr 2022 10:43:29 -0700 Message-Id: <20220417174426.711829-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Update SCR_EL3 fields per ARM DDI0487 H.a. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée --- target/arm/cpu.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 9a29a4a215..f843c62c83 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1544,6 +1544,18 @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask) #define SCR_FIEN (1U << 21) #define SCR_ENSCXT (1U << 25) #define SCR_ATA (1U << 26) +#define SCR_FGTEN (1U << 27) +#define SCR_ECVEN (1U << 28) +#define SCR_TWEDEN (1U << 29) +#define SCR_TWEDEL MAKE_64BIT_MASK(30, 4) +#define SCR_TME (1ULL << 34) +#define SCR_AMVOFFEN (1ULL << 35) +#define SCR_ENAS0 (1ULL << 36) +#define SCR_ADEN (1ULL << 37) +#define SCR_HXEN (1ULL << 38) +#define SCR_TRNDR (1ULL << 40) +#define SCR_ENTP2 (1ULL << 41) +#define SCR_GPF (1ULL << 48) #define HSTR_TTEE (1 << 16) #define HSTR_TJDBX (1 << 17) From patchwork Sun Apr 17 17:43:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562822 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1854531map; Sun, 17 Apr 2022 10:52:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUW8eJjhoBY7A+aWOdTS5OlgKS9Ykw7leCj8QlrxBvnbvnNWlNCuwe5DZDr/oyEvscSr0L X-Received: by 2002:ac8:4e52:0:b0:2f1:f55b:8f20 with SMTP id e18-20020ac84e52000000b002f1f55b8f20mr3960757qtw.421.1650217958596; Sun, 17 Apr 2022 10:52:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650217958; cv=none; d=google.com; s=arc-20160816; b=EdLlw48OLQeSn20C8u6vY+T8DqKOi8to6YjMqU2KdjDVaCMXOvS9UM9AABZN92v+Fx SerSBnQ9h+iz4cT1R1zSOo7eXC/OPA1hmRLmpmJ5Wo98u9fHQMjXBxFcBEmSCesW1UB1 4ucIMWqhXbd5VYkGL2EAcIKkiCd10gZ32gsId+fyUA9EIFmCeQuDp/FnEm5+fEjtBRET W6tBhnGiioeznQBipRpKQxhD1UB49RWECStVArHqe9yltgxSC3Pojsi3IokcxukDFnzl LAN+MOdRQyBQ1p9rVv5Q8hcpNh4bPEGL7lvMq6GOGuWrOmkXJqIPbaF7fk+Gy6qJd2cf B3CA== 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=vxLFgR2+O/yEO8CWTOhGko5rMSYgERGzbB2hOUZT2qw=; b=e4n2/Ow3aIVnkBCHBe2uMd7Q4JbsNxNzj7bnMIIM9Wfg8BIGAXtP63Sh9OVuyeXuJK ZoqNtsWIzfuFPSGFLiQEAkNjjq6t4fYJWrxgVd21WzOzuyyWnYJThG/4NzcPxWTOVA2C jHgewlqcITcyIHQogrt1AH5LBpZLdJFSBmda2KRkGhPPEo9V1B1UfNlWyLTE3DxEq/fB M7OMrb85640DZlKU9ru1gzpxfKawTeFMgXQFXvFsn0JpK6We+4vF3NmRUblIF2Gx6w9M te3QOGsXayc50+AF1ZV4HwQoa8x/1wit78UfJzDtR81rOkluXgniDgKmmBp/7euGl7dQ j7MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DI2wNBxy; 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 j7-20020ac85c47000000b002e1fbf3beaesi2493285qtj.159.2022.04.17.10.52.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 10:52:38 -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=DI2wNBxy; 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]:38574 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng94g-0000VT-5e for patch@linaro.org; Sun, 17 Apr 2022 13:52:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47724) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8wu-0000eP-70 for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:39 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:38745) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8ws-0003Fj-Lt for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:35 -0400 Received: by mail-pj1-x1034.google.com with SMTP id s14-20020a17090a880e00b001caaf6d3dd1so15524710pjn.3 for ; Sun, 17 Apr 2022 10:44:33 -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=vxLFgR2+O/yEO8CWTOhGko5rMSYgERGzbB2hOUZT2qw=; b=DI2wNBxyNTHyxEmGRPu3vdwxS/laH9SsS+E2H6qdbjNXas4N9p99jvRv0GaJaJMqCJ 8n9osSuqzQnMuH91TtrbZq2/+hLJlBmd4ipexGdLwxPbLBIBnNBdiauOefPJcMMIAvYO 0u7+JqGV1Mm982Pmkw7gwVSXHMH1/DqKX953whZfxpSgwKUxSWlsWpMkjEDn7RdlqYaZ FBtarDC8e0BMwHf9v6vl4u56sZlHMfWszW1wFhAToFYV+GaEkIyrAEZKLOJJaRKjZ/ZP kK4MekSXaa1PNUtNp6wDSWdiGubCJ04KU4Chqe0OgbVO6/NZupWo4Ixzl6FIAbQKtuE7 P+Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vxLFgR2+O/yEO8CWTOhGko5rMSYgERGzbB2hOUZT2qw=; b=przrJ8xm+WJ28cmcU1MhwLzmyEg4agtcSsQCHcsDnvP8EqUDdX6tfVeHzBT9rOUsCZ iY/GIcOF0+gW3j4oRwdv265wbmuyVL2r1ItbfzxgNSsdjl7IqH0Yj7uzOpF7NDEX9OHd he+uaDpfXHNLC+5rhiHWGyvdgYgq9FYh7TxcHk7ncjLJeUil1WuWgqKPR3nsHCnX98PV BmbJgsd46M8yESB5GBEYf2IC+gi/7NbSr4eL/JIYcTFkAfUbM50q6Q2jPSYGsT4SWzVG ptDZRZQymlL6PDWEZ7EJi8k+C8OwgLfk3MAciz5UM+/keDuDlKIoPW6kEuArfnWiZZZW OPDQ== X-Gm-Message-State: AOAM530XTCo1q9FVDg0q5HYQR5OnakFpAJVCuFpHwJeExQXLC2N6kFX2 opmm5xbv7ZWKAJLN6OlhS0w8HDNZjMBP4w== X-Received: by 2002:a17:90b:1a81:b0:1d2:63f5:e24e with SMTP id ng1-20020a17090b1a8100b001d263f5e24emr7088951pjb.124.1650217473013; Sun, 17 Apr 2022 10:44:33 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 04/60] target/arm: Update SCTLR bits to ARMv9.2 Date: Sun, 17 Apr 2022 10:43:30 -0700 Message-Id: <20220417174426.711829-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Update SCTLR_ELx fields per ARM DDI0487 H.a. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée --- target/arm/cpu.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index f843c62c83..9ae9c935a2 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1232,6 +1232,20 @@ void pmu_init(ARMCPU *cpu); #define SCTLR_ATA0 (1ULL << 42) /* v8.5-MemTag */ #define SCTLR_ATA (1ULL << 43) /* v8.5-MemTag */ #define SCTLR_DSSBS_64 (1ULL << 44) /* v8.5, AArch64 only */ +#define SCTLR_TWEDEn (1ULL << 45) /* FEAT_TWED */ +#define SCTLR_TWEDEL MAKE_64_MASK(46, 4) /* FEAT_TWED */ +#define SCTLR_TMT0 (1ULL << 50) /* FEAT_TME */ +#define SCTLR_TMT (1ULL << 51) /* FEAT_TME */ +#define SCTLR_TME0 (1ULL << 52) /* FEAT_TME */ +#define SCTLR_TME (1ULL << 53) /* FEAT_TME */ +#define SCTLR_EnASR (1ULL << 54) /* FEAT_LS64_V */ +#define SCTLR_EnAS0 (1ULL << 55) /* FEAT_LS64_ACCDATA */ +#define SCTLR_EnALS (1ULL << 56) /* FEAT_LS64 */ +#define SCTLR_EPAN (1ULL << 57) /* FEAT_PAN3 */ +#define SCTLR_EnTP2 (1ULL << 60) /* FEAT_SME */ +#define SCTLR_NMI (1ULL << 61) /* FEAT_NMI */ +#define SCTLR_SPINTMASK (1ULL << 62) /* FEAT_NMI */ +#define SCTLR_TIDCP (1ULL << 63) /* FEAT_TIDCP1 */ #define CPTR_TCPAC (1U << 31) #define CPTR_TTA (1U << 20) From patchwork Sun Apr 17 17:43:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562823 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1856291map; Sun, 17 Apr 2022 10:56:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy82vZOF37L1VjEQxb29fiUWhdxz94/8wwz0iSaV94Txh9g4P7Yr7bRG6vBOdMFDULeF5Lw X-Received: by 2002:a05:6214:238e:b0:435:3700:d65 with SMTP id fw14-20020a056214238e00b0043537000d65mr5478995qvb.65.1650218188907; Sun, 17 Apr 2022 10:56:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650218188; cv=none; d=google.com; s=arc-20160816; b=bu6w8vCkWbwXnwf66vYd0Dkmk2kuvw5kshZJD78Zsr1YvYIXBwGVMLxGE+wWEVR9yJ 3j2Q+fPXPxtqXKqQK4ZviOCfVFQNVzDgxv+AdqfhNgGAQspoTCCv+08qJmZIoGeHbSJX jJRxJio1PH3p+g/l1mefxqr6bdJXkSFFLXz3iX08IEH2RUQKxyGbpwN5OLwYnQndmh2t J8GQMOA9d1ZmPSbeXu8o6U2QKUcLoL8u7qWTg6Lae5fPnb0xU/3GtptRuMhJl+C9ImZV pN52QSX9La7h3wVVzX/Bbot7JrmkHz59vHu4+Skj1ueevp59Ghp2huVwUGqshkDydLEX Z45A== 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=QU3oeydO4deqKs71AOrHq4mL0RBHni0rDESBhTtVtZg=; b=i6QKISo/WTubW9dJwzWCFZ4WYkmeeB5AWkxbOMRHEYPIRVv/QbJ5VbZnovRhNJ9Yry MNPLULzatnY39jArY1BWW4HvFZ0rLJ/K8KSM37yB0Fyy52Snti3sytPorUYlKmGnkrQY +NkC9E+JsyMJY8+Onil/xQihu8JkAsp1UXW1yScf6OToQ/kE7QBv8Eg2QDGDQZ9jLKUK bNNiNV9/2VYtb6hsywS9ao3JR6ofZhWwozRuf7sMiilmNYyRbsZ2Huvd2Pp6fK5Kl0xe 4PLaptWW8SuQEC4ZtbBBBnxbnk/OeQSgVqaOFh67pIf5f1e2fiymm4D9qs7IzlKZVDiO cASw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QuHfkcAa; 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 o8-20020a05622a008800b002ee55de5362si2794652qtw.132.2022.04.17.10.56.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 10:56:28 -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=QuHfkcAa; 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]:47308 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng98O-0006Hx-Fm for patch@linaro.org; Sun, 17 Apr 2022 13:56:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47744) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8wu-0000eW-SZ for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:39 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:44579) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8wt-0003G1-7n for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:36 -0400 Received: by mail-pg1-x52c.google.com with SMTP id j71so1443550pge.11 for ; Sun, 17 Apr 2022 10:44:34 -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=QU3oeydO4deqKs71AOrHq4mL0RBHni0rDESBhTtVtZg=; b=QuHfkcAa45CVHNhWIt5J9EguM6s0DglhM2qCMAOia+jzJ5jEmbq/eZgmSZMXu+9Jcz evGbGUhTefzInCOFnHboL4DEIFTv1RUGO3o1lG+l5SYB29R2ikvOifJxIZuUbnq65sad PPxeIJKD0T19WIEoi6axKLrZS8cGM3JIYZ8QcfpFJYVoUTBTtoEjCWLHJAgyP5Hm5gFj li8G0ND1j/RVNoREFGSURvmPCFxuO4wUp08jOO7qLz2lFvB7F3Uli7KBdj8+8IzdFeze e929xuBSZAWfFrjvf15McWULdX/kfJWrVy5qUKXQiY39vxAn7Lfig0wczP5JEApAErX0 SK6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QU3oeydO4deqKs71AOrHq4mL0RBHni0rDESBhTtVtZg=; b=yPITRyyGRwpA26lHidiSuvsgk/X1O3X7nzaQMXSnN/zNK0s4DG+IPoKfRwtImSwie7 Gs4A3YKbtUBXr0mEYkha7g4w4yPTewbBPgRiM+GyfYtAMuycamqvQ2At5xGnZWkNztRp sTR90MdRYaUkqLhCGhbwDacoowftOtVw9soJmm4kroyEfm0KI/Ux0sBl8x8spAF8Ncf8 rmufcVy9T2arASZzxcQFeJs4glX6gpc8uciMUOiCBtUXnldXfmBCTitGRQnV7Z560KA0 v0hUckEM/0oFug6jnEP1t9bwZMapCPlFbf62tkQeoZLy6A4wea3FL/UUPqxvo3YEqatv nlmg== X-Gm-Message-State: AOAM532coOkSYYD+AoaHoyFAC/rnxYWaTpJTqkv7l9UtGif3/VXRgvwR uYlf59Az398YD79Mu9uogM32WQZHxcnzBQ== X-Received: by 2002:a05:6a00:997:b0:506:1e25:435e with SMTP id u23-20020a056a00099700b005061e25435emr8268538pfg.9.1650217473977; Sun, 17 Apr 2022 10:44:33 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 05/60] target/arm: Change DisasContext.aarch64 to bool Date: Sun, 17 Apr 2022 10:43:31 -0700 Message-Id: <20220417174426.711829-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Bool is a more appropriate type for this value. Move the member down in the struct to keep the bool type members together and remove a hole. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée --- target/arm/translate.h | 2 +- target/arm/translate-a64.c | 2 +- target/arm/translate.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target/arm/translate.h b/target/arm/translate.h index 3a0db801d3..8b7dd1a4c0 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -59,12 +59,12 @@ typedef struct DisasContext { * so that top level loop can generate correct syndrome information. */ uint32_t svc_imm; - int aarch64; int current_el; /* Debug target exception level for single-step exceptions */ int debug_target_el; GHashTable *cp_regs; uint64_t features; /* CPU features bits */ + bool aarch64; /* Because unallocated encodings generate different exception syndrome * information from traps due to FP being disabled, we can't do a single * "is fp access disabled" check at a high level in the decode tree. diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 9333d7be41..4dad23db48 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -14664,7 +14664,7 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, dc->isar = &arm_cpu->isar; dc->condjmp = 0; - dc->aarch64 = 1; + dc->aarch64 = true; /* If we are coming from secure EL0 in a system with a 32-bit EL3, then * there is no secure EL1, so we route exceptions to EL3. */ diff --git a/target/arm/translate.c b/target/arm/translate.c index bf2196b9e2..480e58f49e 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -9334,7 +9334,7 @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) dc->isar = &cpu->isar; dc->condjmp = 0; - dc->aarch64 = 0; + dc->aarch64 = false; /* If we are coming from secure EL0 in a system with a 32-bit EL3, then * there is no secure EL1, so we route exceptions to EL3. */ From patchwork Sun Apr 17 17:43:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562820 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1854517map; Sun, 17 Apr 2022 10:52:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEeX14T0Cq75GieBtrH1t6+Wnu6E/MxnHb7cGjDuj8gmYoap09z8Qas7flhVzdmVE4DQOb X-Received: by 2002:ad4:5bc1:0:b0:42c:37be:6ac3 with SMTP id t1-20020ad45bc1000000b0042c37be6ac3mr5884774qvt.18.1650217957803; Sun, 17 Apr 2022 10:52:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650217957; cv=none; d=google.com; s=arc-20160816; b=wC67fW2k2/K6fRSKAudgBtPx9d2KtNiDR1Z74Zk0hr5cdrsd1xM2P9RAiuBCmaPlGg Naqcm0viXmc5nEqPk5+52PG06e5wKirxMcu45/HEdSJ+XusF49AhkeuacHAT4QsRjxSZ 8JFRyAMOtdQsVHheWDtxYmUJ84uqy2Qg6CCDBKtu5Ue2BL7uJY/auTnNS6b6CMHUpL1w f+Ekzin5pDwBDzrFKkmyMqVy7GtnAmV1OnbDNHzaplR5hzr6zonHYcRWW8IFh62aaC5L xP3rPthr/X93XcqFIUYgeduUvT6hibT6jEj/cXOZrG9nOyZiahvbg93kGIb0SJXFMmOX 4E0w== 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=4B9pthiRLfIf40OZcpcAQf7C9gNufiID5iESdzNE71c=; b=molPMGW2/8XMdLUVfelmB6EbuHieKEzw25GpJc7a8Hbt0Ew6aHZ6IZ2Iulf5Z7v6y1 cpvSOLyf1y6ZZusBaBYSm5Ujt1AJplrbTrYlFDt3ohggQ1wQoHcAkTxExZ7C4wKp2Hto ihBDLYSARZcIG47fiu4doRKRurLLQF4sZ9JAEzAxwRwDOnnjrjmEiymUARkLQeQbl683 MgiqtzBMWfDduln4v3ooi/F8rabpIn3wxz3a5kAf+g2GjBWTzFHzxUtFHMicUmxRnRIl 1DJ/iUOlxgPRIQOhPEF7wwmyoM3KVr0Q8DI2oeAImDVJBd3DeOpOgr4vQieTi3nuX1n1 G7Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VJE4sumE; 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 s25-20020ac87599000000b002e1fbf3be96si2312833qtq.135.2022.04.17.10.52.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 10:52:37 -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=VJE4sumE; 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]:38642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng94f-0000XY-BJ for patch@linaro.org; Sun, 17 Apr 2022 13:52:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8wx-0000fI-J0 for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:41 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:40532) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8wu-0003GR-Ku for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:37 -0400 Received: by mail-pj1-x102a.google.com with SMTP id md20-20020a17090b23d400b001cb70ef790dso15505987pjb.5 for ; Sun, 17 Apr 2022 10:44:35 -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=4B9pthiRLfIf40OZcpcAQf7C9gNufiID5iESdzNE71c=; b=VJE4sumENvnXSWQR9VW72B1CEU54og69sdChfbuItGbFzvfIOztws4fgfB1zp4r4nQ XI+74VB7pbvHnvY8uJed8/jkGhoc60Cf9SDU78fbLT/sTmrt0Pep0oBsE/kq4T8MK/BK 5PSbxELnwExO1ZrXwK+IhQhR77hk49TZJ+71la3YzVclPnfgwSu2ZQIvIOJlOFMwc4ii Ie6lN77wz3MVkLWmasezY7Fwp6bjbegJ7apvIPPNL+ikj9OPowiGVNr2DfZSIUNzUPoM Ar3VSGdgNelzCAp5KxnAXwFw6bMMk7YznGqGqBn+lGqNKtpPvXtC9Y4br30BFhs8AYPz 2nmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4B9pthiRLfIf40OZcpcAQf7C9gNufiID5iESdzNE71c=; b=2vgD8uF5exH0Z3icXeL8fpFLjFHpzPLaAPMRDeS3fT58SorEgXScqkqtQWd7VsYSfN TKpj7Qno8t+aqyjXFvWfdxWcDZHB0/I3pIqcjgKcPi1phI5nlfSZ14TDmEkEjYpQuhDG MRK7TYlcw/95J9Q/8AgWsAQehQhDCpwpIjMVcyCuRRf+ZpLkb5g2CyvryuJCGRIQi76E ZwAJGhx4hJ+UICPTl6690TG0SGgUNtYFOIkktCKh8axroaluIs6IFXekogpt/h9PRe+D +EbgT3G4aS1ZtDFDHbqY5zhBKkyaPiGf9gucWl8IV2pRJZn0/E2jWkaLV6WoXQ5Rb9An UQtA== X-Gm-Message-State: AOAM531BBuoDRRNSuDVBJB1w5GnkphHdmMGKo/ys+TFwkQNZB9qyLQvy 2JiyDQTkaYx61QIo0lHn3izTbkEWddXBrw== X-Received: by 2002:a17:90a:634b:b0:1ca:6c7e:7952 with SMTP id v11-20020a17090a634b00b001ca6c7e7952mr14230125pjs.54.1650217474868; Sun, 17 Apr 2022 10:44:34 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 06/60] target/arm: Change CPUArchState.aarch64 to bool Date: Sun, 17 Apr 2022 10:43:32 -0700 Message-Id: <20220417174426.711829-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Bool is a more appropriate type for this value. Adjust the assignments to use true/false. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée --- target/arm/cpu.h | 2 +- target/arm/cpu.c | 2 +- target/arm/helper-a64.c | 4 ++-- target/arm/helper.c | 2 +- target/arm/hvf/hvf.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 9ae9c935a2..a61a52e2f6 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -258,7 +258,7 @@ typedef struct CPUArchState { * all other bits are stored in their correct places in env->pstate */ uint32_t pstate; - uint32_t aarch64; /* 1 if CPU is in aarch64 state; inverse of PSTATE.nRW */ + bool aarch64; /* True if CPU is in aarch64 state; inverse of PSTATE.nRW */ /* Cached TBFLAGS state. See below for which bits are included. */ CPUARMTBFlags hflags; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 5d4ca7a227..30e0d16ad4 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -189,7 +189,7 @@ static void arm_cpu_reset(DeviceState *dev) if (arm_feature(env, ARM_FEATURE_AARCH64)) { /* 64 bit CPUs always start in 64 bit mode */ - env->aarch64 = 1; + env->aarch64 = true; #if defined(CONFIG_USER_ONLY) env->pstate = PSTATE_MODE_EL0t; /* Userspace expects access to DC ZVA, CTL_EL0 and the cache ops */ diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c index 7cf953b1e6..77a8502b6b 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -952,7 +952,7 @@ void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc) qemu_mutex_unlock_iothread(); if (!return_to_aa64) { - env->aarch64 = 0; + env->aarch64 = false; /* We do a raw CPSR write because aarch64_sync_64_to_32() * will sort the register banks out for us, and we've already * caught all the bad-mode cases in el_from_spsr(). @@ -975,7 +975,7 @@ void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc) } else { int tbii; - env->aarch64 = 1; + env->aarch64 = true; spsr &= aarch64_pstate_valid_mask(&env_archcpu(env)->isar); pstate_write(env, spsr); if (!arm_singlestep_active(env)) { diff --git a/target/arm/helper.c b/target/arm/helper.c index 7d14650615..47fe790854 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -10182,7 +10182,7 @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs) } pstate_write(env, PSTATE_DAIF | new_mode); - env->aarch64 = 1; + env->aarch64 = true; aarch64_restore_sp(env, new_el); helper_rebuild_hflags_a64(env, new_el); diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 8c34f86792..11176ef252 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -565,7 +565,7 @@ int hvf_arch_init_vcpu(CPUState *cpu) hv_return_t ret; int i; - env->aarch64 = 1; + env->aarch64 = true; asm volatile("mrs %0, cntfrq_el0" : "=r"(arm_cpu->gt_cntfrq_hz)); /* Allocate enough space for our sysreg sync */ From patchwork Sun Apr 17 17:43:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562818 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1852966map; Sun, 17 Apr 2022 10:49:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUJBhlZdAjrFaEzP178XKwzNz904OPMoLj23nJiZ3m40+t9c/wEYjGVpPgXgvzuLHwn2VB X-Received: by 2002:a37:88c1:0:b0:69e:61cc:b51a with SMTP id k184-20020a3788c1000000b0069e61ccb51amr4647707qkd.71.1650217751792; Sun, 17 Apr 2022 10:49:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650217751; cv=none; d=google.com; s=arc-20160816; b=iXFQayATXZHu2X4zXydgmOmIuAN7N5lQKn0MLMV0ZoDI5pTvgo/2aAPG32TDop5YV2 uQGB0cAWw7r0Z1CoAKDpN+Bm2DyWBVIk9QIjqqdmsXn3VFey9mwcUCCwAXrqFRtZMaRA alIFTPFux1XQQKP38rbw5GbG6KAr9i8a5CzyD5ZvgpcB7QGU7FsTk6+t/sEzlPIlJX20 ze1tAWg2clsgPkZhs/l3SY65zwh/DHUu10t3QLowIoy+BnqDMp5Vf2TJBZEpUexCyFkg lNEmOXQrqAzDvwW00V92kFa6o08JiY5fcy9ddcvR1400QD/0wwbWBf+RL+D35H+d7zy3 JaJQ== 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=VFtB/E7djXDPURXg40lhRvaf5WnkYYoUZ27VyitKWXw=; b=bknr1+qLOCJZJHD6JbeVKHfgYoC7SVEftkOk5ojUhN2FgL/wAKGlYXi0g/V5iUUqQw Ssz6dicJEMVqU//EtJ5KibxiVX80pxXkCStP/VxqOuBSddael5zuTqUd+pa0JZG83cpQ BGhlWXmuoanEpUbBtjDeuKKJrdHcATnkv6Y4Mb5/sTuAY+HEFE2UI5rRKujb+ab4M4X9 JPihK8wTxp9JM477y2Gaok6TXc2XWvIPNDD418J5GIEzrkkVT4LQJ6A1xY6w9kFlbtCB arqttKAJAlRjIg+EnWlD08gDhR8xuTrDp65zy9U/rqdhy4LgLauAvahRK/w1LMYDahL1 BTDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="BiNO/Tsd"; 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 x7-20020a05620a258700b0067e4be23800si2546877qko.69.2022.04.17.10.49.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 10:49:11 -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="BiNO/Tsd"; 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]:57952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng91K-0002rm-R9 for patch@linaro.org; Sun, 17 Apr 2022 13:49:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47816) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8wx-0000fK-Kg for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:41 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:44654) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8wv-0003Gs-2H for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:38 -0400 Received: by mail-pj1-x102c.google.com with SMTP id u5-20020a17090a6a8500b001d0b95031ebso5272257pjj.3 for ; Sun, 17 Apr 2022 10:44:36 -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=VFtB/E7djXDPURXg40lhRvaf5WnkYYoUZ27VyitKWXw=; b=BiNO/Tsd5nN/K0y5UIKpidCYPek4TbeIB8m1MQZe9XMma39xFN2au6Vu3xS3MgjYiA aFuhzEWNFoh+jH501BEzLj+moRqLSG21PZAmpaItbrEWLbHORUsf5jJx9fRCObdtCvq8 AOGwC1pQEzRVFsS7fyDQXPRBcqqOCqQP7mvXiqgztW+1I4UuZl0mfWm6fdZwZH54N1wZ YY1UdaD55HP9sIbvwugNJUX5hfYXic/YFjGCIE1aEispWSD0d288zMo6am70kIzVcBI5 X/hLQZAufGsxDf4+XY9up7PVuUeyupHHRFdgK+pH8fd9yk2KJOHbWuy+1z5FK+3FoNrs 4gqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VFtB/E7djXDPURXg40lhRvaf5WnkYYoUZ27VyitKWXw=; b=ORd/gmMWNFvjA59/PSRBmA9bZbW4qpibNhu/rBGfAgp7Ak/VnC3lPVKGsGtjva6zA6 xnUKHyg2vGOHUDPFOojqz25Iv5y2FOo9Xiz8qeiyvHmEBfmV8tR1MwsjoCTJ3DnXwkgg a+n3F61QIEMeFS2T+TgWJytToPFaoQRT11mMA5ndRX2MtFWCQewL5X7JFv9rFeoLtvfZ ZexJ4+bulwypBIWWG5wmAUH+SPYipQpsfPCPtITqF9199MqWkM3PwKBsSmbWlZRNxzD1 8wJjt9JNCUeMLKNV2KcHAN3z7qn4d2XOEq0Ga0dyUgWTsICSqV/kOw7NyH7GLVu46H7u CboA== X-Gm-Message-State: AOAM530/Gh4+q6rO2xk0lZESNk1M0x1sW6K0kBaCxxcoujSr8LQ+XzNF nFdAsLVhvw0F3peUa1lrP8RO1UiAiRxGLg== X-Received: by 2002:a17:90b:218d:b0:1d0:90f5:4064 with SMTP id ku13-20020a17090b218d00b001d090f54064mr9222138pjb.95.1650217475781; Sun, 17 Apr 2022 10:44:35 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 07/60] target/arm: Extend store_cpu_offset to take field size Date: Sun, 17 Apr 2022 10:43:33 -0700 Message-Id: <20220417174426.711829-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Currently we assume all fields are 32-bit. Prepare for fields of a single byte, using sizeof. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Reviewed-by: Alex Bennée --- target/arm/translate-a32.h | 13 +++++-------- target/arm/translate.c | 21 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/target/arm/translate-a32.h b/target/arm/translate-a32.h index 5be4b9b834..f593740a88 100644 --- a/target/arm/translate-a32.h +++ b/target/arm/translate-a32.h @@ -61,17 +61,14 @@ static inline TCGv_i32 load_cpu_offset(int offset) #define load_cpu_field(name) load_cpu_offset(offsetof(CPUARMState, name)) -static inline void store_cpu_offset(TCGv_i32 var, int offset) -{ - tcg_gen_st_i32(var, cpu_env, offset); - tcg_temp_free_i32(var); -} +void store_cpu_offset(TCGv_i32 var, int offset, int size); -#define store_cpu_field(var, name) \ - store_cpu_offset(var, offsetof(CPUARMState, name)) +#define store_cpu_field(var, name) \ + store_cpu_offset(var, offsetof(CPUARMState, name), \ + sizeof(((CPUARMState *)NULL)->name)) #define store_cpu_field_constant(val, name) \ - tcg_gen_st_i32(tcg_constant_i32(val), cpu_env, offsetof(CPUARMState, name)) + store_cpu_field(tcg_constant_i32(val), name) /* Create a new temporary and set it to the value of a CPU register. */ static inline TCGv_i32 load_reg(DisasContext *s, int reg) diff --git a/target/arm/translate.c b/target/arm/translate.c index 480e58f49e..c745b7fc91 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -180,6 +180,25 @@ typedef enum ISSInfo { ISSIs16Bit = (1 << 8), } ISSInfo; +/* + * Store var into env + offset to a member with size bytes. + * Free var after use. + */ +void store_cpu_offset(TCGv_i32 var, int offset, int size) +{ + switch (size) { + case 1: + tcg_gen_st8_i32(var, cpu_env, offset); + break; + case 4: + tcg_gen_st_i32(var, cpu_env, offset); + break; + default: + g_assert_not_reached(); + } + tcg_temp_free_i32(var); +} + /* Save the syndrome information for a Data Abort */ static void disas_set_da_iss(DisasContext *s, MemOp memop, ISSInfo issinfo) { @@ -4852,7 +4871,7 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, tcg_temp_free_i32(tmp); } else { TCGv_i32 tmp = load_reg(s, rt); - store_cpu_offset(tmp, ri->fieldoffset); + store_cpu_offset(tmp, ri->fieldoffset, 4); } } } From patchwork Sun Apr 17 17:43:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562826 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1856573map; Sun, 17 Apr 2022 10:57:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9e9GoFHJMIimI6AXDHqIoNlYITArt1mY1mqXkFuiXv4Ka1W+DBQf3yui9fYH1nimD6NDC X-Received: by 2002:a05:620a:258e:b0:680:f33c:dbcd with SMTP id x14-20020a05620a258e00b00680f33cdbcdmr4840545qko.542.1650218236022; Sun, 17 Apr 2022 10:57:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650218236; cv=none; d=google.com; s=arc-20160816; b=tylCnCcIso9svqUTijRn3EtNgL8JZgLA9H8UOngVch1g3HPYcyZ+yw3+VZGSdM0YAc jnjpLSNuiex1Y30uNZzadAbNePF/z7dMr051BB4/g/T4w38xumistoV7vrpqQ7WwVbD3 WrYIC6yolmVyqvwM6LgTM5JPIFyaQQfVGUdA1Bkaa0kggE/k0kxpVbCzN0Tl9WrUxvkt WLa7IsUCO4JG2fzwB/I2Z8xmOh5t6WS7LOFD9a8B28q9FnIrEDp+sjcvyieFArPrstqY AvzQU2Kd0hPAZv3CA4dZalzSC5lW3fPJKQb+mm1aYHvAxOiwmZdecKeMpFqpnCI/CLKb BLUg== 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=RxLRcUMRXZIX8VeQpjedlgnjJfO7UvkrNmgRZi4O4+0=; b=Q/XRNyXCxG1BuwNyZcTZf0+JGR5ICM0+tsHg1+llMaAw7uO/TsqGcHXXuwutaWP7lm Ut6dIoLg2k9ec2aR3UnxqkWoXH/jHhSbB2gnry+L5jHmOBCfd+8TpMGrVGGPlB7RlQLw xFKnWHtZysZswfDQTwp5oxb6BMg3wcYJC2u/8ZmHcZAZSU88OH3sQjmNT1zJ2PFUBYIj 5NtphzAi1jawvY7NrHpAzltmJYqSUjQ5jTsJGzvKLjzvWLAL7D12r+YLS3kb0+giK5zv RzDbyA6xMP419ten/JHtajL0qtvXp/9rrgK1mrvExN3EqKUv5+kgFb2k8PGLORIq9j96 kjKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KdLM8h1J; 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 x25-20020ac87a99000000b002e22bbe9f4esi2242615qtr.158.2022.04.17.10.57.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 10:57:16 -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=KdLM8h1J; 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]:48584 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng999-0007C5-KH for patch@linaro.org; Sun, 17 Apr 2022 13:57:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8wy-0000fU-Qj for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:41 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:44583) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8wv-0003H9-Sl for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:40 -0400 Received: by mail-pg1-x530.google.com with SMTP id j71so1443664pge.11 for ; Sun, 17 Apr 2022 10:44:37 -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=RxLRcUMRXZIX8VeQpjedlgnjJfO7UvkrNmgRZi4O4+0=; b=KdLM8h1JGtzeZuX9glkjRthvPMUmMwW7CNEQ/sKHmk5U8L+Lptw5Cj5sJvm/W0qu6Y 1aQIDVX487Smbz7Tqsw/pP7DR4DmpUh4cvKjVuXnB9TWKHf3iQnK65l14jjz4yljw59B RF1ySx5Gb3CLSsWlepjHm0JeiezwKG7brMkVw1TuawQMvI2GoqEOm4pJKLpjuCbnGbg9 hXHKQNxfxSAJgr7AjVn1jMncJK1hFKLIMktb4ZtuIPfppky6hwDFivDupaEglnz44f5c RXCYzPzhN+brwePv6ln/I1dLX/8Fn4LEGJ4GWODZ/PTOvHHvhX0bZA7k0Zcfb0b6yT18 35TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RxLRcUMRXZIX8VeQpjedlgnjJfO7UvkrNmgRZi4O4+0=; b=4oZ9pkXMJjlehQ1HTsbVckC6mdrZr0tx86zmKQPsIdCVHGWhpRpv5PIg0Ko7SoTwbM ++axaJ+cfnU+b7nCz+oPI247pit2muvb4U1m104puFyzZNiZTqw4ORQ/Rjg4xFOBnNJl clDW61TsbooUfvm5orhM/dFmAYx1WZhCOt6u4R13RMUpSULjefaywgdeDStDYkA5NKG0 XdqLt2AariWWj0FioeLaGKBc6bHyZKCa1eITIlVxkAC/BGakivKxcarrGQlQFt0s/3Hh t4LGjsDqf0HW3ybRfho5PQPgmwYHkwnk+MaM8aCAHbMSenX2y4MO6Bos38GXW6YRxQ86 FCxQ== X-Gm-Message-State: AOAM5320eNbb5p7KjtXXWpe5riVbabuN7XtuTSr6TTmbT8AmziUV7My0 IHedV/5tPMuDfHQgHL6P6bgfrmsGrt7IAg== X-Received: by 2002:aa7:920b:0:b0:505:66a5:3029 with SMTP id 11-20020aa7920b000000b0050566a53029mr8313795pfo.40.1650217476615; Sun, 17 Apr 2022 10:44:36 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 08/60] target/arm: Change DisasContext.thumb to bool Date: Sun, 17 Apr 2022 10:43:34 -0700 Message-Id: <20220417174426.711829-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Bool is a more appropriate type for this value. Move the member down in the struct to keep the bool type members together and remove a hole. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Reviewed-by: Alex Bennée --- target/arm/translate.h | 2 +- target/arm/translate-a64.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/arm/translate.h b/target/arm/translate.h index 8b7dd1a4c0..050d80f6f9 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -30,7 +30,6 @@ typedef struct DisasContext { bool eci_handled; /* TCG op to rewind to if this turns out to be an invalid ECI state */ TCGOp *insn_eci_rewind; - int thumb; int sctlr_b; MemOp be_data; #if !defined(CONFIG_USER_ONLY) @@ -65,6 +64,7 @@ typedef struct DisasContext { GHashTable *cp_regs; uint64_t features; /* CPU features bits */ bool aarch64; + bool thumb; /* Because unallocated encodings generate different exception syndrome * information from traps due to FP being disabled, we can't do a single * "is fp access disabled" check at a high level in the decode tree. diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 4dad23db48..be7283b966 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -14670,7 +14670,7 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, */ dc->secure_routed_to_el3 = arm_feature(env, ARM_FEATURE_EL3) && !arm_el_is_aa64(env, 3); - dc->thumb = 0; + dc->thumb = false; dc->sctlr_b = 0; dc->be_data = EX_TBFLAG_ANY(tb_flags, BE_DATA) ? MO_BE : MO_LE; dc->condexec_mask = 0; From patchwork Sun Apr 17 17:43:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562821 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1854527map; Sun, 17 Apr 2022 10:52:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/8aCPfq00N/vU3a3AeTiVCYkibBJHOoIR1mgTc595G9UUSn4HnZcRFD2bzFGrmb0bcV6k X-Received: by 2002:ac8:57d2:0:b0:2f1:fa23:a415 with SMTP id w18-20020ac857d2000000b002f1fa23a415mr2451786qta.322.1650217958408; Sun, 17 Apr 2022 10:52:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650217958; cv=none; d=google.com; s=arc-20160816; b=Vu2huYQwJaoE4C5gGMI2DLrzAVvjEc56f7mea6C8C0Mb8B0HFCtP7VR31VzzRGgvCF dkYF0s6/OeUmAHQaDon1iGUqhLMh9UpkCTGaFfVPxtdClGa95Mp93EC84muIp2yFdD3B zYKDIZRR/oB8DcF+80zJpC5aXP80MoxCVVinXCY/fFYXjgvDwftyIENEs+pfmmVeDC2C pcB+nSiiczxMeirJQNK7nypdQJ6vTRNcI0s6OSol/4wEY8pw15hJU3BS5P/xmNRBcgje xAZ2C1vs4tApy7XIk43lP9Q9Z2Ghzr+t+BR105R9os6kBSk95ZxvWUkh69YReTfFS+2Q bfVA== 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=28ulwBk/DdHKOhHfzeHCOUU8iGC2wvWNCEyLXBlgf/g=; b=p+l5VYkaOlrgjvayg9MnP1rRXG3BacT3YwIeK2Q3b3jsNJWvtHbj9Wb1aEQ/ewdbJX 19LzV+xqbDEJtI84zB01KMqqOZrXPAZFofp4GxwtgdTHyaB6/0njn9+67wbThiJfpm32 Qldf9Fr4g1PwHB6Em4aM+rUUnpM3Fz/qogALkT550goDC5/bDfLC3HBQZoHaYBQD5r2L oHuqgQiRZ78Mcf/spXRLtnkglCmtPU2y91U/xLOHKgnK+H5XPWJTZTf03k0yET/3HD15 yrmzlTVESZy7or8ckx8lcBbrR/ghocpINbJPvd3aB8ev7cjmBGwJ1e0PPVEL6kSNIwHe /sTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JAj8bIiA; 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 gc11-20020a056214230b00b004443496676dsi2112361qvb.420.2022.04.17.10.52.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 10:52:38 -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=JAj8bIiA; 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]:38648 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng94f-0000Y0-RN for patch@linaro.org; Sun, 17 Apr 2022 13:52:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47922) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8x0-0000fZ-7O for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:43 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:38738) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8wx-0003HP-AS for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:41 -0400 Received: by mail-pj1-x102c.google.com with SMTP id s14-20020a17090a880e00b001caaf6d3dd1so15524804pjn.3 for ; Sun, 17 Apr 2022 10:44:38 -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=28ulwBk/DdHKOhHfzeHCOUU8iGC2wvWNCEyLXBlgf/g=; b=JAj8bIiAgO5uzz4Oe7l6bjlADn4o1Vg69i2QGlT6tTEESbK2OvQj0MnybKY8D2Cueu 1ZwlHh3eDqwI3DmWLxOCZODdIknmUVWVaCJ0J8CVER5YBmY3OU2W6pZxCj3x74+Ha0sr vsNYCAHIUrZradqz33jQEAdKI2001/xqhGJ/MVnd3Wq3CDGt81iI+25K9fnRU7FYRMFB lY/PL7cJO6jyrgYTAXqHfctZpiBdNNp+VyQf9FEsGpXnJsFA1gGYpTDR0ELQ6nnuwhNe dNW9Pt2tY8g4XXPN5OlaEQ1SUCeTytlvf8TbLp47OyXgpt6ChGWv3TjOPtOCiSEFr9Ot G97w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=28ulwBk/DdHKOhHfzeHCOUU8iGC2wvWNCEyLXBlgf/g=; b=BNMOZMknVYIz4s2XFUQ3A/SqQn2OmRSfDXLEMh9DfAFN33PHkzegQKkv42kprBR4aS diFCSWxoLHi1gI3zHHNfgZgtMLlEZLQ0vvwhS/I09kq+8Xoap+5ctlb6WyiW3FXQc9gk BOc01oa9yrvjgySw4/tHsCx18Sc6+Vn6711TPUIKrXdFJaWjHLZSNYYbOV4uuSCbzNnK 9z4z/YvgJocCMTePDtJprIFJxf1y8w1ylc9ZvLkMHlT1i/gF54MZ/2l8aKOHBBbMtdpA 8UpFodqNeb9rAFUY53SEYJwdEuaQgeuxYliYb3woKjk8mlRDlaO77h5HBBaoqxjYm/uK 0t6w== X-Gm-Message-State: AOAM53121C8Ke55OwRwf4LmY9d5LKyry5soYf99WvA4SkB7XwprRt5jp xNoEiQV9or5faJkt5OBhNCDeZ92xfFhlLg== X-Received: by 2002:a17:90a:5902:b0:1cb:a0eb:8f8c with SMTP id k2-20020a17090a590200b001cba0eb8f8cmr8955487pji.17.1650217477378; Sun, 17 Apr 2022 10:44:37 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 09/60] target/arm: Change CPUArchState.thumb to bool Date: Sun, 17 Apr 2022 10:43:35 -0700 Message-Id: <20220417174426.711829-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Bool is a more appropriate type for this value. Adjust the assignments to use true/false. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/cpu.h | 2 +- linux-user/arm/cpu_loop.c | 2 +- target/arm/cpu.c | 2 +- target/arm/m_helper.c | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index a61a52e2f6..4eb378ede2 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -259,6 +259,7 @@ typedef struct CPUArchState { */ uint32_t pstate; bool aarch64; /* True if CPU is in aarch64 state; inverse of PSTATE.nRW */ + bool thumb; /* True if CPU is in thumb mode; cpsr[5] */ /* Cached TBFLAGS state. See below for which bits are included. */ CPUARMTBFlags hflags; @@ -285,7 +286,6 @@ typedef struct CPUArchState { uint32_t ZF; /* Z set if zero. */ uint32_t QF; /* 0 or 1 */ uint32_t GE; /* cpsr[19:16] */ - uint32_t thumb; /* cpsr[5]. 0 = arm mode, 1 = thumb mode. */ uint32_t condexec_bits; /* IT bits. cpsr[15:10,26:25]. */ uint32_t btype; /* BTI branch type. spsr[11:10]. */ uint64_t daif; /* exception masks, in the bits they are in PSTATE */ diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c index aae375d617..2979109f92 100644 --- a/linux-user/arm/cpu_loop.c +++ b/linux-user/arm/cpu_loop.c @@ -231,7 +231,7 @@ do_kernel_trap(CPUARMState *env) /* Jump back to the caller. */ addr = env->regs[14]; if (addr & 1) { - env->thumb = 1; + env->thumb = true; addr &= ~1; } env->regs[15] = addr; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 30e0d16ad4..561f180067 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -51,7 +51,7 @@ static void arm_cpu_set_pc(CPUState *cs, vaddr value) if (is_a64(env)) { env->pc = value; - env->thumb = 0; + env->thumb = false; } else { env->regs[15] = value & ~1; env->thumb = value & 1; diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c index b7a0fe0114..a740c3e160 100644 --- a/target/arm/m_helper.c +++ b/target/arm/m_helper.c @@ -564,7 +564,7 @@ void HELPER(v7m_bxns)(CPUARMState *env, uint32_t dest) env->v7m.control[M_REG_S] &= ~R_V7M_CONTROL_SFPA_MASK; } switch_v7m_security_state(env, dest & 1); - env->thumb = 1; + env->thumb = true; env->regs[15] = dest & ~1; arm_rebuild_hflags(env); } @@ -590,7 +590,7 @@ void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest) * except that the low bit doesn't indicate Thumb/not. */ env->regs[14] = nextinst; - env->thumb = 1; + env->thumb = true; env->regs[15] = dest & ~1; return; } @@ -626,7 +626,7 @@ void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest) } env->v7m.control[M_REG_S] &= ~R_V7M_CONTROL_SFPA_MASK; switch_v7m_security_state(env, 0); - env->thumb = 1; + env->thumb = true; env->regs[15] = dest; arm_rebuild_hflags(env); } From patchwork Sun Apr 17 17:43:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562831 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1859493map; Sun, 17 Apr 2022 11:03:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyr9u5tyd9sM4vVn+UAGVBTC1qPKOvcI4Hb4EwoizjKqinHUro4V8wtrOiOV1Ym36HS5dTR X-Received: by 2002:ac8:5948:0:b0:2f2:104:8de5 with SMTP id 8-20020ac85948000000b002f201048de5mr427008qtz.499.1650218628498; Sun, 17 Apr 2022 11:03:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650218628; cv=none; d=google.com; s=arc-20160816; b=a+mhPYlx7lOzdoz29IJO0xiZKhbRqSjCNZF3diB3LR9wNYO+C0K+A50KmhKJ22wmdM 3AoWkn+I6Wqo6yMP8AClQCxzXP5B0ZFfhklRsaHujwnFUfFOOX25Ux7Yfomr3b4x0Ces 6luBciQVuvD2sHWngs4jxrs3wgLSn+q4M18v8eBd+REaWECL9L4OrEW9Hq9awhp/gkUv 9JL2P+S1qjEs6u6YjOb6LR+zulbA9p88TID6l7TiAyhqb41buCHfGcmEvWwzb+ePyYmS nArnPS+35dSiaAtv1GyWUdrlguUwdH/+/khEgyKxjktu9Aq6PV5Lh4NIdd0lmiCH9DLN fdhw== 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=vIjgH0QxYeAMP4DzJu3i3Y0UtqyUSNTOLfLjsYFO5vU=; b=LbXuwEpQ2iNRoH8RoIaz2x7xsI9rBaxEkOQSf6AUYt3ocPa3oHzQpuogAaQXiguvLs h5TkIVddnAnYE9u8Hc6mvmmg15m5YHvYpZslOOTetl1gWQ03s+cF/+l/Oh9ijoDPFQhO iDY766RbpD7lumKhqmj64jSehZ0rruJniu28dNjEcef4fan0dfx2uQQrQgJpf/zYTfLx 0N7Kf3xK4kzNwZ4mYsccvidNzoRa9hLFe2YEHd+SoPeLyh+LFStQuVef+ZJBHOzCVhQl KsDsUqBzFlxC/zaUZvdmZfsG1VgCEqc7Xc90sj2vt5OJeBJRB5g5/Rh1OUB4w9Xop1/R 5UvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PDXnRxqp; 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 d23-20020a05620a159700b0069c437e5737si2205167qkk.243.2022.04.17.11.03.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:03:48 -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=PDXnRxqp; 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]:37538 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9FU-00021n-2E for patch@linaro.org; Sun, 17 Apr 2022 14:03:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47926) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8x0-0000fb-AS for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:43 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:33601) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8wx-0003Hb-IO for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:42 -0400 Received: by mail-pg1-x534.google.com with SMTP id k14so14986489pga.0 for ; Sun, 17 Apr 2022 10:44:39 -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=vIjgH0QxYeAMP4DzJu3i3Y0UtqyUSNTOLfLjsYFO5vU=; b=PDXnRxqpB6Ja5X6pHmUS58KPdyU9sgvY3ljJ1wuYioD3iMjqxhl1US2Siw/MnLHRmm KDWsbWAByfc0AtQ2C1aieJm4zbxOClH7c6OOt2y8hBoeuNI0AlJT/MJEn8NEJFcBBfYB ao0RyFRr/Tp/D12Gw1gAw51lT/yp25XR4606YZEPIGyqoW01/vRbTW5JF2PywahmTWy5 J4WKLJ1XfO6g5nR1YCgSllkqelxOc+f/5xBnc1e1RBLHICicd0oyHooWbfI+COkEDmyX mfhDYthyZ8dYoZmEEHM/HOnYha9srcbSTxv5tRCM6PP+BS91cz7u9OhO+jtZcxEUl280 NJjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vIjgH0QxYeAMP4DzJu3i3Y0UtqyUSNTOLfLjsYFO5vU=; b=k2eDWJM8M6UHwvqZTclmRKPqOQ+viX2RmHSF+RUwB4QmrFODSarlsqeFoLOs0Itjd9 dMTMnfLaWpHF4jWHLW4S4WqYFyYKXzvc7zNFoaQiCsPjdoLF1xEzzood9SK2mmXRtJkV GCVqUvz/TD2FVsLzxQ6GRadb3cRVoHBGkdR0XBwco6LYLGy1U4AjNW0fY1rFk86ZwtP4 yi96sT0GjKplDEwZSEMzWtdo3GMGjCNKa3V4cVS8njogtHBJpMl+In7LnHgPD6XfVdCy faRlFaP2IdOyoH+tYVU87sSbKP4GW0rtJcqFUfdt5/ICYTqRweRoK8MrpzVDQ2GKY8G/ dWdw== X-Gm-Message-State: AOAM5302+/e2mD5OOw8hNGbaLv/830O9/QJtdDuonu3Y+KAwgilpzaFW CpCiKepUBJkjf3SCJzgBD3UbgPdLTDg5sw== X-Received: by 2002:a63:4f43:0:b0:39d:96ff:838c with SMTP id p3-20020a634f43000000b0039d96ff838cmr6937937pgl.115.1650217478256; Sun, 17 Apr 2022 10:44:38 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 10/60] target/arm: Remove fpexc32_access Date: Sun, 17 Apr 2022 10:43:36 -0700 Message-Id: <20220417174426.711829-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x534.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This function is incorrect in that it does not properly consider CPTR_EL2.FPEN. We've already got another mechanism for raising an FPU access trap: ARM_CP_FPU, so use that instead. Remove CP_ACCESS_TRAP_FP_EL{2,3}, which becomes unused. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/cpu.h | 5 ----- target/arm/helper.c | 17 ++--------------- target/arm/op_helper.c | 13 ------------- 3 files changed, 2 insertions(+), 33 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 4eb378ede2..e7f669d0a9 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2806,11 +2806,6 @@ typedef enum CPAccessResult { /* As CP_ACCESS_UNCATEGORIZED, but for traps directly to EL2 or EL3 */ CP_ACCESS_TRAP_UNCATEGORIZED_EL2 = 5, CP_ACCESS_TRAP_UNCATEGORIZED_EL3 = 6, - /* Access fails and results in an exception syndrome for an FP access, - * trapped directly to EL2 or EL3 - */ - CP_ACCESS_TRAP_FP_EL2 = 7, - CP_ACCESS_TRAP_FP_EL3 = 8, } CPAccessResult; /* Access functions for coprocessor registers. These cannot fail and diff --git a/target/arm/helper.c b/target/arm/helper.c index 47fe790854..60d9233b7e 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -4785,18 +4785,6 @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri, } } -static CPAccessResult fpexc32_access(CPUARMState *env, const ARMCPRegInfo *ri, - bool isread) -{ - if ((env->cp15.cptr_el[2] & CPTR_TFP) && arm_current_el(env) == 2) { - return CP_ACCESS_TRAP_FP_EL2; - } - if (env->cp15.cptr_el[3] & CPTR_TFP) { - return CP_ACCESS_TRAP_FP_EL3; - } - return CP_ACCESS_OK; -} - static void sdcr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { @@ -5098,9 +5086,8 @@ static const ARMCPRegInfo v8_cp_reginfo[] = { .access = PL1_RW, .readfn = spsel_read, .writefn = spsel_write }, { .name = "FPEXC32_EL2", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 3, .opc2 = 0, - .type = ARM_CP_ALIAS, - .fieldoffset = offsetof(CPUARMState, vfp.xregs[ARM_VFP_FPEXC]), - .access = PL2_RW, .accessfn = fpexc32_access }, + .access = PL2_RW, .type = ARM_CP_ALIAS | ARM_CP_FPU, + .fieldoffset = offsetof(CPUARMState, vfp.xregs[ARM_VFP_FPEXC]) }, { .name = "DACR32_EL2", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 4, .crn = 3, .crm = 0, .opc2 = 0, .access = PL2_RW, .resetvalue = 0, diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 70b42b55fd..2b87e8808b 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -691,19 +691,6 @@ void HELPER(access_check_cp_reg)(CPUARMState *env, void *rip, uint32_t syndrome, target_el = 3; syndrome = syn_uncategorized(); break; - case CP_ACCESS_TRAP_FP_EL2: - target_el = 2; - /* Since we are an implementation that takes exceptions on a trapped - * conditional insn only if the insn has passed its condition code - * check, we take the IMPDEF choice to always report CV=1 COND=0xe - * (which is also the required value for AArch64 traps). - */ - syndrome = syn_fp_access_trap(1, 0xe, false); - break; - case CP_ACCESS_TRAP_FP_EL3: - target_el = 3; - syndrome = syn_fp_access_trap(1, 0xe, false); - break; default: g_assert_not_reached(); } From patchwork Sun Apr 17 17:43:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562828 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1858049map; Sun, 17 Apr 2022 11:00:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxn+jjlQBiJ0CuHtZ6QhQVY9S1JN2QcMc3WKOj3ZEe7eDeBbA62aalqW1/VJUNPjrymX4Yh X-Received: by 2002:a05:622a:3ce:b0:2f1:fd16:751b with SMTP id k14-20020a05622a03ce00b002f1fd16751bmr1368844qtx.197.1650218453966; Sun, 17 Apr 2022 11:00:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650218453; cv=none; d=google.com; s=arc-20160816; b=APEkKbBJRvVa9JOC5vKLxk+O0wC3HMvX0FaSBABDf0K6pZZsAg4sicZu9sb507qgyz rvTT66MT+QV9yoSO6RULGEinJAV82c29UrNYSI/cVWKSQCl92pus8/AozbMfOJUN1id/ hjFzNy3WelK0IC/DOTNIbpQT/4siYtFdSdmA76Z7R0a5ggr3UkZROts6xaMLpuzYacRu dOp2ID9MLuueexP3Kz9LHHkyidzdg6ZavJwis5CllDDFulGkdSTRdbSsmW9XwXTam0cC RzPBFt0ShoYRAFeNKs5nawrXJ7F7xfCN9zkZO6xXRMpMcKC2pUBS2I7AuIRGRvID3yLU GCTg== 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=MiWeWkecp06NuqnvJcQe+4MeVb3lXXDHi5qwkM/XVaM=; b=Fc4uDmpuvCJ/02pmCDjrmtekUB7z8NmhenwqSt0D7kCg31qZDaaDqTJfMjeWiCCPTN Mq5LWTO3jx17LwRQgnVe2ZUr0bnunCXIsXGtERGuxv9iaGSzC4KTEQ1ovhiHtveP2S+4 qFFCEiB6L4KZM0GQY8dUar5vp9dZNKh+IoxDkzP37B8qx/Pd7t7fg5ZjUs/jWs3wIZWM 48vq551j15UJzitSTkozvKOFq6mDujGbBhV1yQ6Li8U4caDpHX1CDBC8dQkgEbCCu1oB 2XW0QZqtEuQWvEInwK4O5AEyejFZn3VSCa2Dgk7EB8u/Q39og3EiiJqFLzTR6xi19xNG 2Lkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B20sxyvp; 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 t3-20020a375f03000000b0069bdffcd7ccsi2449027qkb.668.2022.04.17.11.00.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:00:53 -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=B20sxyvp; 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]:57248 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9Cf-0004gU-Hu for patch@linaro.org; Sun, 17 Apr 2022 14:00:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47918) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8x0-0000fY-4I for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:43 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:33603) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8wy-0003Hx-D6 for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:41 -0400 Received: by mail-pg1-x536.google.com with SMTP id k14so14986518pga.0 for ; Sun, 17 Apr 2022 10:44:40 -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=MiWeWkecp06NuqnvJcQe+4MeVb3lXXDHi5qwkM/XVaM=; b=B20sxyvpNez0Dj4y1gXoZcPlKJOklmmL98rVxx52/lIffU2syKDPNWTYTn1V5eNvoI 1BvR+zNmREQIXGN8NHFFPGhVSMW9A22KtqBcbPWvJtM6O2KqhgBTNwEFXQEDDlKbzQu0 3YmA8XB6I1Oxydq4f7zBJynmBUyCu1QIT+nh2eAyLuwBGPiL+GDuqljuYrjfruf6AbIO NQovIcO7noSyD6t61CDTie0lWOogauqxNaNJgFjBWUn1u1tD3hiuQsSYVEePLU9OZOVs sXgnKnK9J29WNXVaoLU7vwsMxF7WfFuqO/e6mwIP+DoHdpM5q6l269EUXgaEtlYNrhnO baBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MiWeWkecp06NuqnvJcQe+4MeVb3lXXDHi5qwkM/XVaM=; b=SSzQKzkAQGaHwo1GL/JO+xKx6EEPOx09FfD5CpoxlrFmac/r0sri62+fj5bGEZAyAK 6JiTKT6w1BNfVBanDXBanORowHzyQnURPDJbFpU3TklVbSTai38NpATTpd6a5mRoOLwU yLudje99QCe1nitEYoaMaC7xWF6+VV/CTt6niJJR9zdo/sBoIaV3qQLYtP+yPl/1hFMp T4bM30V1Vala9pzivmtdzsUYm7rpsOqwItQwthH+JKmGO7L1CQpxy5nwM2T7C/HFtFR9 qfb99MWjdv/FU2AN7vbwrCla54eOk/NJ8FRw8Cfl0NaHrR3L5yLZhooNqE/xxnu2UMfC pwFw== X-Gm-Message-State: AOAM531RxCK955e5NFsDepswrixNeLtAqyazTH6Ndy9pKuYkM1XFJ1ua JmHnNHvEi214iy0NvMCOowZ2aOGsAcl5ow== X-Received: by 2002:aa7:9ad8:0:b0:50a:49e1:164c with SMTP id x24-20020aa79ad8000000b0050a49e1164cmr8354515pfp.8.1650217479056; Sun, 17 Apr 2022 10:44:39 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 11/60] target/arm: Split out set_btype_raw Date: Sun, 17 Apr 2022 10:43:37 -0700 Message-Id: <20220417174426.711829-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Common code for reset_btype and set_btype. Use tcg_constant_i32. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate-a64.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index be7283b966..a85ca380a9 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -128,29 +128,28 @@ static int get_a64_user_mem_index(DisasContext *s) return arm_to_core_mmu_idx(useridx); } -static void reset_btype(DisasContext *s) +static void set_btype_raw(int val) { - if (s->btype != 0) { - TCGv_i32 zero = tcg_const_i32(0); - tcg_gen_st_i32(zero, cpu_env, offsetof(CPUARMState, btype)); - tcg_temp_free_i32(zero); - s->btype = 0; - } + tcg_gen_st_i32(tcg_constant_i32(val), cpu_env, + offsetof(CPUARMState, btype)); } static void set_btype(DisasContext *s, int val) { - TCGv_i32 tcg_val; - /* BTYPE is a 2-bit field, and 0 should be done with reset_btype. */ tcg_debug_assert(val >= 1 && val <= 3); - - tcg_val = tcg_const_i32(val); - tcg_gen_st_i32(tcg_val, cpu_env, offsetof(CPUARMState, btype)); - tcg_temp_free_i32(tcg_val); + set_btype_raw(val); s->btype = -1; } +static void reset_btype(DisasContext *s) +{ + if (s->btype != 0) { + set_btype_raw(0); + s->btype = 0; + } +} + void gen_a64_set_pc_im(uint64_t val) { tcg_gen_movi_i64(cpu_pc, val); From patchwork Sun Apr 17 17:43:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562824 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1856565map; Sun, 17 Apr 2022 10:57:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynv3xGzotdJSkEaOGhF8b+rTs2N1ik/rxDk0V+riHrWNPdT3EZVEQUrctHHSbVwjbbJ2+h X-Received: by 2002:a05:620a:f03:b0:67e:1e38:4a0 with SMTP id v3-20020a05620a0f0300b0067e1e3804a0mr4758221qkl.86.1650218235236; Sun, 17 Apr 2022 10:57:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650218235; cv=none; d=google.com; s=arc-20160816; b=UI9lDEBfbdWUG5QliI78HoGGYx1IfHZdX8yciDcdWnl7H3WNrBj4OeC8ZhyL1MD61J yhndnIV8DR/ipsAFvStRGrGU9ee3jS4/Nz+Dcw6K4LmYDGIE9L1A1mxCkZz0o/VU6qmt 3okMyPe5+WZHY0d7uj9hq7uU/jytKh2D9WqK6TaUaSGJfc3u8g8OQ+ySOGihimQtDf9O Mj3kS9rostsyJj4bQnzqjFrmpF5K54fNotF+F3qufJS2V15TlQcTt2kYlND1cDNRwmFo 1a+knWa7OAyClL0W4R0C44bMtrPQzwVka550rFW1OM1JoFk/9Oove9JYKwSALDWyxen9 m86Q== 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=vG6RbvXKJEF7LRvBZL+ritf7+gssSLdu8vjdxGvJ4Ws=; b=kYq6ujybrgno5q0re6DfOMR1h8dPpZhmtD9BQYjNeLcoihBGr/2Hl5Vj95zMQSHz1L n//liI7BRuK3PQ1ymtOU+Jli3UXQzJtq3RN94z/tQ2PIv7/wLOZMPjzxS8c0MUF/xqGw fwpRiiF61zeqvG1+pbsochgMyvnwTyQR0hubdVnifv6swl0P7iuSsXMko6MWpu00g95m 1WCB+UnlPfy5EpCg8Tdzv8Xy/FxXN7o/kG3nB6Qm6tAMb90E0MEkzQvSNH0fd1MbfWN6 iSH2xuG/dyOoreewWEEN/7W7S3FxaB8WZqMTrZvYGpvlRVOEX6rE5JMg8nhh3hmppkwV m5uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H47D5x6S; 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 w11-20020a0cfc4b000000b00440e46a7d90si1881753qvp.558.2022.04.17.10.57.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 10:57:15 -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=H47D5x6S; 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]:48444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng998-00075g-PM for patch@linaro.org; Sun, 17 Apr 2022 13:57:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8x3-0000h8-C0 for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:45 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:41960) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8wz-0003IG-50 for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:43 -0400 Received: by mail-pl1-x62f.google.com with SMTP id s14so10738174plk.8 for ; Sun, 17 Apr 2022 10:44:40 -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=vG6RbvXKJEF7LRvBZL+ritf7+gssSLdu8vjdxGvJ4Ws=; b=H47D5x6Shn7fQGf+4FEQc6oC2xBpiuTUjJSGhhQf7fGGK/ZGJuURsYLJOwvB/YM6W/ 4KrGqKbGS5DyGW4XFoYZLL7WkebZauxspjQQ6+LoMUalKOf0isUx5xhGlB1TYGcmXazB uA0pjFk+IJYaEm9t1wAgTEEKj9zsnRKcfeL/zQHm4/C0IaLMR9lRfO8e02UeAWz17E7J 3dOlnqUduqenGWONIp3hNVIkndOg1msT4Zil+7gW8aL4vL95y08/7aBipM/7Rt1ooaJD V5f1x0ljqVWMw9DM7GlqNTzHVvjffw7JrvtttwrsqqgGXsYRwddNUW94xIBVqJ5kfrBw p6aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vG6RbvXKJEF7LRvBZL+ritf7+gssSLdu8vjdxGvJ4Ws=; b=r2VE+5uCnChaoS2gcEgI3HKQMO+uLP76yiG139mJNpFMiSSfHveP5P5oUjwMRrGNIi S03QDo2cuXV1bl4ulXx3CqbgOemBlL9r0Unv3H4HmkhMW7PRrjaBOxauSyyGeQ9pV2wr L44sIOrDNfCqdAq2eHNnQvFg/qKCtyZevPVrP4vjghyhHjLXfTcqop0Hg9O9V2vd1w2x tDivRvEfOBkgqoYg53YAwoZNSeK2IDQ6yo90KIxPPIuoE1bqAqQZBhH4GjKnzfjb00Zz AoEosf3E+sVpO2vfKm0A/zcisb0iNh1qfClYP+Iv7MMs4HICzcD/GBfVZbxhwcQOzmoX zHfw== X-Gm-Message-State: AOAM533yqdas3Z2iqEg53lg21S9uKPsyatS30ohmtNK41SSO8Q1o4G/o nQD/yIQeKYa7ElM5bk0ed/o+Vu/fg+GAJw== X-Received: by 2002:a17:90a:4bc2:b0:1b8:cdd3:53e2 with SMTP id u2-20020a17090a4bc200b001b8cdd353e2mr14253075pjl.219.1650217479905; Sun, 17 Apr 2022 10:44:39 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 12/60] target/arm: Split out gen_rebuild_hflags Date: Sun, 17 Apr 2022 10:43:38 -0700 Message-Id: <20220417174426.711829-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" For aa32, the function has a parameter to use the new el. For aa64, that never happens. Use tcg_constant_i32 while we're at it. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate-a64.c | 21 +++++++++----------- target/arm/translate.c | 40 +++++++++++++++++++++++--------------- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index a85ca380a9..a00a882145 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -341,6 +341,11 @@ static void a64_free_cc(DisasCompare64 *c64) tcg_temp_free_i64(c64->value); } +static void gen_rebuild_hflags(DisasContext *s) +{ + gen_helper_rebuild_hflags_a64(cpu_env, tcg_constant_i32(s->current_el)); +} + static void gen_exception_internal(int excp) { TCGv_i32 tcg_excp = tcg_const_i32(excp); @@ -1667,9 +1672,7 @@ static void handle_msr_i(DisasContext *s, uint32_t insn, } else { clear_pstate_bits(PSTATE_UAO); } - t1 = tcg_const_i32(s->current_el); - gen_helper_rebuild_hflags_a64(cpu_env, t1); - tcg_temp_free_i32(t1); + gen_rebuild_hflags(s); break; case 0x04: /* PAN */ @@ -1681,9 +1684,7 @@ static void handle_msr_i(DisasContext *s, uint32_t insn, } else { clear_pstate_bits(PSTATE_PAN); } - t1 = tcg_const_i32(s->current_el); - gen_helper_rebuild_hflags_a64(cpu_env, t1); - tcg_temp_free_i32(t1); + gen_rebuild_hflags(s); break; case 0x05: /* SPSel */ @@ -1741,9 +1742,7 @@ static void handle_msr_i(DisasContext *s, uint32_t insn, } else { clear_pstate_bits(PSTATE_TCO); } - t1 = tcg_const_i32(s->current_el); - gen_helper_rebuild_hflags_a64(cpu_env, t1); - tcg_temp_free_i32(t1); + gen_rebuild_hflags(s); /* Many factors, including TCO, go into MTE_ACTIVE. */ s->base.is_jmp = DISAS_UPDATE_NOCHAIN; } else if (dc_isar_feature(aa64_mte_insn_reg, s)) { @@ -1990,9 +1989,7 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, * A write to any coprocessor regiser that ends a TB * must rebuild the hflags for the next TB. */ - TCGv_i32 tcg_el = tcg_const_i32(s->current_el); - gen_helper_rebuild_hflags_a64(cpu_env, tcg_el); - tcg_temp_free_i32(tcg_el); + gen_rebuild_hflags(s); /* * We default to ending the TB on a coprocessor register write, * but allow this to be suppressed by the register definition diff --git a/target/arm/translate.c b/target/arm/translate.c index c745b7fc91..6b293f8279 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -351,6 +351,26 @@ void gen_set_cpsr(TCGv_i32 var, uint32_t mask) tcg_temp_free_i32(tmp_mask); } +static void gen_rebuild_hflags(DisasContext *s, bool new_el) +{ + bool m_profile = arm_dc_feature(s, ARM_FEATURE_M); + + if (new_el) { + if (m_profile) { + gen_helper_rebuild_hflags_m32_newel(cpu_env); + } else { + gen_helper_rebuild_hflags_a32_newel(cpu_env); + } + } else { + TCGv_i32 tcg_el = tcg_constant_i32(s->current_el); + if (m_profile) { + gen_helper_rebuild_hflags_m32(cpu_env, tcg_el); + } else { + gen_helper_rebuild_hflags_a32(cpu_env, tcg_el); + } + } +} + static void gen_exception_internal(int excp) { TCGv_i32 tcg_excp = tcg_const_i32(excp); @@ -4885,17 +4905,7 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, * A write to any coprocessor register that ends a TB * must rebuild the hflags for the next TB. */ - TCGv_i32 tcg_el = tcg_const_i32(s->current_el); - if (arm_dc_feature(s, ARM_FEATURE_M)) { - gen_helper_rebuild_hflags_m32(cpu_env, tcg_el); - } else { - if (ri->type & ARM_CP_NEWEL) { - gen_helper_rebuild_hflags_a32_newel(cpu_env); - } else { - gen_helper_rebuild_hflags_a32(cpu_env, tcg_el); - } - } - tcg_temp_free_i32(tcg_el); + gen_rebuild_hflags(s, ri->type & ARM_CP_NEWEL); /* * We default to ending the TB on a coprocessor register write, * but allow this to be suppressed by the register definition @@ -6445,7 +6455,7 @@ static bool trans_MSR_v7m(DisasContext *s, arg_MSR_v7m *a) tcg_temp_free_i32(addr); tcg_temp_free_i32(reg); /* If we wrote to CONTROL, the EL might have changed */ - gen_helper_rebuild_hflags_m32_newel(cpu_env); + gen_rebuild_hflags(s, true); gen_lookup_tb(s); return true; } @@ -8897,7 +8907,7 @@ static bool trans_CPS(DisasContext *s, arg_CPS *a) static bool trans_CPS_v7m(DisasContext *s, arg_CPS_v7m *a) { - TCGv_i32 tmp, addr, el; + TCGv_i32 tmp, addr; if (!arm_dc_feature(s, ARM_FEATURE_M)) { return false; @@ -8920,9 +8930,7 @@ static bool trans_CPS_v7m(DisasContext *s, arg_CPS_v7m *a) gen_helper_v7m_msr(cpu_env, addr, tmp); tcg_temp_free_i32(addr); } - el = tcg_const_i32(s->current_el); - gen_helper_rebuild_hflags_m32(cpu_env, el); - tcg_temp_free_i32(el); + gen_rebuild_hflags(s, false); tcg_temp_free_i32(tmp); gen_lookup_tb(s); return true; From patchwork Sun Apr 17 17:43:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562832 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1859535map; Sun, 17 Apr 2022 11:03:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyy8rEq6sQFdDR9imxAPL84JCqTGqniiBJzyhaS2xq9WupuB80lp+9VU8+u7wyJNDTEtkqX X-Received: by 2002:ac8:7c4c:0:b0:2f1:f09a:fdc4 with SMTP id o12-20020ac87c4c000000b002f1f09afdc4mr5049550qtv.605.1650218632178; Sun, 17 Apr 2022 11:03:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650218632; cv=none; d=google.com; s=arc-20160816; b=ZVCCyCNULVJU6xKHwZ425OsRiTpwHZj121fTitEMS6hyA5C1gR7qY6bzvi1jf0aNEO m3+/dvh3NB5uQbIRzu/3Nx9xRWdd1N4axJSemjSJ46+FZXJQAn0Sv0XAqSeyr5DtIQ83 /Az0izuaHef+urst46sdNtT/mMgHEtQ6jsG1NnWW1AuAa44PR5DlnE7d9brm2qXqza1e TRsWF/qC0A5HyiF93l5IitK7zOmtYFfVNqVsMDeN8UV4ZtL2FxBiWjQv7sI+5651MYWM fkaaDWxJ7u/+ZwsAVyLm2UcRuFxhnoNRuPK2Ru1Y5inF5YCio/4Pni59wHwF74MgKNuT 4tvw== 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=Li7BpUg3HRfrUiGI4ar3otSrrJFn7ZOtj1NESYHRNXk=; b=AlVP+dvE4335akoLvAA8Ei/7ASbIeksRuO/WdjbLCb8ulzbC+knKsdNKC8ST2dqd1k 6z7uEOnJBMKZ33vi6xH1DBvsLE5CgzcK6S7qtjtdaYkwAp12pKSjcw9ZF07fgHQmMNSM 4Cz4AMFmYdF+g49khL6AunshNlujlLymHwn4GTJ7SX36kcAbkRoTswtiBhgv/Jaqb7HG qEsYX8YJy9XT2Dk98NGgB3rpQusVg9NwcBcGkHmXSuVh1u8/oyup4fERSOOvsPXJH/GR VSjOpZ7bz0nhJRmhM5CCK2orrOZHoLRw2Y/pNwct2T3nTtI3SfDQbJ4CZA/7vKTYIUfS 7/1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wXkVsXk5; 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 q21-20020a05620a0c9500b0069e9b58405csi290651qki.547.2022.04.17.11.03.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:03:52 -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=wXkVsXk5; 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]:37518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9FX-00021D-Nu for patch@linaro.org; Sun, 17 Apr 2022 14:03:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48108) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8x5-0000ix-9s for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:48 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:52098) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8x0-0003Ie-Fd for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:45 -0400 Received: by mail-pj1-x102d.google.com with SMTP id bg24so11337276pjb.1 for ; Sun, 17 Apr 2022 10:44:42 -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=Li7BpUg3HRfrUiGI4ar3otSrrJFn7ZOtj1NESYHRNXk=; b=wXkVsXk5mbXDOQhf8gRMZUr3/Uw8KLt/6fH5EYTix9axQgBvxjezExqvNA7ZeA0Bq1 5geKiPueFELq9a0QkzRZ5Du08vnbr1AM61rBM8do6ooWz7woR3KUyVzQkArmy+Vk7gsK bxlxMkmJGNaZG1qViykgTJuemgMz0z0SyIttZECcDYX82PbXQNsNYOQF/QDiCU+fdhmT OIuR5h+3yJ/FFJo1KjOh0Jc1fhCFG3d7fHsqbH17UjJ8+gQLgOyNOj/tF91Fl3vc8cCi FbcmSA+ZuOg0fQA86cj5oa9e986wtCeFibYOvQkEHKhDxqCnlEKgT6UdA7wxOwCSalaV 5O/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Li7BpUg3HRfrUiGI4ar3otSrrJFn7ZOtj1NESYHRNXk=; b=5S/j9rcBVubDV94x6jqwuULbP+j+KJAvpAxISQ8KY0GlkZ9QVG7ykuUrrQeN4WYYUy 9mzQzKr1njg7yNcT21/nvOETODj5u3KS2mL7UjnZG+ghxz1R8FDSDNzBPGfJ81/8dMfO oBPmDPgeFwLJFN0T3yik4mMibQqQID0Zj4vMFayYC82FzWkJkRGcMOjPStgTm4uL3TGq 67nzWTIz+a9hvgg6lHbP4QdFJTkJYG/MuLcJ5jeic9lUMpv3vG57uyYrEgHYyWq+qbuz hukYgXpasclJVEvXW4PT7crgcuSpXSv3c27u4L16npKYBEB9VvkQUHck4BOaPcJwTu2/ VKQA== X-Gm-Message-State: AOAM532JrHdekOgidnfQHysCG6Er9Kjow7IvUki6124hTHXLUmh6IqYh a/JJAf3VMkusSwcXL5GRf/BopoeIbzPbZw== X-Received: by 2002:a17:90a:cc6:b0:1d2:9a04:d29e with SMTP id 6-20020a17090a0cc600b001d29a04d29emr1463017pjt.136.1650217480899; Sun, 17 Apr 2022 10:44:40 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 13/60] target/arm: Use tcg_constant in translate-a64.c Date: Sun, 17 Apr 2022 10:43:39 -0700 Message-Id: <20220417174426.711829-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use tcg_constant_{i32,i64,ptr} as appropriate throughout, which means we get to remove lots of tcg_temp_free_*. Drop variables in many cases, passing the constant directly to another function. Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 302 +++++++++++-------------------------- 1 file changed, 90 insertions(+), 212 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index a00a882145..3867910ed4 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -240,14 +240,10 @@ static void gen_address_with_allocation_tag0(TCGv_i64 dst, TCGv_i64 src) static void gen_probe_access(DisasContext *s, TCGv_i64 ptr, MMUAccessType acc, int log2_size) { - TCGv_i32 t_acc = tcg_const_i32(acc); - TCGv_i32 t_idx = tcg_const_i32(get_mem_index(s)); - TCGv_i32 t_size = tcg_const_i32(1 << log2_size); - - gen_helper_probe_access(cpu_env, ptr, t_acc, t_idx, t_size); - tcg_temp_free_i32(t_acc); - tcg_temp_free_i32(t_idx); - tcg_temp_free_i32(t_size); + gen_helper_probe_access(cpu_env, ptr, + tcg_constant_i32(acc), + tcg_constant_i32(get_mem_index(s)), + tcg_constant_i32(1 << log2_size)); } /* @@ -262,7 +258,6 @@ static TCGv_i64 gen_mte_check1_mmuidx(DisasContext *s, TCGv_i64 addr, int core_idx) { if (tag_checked && s->mte_active[is_unpriv]) { - TCGv_i32 tcg_desc; TCGv_i64 ret; int desc = 0; @@ -271,11 +266,9 @@ static TCGv_i64 gen_mte_check1_mmuidx(DisasContext *s, TCGv_i64 addr, desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write); desc = FIELD_DP32(desc, MTEDESC, SIZEM1, (1 << log2_size) - 1); - tcg_desc = tcg_const_i32(desc); ret = new_tmp_a64(s); - gen_helper_mte_check(ret, cpu_env, tcg_desc, addr); - tcg_temp_free_i32(tcg_desc); + gen_helper_mte_check(ret, cpu_env, tcg_constant_i32(desc), addr); return ret; } @@ -296,7 +289,6 @@ TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write, bool tag_checked, int size) { if (tag_checked && s->mte_active[0]) { - TCGv_i32 tcg_desc; TCGv_i64 ret; int desc = 0; @@ -305,11 +297,9 @@ TCGv_i64 gen_mte_checkN(DisasContext *s, TCGv_i64 addr, bool is_write, desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write); desc = FIELD_DP32(desc, MTEDESC, SIZEM1, size - 1); - tcg_desc = tcg_const_i32(desc); ret = new_tmp_a64(s); - gen_helper_mte_check(ret, cpu_env, tcg_desc, addr); - tcg_temp_free_i32(tcg_desc); + gen_helper_mte_check(ret, cpu_env, tcg_constant_i32(desc), addr); return ret; } @@ -348,11 +338,8 @@ static void gen_rebuild_hflags(DisasContext *s) static void gen_exception_internal(int excp) { - TCGv_i32 tcg_excp = tcg_const_i32(excp); - assert(excp_is_internal(excp)); - gen_helper_exception_internal(cpu_env, tcg_excp); - tcg_temp_free_i32(tcg_excp); + gen_helper_exception_internal(cpu_env, tcg_constant_i32(excp)); } static void gen_exception_internal_insn(DisasContext *s, uint64_t pc, int excp) @@ -364,12 +351,8 @@ static void gen_exception_internal_insn(DisasContext *s, uint64_t pc, int excp) static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syndrome) { - TCGv_i32 tcg_syn; - gen_a64_set_pc_im(s->pc_curr); - tcg_syn = tcg_const_i32(syndrome); - gen_helper_exception_bkpt_insn(cpu_env, tcg_syn); - tcg_temp_free_i32(tcg_syn); + gen_helper_exception_bkpt_insn(cpu_env, tcg_constant_i32(syndrome)); s->base.is_jmp = DISAS_NORETURN; } @@ -831,15 +814,15 @@ static void gen_adc(int sf, TCGv_i64 dest, TCGv_i64 t0, TCGv_i64 t1) static void gen_adc_CC(int sf, TCGv_i64 dest, TCGv_i64 t0, TCGv_i64 t1) { if (sf) { - TCGv_i64 result, cf_64, vf_64, tmp; - result = tcg_temp_new_i64(); - cf_64 = tcg_temp_new_i64(); - vf_64 = tcg_temp_new_i64(); - tmp = tcg_const_i64(0); + TCGv_i64 result = tcg_temp_new_i64(); + TCGv_i64 cf_64 = tcg_temp_new_i64(); + TCGv_i64 vf_64 = tcg_temp_new_i64(); + TCGv_i64 tmp = tcg_temp_new_i64(); + TCGv_i64 zero = tcg_constant_i64(0); tcg_gen_extu_i32_i64(cf_64, cpu_CF); - tcg_gen_add2_i64(result, cf_64, t0, tmp, cf_64, tmp); - tcg_gen_add2_i64(result, cf_64, result, cf_64, t1, tmp); + tcg_gen_add2_i64(result, cf_64, t0, zero, cf_64, zero); + tcg_gen_add2_i64(result, cf_64, result, cf_64, t1, zero); tcg_gen_extrl_i64_i32(cpu_CF, cf_64); gen_set_NZ64(result); @@ -855,15 +838,15 @@ static void gen_adc_CC(int sf, TCGv_i64 dest, TCGv_i64 t0, TCGv_i64 t1) tcg_temp_free_i64(cf_64); tcg_temp_free_i64(result); } else { - TCGv_i32 t0_32, t1_32, tmp; - t0_32 = tcg_temp_new_i32(); - t1_32 = tcg_temp_new_i32(); - tmp = tcg_const_i32(0); + TCGv_i32 t0_32 = tcg_temp_new_i32(); + TCGv_i32 t1_32 = tcg_temp_new_i32(); + TCGv_i32 tmp = tcg_temp_new_i32(); + TCGv_i32 zero = tcg_constant_i32(0); tcg_gen_extrl_i64_i32(t0_32, t0); tcg_gen_extrl_i64_i32(t1_32, t1); - tcg_gen_add2_i32(cpu_NF, cpu_CF, t0_32, tmp, cpu_CF, tmp); - tcg_gen_add2_i32(cpu_NF, cpu_CF, cpu_NF, cpu_CF, t1_32, tmp); + tcg_gen_add2_i32(cpu_NF, cpu_CF, t0_32, zero, cpu_CF, zero); + tcg_gen_add2_i32(cpu_NF, cpu_CF, cpu_NF, cpu_CF, t1_32, zero); tcg_gen_mov_i32(cpu_ZF, cpu_NF); tcg_gen_xor_i32(cpu_VF, cpu_NF, t0_32); @@ -1632,7 +1615,6 @@ static void gen_axflag(void) static void handle_msr_i(DisasContext *s, uint32_t insn, unsigned int op1, unsigned int op2, unsigned int crm) { - TCGv_i32 t1; int op = op1 << 3 | op2; /* End the TB by default, chaining is ok. */ @@ -1691,9 +1673,7 @@ static void handle_msr_i(DisasContext *s, uint32_t insn, if (s->current_el == 0) { goto do_unallocated; } - t1 = tcg_const_i32(crm & PSTATE_SP); - gen_helper_msr_i_spsel(cpu_env, t1); - tcg_temp_free_i32(t1); + gen_helper_msr_i_spsel(cpu_env, tcg_constant_i32(crm & PSTATE_SP)); break; case 0x19: /* SSBS */ @@ -1721,15 +1701,11 @@ static void handle_msr_i(DisasContext *s, uint32_t insn, break; case 0x1e: /* DAIFSet */ - t1 = tcg_const_i32(crm); - gen_helper_msr_i_daifset(cpu_env, t1); - tcg_temp_free_i32(t1); + gen_helper_msr_i_daifset(cpu_env, tcg_constant_i32(crm)); break; case 0x1f: /* DAIFClear */ - t1 = tcg_const_i32(crm); - gen_helper_msr_i_daifclear(cpu_env, t1); - tcg_temp_free_i32(t1); + gen_helper_msr_i_daifclear(cpu_env, tcg_constant_i32(crm)); /* For DAIFClear, exit the cpu loop to re-evaluate pending IRQs. */ s->base.is_jmp = DISAS_UPDATE_EXIT; break; @@ -1842,19 +1818,14 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, /* Emit code to perform further access permissions checks at * runtime; this may result in an exception. */ - TCGv_ptr tmpptr; - TCGv_i32 tcg_syn, tcg_isread; uint32_t syndrome; - gen_a64_set_pc_im(s->pc_curr); - tmpptr = tcg_const_ptr(ri); syndrome = syn_aa64_sysregtrap(op0, op1, op2, crn, crm, rt, isread); - tcg_syn = tcg_const_i32(syndrome); - tcg_isread = tcg_const_i32(isread); - gen_helper_access_check_cp_reg(cpu_env, tmpptr, tcg_syn, tcg_isread); - tcg_temp_free_ptr(tmpptr); - tcg_temp_free_i32(tcg_syn); - tcg_temp_free_i32(tcg_isread); + gen_a64_set_pc_im(s->pc_curr); + gen_helper_access_check_cp_reg(cpu_env, + tcg_constant_ptr(ri), + tcg_constant_i32(syndrome), + tcg_constant_i32(isread)); } else if (ri->type & ARM_CP_RAISES_EXC) { /* * The readfn or writefn might raise an exception; @@ -1885,17 +1856,15 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, case ARM_CP_DC_ZVA: /* Writes clear the aligned block of memory which rt points into. */ if (s->mte_active[0]) { - TCGv_i32 t_desc; int desc = 0; desc = FIELD_DP32(desc, MTEDESC, MIDX, get_mem_index(s)); desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid); desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); - t_desc = tcg_const_i32(desc); tcg_rt = new_tmp_a64(s); - gen_helper_mte_check_zva(tcg_rt, cpu_env, t_desc, cpu_reg(s, rt)); - tcg_temp_free_i32(t_desc); + gen_helper_mte_check_zva(tcg_rt, cpu_env, + tcg_constant_i32(desc), cpu_reg(s, rt)); } else { tcg_rt = clean_data_tbi(s, cpu_reg(s, rt)); } @@ -1959,10 +1928,7 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, if (ri->type & ARM_CP_CONST) { tcg_gen_movi_i64(tcg_rt, ri->resetvalue); } else if (ri->readfn) { - TCGv_ptr tmpptr; - tmpptr = tcg_const_ptr(ri); - gen_helper_get_cp_reg64(tcg_rt, cpu_env, tmpptr); - tcg_temp_free_ptr(tmpptr); + gen_helper_get_cp_reg64(tcg_rt, cpu_env, tcg_constant_ptr(ri)); } else { tcg_gen_ld_i64(tcg_rt, cpu_env, ri->fieldoffset); } @@ -1971,10 +1937,7 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, /* If not forbidden by access permissions, treat as WI */ return; } else if (ri->writefn) { - TCGv_ptr tmpptr; - tmpptr = tcg_const_ptr(ri); - gen_helper_set_cp_reg64(cpu_env, tmpptr, tcg_rt); - tcg_temp_free_ptr(tmpptr); + gen_helper_set_cp_reg64(cpu_env, tcg_constant_ptr(ri), tcg_rt); } else { tcg_gen_st_i64(tcg_rt, cpu_env, ri->fieldoffset); } @@ -2052,7 +2015,6 @@ static void disas_exc(DisasContext *s, uint32_t insn) int opc = extract32(insn, 21, 3); int op2_ll = extract32(insn, 0, 5); int imm16 = extract32(insn, 5, 16); - TCGv_i32 tmp; switch (opc) { case 0: @@ -2087,9 +2049,7 @@ static void disas_exc(DisasContext *s, uint32_t insn) break; } gen_a64_set_pc_im(s->pc_curr); - tmp = tcg_const_i32(syn_aa64_smc(imm16)); - gen_helper_pre_smc(cpu_env, tmp); - tcg_temp_free_i32(tmp); + gen_helper_pre_smc(cpu_env, tcg_constant_i32(syn_aa64_smc(imm16))); gen_ss_advance(s); gen_exception_insn(s, s->base.pc_next, EXCP_SMC, syn_aa64_smc(imm16), 3); @@ -2563,7 +2523,7 @@ static void gen_compare_and_swap_pair(DisasContext *s, int rs, int rt, tcg_temp_free_i64(cmp); } else if (tb_cflags(s->base.tb) & CF_PARALLEL) { if (HAVE_CMPXCHG128) { - TCGv_i32 tcg_rs = tcg_const_i32(rs); + TCGv_i32 tcg_rs = tcg_constant_i32(rs); if (s->be_data == MO_LE) { gen_helper_casp_le_parallel(cpu_env, tcg_rs, clean_addr, t1, t2); @@ -2571,7 +2531,6 @@ static void gen_compare_and_swap_pair(DisasContext *s, int rs, int rt, gen_helper_casp_be_parallel(cpu_env, tcg_rs, clean_addr, t1, t2); } - tcg_temp_free_i32(tcg_rs); } else { gen_helper_exit_atomic(cpu_env); s->base.is_jmp = DISAS_NORETURN; @@ -2582,7 +2541,7 @@ static void gen_compare_and_swap_pair(DisasContext *s, int rs, int rt, TCGv_i64 a2 = tcg_temp_new_i64(); TCGv_i64 c1 = tcg_temp_new_i64(); TCGv_i64 c2 = tcg_temp_new_i64(); - TCGv_i64 zero = tcg_const_i64(0); + TCGv_i64 zero = tcg_constant_i64(0); /* Load the two words, in memory order. */ tcg_gen_qemu_ld_i64(d1, clean_addr, memidx, @@ -2603,7 +2562,6 @@ static void gen_compare_and_swap_pair(DisasContext *s, int rs, int rt, tcg_temp_free_i64(a2); tcg_temp_free_i64(c1); tcg_temp_free_i64(c2); - tcg_temp_free_i64(zero); /* Write back the data from memory to Rs. */ tcg_gen_mov_i64(s1, d1); @@ -2820,7 +2778,7 @@ static void disas_ld_lit(DisasContext *s, uint32_t insn) tcg_rt = cpu_reg(s, rt); - clean_addr = tcg_const_i64(s->pc_curr + imm); + clean_addr = tcg_constant_i64(s->pc_curr + imm); if (is_vector) { do_fp_ld(s, rt, clean_addr, size); } else { @@ -2830,7 +2788,6 @@ static void disas_ld_lit(DisasContext *s, uint32_t insn) do_gpr_ld(s, tcg_rt, clean_addr, size + is_signed * MO_SIGN, false, true, rt, iss_sf, false); } - tcg_temp_free_i64(clean_addr); } /* @@ -3736,7 +3693,7 @@ static void disas_ldst_multiple_struct(DisasContext *s, uint32_t insn) mop = endian | size | align; elements = (is_q ? 16 : 8) >> size; - tcg_ebytes = tcg_const_i64(1 << size); + tcg_ebytes = tcg_constant_i64(1 << size); for (r = 0; r < rpt; r++) { int e; for (e = 0; e < elements; e++) { @@ -3752,7 +3709,6 @@ static void disas_ldst_multiple_struct(DisasContext *s, uint32_t insn) } } } - tcg_temp_free_i64(tcg_ebytes); if (!is_store) { /* For non-quad operations, setting a slice of the low @@ -3882,7 +3838,7 @@ static void disas_ldst_single_struct(DisasContext *s, uint32_t insn) total); mop = finalize_memop(s, scale); - tcg_ebytes = tcg_const_i64(1 << scale); + tcg_ebytes = tcg_constant_i64(1 << scale); for (xs = 0; xs < selem; xs++) { if (replicate) { /* Load and replicate to all elements */ @@ -3904,7 +3860,6 @@ static void disas_ldst_single_struct(DisasContext *s, uint32_t insn) tcg_gen_add_i64(clean_addr, clean_addr, tcg_ebytes); rt = (rt + 1) % 32; } - tcg_temp_free_i64(tcg_ebytes); if (is_postidx) { if (rm == 31) { @@ -4095,7 +4050,7 @@ static void disas_ldst_tag(DisasContext *s, uint32_t insn) if (is_zero) { TCGv_i64 clean_addr = clean_data_tbi(s, addr); - TCGv_i64 tcg_zero = tcg_const_i64(0); + TCGv_i64 tcg_zero = tcg_constant_i64(0); int mem_index = get_mem_index(s); int i, n = (1 + is_pair) << LOG2_TAG_GRANULE; @@ -4105,7 +4060,6 @@ static void disas_ldst_tag(DisasContext *s, uint32_t insn) tcg_gen_addi_i64(clean_addr, clean_addr, 8); tcg_gen_qemu_st_i64(tcg_zero, clean_addr, mem_index, MO_UQ); } - tcg_temp_free_i64(tcg_zero); } if (index != 0) { @@ -4224,13 +4178,12 @@ static void disas_add_sub_imm(DisasContext *s, uint32_t insn) tcg_gen_addi_i64(tcg_result, tcg_rn, imm); } } else { - TCGv_i64 tcg_imm = tcg_const_i64(imm); + TCGv_i64 tcg_imm = tcg_constant_i64(imm); if (sub_op) { gen_sub_CC(is_64bit, tcg_result, tcg_rn, tcg_imm); } else { gen_add_CC(is_64bit, tcg_result, tcg_rn, tcg_imm); } - tcg_temp_free_i64(tcg_imm); } if (is_64bit) { @@ -4278,12 +4231,9 @@ static void disas_add_sub_imm_with_tags(DisasContext *s, uint32_t insn) tcg_rd = cpu_reg_sp(s, rd); if (s->ata) { - TCGv_i32 offset = tcg_const_i32(imm); - TCGv_i32 tag_offset = tcg_const_i32(uimm4); - - gen_helper_addsubg(tcg_rd, cpu_env, tcg_rn, offset, tag_offset); - tcg_temp_free_i32(tag_offset); - tcg_temp_free_i32(offset); + gen_helper_addsubg(tcg_rd, cpu_env, tcg_rn, + tcg_constant_i32(imm), + tcg_constant_i32(uimm4)); } else { tcg_gen_addi_i64(tcg_rd, tcg_rn, imm); gen_address_with_allocation_tag0(tcg_rd, tcg_rd); @@ -4469,7 +4419,6 @@ static void disas_movw_imm(DisasContext *s, uint32_t insn) int opc = extract32(insn, 29, 2); int pos = extract32(insn, 21, 2) << 4; TCGv_i64 tcg_rd = cpu_reg(s, rd); - TCGv_i64 tcg_imm; if (!sf && (pos >= 32)) { unallocated_encoding(s); @@ -4489,9 +4438,7 @@ static void disas_movw_imm(DisasContext *s, uint32_t insn) tcg_gen_movi_i64(tcg_rd, imm); break; case 3: /* MOVK */ - tcg_imm = tcg_const_i64(imm); - tcg_gen_deposit_i64(tcg_rd, tcg_rd, tcg_imm, pos, 16); - tcg_temp_free_i64(tcg_imm); + tcg_gen_deposit_i64(tcg_rd, tcg_rd, tcg_constant_i64(imm), pos, 16); if (!sf) { tcg_gen_ext32u_i64(tcg_rd, tcg_rd); } @@ -4731,11 +4678,7 @@ static void shift_reg_imm(TCGv_i64 dst, TCGv_i64 src, int sf, if (shift_i == 0) { tcg_gen_mov_i64(dst, src); } else { - TCGv_i64 shift_const; - - shift_const = tcg_const_i64(shift_i); - shift_reg(dst, src, sf, shift_type, shift_const); - tcg_temp_free_i64(shift_const); + shift_reg(dst, src, sf, shift_type, tcg_constant_i64(shift_i)); } } @@ -5312,7 +5255,7 @@ static void disas_cond_select(DisasContext *s, uint32_t insn) tcg_rd = cpu_reg(s, rd); a64_test_cc(&c, cond); - zero = tcg_const_i64(0); + zero = tcg_constant_i64(0); if (rn == 31 && rm == 31 && (else_inc ^ else_inv)) { /* CSET & CSETM. */ @@ -5333,7 +5276,6 @@ static void disas_cond_select(DisasContext *s, uint32_t insn) tcg_gen_movcond_i64(c.cond, tcg_rd, c.value, zero, t_true, t_false); } - tcg_temp_free_i64(zero); a64_free_cc(&c); if (!sf) { @@ -5430,7 +5372,7 @@ static void handle_rev16(DisasContext *s, unsigned int sf, TCGv_i64 tcg_rd = cpu_reg(s, rd); TCGv_i64 tcg_tmp = tcg_temp_new_i64(); TCGv_i64 tcg_rn = read_cpu_reg(s, rn, sf); - TCGv_i64 mask = tcg_const_i64(sf ? 0x00ff00ff00ff00ffull : 0x00ff00ff); + TCGv_i64 mask = tcg_constant_i64(sf ? 0x00ff00ff00ff00ffull : 0x00ff00ff); tcg_gen_shri_i64(tcg_tmp, tcg_rn, 8); tcg_gen_and_i64(tcg_rd, tcg_rn, mask); @@ -5438,7 +5380,6 @@ static void handle_rev16(DisasContext *s, unsigned int sf, tcg_gen_shli_i64(tcg_rd, tcg_rd, 8); tcg_gen_or_i64(tcg_rd, tcg_rd, tcg_tmp); - tcg_temp_free_i64(mask); tcg_temp_free_i64(tcg_tmp); } @@ -5721,15 +5662,13 @@ static void handle_crc32(DisasContext *s, } tcg_acc = cpu_reg(s, rn); - tcg_bytes = tcg_const_i32(1 << sz); + tcg_bytes = tcg_constant_i32(1 << sz); if (crc32c) { gen_helper_crc32c_64(cpu_reg(s, rd), tcg_acc, tcg_val, tcg_bytes); } else { gen_helper_crc32_64(cpu_reg(s, rd), tcg_acc, tcg_val, tcg_bytes); } - - tcg_temp_free_i32(tcg_bytes); } /* Data-processing (2 source) @@ -5795,15 +5734,13 @@ static void disas_data_proc_2src(DisasContext *s, uint32_t insn) if (sf == 0 || !dc_isar_feature(aa64_mte_insn_reg, s)) { goto do_unallocated; } else { - TCGv_i64 t1 = tcg_const_i64(1); - TCGv_i64 t2 = tcg_temp_new_i64(); + TCGv_i64 t = tcg_temp_new_i64(); - tcg_gen_extract_i64(t2, cpu_reg_sp(s, rn), 56, 4); - tcg_gen_shl_i64(t1, t1, t2); - tcg_gen_or_i64(cpu_reg(s, rd), cpu_reg(s, rm), t1); + tcg_gen_extract_i64(t, cpu_reg_sp(s, rn), 56, 4); + tcg_gen_shl_i64(t, tcg_constant_i64(1), t); + tcg_gen_or_i64(cpu_reg(s, rd), cpu_reg(s, rm), t); - tcg_temp_free_i64(t1); - tcg_temp_free_i64(t2); + tcg_temp_free_i64(t); } break; case 8: /* LSLV */ @@ -5938,7 +5875,7 @@ static void handle_fp_compare(DisasContext *s, int size, tcg_vn = read_fp_dreg(s, rn); if (cmp_with_zero) { - tcg_vm = tcg_const_i64(0); + tcg_vm = tcg_constant_i64(0); } else { tcg_vm = read_fp_dreg(s, rm); } @@ -6048,7 +5985,6 @@ static void disas_fp_compare(DisasContext *s, uint32_t insn) static void disas_fp_ccomp(DisasContext *s, uint32_t insn) { unsigned int mos, type, rm, cond, rn, op, nzcv; - TCGv_i64 tcg_flags; TCGLabel *label_continue = NULL; int size; @@ -6092,9 +6028,7 @@ static void disas_fp_ccomp(DisasContext *s, uint32_t insn) label_continue = gen_new_label(); arm_gen_test_cc(cond, label_match); /* nomatch: */ - tcg_flags = tcg_const_i64(nzcv << 28); - gen_set_nzcv(tcg_flags); - tcg_temp_free_i64(tcg_flags); + gen_set_nzcv(tcg_constant_i64(nzcv << 28)); tcg_gen_br(label_continue); gen_set_label(label_match); } @@ -6115,7 +6049,7 @@ static void disas_fp_ccomp(DisasContext *s, uint32_t insn) static void disas_fp_csel(DisasContext *s, uint32_t insn) { unsigned int mos, type, rm, cond, rn, rd; - TCGv_i64 t_true, t_false, t_zero; + TCGv_i64 t_true, t_false; DisasCompare64 c; MemOp sz; @@ -6160,10 +6094,8 @@ static void disas_fp_csel(DisasContext *s, uint32_t insn) read_vec_element(s, t_false, rm, 0, sz); a64_test_cc(&c, cond); - t_zero = tcg_const_i64(0); - tcg_gen_movcond_i64(c.cond, t_true, c.value, t_zero, t_true, t_false); - tcg_temp_free_i64(t_zero); - tcg_temp_free_i64(t_false); + tcg_gen_movcond_i64(c.cond, t_true, c.value, tcg_constant_i64(0), + t_true, t_false); a64_free_cc(&c); /* Note that sregs & hregs write back zeros to the high bits, @@ -6944,7 +6876,6 @@ static void disas_fp_imm(DisasContext *s, uint32_t insn) int type = extract32(insn, 22, 2); int mos = extract32(insn, 29, 3); uint64_t imm; - TCGv_i64 tcg_res; MemOp sz; if (mos || imm5) { @@ -6975,10 +6906,7 @@ static void disas_fp_imm(DisasContext *s, uint32_t insn) } imm = vfp_expand_imm(sz, imm8); - - tcg_res = tcg_const_i64(imm); - write_fp_dreg(s, rd, tcg_res); - tcg_temp_free_i64(tcg_res); + write_fp_dreg(s, rd, tcg_constant_i64(imm)); } /* Handle floating point <=> fixed point conversions. Note that we can @@ -6996,7 +6924,7 @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode, tcg_fpstatus = fpstatus_ptr(type == 3 ? FPST_FPCR_F16 : FPST_FPCR); - tcg_shift = tcg_const_i32(64 - scale); + tcg_shift = tcg_constant_i32(64 - scale); if (itof) { TCGv_i64 tcg_int = cpu_reg(s, rn); @@ -7155,7 +7083,6 @@ static void handle_fpfpcvt(DisasContext *s, int rd, int rn, int opcode, } tcg_temp_free_ptr(tcg_fpstatus); - tcg_temp_free_i32(tcg_shift); } /* Floating point <-> fixed point conversions @@ -8426,7 +8353,7 @@ static void handle_shri_with_rndacc(TCGv_i64 tcg_res, TCGv_i64 tcg_src, /* Deal with the rounding step */ if (round) { if (extended_result) { - TCGv_i64 tcg_zero = tcg_const_i64(0); + TCGv_i64 tcg_zero = tcg_constant_i64(0); if (!is_u) { /* take care of sign extending tcg_res */ tcg_gen_sari_i64(tcg_src_hi, tcg_src, 63); @@ -8438,7 +8365,6 @@ static void handle_shri_with_rndacc(TCGv_i64 tcg_res, TCGv_i64 tcg_src, tcg_src, tcg_zero, tcg_rnd, tcg_zero); } - tcg_temp_free_i64(tcg_zero); } else { tcg_gen_add_i64(tcg_src, tcg_src, tcg_rnd); } @@ -8524,8 +8450,7 @@ static void handle_scalar_simd_shri(DisasContext *s, } if (round) { - uint64_t round_const = 1ULL << (shift - 1); - tcg_round = tcg_const_i64(round_const); + tcg_round = tcg_constant_i64(1ULL << (shift - 1)); } else { tcg_round = NULL; } @@ -8551,9 +8476,6 @@ static void handle_scalar_simd_shri(DisasContext *s, tcg_temp_free_i64(tcg_rn); tcg_temp_free_i64(tcg_rd); - if (round) { - tcg_temp_free_i64(tcg_round); - } } /* SHL/SLI - Scalar shift left */ @@ -8651,8 +8573,7 @@ static void handle_vec_simd_sqshrn(DisasContext *s, bool is_scalar, bool is_q, tcg_final = tcg_const_i64(0); if (round) { - uint64_t round_const = 1ULL << (shift - 1); - tcg_round = tcg_const_i64(round_const); + tcg_round = tcg_constant_i64(1ULL << (shift - 1)); } else { tcg_round = NULL; } @@ -8672,9 +8593,6 @@ static void handle_vec_simd_sqshrn(DisasContext *s, bool is_scalar, bool is_q, write_vec_element(s, tcg_final, rd, 1, MO_64); } - if (round) { - tcg_temp_free_i64(tcg_round); - } tcg_temp_free_i64(tcg_rn); tcg_temp_free_i64(tcg_rd); tcg_temp_free_i32(tcg_rd_narrowed); @@ -8726,7 +8644,7 @@ static void handle_simd_qshl(DisasContext *s, bool scalar, bool is_q, } if (size == 3) { - TCGv_i64 tcg_shift = tcg_const_i64(shift); + TCGv_i64 tcg_shift = tcg_constant_i64(shift); static NeonGenTwo64OpEnvFn * const fns[2][2] = { { gen_helper_neon_qshl_s64, gen_helper_neon_qshlu_s64 }, { NULL, gen_helper_neon_qshl_u64 }, @@ -8743,10 +8661,9 @@ static void handle_simd_qshl(DisasContext *s, bool scalar, bool is_q, tcg_temp_free_i64(tcg_op); } - tcg_temp_free_i64(tcg_shift); clear_vec_high(s, is_q, rd); } else { - TCGv_i32 tcg_shift = tcg_const_i32(shift); + TCGv_i32 tcg_shift = tcg_constant_i32(shift); static NeonGenTwoOpEnvFn * const fns[2][2][3] = { { { gen_helper_neon_qshl_s8, @@ -8791,7 +8708,6 @@ static void handle_simd_qshl(DisasContext *s, bool scalar, bool is_q, tcg_temp_free_i32(tcg_op); } - tcg_temp_free_i32(tcg_shift); if (!scalar) { clear_vec_high(s, is_q, rd); @@ -8811,7 +8727,7 @@ static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn, int pass; if (fracbits || size == MO_64) { - tcg_shift = tcg_const_i32(fracbits); + tcg_shift = tcg_constant_i32(fracbits); } if (size == MO_64) { @@ -8896,9 +8812,6 @@ static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn, } tcg_temp_free_ptr(tcg_fpst); - if (tcg_shift) { - tcg_temp_free_i32(tcg_shift); - } clear_vec_high(s, elements << size == 16, rd); } @@ -8988,7 +8901,7 @@ static void handle_simd_shift_fpint_conv(DisasContext *s, bool is_scalar, tcg_fpstatus = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); gen_helper_set_rmode(tcg_rmode, tcg_rmode, tcg_fpstatus); fracbits = (16 << size) - immhb; - tcg_shift = tcg_const_i32(fracbits); + tcg_shift = tcg_constant_i32(fracbits); if (size == MO_64) { int maxpass = is_scalar ? 1 : 2; @@ -9046,7 +8959,6 @@ static void handle_simd_shift_fpint_conv(DisasContext *s, bool is_scalar, } } - tcg_temp_free_i32(tcg_shift); gen_helper_set_rmode(tcg_rmode, tcg_rmode, tcg_fpstatus); tcg_temp_free_ptr(tcg_fpstatus); tcg_temp_free_i32(tcg_rmode); @@ -9918,23 +9830,15 @@ static void handle_2misc_64(DisasContext *s, int opcode, bool u, case 0x1c: /* FCVTAS */ case 0x3a: /* FCVTPS */ case 0x3b: /* FCVTZS */ - { - TCGv_i32 tcg_shift = tcg_const_i32(0); - gen_helper_vfp_tosqd(tcg_rd, tcg_rn, tcg_shift, tcg_fpstatus); - tcg_temp_free_i32(tcg_shift); + gen_helper_vfp_tosqd(tcg_rd, tcg_rn, tcg_constant_i32(0), tcg_fpstatus); break; - } case 0x5a: /* FCVTNU */ case 0x5b: /* FCVTMU */ case 0x5c: /* FCVTAU */ case 0x7a: /* FCVTPU */ case 0x7b: /* FCVTZU */ - { - TCGv_i32 tcg_shift = tcg_const_i32(0); - gen_helper_vfp_touqd(tcg_rd, tcg_rn, tcg_shift, tcg_fpstatus); - tcg_temp_free_i32(tcg_shift); + gen_helper_vfp_touqd(tcg_rd, tcg_rn, tcg_constant_i32(0), tcg_fpstatus); break; - } case 0x18: /* FRINTN */ case 0x19: /* FRINTM */ case 0x38: /* FRINTP */ @@ -9974,7 +9878,7 @@ static void handle_2misc_fcmp_zero(DisasContext *s, int opcode, if (is_double) { TCGv_i64 tcg_op = tcg_temp_new_i64(); - TCGv_i64 tcg_zero = tcg_const_i64(0); + TCGv_i64 tcg_zero = tcg_constant_i64(0); TCGv_i64 tcg_res = tcg_temp_new_i64(); NeonGenTwoDoubleOpFn *genfn; bool swap = false; @@ -10010,13 +9914,12 @@ static void handle_2misc_fcmp_zero(DisasContext *s, int opcode, write_vec_element(s, tcg_res, rd, pass, MO_64); } tcg_temp_free_i64(tcg_res); - tcg_temp_free_i64(tcg_zero); tcg_temp_free_i64(tcg_op); clear_vec_high(s, !is_scalar, rd); } else { TCGv_i32 tcg_op = tcg_temp_new_i32(); - TCGv_i32 tcg_zero = tcg_const_i32(0); + TCGv_i32 tcg_zero = tcg_constant_i32(0); TCGv_i32 tcg_res = tcg_temp_new_i32(); NeonGenTwoSingleOpFn *genfn; bool swap = false; @@ -10085,7 +9988,6 @@ static void handle_2misc_fcmp_zero(DisasContext *s, int opcode, } } tcg_temp_free_i32(tcg_res); - tcg_temp_free_i32(tcg_zero); tcg_temp_free_i32(tcg_op); if (!is_scalar) { clear_vec_high(s, is_q, rd); @@ -10186,7 +10088,7 @@ static void handle_2misc_narrow(DisasContext *s, bool scalar, int passes = scalar ? 1 : 2; if (scalar) { - tcg_res[1] = tcg_const_i32(0); + tcg_res[1] = tcg_constant_i32(0); } for (pass = 0; pass < passes; pass++) { @@ -10364,9 +10266,7 @@ static void handle_2misc_satacc(DisasContext *s, bool is_scalar, bool is_u, } if (is_scalar) { - TCGv_i64 tcg_zero = tcg_const_i64(0); - write_vec_element(s, tcg_zero, rd, 0, MO_64); - tcg_temp_free_i64(tcg_zero); + write_vec_element(s, tcg_constant_i64(0), rd, 0, MO_64); } write_vec_element_i32(s, tcg_rd, rd, pass, MO_32); } @@ -10549,23 +10449,17 @@ static void disas_simd_scalar_two_reg_misc(DisasContext *s, uint32_t insn) case 0x1c: /* FCVTAS */ case 0x3a: /* FCVTPS */ case 0x3b: /* FCVTZS */ - { - TCGv_i32 tcg_shift = tcg_const_i32(0); - gen_helper_vfp_tosls(tcg_rd, tcg_rn, tcg_shift, tcg_fpstatus); - tcg_temp_free_i32(tcg_shift); + gen_helper_vfp_tosls(tcg_rd, tcg_rn, tcg_constant_i32(0), + tcg_fpstatus); break; - } case 0x5a: /* FCVTNU */ case 0x5b: /* FCVTMU */ case 0x5c: /* FCVTAU */ case 0x7a: /* FCVTPU */ case 0x7b: /* FCVTZU */ - { - TCGv_i32 tcg_shift = tcg_const_i32(0); - gen_helper_vfp_touls(tcg_rd, tcg_rn, tcg_shift, tcg_fpstatus); - tcg_temp_free_i32(tcg_shift); + gen_helper_vfp_touls(tcg_rd, tcg_rn, tcg_constant_i32(0), + tcg_fpstatus); break; - } default: g_assert_not_reached(); } @@ -10737,8 +10631,7 @@ static void handle_vec_simd_shrn(DisasContext *s, bool is_q, read_vec_element(s, tcg_final, rd, is_q ? 1 : 0, MO_64); if (round) { - uint64_t round_const = 1ULL << (shift - 1); - tcg_round = tcg_const_i64(round_const); + tcg_round = tcg_constant_i64(1ULL << (shift - 1)); } else { tcg_round = NULL; } @@ -10756,9 +10649,6 @@ static void handle_vec_simd_shrn(DisasContext *s, bool is_q, } else { write_vec_element(s, tcg_final, rd, 1, MO_64); } - if (round) { - tcg_temp_free_i64(tcg_round); - } tcg_temp_free_i64(tcg_rn); tcg_temp_free_i64(tcg_rd); tcg_temp_free_i64(tcg_final); @@ -12462,7 +12352,7 @@ static void handle_2misc_pairwise(DisasContext *s, int opcode, bool u, } } if (!is_q) { - tcg_res[1] = tcg_const_i64(0); + tcg_res[1] = tcg_constant_i64(0); } for (pass = 0; pass < 2; pass++) { write_vec_element(s, tcg_res[pass], rd, pass, MO_64); @@ -12895,25 +12785,17 @@ static void disas_simd_two_reg_misc(DisasContext *s, uint32_t insn) case 0x1c: /* FCVTAS */ case 0x3a: /* FCVTPS */ case 0x3b: /* FCVTZS */ - { - TCGv_i32 tcg_shift = tcg_const_i32(0); gen_helper_vfp_tosls(tcg_res, tcg_op, - tcg_shift, tcg_fpstatus); - tcg_temp_free_i32(tcg_shift); + tcg_constant_i32(0), tcg_fpstatus); break; - } case 0x5a: /* FCVTNU */ case 0x5b: /* FCVTMU */ case 0x5c: /* FCVTAU */ case 0x7a: /* FCVTPU */ case 0x7b: /* FCVTZU */ - { - TCGv_i32 tcg_shift = tcg_const_i32(0); gen_helper_vfp_touls(tcg_res, tcg_op, - tcg_shift, tcg_fpstatus); - tcg_temp_free_i32(tcg_shift); + tcg_constant_i32(0), tcg_fpstatus); break; - } case 0x18: /* FRINTN */ case 0x19: /* FRINTM */ case 0x38: /* FRINTP */ @@ -14011,7 +13893,7 @@ static void disas_simd_indexed(DisasContext *s, uint32_t insn) } if (is_scalar) { - tcg_res[1] = tcg_const_i64(0); + tcg_res[1] = tcg_constant_i64(0); } for (pass = 0; pass < 2; pass++) { @@ -14415,7 +14297,7 @@ static void disas_crypto_four_reg(DisasContext *s, uint32_t insn) tcg_op2 = tcg_temp_new_i32(); tcg_op3 = tcg_temp_new_i32(); tcg_res = tcg_temp_new_i32(); - tcg_zero = tcg_const_i32(0); + tcg_zero = tcg_constant_i32(0); read_vec_element_i32(s, tcg_op1, rn, 3, MO_32); read_vec_element_i32(s, tcg_op2, rm, 3, MO_32); @@ -14435,7 +14317,6 @@ static void disas_crypto_four_reg(DisasContext *s, uint32_t insn) tcg_temp_free_i32(tcg_op2); tcg_temp_free_i32(tcg_op3); tcg_temp_free_i32(tcg_res); - tcg_temp_free_i32(tcg_zero); } } @@ -14943,22 +14824,19 @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) gen_helper_yield(cpu_env); break; case DISAS_WFI: - { - /* This is a special case because we don't want to just halt the CPU - * if trying to debug across a WFI. + /* + * This is a special case because we don't want to just halt + * the CPU if trying to debug across a WFI. */ - TCGv_i32 tmp = tcg_const_i32(4); - gen_a64_set_pc_im(dc->base.pc_next); - gen_helper_wfi(cpu_env, tmp); - tcg_temp_free_i32(tmp); - /* The helper doesn't necessarily throw an exception, but we + gen_helper_wfi(cpu_env, tcg_constant_i32(4)); + /* + * The helper doesn't necessarily throw an exception, but we * must go back to the main loop to check for interrupts anyway. */ tcg_gen_exit_tb(NULL, 0); break; } - } } } From patchwork Sun Apr 17 17:43:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562825 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1856569map; Sun, 17 Apr 2022 10:57:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9zl6h2htf8c1ln/TILlT13SD+7WQCCDZ/X/JLRXueGtdmCprzfSNZLhT+yugLc43EL/+s X-Received: by 2002:a05:622a:1443:b0:2eb:b4b7:c3b with SMTP id v3-20020a05622a144300b002ebb4b70c3bmr4960156qtx.574.1650218235432; Sun, 17 Apr 2022 10:57:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650218235; cv=none; d=google.com; s=arc-20160816; b=IeMMxn6QQbGRJ5K81izgqTG90nBWTmY5/2YbPDJPCbdWOaybq/EuHqLRhvisCmyqP2 reKInHMnY2v9rxJ3XQZ0iwh5yMgv1v/VJjMDZrJdXnfvs3GUCcyH9aQNhChtsBdRbmCm acfCTQVkBQtN177n6Q8puWcDdIo1uxet6KIJIcBQ3NsWKg/MZRBVGozRTv41ahgzgOEl QlD9tCRJtYu9+vVMfIJ8fR3Pn4Ee4CCOs4NHlElbVzGqLL3cYAHpQgnIOc6IETMAi0aT Wx5YSboe8HCkqrf0pQM+5TLV/Wq4t9B+Nyhe204Y5+ck07QQgsuFWgo8z1wf6YB1aoex 4lFg== 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=cn62Jvoq3Pb11WwsFWhBF5m4nITQmzUChokYzJD1Jq4=; b=VJzHB5J3qIsWW4yIJzeGcZuL4K21cyP59vqiuEXanMUfT0pI6wJPNNmitXuqmNIESx dy467H7aVcVXO/ZaIYFxc/QSSUPZzkS1IBcsWvx9jQlG9uApypZ9zW3zEXBUE8uhmpq2 ta3RAYGK6tb87t49Q0haHu5ZjVzLOVUy3O2ZMwECVO0SnXOoOEsZKqKz/1QQy1G3irG5 UJN0MWTPWLZu0ZVQMEBhSPcilFEtAU8yMgHjJ9bTpjbRf5XSHvL3z2FL4EPSxJD0pyiU A/jdOhMDEvNTJX3XtTPc7zaHzRmTX6Exf7O4FjeLBhIJjXZ222JK+JJArKt7u+DyUal/ wgRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eReMNywe; 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 m19-20020a05620a291300b0067ecf414f7asi2469152qkp.156.2022.04.17.10.57.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 10:57:15 -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=eReMNywe; 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]:48556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng999-0007B2-2A for patch@linaro.org; Sun, 17 Apr 2022 13:57:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48040) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8x3-0000hB-DG for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:45 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]:38895) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8x1-0003J3-2W for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:44 -0400 Received: by mail-pg1-x533.google.com with SMTP id s137so14959686pgs.5 for ; Sun, 17 Apr 2022 10:44:42 -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=cn62Jvoq3Pb11WwsFWhBF5m4nITQmzUChokYzJD1Jq4=; b=eReMNyweJi6MfDh6wje3xHRDFoafz6DelGZ7BTElJiwX1MEN+afQ6vd1k0/ygxxcmH I1s06huv/JT0z+TtstYbh0GX1xX8NPOxDh5Eo6hE1u8oIp5wefixtEH0K1VGpVHQEsjD 2U0LBaFsy9Ud6KIkhsuvStq1om78hlq/HGk8RQQ93GluZ4JlzUTOvB01T0SVuia7mzZV wMT7SaAaww5UE8V4FW0kLJU0Vga4gDiSxo2+8uACq5je6JTPsRCTAOSzT/BCabSDdD9g zIL+et9OUkR26jvckhb1UsV1Mg6qhfTJJs5fg4Llk3HUWHiNz38TDvOMw08lxbo2r+d5 yXSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cn62Jvoq3Pb11WwsFWhBF5m4nITQmzUChokYzJD1Jq4=; b=a4lZ76YK4CkbMMehU7wgK+i1IgNtmfwgA72R86nvWzlaykSW8rPeXX5FW0U2W5Kxtw dWkGtzfm46WbC4qFWSCj6AO7AebFktTK1VultlDdhgN4MVsnbeKRWpD4UHeVetd1xgI9 GAVGItKjtOZzRWVqZsET36YWtoQM0r/Y87g+gLN+liqWYxA0sIMam7wCRWqhpXRyMjcu NyBVo3moGj13fxHd0pLtidBV6iG4DG8F0LV4g1JO8aRjcEODxKCTxSrM1E1ZCbo6OFof iR3mtliPRwoaxR5z9rbNYAEA3Nwwrs61Mh1v9Yg+zjGyquQktN3Hfok+4ZluND3lX/Is iXfQ== X-Gm-Message-State: AOAM531caEK2tKWtNkPAzuJb+RZCMKdVbca3MiD7yL9QX2aYfoo/iD9V yCAC+ARVLnnrFs9gHCLV1KaWudPcIBXlyA== X-Received: by 2002:a05:6a00:b94:b0:50a:5ff2:bb2a with SMTP id g20-20020a056a000b9400b0050a5ff2bb2amr5172146pfj.56.1650217481745; Sun, 17 Apr 2022 10:44:41 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 14/60] target/arm: Simplify GEN_SHIFT in translate.c Date: Sun, 17 Apr 2022 10:43:40 -0700 Message-Id: <20220417174426.711829-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Instead of computing tmp1 = shift & 0xff; dest = (tmp1 > 0x1f ? 0 : value) << (tmp1 & 0x1f) use tmpd = value << (shift & 0x1f); dest = shift & 0xe ? 0 : tmpd; which has a flatter dependency tree. Use tcg_constant_i32 while we're at it. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index 6b293f8279..57631c9fa1 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -552,16 +552,14 @@ static void gen_sbc_CC(TCGv_i32 dest, TCGv_i32 t0, TCGv_i32 t1) #define GEN_SHIFT(name) \ static void gen_##name(TCGv_i32 dest, TCGv_i32 t0, TCGv_i32 t1) \ { \ - TCGv_i32 tmp1, tmp2, tmp3; \ - tmp1 = tcg_temp_new_i32(); \ - tcg_gen_andi_i32(tmp1, t1, 0xff); \ - tmp2 = tcg_const_i32(0); \ - tmp3 = tcg_const_i32(0x1f); \ - tcg_gen_movcond_i32(TCG_COND_GTU, tmp2, tmp1, tmp3, tmp2, t0); \ - tcg_temp_free_i32(tmp3); \ - tcg_gen_andi_i32(tmp1, tmp1, 0x1f); \ - tcg_gen_##name##_i32(dest, tmp2, tmp1); \ - tcg_temp_free_i32(tmp2); \ + TCGv_i32 tmpd = tcg_temp_new_i32(); \ + TCGv_i32 tmp1 = tcg_temp_new_i32(); \ + TCGv_i32 zero = tcg_constant_i32(0); \ + tcg_gen_andi_i32(tmp1, t1, 0x1f); \ + tcg_gen_##name##_i32(tmpd, t0, tmp1); \ + tcg_gen_andi_i32(tmp1, t1, 0xe0); \ + tcg_gen_movcond_i32(TCG_COND_NE, dest, tmp1, zero, zero, tmpd); \ + tcg_temp_free_i32(tmpd); \ tcg_temp_free_i32(tmp1); \ } GEN_SHIFT(shl) From patchwork Sun Apr 17 17:43:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562836 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1861257map; Sun, 17 Apr 2022 11:06:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRYAZaRi96O9Hjn6X5qJ6Vgq92V1D8o2JNs/u5ZqqHAYh+8vNeYXdYJ0+XtQ9DFZJqEvBc X-Received: by 2002:a05:6214:168:b0:444:52f0:7b28 with SMTP id y8-20020a056214016800b0044452f07b28mr5781691qvs.46.1650218810517; Sun, 17 Apr 2022 11:06:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650218810; cv=none; d=google.com; s=arc-20160816; b=yf5QBUhdBLZRuMEP5oacJF/rc8V8HGNC6xkwH2Q8K4Wftkj5xskwCx7AZG60oxYFEY iSnZwF6eYFs06PasiCyHbTBlOqpSAqlCshXJmkJCuUukR8Xt7m20l0cms+iDYV4LQ/iG A7OsJW8zgtGWLAfPzbc+6JY5TpHMb24/m4kLvnZNgyaf9jyPjIJoqjDECeW+N7BGM9Jq 8enSSbJZcWNU/cSVzQP57c7XYIEzbeuWXRgdCQUkjdcwQS3mtMemHQN9Ux+k73v2Of2i Jg3asMrwmpRP1X5KTRIzxj9qKzSQuWgBDYLtdOLbgSwbbrvjUxLgOrspywbMTbEWBKeY 0q/A== 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=z284YO2l+zNv3weW3jS6RSJVzTJCNg6AbcZ1VqRFtfo=; b=09IOYQAOq5wavbzeh1ZBmB9r3BZzQbipa7ZT6P7HHiRTdO9f4wpW9pVi8FqhGB1/Jw GkgL5r+eOtUIwBudXwIiUcw1ei7W9U6O1Kyq0UeVXThf/AQ61NmiPX/l2N+PPLV/LnH8 eE7NZPaYogOsgTnGLayVpyDziMl2hqkw762SYVVWH7SpSLF44ayg+6/6Nu8g+5i57aIp Ht+MFNTy13nuH/8SrDDwN6qOLtg7EI6T/vCZrKEaWg/Htmu9GbzOOGaJu5/wTvPTtZc3 3bSvgN3GUwHdPufB2r3LPOCkg8ZR+mo3SykUSuwh2BSRhgXlr/+vcM7/Qjq77wTJz5zs v5Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xEMyygvU; 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 k3-20020ac85fc3000000b002f1f9385c0asi989901qta.423.2022.04.17.11.06.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:06:50 -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=xEMyygvU; 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]:48448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9IQ-0000rn-3B for patch@linaro.org; Sun, 17 Apr 2022 14:06:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48112) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8x5-0000j2-BW for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:48 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:40610) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8x3-0003JU-35 for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:46 -0400 Received: by mail-pl1-x633.google.com with SMTP id t12so10738699pll.7 for ; Sun, 17 Apr 2022 10:44:43 -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=z284YO2l+zNv3weW3jS6RSJVzTJCNg6AbcZ1VqRFtfo=; b=xEMyygvUXN6bfDFI+qFB8xYg7Yc899cQXWUScaoDeYT+iLdPSDz52Sgrww4GTluvJx 8kjEMBDub64QOMrG/1QjBZtH7ttYlfPbveFMpYMjxp2HwoMtfUWjbSVtamU3J2WZKWkv epZNeylcWT88FK2bANnV8JAoCtp5vnLKXm2K7ha7NQsR2JexI+MOkjvaM9shDgaxSrbp ytLWELUpKTVHbJl+bhVRhYFb0oOpkrg9brLBeTmMRcQOjP3xz7iNfO4QWhBVoD8fSFlx NUC6L/j8h7a7Li+1TqPUaEi2p+9jUbInQiPWIFk1LSF64jFtY0VXzQ0parAv4K6wn8Gy Wydg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=z284YO2l+zNv3weW3jS6RSJVzTJCNg6AbcZ1VqRFtfo=; b=IG0V78/EqV4koKODyaY2cvyPPJJyufkUe55Yo/8hxcM9T7/Nz37kjyuXTNYeXT0Svs X3NZC89cYko8a4HiDtKVU96x80Yrr5PDVBfciwXEHWA9q12PMVeHT6tRZBSJjqMKFMsl 2yHM2gFxldbilvdonmHaIfUKpoi1Ub65huZcITXzgIvRfj32Vy0wvHNvyw/W6jk+/AJX B0oQwkFbxxc2iMICSQ/jxPXoG9AEDKMFi4ctyw5/s3No4VhA8DGB3xAELjidzzaaITJo O1CaUWtxp0zjo6Q1jeHnXqSE2t3TtWUf1WXwMmZbSBBQb1R6PlHBKke9c+uZS7jjwid6 aNAQ== X-Gm-Message-State: AOAM530RUp4xH/Tltm2JQg/vltcmdOF6d/lyqXbxBrx/HsVSBoonNW2S Pwl7h6Xn6MGnngPqfvEQm9xSwxiTFnqO4Q== X-Received: by 2002:a17:902:ce0f:b0:156:5a4:926c with SMTP id k15-20020a170902ce0f00b0015605a4926cmr7557717plg.3.1650217482752; Sun, 17 Apr 2022 10:44:42 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 15/60] target/arm: Simplify gen_sar Date: Sun, 17 Apr 2022 10:43:41 -0700 Message-Id: <20220417174426.711829-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use tcg_gen_umin_i32 instead of tcg_gen_movcond_i32. Use tcg_constant_i32 while we're at it. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index 57631c9fa1..8d6534f9a5 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -568,12 +568,10 @@ GEN_SHIFT(shr) static void gen_sar(TCGv_i32 dest, TCGv_i32 t0, TCGv_i32 t1) { - TCGv_i32 tmp1, tmp2; - tmp1 = tcg_temp_new_i32(); + TCGv_i32 tmp1 = tcg_temp_new_i32(); + tcg_gen_andi_i32(tmp1, t1, 0xff); - tmp2 = tcg_const_i32(0x1f); - tcg_gen_movcond_i32(TCG_COND_GTU, tmp1, tmp1, tmp2, tmp2, tmp1); - tcg_temp_free_i32(tmp2); + tcg_gen_umin_i32(tmp1, tmp1, tcg_constant_i32(31)); tcg_gen_sar_i32(dest, t0, tmp1); tcg_temp_free_i32(tmp1); } From patchwork Sun Apr 17 17:43:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562827 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1858028map; Sun, 17 Apr 2022 11:00:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy40Sq6wXHK8HSmYt72WMCl7a71XjZlxe7nA7AV4j3Rf98WNxCrqc0w58eDp0N5Hab3wB6p X-Received: by 2002:ac8:5c85:0:b0:2e2:3211:92e9 with SMTP id r5-20020ac85c85000000b002e2321192e9mr5095765qta.386.1650218452948; Sun, 17 Apr 2022 11:00:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650218452; cv=none; d=google.com; s=arc-20160816; b=POmsd+FsPRikq1NZeMWBulRVo7Xrg+ra9mUVbS6AlMtVqFT3PX4YzbXv2JchAPvrhJ XptAVsBVxDkIrg30jh5Zd8H3zwvt0SjAcf2UJlierMVG32ANzdYXQZOBmkNu+pF6/2Nu 08VotRmAvidLZEYrJxBlUHgD1uwAPoJXHgqxoBPwFAEaY2Sh2RDDVZQ2VvQQguf75o/E iCGhUL7962x/u30TLiowhyrLru32uWGRSqJYehxvVS5riT+LP8vhctRzglO09lLSAwO0 q9WMfYLc3lq2mXLLz8s3Yh7h5sWQ/rS1g2Guji5omNfkQTWjp0EahdvpQvSo9Pt93PGk dxnQ== 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=T+qbueQADK/vfjH9sg1vNkUW9Au5lmMPxG4EP03Vc/s=; b=YCoM4bosPuCcAxo4erSh7Fq1nEKzMqC4ndq7ItDQfrTPtehsRyrn6EymRFZc2LuEnh MPWuI9oRZkf5pRKjRGiWBgyan5bQ4SdGAyV95Aj3+9YGCP+L2JSC1eZW9YxZy/cNJ/bs TqIqsMVGu/lxd87J5Y5n8mSz4z4RsXr6uJ8gwfJB+SY3eNJm6a6L4vuDVEh/Afi3laJt iuyqKFTw2IABqzYsI9DgEgAjup0ZKyR3SHyxbBIGaEhwqC0gsuao19+WnlDx9sE5aHwE WVBz91kRGjlwORMJ4PlA4oGBR8UJE9kJhDusM90BvS2boIcs+rNg+0nHItP24KlP+til soCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aySD4yBw; 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 s15-20020ac85ccf000000b002e2051a44fbsi2650198qta.286.2022.04.17.11.00.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:00:52 -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=aySD4yBw; 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]:57172 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9Ce-0004dr-GN for patch@linaro.org; Sun, 17 Apr 2022 14:00:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8x5-0000iq-7g for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:48 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]:43921) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8x3-0003Jm-3E for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:46 -0400 Received: by mail-pg1-x532.google.com with SMTP id u2so14950417pgq.10 for ; Sun, 17 Apr 2022 10:44:44 -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=T+qbueQADK/vfjH9sg1vNkUW9Au5lmMPxG4EP03Vc/s=; b=aySD4yBwds8m94r8eX+fNpZnJzukavDjz6GWEEYQXcYuhW+SoTf11yPk9b9FSLiRvQ /dQMLgqdOKfTCSyYfG8lWeS3HNNyZH6WiBiFBElJrP3xx1ttzlWfGvNxv7ke2dFCWwMy lEcoZ5auKUOCfGKLqw5Y1akblshYbXERu95YWjXYXvWftvuWQboERDOLvLB3/R09h/rg LNo2O17hMSrvV06vy7OYmCl2yKSdFcujSkET3q/XodSs0nQe4b+VmEZJLky+xgWDmBK+ jV/On1JngCVBw9VBqGYDrTuoRYDhxNJNqgnHcv3TQyNT6tUQIZFyoOruIagcYiSZFSG4 LiwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=T+qbueQADK/vfjH9sg1vNkUW9Au5lmMPxG4EP03Vc/s=; b=0MXRHiUMoTlHyz8mAmOtu9YRI9sh0R5otays0b85mPjWBEpPFkaKCtNhG/jm+LBPoN 9n1hVj88TtF1SPaUR3gnzKBbo2NUAc4Oduu/VlgV8xlHN99evBRFc/NP2hXH+9ZOWB0r ChxmtbaoW92XakWiLSxE7GZ1VNGJTQQbv5dK9SlDzNQOweE4RBpq8kysvMixxzcXOUxF MNy29FFf3quIYphhdtelsEJL+Vk8gB8z+WI3C+p92GR81XNxA2kYQ5kEawk3UmxKxmLv 166TagvDwn4PWgonubbDuJ6//Nk44Y1k+z5dC+eoTzemADtm9t7uGl2fsbx69xT2J7N9 CVHg== X-Gm-Message-State: AOAM531waYB1GAqgiRJm6Q6jJJSZaaYnoh16YYIxXUJGxTCuTYsNdTAm 6TwnSbuPydMqX6Ch5quxYeiksoJtds3jvA== X-Received: by 2002:a05:6a00:b46:b0:508:2d0f:9f83 with SMTP id p6-20020a056a000b4600b005082d0f9f83mr8308075pfo.80.1650217483604; Sun, 17 Apr 2022 10:44:43 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 16/60] target/arm: Simplify aa32 DISAS_WFI Date: Sun, 17 Apr 2022 10:43:42 -0700 Message-Id: <20220417174426.711829-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x532.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The length of the previous insn may be computed from the difference of start and end addresses. Use tcg_constant_i32 while we're at it. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index 8d6534f9a5..e1c1dbc563 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -9870,18 +9870,14 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) /* nothing more to generate */ break; case DISAS_WFI: - { - TCGv_i32 tmp = tcg_const_i32((dc->thumb && - !(dc->insn & (1U << 31))) ? 2 : 4); - - gen_helper_wfi(cpu_env, tmp); - tcg_temp_free_i32(tmp); - /* The helper doesn't necessarily throw an exception, but we + gen_helper_wfi(cpu_env, + tcg_constant_i32(dc->base.pc_next - dc->pc_curr)); + /* + * The helper doesn't necessarily throw an exception, but we * must go back to the main loop to check for interrupts anyway. */ tcg_gen_exit_tb(NULL, 0); break; - } case DISAS_WFE: gen_helper_wfe(cpu_env); break; From patchwork Sun Apr 17 17:43:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562835 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1861207map; Sun, 17 Apr 2022 11:06:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcZZFvA+qA1foBJD16wihKA/WQlGlR1F70HU633twfpMtIvIqUFVlWkDadwtThnK8UUrE5 X-Received: by 2002:ac8:5551:0:b0:2f1:ea20:40a with SMTP id o17-20020ac85551000000b002f1ea20040amr5001257qtr.139.1650218804612; Sun, 17 Apr 2022 11:06:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650218804; cv=none; d=google.com; s=arc-20160816; b=e4ynI4BSRNq+1A848vlqmjKV6//QvDm2PXotFhOekF94iMhLKcfe6rtY3UA1IqBNO6 W5l0LxY76QTQKBRK6myDgedM948CWsC3XtZpsZHcZg/vERvKy+DoYsxgrfrfTIK453LI i7NkkIjV4KS63ANMdM4CKHElZZZOavJnUqZ4tPGCMyvcpqpxrJMmrpAh0Qztaba7Pluv TkNh19Lf+B9a7J6kyu5Y2mccuSaw4ggLJepPDUa1xQjzk7QXYs30lkjY78LZ8WutOEF7 Pszp3LBjxkswAqc4keGCwyM65CV3G28ziJcNlaTHb0qkGQf0xQCLvkEtnd1TE9z9rFMb 99UA== 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=V6Sw+Kw5igCtY28372OR+Z/+OWydY+yQWED9kzgh3iA=; b=1Ag7yF9UwfhygYzF/l+MnZk/f93+ztVw1Uq5gS4zIruGCIscLPGDapXc2Koj4mUaqO GljKz0SxJ72+kwWx1Uo8YuevVlbY6gBuUWbFw3RpltVtNzoUzTw1LUJc7IonSUSRJDOU 3s8xIaNeL36QdCwn67ql0eUXufKWyNDfpuFsIhKI05syJ9Zhh5PJBOAWYZSeewuzPBbZ k33+Dl9GR/+X1EEr6rw95n7cLcH1Yqc+Fci4tCwZ+AgOo7Z8zM05ZmY2o4vdsSRMiLr4 3arbiN2Tt7hWX7C3cxVaLwKUd1vHQfQ3hFArhmbznIb6uWk5AXhasenGCxrmvxvwxpI2 zhag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ey0JDQNb; 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 f10-20020a05620a280a00b0067e4be239fbsi2645262qkp.576.2022.04.17.11.06.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:06: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=Ey0JDQNb; 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]:47552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9IK-0000E2-6I for patch@linaro.org; Sun, 17 Apr 2022 14:06:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48178) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8x8-0000lJ-7v for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:50 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]:34705) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8x5-0003K2-0M for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:49 -0400 Received: by mail-pl1-x62d.google.com with SMTP id n8so10761683plh.1 for ; Sun, 17 Apr 2022 10:44:45 -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=V6Sw+Kw5igCtY28372OR+Z/+OWydY+yQWED9kzgh3iA=; b=Ey0JDQNbjHLk3vCelOf+nsPiPr1X4Q774SH7IbCBjGOJpB9b9Z8WeU66zTP8ASijMh L7lBixAJDdeIeBB8ngRrAPVWV+RVbe0KfifDy0ChsgECkAcPersgABvIoaiu5e7n5r/+ id1PJyKJetdNkStzJ0EyBOhSJIwi45GiRnyKBBNqPPgdvX+JqKiN748Oh3tLmC6U//my 2VenqN3NVaqXaly8Cs/a+jHiJ1H4PPXztvv5VGenRtCd0/zzE+HTD4VlHMYeKizE7UNc 1vFPBLH+9piDvToOcwdGBitHvSt2gGY69GJqbLZRNOZ29RbkA9xXIvZLPvaKWZw3aDXj XGbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V6Sw+Kw5igCtY28372OR+Z/+OWydY+yQWED9kzgh3iA=; b=qQxjUcHi3DTLjD7Yz95/vLcA64xST1ae26fg29M7bPMkrGl+VxyvejCKo5rCwGGi72 Uv+c3CuXtGdT5XJnOrk3JXefq3PqJCeodrUVz1+8I084Nb8tL3tr25hdkgSN8DjZlUbY rx2faeGDlpggi44n+3ax2jFWJCUIVonS2bmxI0HFPgf7W8pl52a6wxrn6lTrXu0tNn1A 0eXd3A5jJTablVvqVgQTC7LyJEvTM3AB8MnRfm+UPJiwrfOBpsIa/4HIMpUA7p8fWyL1 lOHIVS+HYU/NgHmY8JwUsOPGc23kHzMrUfE7QXf3zyjNEaFVH4wGPhS2oQJwjMfeesQj IjiA== X-Gm-Message-State: AOAM53095a0E+vm4kIbB8f5VHLJHvindvirawvT7149SV4dr7Und3bZG y3sL8shGZWMW9qOwc/8Xplcj4wuBrUjGrw== X-Received: by 2002:a17:902:ec8c:b0:154:2e86:dd51 with SMTP id x12-20020a170902ec8c00b001542e86dd51mr7629487plg.99.1650217484624; Sun, 17 Apr 2022 10:44:44 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 17/60] target/arm: Use tcg_constant in translate.c Date: Sun, 17 Apr 2022 10:43:43 -0700 Message-Id: <20220417174426.711829-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use tcg_constant_{i32,i64,ptr} as appropriate throughout, which means we get to remove lots of tcg_temp_free_*. Drop variables in many cases, passing the constant directly to another function. Signed-off-by: Richard Henderson --- target/arm/translate.c | 250 ++++++++++++++--------------------------- 1 file changed, 84 insertions(+), 166 deletions(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index e1c1dbc563..5cb4b3da33 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -346,9 +346,7 @@ static void store_sp_checked(DisasContext *s, TCGv_i32 var) void gen_set_cpsr(TCGv_i32 var, uint32_t mask) { - TCGv_i32 tmp_mask = tcg_const_i32(mask); - gen_helper_cpsr_write(cpu_env, var, tmp_mask); - tcg_temp_free_i32(tmp_mask); + gen_helper_cpsr_write(cpu_env, var, tcg_constant_i32(mask)); } static void gen_rebuild_hflags(DisasContext *s, bool new_el) @@ -373,11 +371,8 @@ static void gen_rebuild_hflags(DisasContext *s, bool new_el) static void gen_exception_internal(int excp) { - TCGv_i32 tcg_excp = tcg_const_i32(excp); - assert(excp_is_internal(excp)); - gen_helper_exception_internal(cpu_env, tcg_excp); - tcg_temp_free_i32(tcg_excp); + gen_helper_exception_internal(cpu_env, tcg_constant_i32(excp)); } static void gen_singlestep_exception(DisasContext *s) @@ -1078,12 +1073,8 @@ static inline void gen_smc(DisasContext *s) /* As with HVC, we may take an exception either before or after * the insn executes. */ - TCGv_i32 tmp; - gen_set_pc_im(s, s->pc_curr); - tmp = tcg_const_i32(syn_aa32_smc()); - gen_helper_pre_smc(cpu_env, tmp); - tcg_temp_free_i32(tmp); + gen_helper_pre_smc(cpu_env, tcg_constant_i32(syn_aa32_smc())); gen_set_pc_im(s, s->base.pc_next); s->base.is_jmp = DISAS_SMC; } @@ -1111,13 +1102,9 @@ void gen_exception_insn(DisasContext *s, uint64_t pc, int excp, static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn) { - TCGv_i32 tcg_syn; - gen_set_condexec(s); gen_set_pc_im(s, s->pc_curr); - tcg_syn = tcg_const_i32(syn); - gen_helper_exception_bkpt_insn(cpu_env, tcg_syn); - tcg_temp_free_i32(tcg_syn); + gen_helper_exception_bkpt_insn(cpu_env, tcg_constant_i32(syn)); s->base.is_jmp = DISAS_NORETURN; } @@ -1131,16 +1118,11 @@ void unallocated_encoding(DisasContext *s) static void gen_exception_el(DisasContext *s, int excp, uint32_t syn, TCGv_i32 tcg_el) { - TCGv_i32 tcg_excp; - TCGv_i32 tcg_syn; - gen_set_condexec(s); gen_set_pc_im(s, s->pc_curr); - tcg_excp = tcg_const_i32(excp); - tcg_syn = tcg_const_i32(syn); - gen_helper_exception_with_syndrome(cpu_env, tcg_excp, tcg_syn, tcg_el); - tcg_temp_free_i32(tcg_syn); - tcg_temp_free_i32(tcg_excp); + gen_helper_exception_with_syndrome(cpu_env, + tcg_constant_i32(excp), + tcg_constant_i32(syn), tcg_el); s->base.is_jmp = DISAS_NORETURN; } @@ -1863,24 +1845,21 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn) gen_op_iwmmxt_movq_M0_wRn(wrd); switch ((insn >> 6) & 3) { case 0: - tmp2 = tcg_const_i32(0xff); - tmp3 = tcg_const_i32((insn & 7) << 3); + tmp2 = tcg_constant_i32(0xff); + tmp3 = tcg_constant_i32((insn & 7) << 3); break; case 1: - tmp2 = tcg_const_i32(0xffff); - tmp3 = tcg_const_i32((insn & 3) << 4); + tmp2 = tcg_constant_i32(0xffff); + tmp3 = tcg_constant_i32((insn & 3) << 4); break; case 2: - tmp2 = tcg_const_i32(0xffffffff); - tmp3 = tcg_const_i32((insn & 1) << 5); + tmp2 = tcg_constant_i32(0xffffffff); + tmp3 = tcg_constant_i32((insn & 1) << 5); break; default: - tmp2 = NULL; - tmp3 = NULL; + g_assert_not_reached(); } gen_helper_iwmmxt_insr(cpu_M0, cpu_M0, tmp, tmp2, tmp3); - tcg_temp_free_i32(tmp3); - tcg_temp_free_i32(tmp2); tcg_temp_free_i32(tmp); gen_op_iwmmxt_movq_wRn_M0(wrd); gen_op_iwmmxt_set_mup(); @@ -2336,10 +2315,9 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn) rd0 = (insn >> 16) & 0xf; rd1 = (insn >> 0) & 0xf; gen_op_iwmmxt_movq_M0_wRn(rd0); - tmp = tcg_const_i32((insn >> 20) & 3); iwmmxt_load_reg(cpu_V1, rd1); - gen_helper_iwmmxt_align(cpu_M0, cpu_M0, cpu_V1, tmp); - tcg_temp_free_i32(tmp); + gen_helper_iwmmxt_align(cpu_M0, cpu_M0, cpu_V1, + tcg_constant_i32((insn >> 20) & 3)); gen_op_iwmmxt_movq_wRn_M0(wrd); gen_op_iwmmxt_set_mup(); break; @@ -2393,9 +2371,8 @@ static int disas_iwmmxt_insn(DisasContext *s, uint32_t insn) wrd = (insn >> 12) & 0xf; rd0 = (insn >> 16) & 0xf; gen_op_iwmmxt_movq_M0_wRn(rd0); - tmp = tcg_const_i32(((insn >> 16) & 0xf0) | (insn & 0x0f)); + tmp = tcg_constant_i32(((insn >> 16) & 0xf0) | (insn & 0x0f)); gen_helper_iwmmxt_shufh(cpu_M0, cpu_env, cpu_M0, tmp); - tcg_temp_free_i32(tmp); gen_op_iwmmxt_movq_wRn_M0(wrd); gen_op_iwmmxt_set_mup(); gen_op_iwmmxt_set_cup(); @@ -2868,7 +2845,7 @@ static bool msr_banked_access_decode(DisasContext *s, int r, int sysm, int rn, tcg_gen_sextract_i32(tcg_el, tcg_el, ctz32(SCR_EEL2), 1); tcg_gen_addi_i32(tcg_el, tcg_el, 3); } else { - tcg_el = tcg_const_i32(3); + tcg_el = tcg_constant_i32(3); } gen_exception_el(s, EXCP_UDEF, syn_uncategorized(), tcg_el); @@ -2903,7 +2880,7 @@ undef: static void gen_msr_banked(DisasContext *s, int r, int sysm, int rn) { - TCGv_i32 tcg_reg, tcg_tgtmode, tcg_regno; + TCGv_i32 tcg_reg; int tgtmode = 0, regno = 0; if (!msr_banked_access_decode(s, r, sysm, rn, &tgtmode, ®no)) { @@ -2914,18 +2891,16 @@ static void gen_msr_banked(DisasContext *s, int r, int sysm, int rn) gen_set_condexec(s); gen_set_pc_im(s, s->pc_curr); tcg_reg = load_reg(s, rn); - tcg_tgtmode = tcg_const_i32(tgtmode); - tcg_regno = tcg_const_i32(regno); - gen_helper_msr_banked(cpu_env, tcg_reg, tcg_tgtmode, tcg_regno); - tcg_temp_free_i32(tcg_tgtmode); - tcg_temp_free_i32(tcg_regno); + gen_helper_msr_banked(cpu_env, tcg_reg, + tcg_constant_i32(tgtmode), + tcg_constant_i32(regno)); tcg_temp_free_i32(tcg_reg); s->base.is_jmp = DISAS_UPDATE_EXIT; } static void gen_mrs_banked(DisasContext *s, int r, int sysm, int rn) { - TCGv_i32 tcg_reg, tcg_tgtmode, tcg_regno; + TCGv_i32 tcg_reg; int tgtmode = 0, regno = 0; if (!msr_banked_access_decode(s, r, sysm, rn, &tgtmode, ®no)) { @@ -2936,11 +2911,9 @@ static void gen_mrs_banked(DisasContext *s, int r, int sysm, int rn) gen_set_condexec(s); gen_set_pc_im(s, s->pc_curr); tcg_reg = tcg_temp_new_i32(); - tcg_tgtmode = tcg_const_i32(tgtmode); - tcg_regno = tcg_const_i32(regno); - gen_helper_mrs_banked(tcg_reg, cpu_env, tcg_tgtmode, tcg_regno); - tcg_temp_free_i32(tcg_tgtmode); - tcg_temp_free_i32(tcg_regno); + gen_helper_mrs_banked(tcg_reg, cpu_env, + tcg_constant_i32(tgtmode), + tcg_constant_i32(regno)); store_reg(s, rn, tcg_reg); s->base.is_jmp = DISAS_UPDATE_EXIT; } @@ -3023,9 +2996,8 @@ void gen_gvec_sqrdmlsh_qc(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, } \ static void gen_##NAME##0_vec(unsigned vece, TCGv_vec d, TCGv_vec a) \ { \ - TCGv_vec zero = tcg_const_zeros_vec_matching(d); \ + TCGv_vec zero = tcg_constant_vec_matching(d, vece, 0); \ tcg_gen_cmp_vec(COND, vece, d, a, zero); \ - tcg_temp_free_vec(zero); \ } \ void gen_gvec_##NAME##0(unsigned vece, uint32_t d, uint32_t m, \ uint32_t opr_sz, uint32_t max_sz) \ @@ -4015,8 +3987,8 @@ void gen_ushl_i32(TCGv_i32 dst, TCGv_i32 src, TCGv_i32 shift) TCGv_i32 rval = tcg_temp_new_i32(); TCGv_i32 lsh = tcg_temp_new_i32(); TCGv_i32 rsh = tcg_temp_new_i32(); - TCGv_i32 zero = tcg_const_i32(0); - TCGv_i32 max = tcg_const_i32(32); + TCGv_i32 zero = tcg_constant_i32(0); + TCGv_i32 max = tcg_constant_i32(32); /* * Rely on the TCG guarantee that out of range shifts produce @@ -4034,8 +4006,6 @@ void gen_ushl_i32(TCGv_i32 dst, TCGv_i32 src, TCGv_i32 shift) tcg_temp_free_i32(rval); tcg_temp_free_i32(lsh); tcg_temp_free_i32(rsh); - tcg_temp_free_i32(zero); - tcg_temp_free_i32(max); } void gen_ushl_i64(TCGv_i64 dst, TCGv_i64 src, TCGv_i64 shift) @@ -4044,8 +4014,8 @@ void gen_ushl_i64(TCGv_i64 dst, TCGv_i64 src, TCGv_i64 shift) TCGv_i64 rval = tcg_temp_new_i64(); TCGv_i64 lsh = tcg_temp_new_i64(); TCGv_i64 rsh = tcg_temp_new_i64(); - TCGv_i64 zero = tcg_const_i64(0); - TCGv_i64 max = tcg_const_i64(64); + TCGv_i64 zero = tcg_constant_i64(0); + TCGv_i64 max = tcg_constant_i64(64); /* * Rely on the TCG guarantee that out of range shifts produce @@ -4063,8 +4033,6 @@ void gen_ushl_i64(TCGv_i64 dst, TCGv_i64 src, TCGv_i64 shift) tcg_temp_free_i64(rval); tcg_temp_free_i64(lsh); tcg_temp_free_i64(rsh); - tcg_temp_free_i64(zero); - tcg_temp_free_i64(max); } static void gen_ushl_vec(unsigned vece, TCGv_vec dst, @@ -4159,8 +4127,8 @@ void gen_sshl_i32(TCGv_i32 dst, TCGv_i32 src, TCGv_i32 shift) TCGv_i32 rval = tcg_temp_new_i32(); TCGv_i32 lsh = tcg_temp_new_i32(); TCGv_i32 rsh = tcg_temp_new_i32(); - TCGv_i32 zero = tcg_const_i32(0); - TCGv_i32 max = tcg_const_i32(31); + TCGv_i32 zero = tcg_constant_i32(0); + TCGv_i32 max = tcg_constant_i32(31); /* * Rely on the TCG guarantee that out of range shifts produce @@ -4179,8 +4147,6 @@ void gen_sshl_i32(TCGv_i32 dst, TCGv_i32 src, TCGv_i32 shift) tcg_temp_free_i32(rval); tcg_temp_free_i32(lsh); tcg_temp_free_i32(rsh); - tcg_temp_free_i32(zero); - tcg_temp_free_i32(max); } void gen_sshl_i64(TCGv_i64 dst, TCGv_i64 src, TCGv_i64 shift) @@ -4189,8 +4155,8 @@ void gen_sshl_i64(TCGv_i64 dst, TCGv_i64 src, TCGv_i64 shift) TCGv_i64 rval = tcg_temp_new_i64(); TCGv_i64 lsh = tcg_temp_new_i64(); TCGv_i64 rsh = tcg_temp_new_i64(); - TCGv_i64 zero = tcg_const_i64(0); - TCGv_i64 max = tcg_const_i64(63); + TCGv_i64 zero = tcg_constant_i64(0); + TCGv_i64 max = tcg_constant_i64(63); /* * Rely on the TCG guarantee that out of range shifts produce @@ -4209,8 +4175,6 @@ void gen_sshl_i64(TCGv_i64 dst, TCGv_i64 src, TCGv_i64 shift) tcg_temp_free_i64(rval); tcg_temp_free_i64(lsh); tcg_temp_free_i64(rsh); - tcg_temp_free_i64(zero); - tcg_temp_free_i64(max); } static void gen_sshl_vec(unsigned vece, TCGv_vec dst, @@ -4725,8 +4689,6 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, * Note that on XScale all cp0..c13 registers do an access check * call in order to handle c15_cpar. */ - TCGv_ptr tmpptr; - TCGv_i32 tcg_syn, tcg_isread; uint32_t syndrome; /* Note that since we are an implementation which takes an @@ -4769,14 +4731,10 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, gen_set_condexec(s); gen_set_pc_im(s, s->pc_curr); - tmpptr = tcg_const_ptr(ri); - tcg_syn = tcg_const_i32(syndrome); - tcg_isread = tcg_const_i32(isread); - gen_helper_access_check_cp_reg(cpu_env, tmpptr, tcg_syn, - tcg_isread); - tcg_temp_free_ptr(tmpptr); - tcg_temp_free_i32(tcg_syn); - tcg_temp_free_i32(tcg_isread); + gen_helper_access_check_cp_reg(cpu_env, + tcg_constant_ptr(ri), + tcg_constant_i32(syndrome), + tcg_constant_i32(isread)); } else if (ri->type & ARM_CP_RAISES_EXC) { /* * The readfn or writefn might raise an exception; @@ -4812,13 +4770,11 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, TCGv_i64 tmp64; TCGv_i32 tmp; if (ri->type & ARM_CP_CONST) { - tmp64 = tcg_const_i64(ri->resetvalue); + tmp64 = tcg_constant_i64(ri->resetvalue); } else if (ri->readfn) { - TCGv_ptr tmpptr; tmp64 = tcg_temp_new_i64(); - tmpptr = tcg_const_ptr(ri); - gen_helper_get_cp_reg64(tmp64, cpu_env, tmpptr); - tcg_temp_free_ptr(tmpptr); + gen_helper_get_cp_reg64(tmp64, cpu_env, + tcg_constant_ptr(ri)); } else { tmp64 = tcg_temp_new_i64(); tcg_gen_ld_i64(tmp64, cpu_env, ri->fieldoffset); @@ -4833,13 +4789,10 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, } else { TCGv_i32 tmp; if (ri->type & ARM_CP_CONST) { - tmp = tcg_const_i32(ri->resetvalue); + tmp = tcg_constant_i32(ri->resetvalue); } else if (ri->readfn) { - TCGv_ptr tmpptr; tmp = tcg_temp_new_i32(); - tmpptr = tcg_const_ptr(ri); - gen_helper_get_cp_reg(tmp, cpu_env, tmpptr); - tcg_temp_free_ptr(tmpptr); + gen_helper_get_cp_reg(tmp, cpu_env, tcg_constant_ptr(ri)); } else { tmp = load_cpu_offset(ri->fieldoffset); } @@ -4869,24 +4822,18 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, tcg_temp_free_i32(tmplo); tcg_temp_free_i32(tmphi); if (ri->writefn) { - TCGv_ptr tmpptr = tcg_const_ptr(ri); - gen_helper_set_cp_reg64(cpu_env, tmpptr, tmp64); - tcg_temp_free_ptr(tmpptr); + gen_helper_set_cp_reg64(cpu_env, tcg_constant_ptr(ri), + tmp64); } else { tcg_gen_st_i64(tmp64, cpu_env, ri->fieldoffset); } tcg_temp_free_i64(tmp64); } else { + TCGv_i32 tmp = load_reg(s, rt); if (ri->writefn) { - TCGv_i32 tmp; - TCGv_ptr tmpptr; - tmp = load_reg(s, rt); - tmpptr = tcg_const_ptr(ri); - gen_helper_set_cp_reg(cpu_env, tmpptr, tmp); - tcg_temp_free_ptr(tmpptr); + gen_helper_set_cp_reg(cpu_env, tcg_constant_ptr(ri), tmp); tcg_temp_free_i32(tmp); } else { - TCGv_i32 tmp = load_reg(s, rt); store_cpu_offset(tmp, ri->fieldoffset, 4); } } @@ -5190,12 +5137,10 @@ static void gen_srs(DisasContext *s, } addr = tcg_temp_new_i32(); - tmp = tcg_const_i32(mode); /* get_r13_banked() will raise an exception if called from System mode */ gen_set_condexec(s); gen_set_pc_im(s, s->pc_curr); - gen_helper_get_r13_banked(addr, cpu_env, tmp); - tcg_temp_free_i32(tmp); + gen_helper_get_r13_banked(addr, cpu_env, tcg_constant_i32(mode)); switch (amode) { case 0: /* DA */ offset = -4; @@ -5238,9 +5183,7 @@ static void gen_srs(DisasContext *s, abort(); } tcg_gen_addi_i32(addr, addr, offset); - tmp = tcg_const_i32(mode); - gen_helper_set_r13_banked(cpu_env, tmp, addr); - tcg_temp_free_i32(tmp); + gen_helper_set_r13_banked(cpu_env, tcg_constant_i32(mode), addr); } tcg_temp_free_i32(addr); s->base.is_jmp = DISAS_UPDATE_EXIT; @@ -5552,23 +5495,21 @@ static bool op_s_rri_rot(DisasContext *s, arg_s_rri_rot *a, void (*gen)(TCGv_i32, TCGv_i32, TCGv_i32), int logic_cc, StoreRegKind kind) { - TCGv_i32 tmp1, tmp2; + TCGv_i32 tmp; uint32_t imm; imm = ror32(a->imm, a->rot); if (logic_cc && a->rot) { tcg_gen_movi_i32(cpu_CF, imm >> 31); } - tmp2 = tcg_const_i32(imm); - tmp1 = load_reg(s, a->rn); + tmp = load_reg(s, a->rn); - gen(tmp1, tmp1, tmp2); - tcg_temp_free_i32(tmp2); + gen(tmp, tmp, tcg_constant_i32(imm)); if (logic_cc) { - gen_logic_CC(tmp1); + gen_logic_CC(tmp); } - return store_reg_kind(s, a->rd, tmp1, kind); + return store_reg_kind(s, a->rd, tmp, kind); } static bool op_s_rxi_rot(DisasContext *s, arg_s_rri_rot *a, @@ -5582,9 +5523,10 @@ static bool op_s_rxi_rot(DisasContext *s, arg_s_rri_rot *a, if (logic_cc && a->rot) { tcg_gen_movi_i32(cpu_CF, imm >> 31); } - tmp = tcg_const_i32(imm); - gen(tmp, tmp); + tmp = tcg_temp_new_i32(); + gen(tmp, tcg_constant_i32(imm)); + if (logic_cc) { gen_logic_CC(tmp); } @@ -5710,14 +5652,11 @@ static bool trans_ADR(DisasContext *s, arg_ri *a) static bool trans_MOVW(DisasContext *s, arg_MOVW *a) { - TCGv_i32 tmp; - if (!ENABLE_ARCH_6T2) { return false; } - tmp = tcg_const_i32(a->imm); - store_reg(s, a->rd, tmp); + store_reg(s, a->rd, tcg_constant_i32(a->imm)); return true; } @@ -6088,14 +6027,13 @@ static bool trans_UMAAL(DisasContext *s, arg_UMAAL *a) t0 = load_reg(s, a->rm); t1 = load_reg(s, a->rn); tcg_gen_mulu2_i32(t0, t1, t0, t1); - zero = tcg_const_i32(0); + zero = tcg_constant_i32(0); t2 = load_reg(s, a->ra); tcg_gen_add2_i32(t0, t1, t0, t1, t2, zero); tcg_temp_free_i32(t2); t2 = load_reg(s, a->rd); tcg_gen_add2_i32(t0, t1, t0, t1, t2, zero); tcg_temp_free_i32(t2); - tcg_temp_free_i32(zero); store_reg(s, a->ra, t0); store_reg(s, a->rd, t1); return true; @@ -6342,14 +6280,13 @@ static bool op_crc32(DisasContext *s, arg_rrr *a, bool c, MemOp sz) default: g_assert_not_reached(); } - t3 = tcg_const_i32(1 << sz); + t3 = tcg_constant_i32(1 << sz); if (c) { gen_helper_crc32c(t1, t1, t2, t3); } else { gen_helper_crc32(t1, t1, t2, t3); } tcg_temp_free_i32(t2); - tcg_temp_free_i32(t3); store_reg(s, a->rd, t1); return true; } @@ -6432,8 +6369,8 @@ static bool trans_MRS_v7m(DisasContext *s, arg_MRS_v7m *a) if (!arm_dc_feature(s, ARM_FEATURE_M)) { return false; } - tmp = tcg_const_i32(a->sysm); - gen_helper_v7m_mrs(tmp, cpu_env, tmp); + tmp = tcg_temp_new_i32(); + gen_helper_v7m_mrs(tmp, cpu_env, tcg_constant_i32(a->sysm)); store_reg(s, a->rd, tmp); return true; } @@ -6445,10 +6382,9 @@ static bool trans_MSR_v7m(DisasContext *s, arg_MSR_v7m *a) if (!arm_dc_feature(s, ARM_FEATURE_M)) { return false; } - addr = tcg_const_i32((a->mask << 10) | a->sysm); + addr = tcg_constant_i32((a->mask << 10) | a->sysm); reg = load_reg(s, a->rn); gen_helper_v7m_msr(cpu_env, addr, reg); - tcg_temp_free_i32(addr); tcg_temp_free_i32(reg); /* If we wrote to CONTROL, the EL might have changed */ gen_rebuild_hflags(s, true); @@ -6660,8 +6596,8 @@ static bool trans_TT(DisasContext *s, arg_TT *a) } addr = load_reg(s, a->rn); - tmp = tcg_const_i32((a->A << 1) | a->T); - gen_helper_v7m_tt(tmp, cpu_env, addr, tmp); + tmp = tcg_temp_new_i32(); + gen_helper_v7m_tt(tmp, cpu_env, addr, tcg_constant_i32((a->A << 1) | a->T)); tcg_temp_free_i32(addr); store_reg(s, a->rd, tmp); return true; @@ -7628,7 +7564,7 @@ static bool trans_PKH(DisasContext *s, arg_PKH *a) static bool op_sat(DisasContext *s, arg_sat *a, void (*gen)(TCGv_i32, TCGv_env, TCGv_i32, TCGv_i32)) { - TCGv_i32 tmp, satimm; + TCGv_i32 tmp; int shift = a->imm; if (!ENABLE_ARCH_6) { @@ -7642,9 +7578,7 @@ static bool op_sat(DisasContext *s, arg_sat *a, tcg_gen_shli_i32(tmp, tmp, shift); } - satimm = tcg_const_i32(a->satimm); - gen(tmp, cpu_env, tmp, satimm); - tcg_temp_free_i32(satimm); + gen(tmp, cpu_env, tmp, tcg_constant_i32(a->satimm)); store_reg(s, a->rd, tmp); return true; @@ -7979,9 +7913,7 @@ static bool op_smmla(DisasContext *s, arg_rrrr *a, bool round, bool sub) * a non-zero multiplicand lowpart, and the correct result * lowpart for rounding. */ - TCGv_i32 zero = tcg_const_i32(0); - tcg_gen_sub2_i32(t2, t1, zero, t3, t2, t1); - tcg_temp_free_i32(zero); + tcg_gen_sub2_i32(t2, t1, tcg_constant_i32(0), t3, t2, t1); } else { tcg_gen_add_i32(t1, t1, t3); } @@ -8118,7 +8050,7 @@ static bool op_stm(DisasContext *s, arg_ldst_block *a, int min_n) { int i, j, n, list, mem_idx; bool user = a->u; - TCGv_i32 addr, tmp, tmp2; + TCGv_i32 addr, tmp; if (user) { /* STM (user) */ @@ -8148,9 +8080,7 @@ static bool op_stm(DisasContext *s, arg_ldst_block *a, int min_n) if (user && i != 15) { tmp = tcg_temp_new_i32(); - tmp2 = tcg_const_i32(i); - gen_helper_get_user_reg(tmp, cpu_env, tmp2); - tcg_temp_free_i32(tmp2); + gen_helper_get_user_reg(tmp, cpu_env, tcg_constant_i32(i)); } else { tmp = load_reg(s, i); } @@ -8191,7 +8121,7 @@ static bool do_ldm(DisasContext *s, arg_ldst_block *a, int min_n) bool loaded_base; bool user = a->u; bool exc_return = false; - TCGv_i32 addr, tmp, tmp2, loaded_var; + TCGv_i32 addr, tmp, loaded_var; if (user) { /* LDM (user), LDM (exception return) */ @@ -8234,9 +8164,7 @@ static bool do_ldm(DisasContext *s, arg_ldst_block *a, int min_n) tmp = tcg_temp_new_i32(); gen_aa32_ld_i32(s, tmp, addr, mem_idx, MO_UL | MO_ALIGN); if (user) { - tmp2 = tcg_const_i32(i); - gen_helper_set_user_reg(cpu_env, tmp2, tmp); - tcg_temp_free_i32(tmp2); + gen_helper_set_user_reg(cpu_env, tcg_constant_i32(i), tmp); tcg_temp_free_i32(tmp); } else if (i == a->rn) { loaded_var = tmp; @@ -8329,7 +8257,7 @@ static bool trans_CLRM(DisasContext *s, arg_CLRM *a) s->eci_handled = true; - zero = tcg_const_i32(0); + zero = tcg_constant_i32(0); for (i = 0; i < 15; i++) { if (extract32(a->list, i, 1)) { /* Clear R[i] */ @@ -8341,11 +8269,8 @@ static bool trans_CLRM(DisasContext *s, arg_CLRM *a) * Clear APSR (by calling the MSR helper with the same argument * as for "MSR APSR_nzcvqg, Rn": mask = 0b1100, SYSM=0) */ - TCGv_i32 maskreg = tcg_const_i32(0xc << 8); - gen_helper_v7m_msr(cpu_env, maskreg, zero); - tcg_temp_free_i32(maskreg); + gen_helper_v7m_msr(cpu_env, tcg_constant_i32(0xc00), zero); } - tcg_temp_free_i32(zero); clear_eci_state(s); return true; } @@ -8488,8 +8413,7 @@ static bool trans_DLS(DisasContext *s, arg_DLS *a) store_reg(s, 14, tmp); if (a->size != 4) { /* DLSTP: set FPSCR.LTPSIZE */ - tmp = tcg_const_i32(a->size); - store_cpu_field(tmp, v7m.ltpsize); + store_cpu_field(tcg_constant_i32(a->size), v7m.ltpsize); s->base.is_jmp = DISAS_UPDATE_NOCHAIN; } return true; @@ -8554,8 +8478,7 @@ static bool trans_WLS(DisasContext *s, arg_WLS *a) */ bool ok = vfp_access_check(s); assert(ok); - tmp = tcg_const_i32(a->size); - store_cpu_field(tmp, v7m.ltpsize); + store_cpu_field(tcg_constant_i32(a->size), v7m.ltpsize); /* * LTPSIZE updated, but MVE_NO_PRED will always be the same thing (0) * when we take this upcoming exit from this TB, so gen_jmp_tb() is OK. @@ -8681,8 +8604,7 @@ static bool trans_LE(DisasContext *s, arg_LE *a) gen_set_label(loopend); if (a->tp) { /* Exits from tail-pred loops must reset LTPSIZE to 4 */ - tmp = tcg_const_i32(4); - store_cpu_field(tmp, v7m.ltpsize); + store_cpu_field(tcg_constant_i32(4), v7m.ltpsize); } /* End TB, continuing to following insn */ gen_jmp_tb(s, s->base.pc_next, 1); @@ -8913,21 +8835,18 @@ static bool trans_CPS_v7m(DisasContext *s, arg_CPS_v7m *a) return true; } - tmp = tcg_const_i32(a->im); + tmp = tcg_constant_i32(a->im); /* FAULTMASK */ if (a->F) { - addr = tcg_const_i32(19); + addr = tcg_constant_i32(19); gen_helper_v7m_msr(cpu_env, addr, tmp); - tcg_temp_free_i32(addr); } /* PRIMASK */ if (a->I) { - addr = tcg_const_i32(16); + addr = tcg_constant_i32(16); gen_helper_v7m_msr(cpu_env, addr, tmp); - tcg_temp_free_i32(addr); } gen_rebuild_hflags(s, false); - tcg_temp_free_i32(tmp); gen_lookup_tb(s); return true; } @@ -9063,13 +8982,14 @@ static bool trans_CSEL(DisasContext *s, arg_CSEL *a) } /* In this insn input reg fields of 0b1111 mean "zero", not "PC" */ + zero = tcg_constant_i32(0); if (a->rn == 15) { - rn = tcg_const_i32(0); + rn = zero; } else { rn = load_reg(s, a->rn); } if (a->rm == 15) { - rm = tcg_const_i32(0); + rm = zero; } else { rm = load_reg(s, a->rm); } @@ -9091,10 +9011,8 @@ static bool trans_CSEL(DisasContext *s, arg_CSEL *a) } arm_test_cc(&c, a->fcond); - zero = tcg_const_i32(0); tcg_gen_movcond_i32(c.cond, rn, c.value, zero, rn, rm); arm_free_cc(&c); - tcg_temp_free_i32(zero); store_reg(s, a->rd, rn); tcg_temp_free_i32(rm); From patchwork Sun Apr 17 17:43:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562829 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1858195map; Sun, 17 Apr 2022 11:01:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznLYKjejjaOUbULTEsnKSMbUkvxn+eC4cvVkFi7jbcptXABbMSZcGzLwbzSxcmZL1G+4+Y X-Received: by 2002:a37:8d44:0:b0:69a:224a:dc27 with SMTP id p65-20020a378d44000000b0069a224adc27mr4756898qkd.563.1650218469476; Sun, 17 Apr 2022 11:01:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650218469; cv=none; d=google.com; s=arc-20160816; b=ZvD0lYwzzBvED8EuPKlYf3WuA9pPj/tOoAUooCN5va8+Q8451uryqyjEfginfRH/LZ VUyfEaYBGMXU0II6L4xr9ZiURlv/uOyUfojkrS4m8jyQgVWdIx/Gv8yuON7y/vzAYcNO JwaLevWKQYQ3PL2dC/dZjtxGY9PsmjOCei96TTkx5P4QSSZlLjiiR7+Jn27xSZwWtAze wb8X4F40NmXp7pcyMxmzJAT2OKbtWspwsvf9SUAYe3EyYEQwNjc9SXxIWExADQXtUIvq q9zWNMQ0xVHZWYtb/fQuAupQChMmy8yVCrz603HUFtd6PVoGHZm8T02cbqTPTIjs5Y9s rgOw== 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=IAIkA9WY+ynIkbE8B6qs1qYR9g0d4GyKrWJIQLT3oZA=; b=wi/0+avgDp9tONGCj7a0RD+asbAtkE7Tb7GY1pVUOLZVIg1FFmWNbB6J+heeoxVnJz KgrSECyknzwqiP+LOldtTTOr5dNT5fHj4uHqPxuIsU2lUtCNfHAxTx/9UQBZ0pjRbBwA Zj1/dil9O2cHTM+qNfzOepoYmi2Vq4ApdHaSblNrOPApLzfLXRJOkDEntxtHrqKy3ocn j7dBO9f9r0giC76xFTxiHa2jwBXLziUJ3wuVtyOKxKnHNcRSjTs6fosAfwwwOccD0aYT xGB4BAVy6MnChw5bzx2QuxQlV42BjI+XjqXmsV8lDyGfRxcONsDWOgRboO6EPH4IO7zv +LYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O8+5AEen; 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 jn3-20020ad45de3000000b004461edfdb5dsi2098766qvb.220.2022.04.17.11.01.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:01:09 -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=O8+5AEen; 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]:58472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9Cu-0005Tg-W8 for patch@linaro.org; Sun, 17 Apr 2022 14:01:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8x9-0000m5-20 for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:51 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:41509) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8x5-0003KP-2Q for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:50 -0400 Received: by mail-pg1-x52c.google.com with SMTP id t13so14959740pgn.8 for ; Sun, 17 Apr 2022 10:44:46 -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=IAIkA9WY+ynIkbE8B6qs1qYR9g0d4GyKrWJIQLT3oZA=; b=O8+5AEenqKsSi/tqs2XN7GmHHAC0qCtuR9TYGKlfMLI9yLN2JRLEIYJyfFXaU8mnNb 4ONd5YwXui4ZbYee1FtQduBcVKHwqd4Kc4hZGyw5uSk5rXPvy2FvmQBA86coUjRRJJW/ 2ZuRmqhtx6ICwWKJcq8fp+9kEn3b5jWOHXbgwe1Ix/IxzK1sE2Taofdf2JKPRhsRHnP7 XxSUJhEQ+jUZr3Vw8b1GPwx49nYOVvw86B8qBkLOVAZ97sCOlKcLU5W1wFLaQUYoy/Y4 9RTActJcGEz16EMZrFKesN+pNoJ+yK/ZxOgd3s5rw03VvgNazjUljL3rA9I+T16liqlI W8fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IAIkA9WY+ynIkbE8B6qs1qYR9g0d4GyKrWJIQLT3oZA=; b=WtRIE7assqB5VUgLLcAiiEjFaYAYz1wCHeq0G2HQ5HkfB+bfvmLtKdKeE58qrs8wWM XYxpbsKAfqZ/FGByf5RwNd1qAA55iX09brS7RAiLAGkd95+Aq6r+wisYZit/f+aXQ1DK bc35TJRw9tzLA74VeQeQhJPwSZgz+Eiit260KJdjQba6yRIhBIK9s2Q72J/kxiimWjBs VAh386+V/7tRbAsjknV6KdxVlz4ik7i2iYZrYXTXXQSx+QNlB8wJhaPWlaUxNolErqp8 aY53eNTVJ8Kf+Rw9VjMLAg+h4mcjMjyRkLjfu77klGQRZAwLHa2BB86AT6MHR6GLUvWe +mWA== X-Gm-Message-State: AOAM530C1JDodRVcmxX2kMx+jK8saKkw6j7il5MXV7Ft/ikP2s0I5PSj DBAFFesGSjUyX0ELScRG41sGfK8SM9580w== X-Received: by 2002:a63:5115:0:b0:39c:d48d:1b87 with SMTP id f21-20020a635115000000b0039cd48d1b87mr7299197pgb.107.1650217485735; Sun, 17 Apr 2022 10:44:45 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 18/60] target/arm: Use tcg_constant in translate-m-nocp.c Date: Sun, 17 Apr 2022 10:43:44 -0700 Message-Id: <20220417174426.711829-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use tcg_constant_{i32,i64} as appropriate throughout. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate-m-nocp.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/target/arm/translate-m-nocp.c b/target/arm/translate-m-nocp.c index d9e144e8eb..27363a7b4e 100644 --- a/target/arm/translate-m-nocp.c +++ b/target/arm/translate-m-nocp.c @@ -173,7 +173,7 @@ static bool trans_VSCCLRM(DisasContext *s, arg_VSCCLRM *a) } /* Zero the Sregs from btmreg to topreg inclusive. */ - zero = tcg_const_i64(0); + zero = tcg_constant_i64(0); if (btmreg & 1) { write_neon_element64(zero, btmreg >> 1, 1, MO_32); btmreg++; @@ -187,8 +187,7 @@ static bool trans_VSCCLRM(DisasContext *s, arg_VSCCLRM *a) } assert(btmreg == topreg + 1); if (dc_isar_feature(aa32_mve, s)) { - TCGv_i32 z32 = tcg_const_i32(0); - store_cpu_field(z32, v7m.vpr); + store_cpu_field(tcg_constant_i32(0), v7m.vpr); } clear_eci_state(s); @@ -512,7 +511,7 @@ static bool gen_M_fp_sysreg_read(DisasContext *s, int regno, } case ARM_VFP_FPCXT_NS: { - TCGv_i32 control, sfpa, fpscr, fpdscr, zero; + TCGv_i32 control, sfpa, fpscr, fpdscr; TCGLabel *lab_active = gen_new_label(); lookup_tb = true; @@ -552,10 +551,9 @@ static bool gen_M_fp_sysreg_read(DisasContext *s, int regno, storefn(s, opaque, tmp, true); /* If SFPA is zero then set FPSCR from FPDSCR_NS */ fpdscr = load_cpu_field(v7m.fpdscr[M_REG_NS]); - zero = tcg_const_i32(0); - tcg_gen_movcond_i32(TCG_COND_EQ, fpscr, sfpa, zero, fpdscr, fpscr); + tcg_gen_movcond_i32(TCG_COND_EQ, fpscr, sfpa, tcg_constant_i32(0), + fpdscr, fpscr); gen_helper_vfp_set_fpscr(cpu_env, fpscr); - tcg_temp_free_i32(zero); tcg_temp_free_i32(sfpa); tcg_temp_free_i32(fpdscr); tcg_temp_free_i32(fpscr); From patchwork Sun Apr 17 17:43:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562840 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1862690map; Sun, 17 Apr 2022 11:09:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwflW5+7CAgIY15XmGCidGnETWB+bsDBu/K6cNTJ0r+6PGvCWwpkxaI+oXXw5csG4ujjvpM X-Received: by 2002:a05:6214:50d:b0:444:42f9:e024 with SMTP id v13-20020a056214050d00b0044442f9e024mr5705906qvw.110.1650218991992; Sun, 17 Apr 2022 11:09:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650218991; cv=none; d=google.com; s=arc-20160816; b=wPy4807u3OmP+wQNM9j3rRz8N7+n54+aPGAaaP/te6nMbV9Blwb/NPMrYri1DQYp3U O0Jq1wM7qLAinObqFt0WunTGU5RdaAx5U8Io3v6sIEjLULXs76tnqh7Jy/GP1xkA7nAK 6em2bcf7b+VzMI6U+RT7RwlXWxgOiQ/CWxUTFbOEqNF0AZKcFn2lSJw/z0KunafB4H9d BgdcbDXYlt7xrtV+KkBV/uByHfdzomCbPGdsc5xLVT5o6VCwQcERxu4PZCn7wLqVpqDn Xl1nMmtrgG0c5rkJwL3FFWoCEGxcf+wWUoKCP2RAOefxZaXw06ImdbBfl6ZFm8Te/n3X ha/w== 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=R9t04A2fMNf/j0rLfzwp96zli6WbNRwThiKfiyjip1Q=; b=eeHs9/09e1BjhpSEBaQuuK094rzQoKWdn0/pGb/kHOhGe0tdgu1lOTd7uX6h3RW3i6 l+jXz/W/dGQHmbHLBTjeKYdjC5ks8A9nZogG4u6f9LY8z633RNy2yVBeLEGVWBGWUR4r 20Kvo7OLgb1LnUiA34WcuI088FMUWLOsOxdHI822OiyAf+D7uHw8jxV4d29TohrS4rgo B7TB/WFvTHDRJRmSB58C+GmwyhOfM6EWmi5hNpg29S0HQfab4oRDoz3VG78XqJ0r/GA6 /WWp3x//w+9fCdWyUp/gdrPllDkLZN5tNNXPV7rXJPTNcXHF0GxEUQinxJe9f9OWDuYE 4abQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pjAgOhvO; 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 l16-20020a05620a28d000b0067e88c580b6si2615279qkp.528.2022.04.17.11.09.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:09:51 -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=pjAgOhvO; 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]:58352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9LL-0007WZ-JY for patch@linaro.org; Sun, 17 Apr 2022 14:09:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48232) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8x9-0000mH-BB for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:51 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:45720) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8x6-0003Ka-CI for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:51 -0400 Received: by mail-pj1-x1034.google.com with SMTP id n33-20020a17090a5aa400b001d28f5ee3f9so732945pji.4 for ; Sun, 17 Apr 2022 10:44:47 -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=R9t04A2fMNf/j0rLfzwp96zli6WbNRwThiKfiyjip1Q=; b=pjAgOhvO4E7QNWcocOq2KdCapxIekgveVEVmm43mVJpFBMAHBGZN1h1sQvkYsyLnrl c02SULDFsXOIs8MhWk6ox0xfVJz/kd2o82q11AwSLnKzn4SLGuJEpsEL7XctQ7Ltthn0 a9kSwsXW2SgMjn2n0rX5odm50rfDmbZNAvbliIliQEqm3g2MLbksvsrb+JtVmBWreR3g EWxzKnNXH77XfghkB+HSXz4QTibUgqdM1mNe1MnE1do5UvSK1LsaR5powSbqwrowFNrG Q6Wr8/1TgrBu+9oJTgovR5k6sjMAjrmzV2rBd9r507km9GGSRyofEUdyOlwuWT3gljRy bDvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R9t04A2fMNf/j0rLfzwp96zli6WbNRwThiKfiyjip1Q=; b=TWPtYMwfrxy2K0MaIixPFL2A7oYJXEQY6L3UF/uWhZ/LEyWQDccr52KU9SLrwOmBwI Dn42zOmrQcetHp1MeBiUMFkYMFxuGD8HRnBr8oBUA3zbybBIRnxSuBpsZsHRhIfQ4t4N 5e5FGztRzFommijenkGWtpjQNDEvFua/qGZHKG4vxJKw0A8Y2FQc1AxNiUxW/3gEotV1 rNthUG6xGxv6D4EeKttkZKOeRPMyiNRs8ZxmJ9ODK6yEdry+NrRG3U5CndES70yOscRZ w49lKQqu29gOL9c1KbIEibdohPcZQa32veLxRhoKxvcynAzhHgtSZNXDpn5RoCw6Vl+j lXcw== X-Gm-Message-State: AOAM5302yRRpqqINpZNtEilOzzQCjOZQ8TCZr+S7ysfPd7v2Lv04KVrW O+xQG7WKQTM/DXehC9xMbiDIYFLQGELzIg== X-Received: by 2002:a17:90b:4f45:b0:1d2:21e5:905d with SMTP id pj5-20020a17090b4f4500b001d221e5905dmr8047847pjb.18.1650217486584; Sun, 17 Apr 2022 10:44:46 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 19/60] target/arm: Use tcg_constant in translate-neon.c Date: Sun, 17 Apr 2022 10:43:45 -0700 Message-Id: <20220417174426.711829-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use tcg_constant_{i32,i64} as appropriate throughout. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate-neon.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/target/arm/translate-neon.c b/target/arm/translate-neon.c index 384604c009..2e4d1ec87d 100644 --- a/target/arm/translate-neon.c +++ b/target/arm/translate-neon.c @@ -447,7 +447,7 @@ static bool trans_VLDST_multiple(DisasContext *s, arg_VLDST_multiple *a) int mmu_idx = get_mem_index(s); int size = a->size; TCGv_i64 tmp64; - TCGv_i32 addr, tmp; + TCGv_i32 addr; if (!arm_dc_feature(s, ARM_FEATURE_NEON)) { return false; @@ -513,7 +513,6 @@ static bool trans_VLDST_multiple(DisasContext *s, arg_VLDST_multiple *a) tmp64 = tcg_temp_new_i64(); addr = tcg_temp_new_i32(); - tmp = tcg_const_i32(1 << size); load_reg_var(s, addr, a->rn); mop = endian | size | align; @@ -530,7 +529,7 @@ static bool trans_VLDST_multiple(DisasContext *s, arg_VLDST_multiple *a) neon_load_element64(tmp64, tt, n, size); gen_aa32_st_internal_i64(s, tmp64, addr, mmu_idx, mop); } - tcg_gen_add_i32(addr, addr, tmp); + tcg_gen_addi_i32(addr, addr, 1 << size); /* Subsequent memory operations inherit alignment */ mop &= ~MO_AMASK; @@ -538,7 +537,6 @@ static bool trans_VLDST_multiple(DisasContext *s, arg_VLDST_multiple *a) } } tcg_temp_free_i32(addr); - tcg_temp_free_i32(tmp); tcg_temp_free_i64(tmp64); gen_neon_ldst_base_update(s, a->rm, a->rn, nregs * interleave * 8); @@ -1348,7 +1346,7 @@ static bool do_2shift_env_64(DisasContext *s, arg_2reg_shift *a, * To avoid excessive duplication of ops we implement shift * by immediate using the variable shift operations. */ - constimm = tcg_const_i64(dup_const(a->size, a->shift)); + constimm = tcg_constant_i64(dup_const(a->size, a->shift)); for (pass = 0; pass < a->q + 1; pass++) { TCGv_i64 tmp = tcg_temp_new_i64(); @@ -1358,7 +1356,6 @@ static bool do_2shift_env_64(DisasContext *s, arg_2reg_shift *a, write_neon_element64(tmp, a->vd, pass, MO_64); tcg_temp_free_i64(tmp); } - tcg_temp_free_i64(constimm); return true; } @@ -1394,7 +1391,7 @@ static bool do_2shift_env_32(DisasContext *s, arg_2reg_shift *a, * To avoid excessive duplication of ops we implement shift * by immediate using the variable shift operations. */ - constimm = tcg_const_i32(dup_const(a->size, a->shift)); + constimm = tcg_constant_i32(dup_const(a->size, a->shift)); tmp = tcg_temp_new_i32(); for (pass = 0; pass < (a->q ? 4 : 2); pass++) { @@ -1403,7 +1400,6 @@ static bool do_2shift_env_32(DisasContext *s, arg_2reg_shift *a, write_neon_element32(tmp, a->vd, pass, MO_32); } tcg_temp_free_i32(tmp); - tcg_temp_free_i32(constimm); return true; } @@ -1457,7 +1453,7 @@ static bool do_2shift_narrow_64(DisasContext *s, arg_2reg_shift *a, * This is always a right shift, and the shiftfn is always a * left-shift helper, which thus needs the negated shift count. */ - constimm = tcg_const_i64(-a->shift); + constimm = tcg_constant_i64(-a->shift); rm1 = tcg_temp_new_i64(); rm2 = tcg_temp_new_i64(); rd = tcg_temp_new_i32(); @@ -1477,7 +1473,6 @@ static bool do_2shift_narrow_64(DisasContext *s, arg_2reg_shift *a, tcg_temp_free_i32(rd); tcg_temp_free_i64(rm1); tcg_temp_free_i64(rm2); - tcg_temp_free_i64(constimm); return true; } @@ -1521,7 +1516,7 @@ static bool do_2shift_narrow_32(DisasContext *s, arg_2reg_shift *a, /* size == 2 */ imm = -a->shift; } - constimm = tcg_const_i32(imm); + constimm = tcg_constant_i32(imm); /* Load all inputs first to avoid potential overwrite */ rm1 = tcg_temp_new_i32(); @@ -1546,7 +1541,6 @@ static bool do_2shift_narrow_32(DisasContext *s, arg_2reg_shift *a, shiftfn(rm3, rm3, constimm); shiftfn(rm4, rm4, constimm); - tcg_temp_free_i32(constimm); tcg_gen_concat_i32_i64(rtmp, rm3, rm4); tcg_temp_free_i32(rm4); @@ -2911,7 +2905,7 @@ static bool trans_VTBL(DisasContext *s, arg_VTBL *a) return true; } - desc = tcg_const_i32((a->vn << 2) | a->len); + desc = tcg_constant_i32((a->vn << 2) | a->len); def = tcg_temp_new_i64(); if (a->op) { read_neon_element64(def, a->vd, 0, MO_64); @@ -2926,7 +2920,6 @@ static bool trans_VTBL(DisasContext *s, arg_VTBL *a) tcg_temp_free_i64(def); tcg_temp_free_i64(val); - tcg_temp_free_i32(desc); return true; } From patchwork Sun Apr 17 17:43:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562833 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1859726map; Sun, 17 Apr 2022 11:04:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbmiXMIOuAWW5BxnON9+ehg+shFz5n4M4cJ2c4zsvvlREU2TA79bbtONaqY1ocnsYpaLGh X-Received: by 2002:a05:620a:e8a:b0:69c:1f96:b247 with SMTP id w10-20020a05620a0e8a00b0069c1f96b247mr4729576qkm.234.1650218651600; Sun, 17 Apr 2022 11:04:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650218651; cv=none; d=google.com; s=arc-20160816; b=Mn10UxZCbpHmnQmKACaNr3BTISbhiuzY8zJraDNGhMCITOf1HwQ47xOns03u/Rw4m4 PhkeupFeB4BlwiCePf9h1yeBeXWIZxGK+VvD4e2xi+xLACaxTUNXivUKU7FzC0S5Qx1m 1KWXBmmOExJSzgTDicSOt9xLuAi+7K4tx56kE1xAlJDFwU/xT1AW+qS28/mGey1BZcgV pWCdKQ3wkTNDppaHLCmmiykyvh7c0FhwqkHSV5elgaoMg2SJbbIoaA9Eke6yH8/yrrhq AUVY7TpQuF/YiPFwQIhu5iUanyHcxqficjvDTvzLpjl7SKh9ZlVxcxy+2zBnLl8/zG5U vmlg== 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=rwqJPJ//6TQT5UmISyCch80APlTh3KWpu8wgkVgb10g=; b=I61J4se4J7wDhzTI3rWSd+dAphiRDA+ENSicbtOhkKQHKMBU7NZmq8sJ3WaeunyL6R vFdogHjweANfOORiOJMPwnMixSBVPP0uGaedqgtsC29jCR88htxBDDOCSHL/wtb4YfPQ rnqPym4xZ326Itjl3t0OybmPjZ9hn1+mw2emUQSHw94G6UPk3VYdbrpJFyJMNOPSi9JP fQie+eU7+Gk+g+/W+Fkp3RTvxRiZViYuXtRmXpYE6AayJkV2F+D8LC7xnFCXlnjJXCT8 6+x1KHZI/sDAqp29jemIAhbL378Z15j8DX9CCy7Vx79x7ueok1/3WqLTz3YA1OVJKPCY FJ+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=US1SyCFa; 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 w16-20020ac87e90000000b002ebb0937648si2754344qtj.231.2022.04.17.11.04.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:04:11 -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=US1SyCFa; 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]:39194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9Fr-00037A-6Q for patch@linaro.org; Sun, 17 Apr 2022 14:04:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8xA-0000pF-Cp for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:52 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:37669) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8x6-0003LC-GT for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:52 -0400 Received: by mail-pg1-x534.google.com with SMTP id t184so1964335pgd.4 for ; Sun, 17 Apr 2022 10:44:48 -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=rwqJPJ//6TQT5UmISyCch80APlTh3KWpu8wgkVgb10g=; b=US1SyCFaW/3LmCuUoc+LgmazZxmkCpZZpzMxB4hNYsFVGlTquh7Y86bMsdauF4M2Rn NOyNH2sVKaP/SOlwj51bXQoLOWoCZ51dT5c6MkDaM3TObSt5dIvFiNwIAzyCFL+CyNlb vd8mze0Rnyiwqlgj+XwW/QYG5s0+Mp9A5jjGpg8He71VgUBOwRvgwFgFjMTmQ+yt85tm gr39fedn+ZCe7ZzOgTVD0P03f4Z69BxEGIUR3ICkbM8br9O5jd73eS3w5OOABxoO0PaE 4Kkp2KOKChRFzEDwdRe+kRh7VAIMtE7D2o+dSrEmdx84J5Sli6/S6V1Y+NK9poyFpn1k kHTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rwqJPJ//6TQT5UmISyCch80APlTh3KWpu8wgkVgb10g=; b=GfKOzkogxgD7I/MoidRH82nc43ftmdLAcYT6qiz8+b2bMmAQUgMUPEQRz7BKBPu7gz tKPycuLKRg6x41DiUdiLHBIj1sHm2EhXaRhyFczXMDH+vgOLD6sLm5+4z410CIQekpqj gVuorPa6rYOkAiti/grbe7X6HyC6sCOGtnT4psNugf9vCklUpWrtehdMvYz3hg54bH+R c0wS2141GrbKF5uyrfDen5YSJgDnaT4Yl7KGa3JK6yxcSUE8KY8KPCZzRCZpElHYMiWi 6uh7327HlB+L/VzC1ekJtK4grgkTg6WOHJ6LrOmfjHchAVWug5oJYdICa0sfnQrSY6St inDA== X-Gm-Message-State: AOAM533Nh/eY0SAQ8oZjWXrHQHMCFcoZUssvIaUJdVvx9iV0Seh0e7Eb AU8Jt592MrLJX6ZgjzCqzjeGilSrkha2Ww== X-Received: by 2002:a63:cf41:0:b0:399:3e74:d249 with SMTP id b1-20020a63cf41000000b003993e74d249mr7096851pgj.475.1650217487304; Sun, 17 Apr 2022 10:44:47 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 20/60] target/arm: Use smin/smax for do_sat_addsub_32 Date: Sun, 17 Apr 2022 10:43:46 -0700 Message-Id: <20220417174426.711829-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x534.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The operation we're performing with the movcond is either min/max depending on cond -- simplify. Use tcg_constant_i64 while we're at it. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate-sve.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 2c23459e76..ddc3a8060b 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -1916,8 +1916,6 @@ static bool trans_PNEXT(DisasContext *s, arg_rr_esz *a) static void do_sat_addsub_32(TCGv_i64 reg, TCGv_i64 val, bool u, bool d) { int64_t ibound; - TCGv_i64 bound; - TCGCond cond; /* Use normal 64-bit arithmetic to detect 32-bit overflow. */ if (u) { @@ -1928,15 +1926,12 @@ static void do_sat_addsub_32(TCGv_i64 reg, TCGv_i64 val, bool u, bool d) if (d) { tcg_gen_sub_i64(reg, reg, val); ibound = (u ? 0 : INT32_MIN); - cond = TCG_COND_LT; + tcg_gen_smax_i64(reg, reg, tcg_constant_i64(ibound)); } else { tcg_gen_add_i64(reg, reg, val); ibound = (u ? UINT32_MAX : INT32_MAX); - cond = TCG_COND_GT; + tcg_gen_smin_i64(reg, reg, tcg_constant_i64(ibound)); } - bound = tcg_const_i64(ibound); - tcg_gen_movcond_i64(cond, reg, reg, bound, bound, reg); - tcg_temp_free_i64(bound); } /* Similarly with 64-bit values. */ From patchwork Sun Apr 17 17:43:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562847 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1866987map; Sun, 17 Apr 2022 11:18:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymqgwZsXSM6oxeyLaCIC8l6kug5rXjANoCSnNrvxilzYHrOtJ8MICq6Wi6ER5USH86qDYY X-Received: by 2002:a05:620a:2943:b0:69e:80ba:4a18 with SMTP id n3-20020a05620a294300b0069e80ba4a18mr3302619qkp.301.1650219536564; Sun, 17 Apr 2022 11:18:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650219536; cv=none; d=google.com; s=arc-20160816; b=s2pqxrcgRBwMQacQaii0Xf59olKqe6PnZJia0nd9QGwDZJF7HvzYaR4kZT0X8Zm97T D8CT12iycZNmhcsMYK6ge8kaaYyvKFvUdazPJ8XicCbeHvFyJROcvUAPLRBxvNQBXq66 YrosUFCy4Q8/tbY3OkuqytXeDnPTBfNkoy6UJgdT6B83VljKSNWYByFqEONswuHlcqD+ 8Hh9mHGFdgVKQ86P0wywE6Sr6v/WGbh1LoM0kyyvk14CJpC2bGPnHuWn7LHwrd34iutv 9mRI2pduzeYIE9OSZXOKQ/nwfub1KZoRtFHoI4pXWaxdINoQhAxlzsm8DTVfVilLBVXt KxxQ== 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=Dv6HLxT9VFR7Qb8w8wRvblozKpmuKMNmz+opU05p1gI=; b=Ja/RePH/TMUrOvzhRrXpNcIeLhk7Ope6d8nD1YBNc62VKfjz17HxcCGvDLBy3pxzas wNCA150QzilaIHSEetfO5rKZh26rEEGp2ipqkT9ln5WIln3xwVCthVqBCeKpCzJ+Nlih BMKPPe8yd5Lt4wsqLy6hbhX4Yy3GHooWJ8Sy2sDIqflL8X3J7sJ2OsRO6f2GUEwfdE/S SWpjA4ISOa9VEYU9GxX162s2a0PjhJ5zzbuyDaAvlt0o1sJFwNNT8Jo06oH3/VuTpjdz RootCXDhA6b9Tfz0L34nxTMK7FWPApv0/SoZBEuVHkUUQ2npfW/ScBSNaxsmYJAsMSME UReA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kq+7vAAZ; 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 1-20020ad45ba1000000b004443f45e056si2154186qvq.218.2022.04.17.11.18.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:18:56 -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=Kq+7vAAZ; 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]:51042 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9U8-0004n0-3q for patch@linaro.org; Sun, 17 Apr 2022 14:18:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8xC-0000vQ-Gg for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:54 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]:43924) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8x7-0003LK-Vo for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:53 -0400 Received: by mail-pg1-x535.google.com with SMTP id u2so14950603pgq.10 for ; Sun, 17 Apr 2022 10:44:49 -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=Dv6HLxT9VFR7Qb8w8wRvblozKpmuKMNmz+opU05p1gI=; b=Kq+7vAAZ63i776g4UPxOicCFbMUY+h8h0SEY4QK26+Jh1l4fxASPV9ypVzdhbU/HC7 mt45O+nk6zmIxC3Eu6viECfDHktq+hZE+Sj5nRwGmLvGkztDF9LKIQB7Ln0L0BA4zq8U OcQft1dUVn3yab+S61Nsk3L79Z/LIXPBSGGFdd9XvlZ0jvlF3ooVTIXofTVMiLKCXurT xPQ8NV1AEFfPpP3nBOgtA/0rGwslE7VqfLvHw5q6zdUa2JotT3PG3Z6REZvGukWK0WF9 nv8FVm6yn6fm/fUfH01usO3Zf57/F4/mWo74ABJ8QDxqhhWtVNNupQXfWxTq4/zdsRkS nP8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Dv6HLxT9VFR7Qb8w8wRvblozKpmuKMNmz+opU05p1gI=; b=IAB7/yHrSAwJ73VyR51/iFUVaPk2fFx7o5ghVAALWT1GmKG9/iY9++AnpJNBrVnhV+ y8ZG0OA+QlyD0yQX0UD+ZyOGQZMlQLKgiH1hv1EFwVTOTTdXagLeqi8OHIZlnMzG7OPy Dg/hocgQeDMJlzLOU5vr1VFpSWppL1+ZT/9xKOwl1jll6nZ2vlgZe9DDekCklMb/8RiM 8OYnrNSpM4O+GYBMHGULgBSOys+GhJNt9HnPkvGAqoq+D/OfFGrTLL3CYwr5HvBGpRGJ JtF7fr8I24h4XOyLhHOFitaPHDleRomftZ90TSnnp8MqgSksm4L3jlCGafdIp0na3RaB a8fg== X-Gm-Message-State: AOAM5311f0nnxak+mLDFXKEj+COlgLV4S2fhFZDaBGWI4oya7pHyMOtt 6SrTrG8CKPYzUt8DbDfHFKkw4XFTCxrCTw== X-Received: by 2002:a05:6a00:a8b:b0:4cd:6030:4df3 with SMTP id b11-20020a056a000a8b00b004cd60304df3mr8413946pfl.40.1650217488035; Sun, 17 Apr 2022 10:44:48 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 21/60] target/arm: Use tcg_constant in translate-sve.c Date: Sun, 17 Apr 2022 10:43:47 -0700 Message-Id: <20220417174426.711829-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use tcg_constant_{i32,i64} as appropriate throughout. Signed-off-by: Richard Henderson --- target/arm/translate-sve.c | 198 +++++++++++++------------------------ 1 file changed, 68 insertions(+), 130 deletions(-) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index ddc3a8060b..5b3478a43a 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -282,13 +282,12 @@ static void do_predtest(DisasContext *s, int dofs, int gofs, int words) { TCGv_ptr dptr = tcg_temp_new_ptr(); TCGv_ptr gptr = tcg_temp_new_ptr(); - TCGv_i32 t; + TCGv_i32 t = tcg_temp_new_i32(); tcg_gen_addi_ptr(dptr, cpu_env, dofs); tcg_gen_addi_ptr(gptr, cpu_env, gofs); - t = tcg_const_i32(words); - gen_helper_sve_predtest(t, dptr, gptr, t); + gen_helper_sve_predtest(t, dptr, gptr, tcg_constant_i32(words)); tcg_temp_free_ptr(dptr); tcg_temp_free_ptr(gptr); @@ -889,7 +888,7 @@ static bool do_vpz_ool(DisasContext *s, arg_rpr_esz *a, return true; } - desc = tcg_const_i32(simd_desc(vsz, vsz, 0)); + desc = tcg_constant_i32(simd_desc(vsz, vsz, 0)); temp = tcg_temp_new_i64(); t_zn = tcg_temp_new_ptr(); t_pg = tcg_temp_new_ptr(); @@ -899,7 +898,6 @@ static bool do_vpz_ool(DisasContext *s, arg_rpr_esz *a, fn(temp, t_zn, t_pg, desc); tcg_temp_free_ptr(t_zn); tcg_temp_free_ptr(t_pg); - tcg_temp_free_i32(desc); write_fp_dreg(s, a->rd, temp); tcg_temp_free_i64(temp); @@ -1236,7 +1234,7 @@ static void do_index(DisasContext *s, int esz, int rd, TCGv_i64 start, TCGv_i64 incr) { unsigned vsz = vec_full_reg_size(s); - TCGv_i32 desc = tcg_const_i32(simd_desc(vsz, vsz, 0)); + TCGv_i32 desc = tcg_constant_i32(simd_desc(vsz, vsz, 0)); TCGv_ptr t_zd = tcg_temp_new_ptr(); tcg_gen_addi_ptr(t_zd, cpu_env, vec_full_reg_offset(s, rd)); @@ -1260,17 +1258,14 @@ static void do_index(DisasContext *s, int esz, int rd, tcg_temp_free_i32(i32); } tcg_temp_free_ptr(t_zd); - tcg_temp_free_i32(desc); } static bool trans_INDEX_ii(DisasContext *s, arg_INDEX_ii *a) { if (sve_access_check(s)) { - TCGv_i64 start = tcg_const_i64(a->imm1); - TCGv_i64 incr = tcg_const_i64(a->imm2); + TCGv_i64 start = tcg_constant_i64(a->imm1); + TCGv_i64 incr = tcg_constant_i64(a->imm2); do_index(s, a->esz, a->rd, start, incr); - tcg_temp_free_i64(start); - tcg_temp_free_i64(incr); } return true; } @@ -1278,10 +1273,9 @@ static bool trans_INDEX_ii(DisasContext *s, arg_INDEX_ii *a) static bool trans_INDEX_ir(DisasContext *s, arg_INDEX_ir *a) { if (sve_access_check(s)) { - TCGv_i64 start = tcg_const_i64(a->imm); + TCGv_i64 start = tcg_constant_i64(a->imm); TCGv_i64 incr = cpu_reg(s, a->rm); do_index(s, a->esz, a->rd, start, incr); - tcg_temp_free_i64(start); } return true; } @@ -1290,9 +1284,8 @@ static bool trans_INDEX_ri(DisasContext *s, arg_INDEX_ri *a) { if (sve_access_check(s)) { TCGv_i64 start = cpu_reg(s, a->rn); - TCGv_i64 incr = tcg_const_i64(a->imm); + TCGv_i64 incr = tcg_constant_i64(a->imm); do_index(s, a->esz, a->rd, start, incr); - tcg_temp_free_i64(incr); } return true; } @@ -1884,9 +1877,9 @@ static bool do_pfirst_pnext(DisasContext *s, arg_rr_esz *a, tcg_gen_addi_ptr(t_pd, cpu_env, pred_full_reg_offset(s, a->rd)); tcg_gen_addi_ptr(t_pg, cpu_env, pred_full_reg_offset(s, a->rn)); - t = tcg_const_i32(desc); + t = tcg_temp_new_i32(); - gen_fn(t, t_pd, t_pg, t); + gen_fn(t, t_pd, t_pg, tcg_constant_i32(desc)); tcg_temp_free_ptr(t_pd); tcg_temp_free_ptr(t_pg); @@ -1993,7 +1986,7 @@ static void do_sat_addsub_vec(DisasContext *s, int esz, int rd, int rn, nptr = tcg_temp_new_ptr(); tcg_gen_addi_ptr(dptr, cpu_env, vec_full_reg_offset(s, rd)); tcg_gen_addi_ptr(nptr, cpu_env, vec_full_reg_offset(s, rn)); - desc = tcg_const_i32(simd_desc(vsz, vsz, 0)); + desc = tcg_constant_i32(simd_desc(vsz, vsz, 0)); switch (esz) { case MO_8: @@ -2062,7 +2055,6 @@ static void do_sat_addsub_vec(DisasContext *s, int esz, int rd, int rn, tcg_temp_free_ptr(dptr); tcg_temp_free_ptr(nptr); - tcg_temp_free_i32(desc); } static bool trans_CNT_r(DisasContext *s, arg_CNT_r *a) @@ -2107,9 +2099,7 @@ static bool trans_SINCDEC_r_32(DisasContext *s, arg_incdec_cnt *a) tcg_gen_ext32s_i64(reg, reg); } } else { - TCGv_i64 t = tcg_const_i64(inc); - do_sat_addsub_32(reg, t, a->u, a->d); - tcg_temp_free_i64(t); + do_sat_addsub_32(reg, tcg_constant_i64(inc), a->u, a->d); } return true; } @@ -2126,9 +2116,7 @@ static bool trans_SINCDEC_r_64(DisasContext *s, arg_incdec_cnt *a) TCGv_i64 reg = cpu_reg(s, a->rd); if (inc != 0) { - TCGv_i64 t = tcg_const_i64(inc); - do_sat_addsub_64(reg, t, a->u, a->d); - tcg_temp_free_i64(t); + do_sat_addsub_64(reg, tcg_constant_i64(inc), a->u, a->d); } return true; } @@ -2145,11 +2133,10 @@ static bool trans_INCDEC_v(DisasContext *s, arg_incdec2_cnt *a) if (inc != 0) { if (sve_access_check(s)) { - TCGv_i64 t = tcg_const_i64(a->d ? -inc : inc); tcg_gen_gvec_adds(a->esz, vec_full_reg_offset(s, a->rd), vec_full_reg_offset(s, a->rn), - t, fullsz, fullsz); - tcg_temp_free_i64(t); + tcg_constant_i64(a->d ? -inc : inc), + fullsz, fullsz); } } else { do_mov_z(s, a->rd, a->rn); @@ -2169,9 +2156,8 @@ static bool trans_SINCDEC_v(DisasContext *s, arg_incdec2_cnt *a) if (inc != 0) { if (sve_access_check(s)) { - TCGv_i64 t = tcg_const_i64(inc); - do_sat_addsub_vec(s, a->esz, a->rd, a->rn, t, a->u, a->d); - tcg_temp_free_i64(t); + do_sat_addsub_vec(s, a->esz, a->rd, a->rn, + tcg_constant_i64(inc), a->u, a->d); } } else { do_mov_z(s, a->rd, a->rn); @@ -2244,7 +2230,7 @@ static void do_cpy_m(DisasContext *s, int esz, int rd, int rn, int pg, gen_helper_sve_cpy_m_s, gen_helper_sve_cpy_m_d, }; unsigned vsz = vec_full_reg_size(s); - TCGv_i32 desc = tcg_const_i32(simd_desc(vsz, vsz, 0)); + TCGv_i32 desc = tcg_constant_i32(simd_desc(vsz, vsz, 0)); TCGv_ptr t_zd = tcg_temp_new_ptr(); TCGv_ptr t_zn = tcg_temp_new_ptr(); TCGv_ptr t_pg = tcg_temp_new_ptr(); @@ -2258,7 +2244,6 @@ static void do_cpy_m(DisasContext *s, int esz, int rd, int rn, int pg, tcg_temp_free_ptr(t_zd); tcg_temp_free_ptr(t_zn); tcg_temp_free_ptr(t_pg); - tcg_temp_free_i32(desc); } static bool trans_FCPY(DisasContext *s, arg_FCPY *a) @@ -2269,9 +2254,7 @@ static bool trans_FCPY(DisasContext *s, arg_FCPY *a) if (sve_access_check(s)) { /* Decode the VFP immediate. */ uint64_t imm = vfp_expand_imm(a->esz, a->imm); - TCGv_i64 t_imm = tcg_const_i64(imm); - do_cpy_m(s, a->esz, a->rd, a->rn, a->pg, t_imm); - tcg_temp_free_i64(t_imm); + do_cpy_m(s, a->esz, a->rd, a->rn, a->pg, tcg_constant_i64(imm)); } return true; } @@ -2282,9 +2265,7 @@ static bool trans_CPY_m_i(DisasContext *s, arg_rpri_esz *a) return false; } if (sve_access_check(s)) { - TCGv_i64 t_imm = tcg_const_i64(a->imm); - do_cpy_m(s, a->esz, a->rd, a->rn, a->pg, t_imm); - tcg_temp_free_i64(t_imm); + do_cpy_m(s, a->esz, a->rd, a->rn, a->pg, tcg_constant_i64(a->imm)); } return true; } @@ -2301,11 +2282,10 @@ static bool trans_CPY_z_i(DisasContext *s, arg_CPY_z_i *a) } if (sve_access_check(s)) { unsigned vsz = vec_full_reg_size(s); - TCGv_i64 t_imm = tcg_const_i64(a->imm); tcg_gen_gvec_2i_ool(vec_full_reg_offset(s, a->rd), pred_full_reg_offset(s, a->pg), - t_imm, vsz, vsz, 0, fns[a->esz]); - tcg_temp_free_i64(t_imm); + tcg_constant_i64(a->imm), + vsz, vsz, 0, fns[a->esz]); } return true; } @@ -2406,7 +2386,7 @@ static void do_insr_i64(DisasContext *s, arg_rrr_esz *a, TCGv_i64 val) gen_helper_sve_insr_s, gen_helper_sve_insr_d, }; unsigned vsz = vec_full_reg_size(s); - TCGv_i32 desc = tcg_const_i32(simd_desc(vsz, vsz, 0)); + TCGv_i32 desc = tcg_constant_i32(simd_desc(vsz, vsz, 0)); TCGv_ptr t_zd = tcg_temp_new_ptr(); TCGv_ptr t_zn = tcg_temp_new_ptr(); @@ -2417,7 +2397,6 @@ static void do_insr_i64(DisasContext *s, arg_rrr_esz *a, TCGv_i64 val) tcg_temp_free_ptr(t_zd); tcg_temp_free_ptr(t_zn); - tcg_temp_free_i32(desc); } static bool trans_INSR_f(DisasContext *s, arg_rrr_esz *a) @@ -2536,7 +2515,6 @@ static bool do_perm_pred3(DisasContext *s, arg_rrr_esz *a, bool high_odd, TCGv_ptr t_d = tcg_temp_new_ptr(); TCGv_ptr t_n = tcg_temp_new_ptr(); TCGv_ptr t_m = tcg_temp_new_ptr(); - TCGv_i32 t_desc; uint32_t desc = 0; desc = FIELD_DP32(desc, PREDDESC, OPRSZ, vsz); @@ -2546,14 +2524,12 @@ static bool do_perm_pred3(DisasContext *s, arg_rrr_esz *a, bool high_odd, tcg_gen_addi_ptr(t_d, cpu_env, pred_full_reg_offset(s, a->rd)); tcg_gen_addi_ptr(t_n, cpu_env, pred_full_reg_offset(s, a->rn)); tcg_gen_addi_ptr(t_m, cpu_env, pred_full_reg_offset(s, a->rm)); - t_desc = tcg_const_i32(desc); - fn(t_d, t_n, t_m, t_desc); + fn(t_d, t_n, t_m, tcg_constant_i32(desc)); tcg_temp_free_ptr(t_d); tcg_temp_free_ptr(t_n); tcg_temp_free_ptr(t_m); - tcg_temp_free_i32(t_desc); return true; } @@ -2567,7 +2543,6 @@ static bool do_perm_pred2(DisasContext *s, arg_rr_esz *a, bool high_odd, unsigned vsz = pred_full_reg_size(s); TCGv_ptr t_d = tcg_temp_new_ptr(); TCGv_ptr t_n = tcg_temp_new_ptr(); - TCGv_i32 t_desc; uint32_t desc = 0; tcg_gen_addi_ptr(t_d, cpu_env, pred_full_reg_offset(s, a->rd)); @@ -2576,11 +2551,9 @@ static bool do_perm_pred2(DisasContext *s, arg_rr_esz *a, bool high_odd, desc = FIELD_DP32(desc, PREDDESC, OPRSZ, vsz); desc = FIELD_DP32(desc, PREDDESC, ESZ, a->esz); desc = FIELD_DP32(desc, PREDDESC, DATA, high_odd); - t_desc = tcg_const_i32(desc); - fn(t_d, t_n, t_desc); + fn(t_d, t_n, tcg_constant_i32(desc)); - tcg_temp_free_i32(t_desc); tcg_temp_free_ptr(t_d); tcg_temp_free_ptr(t_n); return true; @@ -2782,18 +2755,15 @@ static void find_last_active(DisasContext *s, TCGv_i32 ret, int esz, int pg) * round up, as we do elsewhere, because we need the exact size. */ TCGv_ptr t_p = tcg_temp_new_ptr(); - TCGv_i32 t_desc; unsigned desc = 0; desc = FIELD_DP32(desc, PREDDESC, OPRSZ, pred_full_reg_size(s)); desc = FIELD_DP32(desc, PREDDESC, ESZ, esz); tcg_gen_addi_ptr(t_p, cpu_env, pred_full_reg_offset(s, pg)); - t_desc = tcg_const_i32(desc); - gen_helper_sve_last_active_element(ret, t_p, t_desc); + gen_helper_sve_last_active_element(ret, t_p, tcg_constant_i32(desc)); - tcg_temp_free_i32(t_desc); tcg_temp_free_ptr(t_p); } @@ -2808,11 +2778,9 @@ static void incr_last_active(DisasContext *s, TCGv_i32 last, int esz) if (is_power_of_2(vsz)) { tcg_gen_andi_i32(last, last, vsz - 1); } else { - TCGv_i32 max = tcg_const_i32(vsz); - TCGv_i32 zero = tcg_const_i32(0); + TCGv_i32 max = tcg_constant_i32(vsz); + TCGv_i32 zero = tcg_constant_i32(0); tcg_gen_movcond_i32(TCG_COND_GEU, last, last, max, zero, last); - tcg_temp_free_i32(max); - tcg_temp_free_i32(zero); } } @@ -2824,11 +2792,9 @@ static void wrap_last_active(DisasContext *s, TCGv_i32 last, int esz) if (is_power_of_2(vsz)) { tcg_gen_andi_i32(last, last, vsz - 1); } else { - TCGv_i32 max = tcg_const_i32(vsz - (1 << esz)); - TCGv_i32 zero = tcg_const_i32(0); + TCGv_i32 max = tcg_constant_i32(vsz - (1 << esz)); + TCGv_i32 zero = tcg_constant_i32(0); tcg_gen_movcond_i32(TCG_COND_LT, last, last, zero, max, last); - tcg_temp_free_i32(max); - tcg_temp_free_i32(zero); } } @@ -2945,7 +2911,7 @@ static void do_clast_scalar(DisasContext *s, int esz, int pg, int rm, bool before, TCGv_i64 reg_val) { TCGv_i32 last = tcg_temp_new_i32(); - TCGv_i64 ele, cmp, zero; + TCGv_i64 ele, cmp; find_last_active(s, last, esz, pg); @@ -2965,10 +2931,9 @@ static void do_clast_scalar(DisasContext *s, int esz, int pg, int rm, ele = load_last_active(s, last, rm, esz); tcg_temp_free_i32(last); - zero = tcg_const_i64(0); - tcg_gen_movcond_i64(TCG_COND_GE, reg_val, cmp, zero, ele, reg_val); + tcg_gen_movcond_i64(TCG_COND_GE, reg_val, cmp, tcg_constant_i64(0), + ele, reg_val); - tcg_temp_free_i64(zero); tcg_temp_free_i64(cmp); tcg_temp_free_i64(ele); } @@ -3196,7 +3161,7 @@ static bool do_ppzz_flags(DisasContext *s, arg_rprr_esz *a, } vsz = vec_full_reg_size(s); - t = tcg_const_i32(simd_desc(vsz, vsz, 0)); + t = tcg_temp_new_i32(); pd = tcg_temp_new_ptr(); zn = tcg_temp_new_ptr(); zm = tcg_temp_new_ptr(); @@ -3207,7 +3172,7 @@ static bool do_ppzz_flags(DisasContext *s, arg_rprr_esz *a, tcg_gen_addi_ptr(zm, cpu_env, vec_full_reg_offset(s, a->rm)); tcg_gen_addi_ptr(pg, cpu_env, pred_full_reg_offset(s, a->pg)); - gen_fn(t, pd, zn, zm, pg, t); + gen_fn(t, pd, zn, zm, pg, tcg_constant_i32(simd_desc(vsz, vsz, 0))); tcg_temp_free_ptr(pd); tcg_temp_free_ptr(zn); @@ -3281,7 +3246,7 @@ static bool do_ppzi_flags(DisasContext *s, arg_rpri_esz *a, } vsz = vec_full_reg_size(s); - t = tcg_const_i32(simd_desc(vsz, vsz, a->imm)); + t = tcg_temp_new_i32(); pd = tcg_temp_new_ptr(); zn = tcg_temp_new_ptr(); pg = tcg_temp_new_ptr(); @@ -3290,7 +3255,7 @@ static bool do_ppzi_flags(DisasContext *s, arg_rpri_esz *a, tcg_gen_addi_ptr(zn, cpu_env, vec_full_reg_offset(s, a->rn)); tcg_gen_addi_ptr(pg, cpu_env, pred_full_reg_offset(s, a->pg)); - gen_fn(t, pd, zn, pg, t); + gen_fn(t, pd, zn, pg, tcg_constant_i32(simd_desc(vsz, vsz, a->imm))); tcg_temp_free_ptr(pd); tcg_temp_free_ptr(zn); @@ -3343,7 +3308,8 @@ static bool do_brk3(DisasContext *s, arg_rprr_s *a, TCGv_ptr n = tcg_temp_new_ptr(); TCGv_ptr m = tcg_temp_new_ptr(); TCGv_ptr g = tcg_temp_new_ptr(); - TCGv_i32 t = tcg_const_i32(FIELD_DP32(0, PREDDESC, OPRSZ, vsz)); + TCGv_i32 t = tcg_temp_new_i32(); + TCGv_i32 desc = tcg_constant_i32(FIELD_DP32(0, PREDDESC, OPRSZ, vsz)); tcg_gen_addi_ptr(d, cpu_env, pred_full_reg_offset(s, a->rd)); tcg_gen_addi_ptr(n, cpu_env, pred_full_reg_offset(s, a->rn)); @@ -3351,10 +3317,10 @@ static bool do_brk3(DisasContext *s, arg_rprr_s *a, tcg_gen_addi_ptr(g, cpu_env, pred_full_reg_offset(s, a->pg)); if (a->s) { - fn_s(t, d, n, m, g, t); + fn_s(t, d, n, m, g, desc); do_pred_flags(t); } else { - fn(d, n, m, g, t); + fn(d, n, m, g, desc); } tcg_temp_free_ptr(d); tcg_temp_free_ptr(n); @@ -3377,17 +3343,18 @@ static bool do_brk2(DisasContext *s, arg_rpr_s *a, TCGv_ptr d = tcg_temp_new_ptr(); TCGv_ptr n = tcg_temp_new_ptr(); TCGv_ptr g = tcg_temp_new_ptr(); - TCGv_i32 t = tcg_const_i32(FIELD_DP32(0, PREDDESC, OPRSZ, vsz)); + TCGv_i32 t = tcg_temp_new_i32(); + TCGv_i32 desc = tcg_constant_i32(FIELD_DP32(0, PREDDESC, OPRSZ, vsz)); tcg_gen_addi_ptr(d, cpu_env, pred_full_reg_offset(s, a->rd)); tcg_gen_addi_ptr(n, cpu_env, pred_full_reg_offset(s, a->rn)); tcg_gen_addi_ptr(g, cpu_env, pred_full_reg_offset(s, a->pg)); if (a->s) { - fn_s(t, d, n, g, t); + fn_s(t, d, n, g, desc); do_pred_flags(t); } else { - fn(d, n, g, t); + fn(d, n, g, desc); } tcg_temp_free_ptr(d); tcg_temp_free_ptr(n); @@ -3461,19 +3428,16 @@ static void do_cntp(DisasContext *s, TCGv_i64 val, int esz, int pn, int pg) TCGv_ptr t_pn = tcg_temp_new_ptr(); TCGv_ptr t_pg = tcg_temp_new_ptr(); unsigned desc = 0; - TCGv_i32 t_desc; desc = FIELD_DP32(desc, PREDDESC, OPRSZ, psz); desc = FIELD_DP32(desc, PREDDESC, ESZ, esz); tcg_gen_addi_ptr(t_pn, cpu_env, pred_full_reg_offset(s, pn)); tcg_gen_addi_ptr(t_pg, cpu_env, pred_full_reg_offset(s, pg)); - t_desc = tcg_const_i32(desc); - gen_helper_sve_cntp(val, t_pn, t_pg, t_desc); + gen_helper_sve_cntp(val, t_pn, t_pg, tcg_constant_i32(desc)); tcg_temp_free_ptr(t_pn); tcg_temp_free_ptr(t_pg); - tcg_temp_free_i32(t_desc); } } @@ -3588,7 +3552,7 @@ static bool trans_CTERM(DisasContext *s, arg_CTERM *a) static bool trans_WHILE(DisasContext *s, arg_WHILE *a) { TCGv_i64 op0, op1, t0, t1, tmax; - TCGv_i32 t2, t3; + TCGv_i32 t2; TCGv_ptr ptr; unsigned vsz = vec_full_reg_size(s); unsigned desc = 0; @@ -3644,7 +3608,7 @@ static bool trans_WHILE(DisasContext *s, arg_WHILE *a) } } - tmax = tcg_const_i64(vsz >> a->esz); + tmax = tcg_constant_i64(vsz >> a->esz); if (eq) { /* Equality means one more iteration. */ tcg_gen_addi_i64(t0, t0, 1); @@ -3664,7 +3628,6 @@ static bool trans_WHILE(DisasContext *s, arg_WHILE *a) /* Bound to the maximum. */ tcg_gen_umin_i64(t0, t0, tmax); - tcg_temp_free_i64(tmax); /* Set the count to zero if the condition is false. */ tcg_gen_movi_i64(t1, 0); @@ -3681,28 +3644,26 @@ static bool trans_WHILE(DisasContext *s, arg_WHILE *a) desc = FIELD_DP32(desc, PREDDESC, OPRSZ, vsz / 8); desc = FIELD_DP32(desc, PREDDESC, ESZ, a->esz); - t3 = tcg_const_i32(desc); ptr = tcg_temp_new_ptr(); tcg_gen_addi_ptr(ptr, cpu_env, pred_full_reg_offset(s, a->rd)); if (a->lt) { - gen_helper_sve_whilel(t2, ptr, t2, t3); + gen_helper_sve_whilel(t2, ptr, t2, tcg_constant_i32(desc)); } else { - gen_helper_sve_whileg(t2, ptr, t2, t3); + gen_helper_sve_whileg(t2, ptr, t2, tcg_constant_i32(desc)); } do_pred_flags(t2); tcg_temp_free_ptr(ptr); tcg_temp_free_i32(t2); - tcg_temp_free_i32(t3); return true; } static bool trans_WHILE_ptr(DisasContext *s, arg_WHILE_ptr *a) { TCGv_i64 op0, op1, diff, t1, tmax; - TCGv_i32 t2, t3; + TCGv_i32 t2; TCGv_ptr ptr; unsigned vsz = vec_full_reg_size(s); unsigned desc = 0; @@ -3717,7 +3678,7 @@ static bool trans_WHILE_ptr(DisasContext *s, arg_WHILE_ptr *a) op0 = read_cpu_reg(s, a->rn, 1); op1 = read_cpu_reg(s, a->rm, 1); - tmax = tcg_const_i64(vsz); + tmax = tcg_constant_i64(vsz); diff = tcg_temp_new_i64(); if (a->rw) { @@ -3743,7 +3704,6 @@ static bool trans_WHILE_ptr(DisasContext *s, arg_WHILE_ptr *a) /* Bound to the maximum. */ tcg_gen_umin_i64(diff, diff, tmax); - tcg_temp_free_i64(tmax); /* Since we're bounded, pass as a 32-bit type. */ t2 = tcg_temp_new_i32(); @@ -3752,17 +3712,15 @@ static bool trans_WHILE_ptr(DisasContext *s, arg_WHILE_ptr *a) desc = FIELD_DP32(desc, PREDDESC, OPRSZ, vsz / 8); desc = FIELD_DP32(desc, PREDDESC, ESZ, a->esz); - t3 = tcg_const_i32(desc); ptr = tcg_temp_new_ptr(); tcg_gen_addi_ptr(ptr, cpu_env, pred_full_reg_offset(s, a->rd)); - gen_helper_sve_whilel(t2, ptr, t2, t3); + gen_helper_sve_whilel(t2, ptr, t2, tcg_constant_i32(desc)); do_pred_flags(t2); tcg_temp_free_ptr(ptr); tcg_temp_free_i32(t2); - tcg_temp_free_i32(t3); return true; } @@ -3856,11 +3814,9 @@ static bool trans_SUBR_zzi(DisasContext *s, arg_rri_esz *a) } if (sve_access_check(s)) { unsigned vsz = vec_full_reg_size(s); - TCGv_i64 c = tcg_const_i64(a->imm); tcg_gen_gvec_2s(vec_full_reg_offset(s, a->rd), vec_full_reg_offset(s, a->rn), - vsz, vsz, c, &op[a->esz]); - tcg_temp_free_i64(c); + vsz, vsz, tcg_constant_i64(a->imm), &op[a->esz]); } return true; } @@ -3881,9 +3837,8 @@ static bool do_zzi_sat(DisasContext *s, arg_rri_esz *a, bool u, bool d) return false; } if (sve_access_check(s)) { - TCGv_i64 val = tcg_const_i64(a->imm); - do_sat_addsub_vec(s, a->esz, a->rd, a->rn, val, u, d); - tcg_temp_free_i64(val); + do_sat_addsub_vec(s, a->esz, a->rd, a->rn, + tcg_constant_i64(a->imm), u, d); } return true; } @@ -3912,12 +3867,9 @@ static bool do_zzi_ool(DisasContext *s, arg_rri_esz *a, gen_helper_gvec_2i *fn) { if (sve_access_check(s)) { unsigned vsz = vec_full_reg_size(s); - TCGv_i64 c = tcg_const_i64(a->imm); - tcg_gen_gvec_2i_ool(vec_full_reg_offset(s, a->rd), vec_full_reg_offset(s, a->rn), - c, vsz, vsz, 0, fn); - tcg_temp_free_i64(c); + tcg_constant_i64(a->imm), vsz, vsz, 0, fn); } return true; } @@ -4221,7 +4173,7 @@ static void do_reduce(DisasContext *s, arg_rpr_esz *a, { unsigned vsz = vec_full_reg_size(s); unsigned p2vsz = pow2ceil(vsz); - TCGv_i32 t_desc = tcg_const_i32(simd_desc(vsz, vsz, p2vsz)); + TCGv_i32 t_desc = tcg_constant_i32(simd_desc(vsz, vsz, p2vsz)); TCGv_ptr t_zn, t_pg, status; TCGv_i64 temp; @@ -4237,7 +4189,6 @@ static void do_reduce(DisasContext *s, arg_rpr_esz *a, tcg_temp_free_ptr(t_zn); tcg_temp_free_ptr(t_pg); tcg_temp_free_ptr(status); - tcg_temp_free_i32(t_desc); write_fp_dreg(s, a->rd, temp); tcg_temp_free_i64(temp); @@ -4414,11 +4365,10 @@ static bool trans_FADDA(DisasContext *s, arg_rprr_esz *a) tcg_gen_addi_ptr(t_rm, cpu_env, vec_full_reg_offset(s, a->rm)); tcg_gen_addi_ptr(t_pg, cpu_env, pred_full_reg_offset(s, a->pg)); t_fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR); - t_desc = tcg_const_i32(simd_desc(vsz, vsz, 0)); + t_desc = tcg_constant_i32(simd_desc(vsz, vsz, 0)); fns[a->esz - 1](t_val, t_val, t_rm, t_pg, t_fpst, t_desc); - tcg_temp_free_i32(t_desc); tcg_temp_free_ptr(t_fpst); tcg_temp_free_ptr(t_pg); tcg_temp_free_ptr(t_rm); @@ -4535,10 +4485,9 @@ static void do_fp_scalar(DisasContext *s, int zd, int zn, int pg, bool is_fp16, tcg_gen_addi_ptr(t_pg, cpu_env, pred_full_reg_offset(s, pg)); status = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_FPCR); - desc = tcg_const_i32(simd_desc(vsz, vsz, 0)); + desc = tcg_constant_i32(simd_desc(vsz, vsz, 0)); fn(t_zd, t_zn, t_pg, scalar, status, desc); - tcg_temp_free_i32(desc); tcg_temp_free_ptr(status); tcg_temp_free_ptr(t_pg); tcg_temp_free_ptr(t_zn); @@ -4548,9 +4497,8 @@ static void do_fp_scalar(DisasContext *s, int zd, int zn, int pg, bool is_fp16, static void do_fp_imm(DisasContext *s, arg_rpri_esz *a, uint64_t imm, gen_helper_sve_fp2scalar *fn) { - TCGv_i64 temp = tcg_const_i64(imm); - do_fp_scalar(s, a->rd, a->rn, a->pg, a->esz == MO_16, temp, fn); - tcg_temp_free_i64(temp); + do_fp_scalar(s, a->rd, a->rn, a->pg, a->esz == MO_16, + tcg_constant_i64(imm), fn); } #define DO_FP_IMM(NAME, name, const0, const1) \ @@ -5297,7 +5245,6 @@ static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr, { unsigned vsz = vec_full_reg_size(s); TCGv_ptr t_pg; - TCGv_i32 t_desc; int desc = 0; /* @@ -5319,14 +5266,12 @@ static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr, } desc = simd_desc(vsz, vsz, zt | desc); - t_desc = tcg_const_i32(desc); t_pg = tcg_temp_new_ptr(); tcg_gen_addi_ptr(t_pg, cpu_env, pred_full_reg_offset(s, pg)); - fn(cpu_env, t_pg, addr, t_desc); + fn(cpu_env, t_pg, addr, tcg_constant_i32(desc)); tcg_temp_free_ptr(t_pg); - tcg_temp_free_i32(t_desc); } /* Indexed by [mte][be][dtype][nreg] */ @@ -6069,7 +6014,6 @@ static void do_mem_zpz(DisasContext *s, int zt, int pg, int zm, TCGv_ptr t_zm = tcg_temp_new_ptr(); TCGv_ptr t_pg = tcg_temp_new_ptr(); TCGv_ptr t_zt = tcg_temp_new_ptr(); - TCGv_i32 t_desc; int desc = 0; if (s->mte_active[0]) { @@ -6081,17 +6025,15 @@ static void do_mem_zpz(DisasContext *s, int zt, int pg, int zm, desc <<= SVE_MTEDESC_SHIFT; } desc = simd_desc(vsz, vsz, desc | scale); - t_desc = tcg_const_i32(desc); tcg_gen_addi_ptr(t_pg, cpu_env, pred_full_reg_offset(s, pg)); tcg_gen_addi_ptr(t_zm, cpu_env, vec_full_reg_offset(s, zm)); tcg_gen_addi_ptr(t_zt, cpu_env, vec_full_reg_offset(s, zt)); - fn(cpu_env, t_zt, t_pg, t_zm, scalar, t_desc); + fn(cpu_env, t_zt, t_pg, t_zm, scalar, tcg_constant_i32(desc)); tcg_temp_free_ptr(t_zt); tcg_temp_free_ptr(t_zm); tcg_temp_free_ptr(t_pg); - tcg_temp_free_i32(t_desc); } /* Indexed by [mte][be][ff][xs][u][msz]. */ @@ -6452,7 +6394,6 @@ static bool trans_LD1_zpiz(DisasContext *s, arg_LD1_zpiz *a) gen_helper_gvec_mem_scatter *fn = NULL; bool be = s->be_data == MO_BE; bool mte = s->mte_active[0]; - TCGv_i64 imm; if (a->esz < a->msz || (a->esz == a->msz && !a->u)) { return false; @@ -6474,9 +6415,8 @@ static bool trans_LD1_zpiz(DisasContext *s, arg_LD1_zpiz *a) /* Treat LD1_zpiz (zn[x] + imm) the same way as LD1_zprz (rn + zm[x]) * by loading the immediate into the scalar parameter. */ - imm = tcg_const_i64(a->imm << a->msz); - do_mem_zpz(s, a->rd, a->pg, a->rn, 0, imm, a->msz, false, fn); - tcg_temp_free_i64(imm); + do_mem_zpz(s, a->rd, a->pg, a->rn, 0, + tcg_constant_i64(a->imm << a->msz), a->msz, false, fn); return true; } @@ -6635,7 +6575,6 @@ static bool trans_ST1_zpiz(DisasContext *s, arg_ST1_zpiz *a) gen_helper_gvec_mem_scatter *fn = NULL; bool be = s->be_data == MO_BE; bool mte = s->mte_active[0]; - TCGv_i64 imm; if (a->esz < a->msz) { return false; @@ -6657,9 +6596,8 @@ static bool trans_ST1_zpiz(DisasContext *s, arg_ST1_zpiz *a) /* Treat ST1_zpiz (zn[x] + imm) the same way as ST1_zprz (rn + zm[x]) * by loading the immediate into the scalar parameter. */ - imm = tcg_const_i64(a->imm << a->msz); - do_mem_zpz(s, a->rd, a->pg, a->rn, 0, imm, a->msz, true, fn); - tcg_temp_free_i64(imm); + do_mem_zpz(s, a->rd, a->pg, a->rn, 0, + tcg_constant_i64(a->imm << a->msz), a->msz, true, fn); return true; } From patchwork Sun Apr 17 17:43:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562841 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1863178map; Sun, 17 Apr 2022 11:10:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0iGENUMRTJBWqDRu+a5zryj/k3tapsmAFtDSrr6q/nt3TJhq8YDuQa6+Cr9xYEmeWdTCV X-Received: by 2002:ac8:7088:0:b0:2f1:e898:2971 with SMTP id y8-20020ac87088000000b002f1e8982971mr5098214qto.152.1650219049043; Sun, 17 Apr 2022 11:10:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650219049; cv=none; d=google.com; s=arc-20160816; b=V7xk6zxHpvlokDAXL8ur75mrROr1bK0B0uS9KTHdFjNDRW4kI7IzkhyTDmcEiK+sFI /FiSTuorcAEiDlzcldNqWbZcutmBxAq43iSr8KP7E8wbALru5J+quVLBpIOLtQ0EqC+A zyhEVUhIUYD5biatImpW1O2HdqVnjDaFLio5vu1SBzF1gXFn50nI7HjGQhYC7mhB6P1K oBOVT1PwZkjXf0Rlnq5151JAfbrJZzQSU4/lb0/yBKJzV2f/Bg/EwlH6m5tT25q77NPN ApOcA1Bn2Jbu2bY1Dk9wq4qPTj6vgnLFOFK5+MhUP6zMgE6zvgZfdkmJJBZQ4OVWEbR8 4GYw== 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=EjDsRVrr40sK4EqnjCDkGgI2/MSKp18+eb6X2mYbvxs=; b=1JahXs2eBtfm5RCubq5z3+1gG5Y3HZEgubu2PIYuQtcMEn05JXcbBGCv3e1/Z5gDbj P5szdmZpGwcPaCjc84Mlif0T1cyOZo4zOfFbZ9YxUjZuHa9ufTecgja4u3evIuwsoMiS fu/5PTM8S8IjV7yOUC0TKF2Y9QO2Hke34gSQ6xiV1PIBwA6if5RIcRfXwSVHnHm088LN UZb/TbBVBsIIg+zZ2PFsTW2vdrEkkPHBC+6FRWuANBEpxj+qhsbBrHMxGFDk5ejdy3XS jwSDj2BtJf32vW9tJ2D7YSC9q13e0Ucq48B9Z/lTmd7rEpAIS/2secS5Y6dRytZnigth +TqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="r0V1/2VK"; 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 14-20020a0562140d4e00b00440e46a7c3fsi343117qvr.221.2022.04.17.11.10.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:10: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="r0V1/2VK"; 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]:60658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9MF-0000eW-HA for patch@linaro.org; Sun, 17 Apr 2022 14:10:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48360) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8xC-0000v7-F1 for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:54 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]:44583) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8x8-0003Lc-FP for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:53 -0400 Received: by mail-pg1-x52e.google.com with SMTP id j71so1444109pge.11 for ; Sun, 17 Apr 2022 10:44:50 -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=EjDsRVrr40sK4EqnjCDkGgI2/MSKp18+eb6X2mYbvxs=; b=r0V1/2VKGSm5JnKWZq0XEM9IyawtQwL+Qi0+lzvFBfLw6fLdrjJ0ACEA4qgpUfL6qd JMfOT1GeV7xx2GRDwB51YYLSB+KUtUlFeTHPkNNW6SjUy51r1S6ENQcYggTyO5nsIbuu bdraHueUHupFOLDpWvXGilF/2XKv74wZjIXY7dqXfnN+o6dw++qunoR9sU9bixEt6nRF Hyq7Vh86/gMwp0KE+3wUDpzGisOiIBLBEAQa03JH/F8m+yLY1rJEx/VXC/8pNx4Dabyb Fxi+tD+OqWxglrBtoVR7/5hkrhiC8TS3iWKOFUcKeMRq5DoYthHpUkbH8TWZEEKzN+7N P1og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EjDsRVrr40sK4EqnjCDkGgI2/MSKp18+eb6X2mYbvxs=; b=ndp5e42AKbRjWJ5Z4j8PoTpkZhFbcLnQ4RkmS6j36vmP68OHGyO2iHbfFu7+5UDWVN izgNecEsp0BZC5/E3hxGmmnq8/R4L3nM0ATB+xcs2ypFVfsrWDhyFPJ/YG8MwCK0TRlt rBiukDBDt7nLoElD1L2k3TRMbian+A2QNaze07ISi20Mh942UU2ejoBEwSCzAeXrJwzk jnV/ZqVBY28xNmcpGszrjGUhyJSnSuQJ27yG1ePxPTUPlmzRpmkKlGfIlqkIza96F1px lax4eNHU2S5in69M68tjRHMlY68jHhq39rWxBgZ3Mx3DXdP7dBNAfxmEOiGvrTrH7aJM 35gg== X-Gm-Message-State: AOAM53273Edik43wSa2RX6+ddKM0FXcyX9+w/bdVglwcvXhlwlslqsG9 fB4NGGk5dZdjoTl+MpChfLuvFCsAUOiBXg== X-Received: by 2002:aa7:8049:0:b0:4fd:bfde:45eb with SMTP id y9-20020aa78049000000b004fdbfde45ebmr8518125pfm.76.1650217488880; Sun, 17 Apr 2022 10:44:48 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 22/60] target/arm: Use tcg_constant in translate-vfp.c Date: Sun, 17 Apr 2022 10:43:48 -0700 Message-Id: <20220417174426.711829-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52e.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use tcg_constant_{i32,i64} as appropriate throughout. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate-vfp.c | 76 ++++++++++++-------------------------- 1 file changed, 23 insertions(+), 53 deletions(-) diff --git a/target/arm/translate-vfp.c b/target/arm/translate-vfp.c index 17f796e32a..32b784b9c8 100644 --- a/target/arm/translate-vfp.c +++ b/target/arm/translate-vfp.c @@ -180,8 +180,7 @@ static void gen_update_fp_context(DisasContext *s) gen_helper_vfp_set_fpscr(cpu_env, fpscr); tcg_temp_free_i32(fpscr); if (dc_isar_feature(aa32_mve, s)) { - TCGv_i32 z32 = tcg_const_i32(0); - store_cpu_field(z32, v7m.vpr); + store_cpu_field(tcg_constant_i32(0), v7m.vpr); } /* * We just updated the FPSCR and VPR. Some of this state is cached @@ -317,7 +316,7 @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) TCGv_i64 frn, frm, dest; TCGv_i64 tmp, zero, zf, nf, vf; - zero = tcg_const_i64(0); + zero = tcg_constant_i64(0); frn = tcg_temp_new_i64(); frm = tcg_temp_new_i64(); @@ -335,27 +334,22 @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) vfp_load_reg64(frm, rm); switch (a->cc) { case 0: /* eq: Z */ - tcg_gen_movcond_i64(TCG_COND_EQ, dest, zf, zero, - frn, frm); + tcg_gen_movcond_i64(TCG_COND_EQ, dest, zf, zero, frn, frm); break; case 1: /* vs: V */ - tcg_gen_movcond_i64(TCG_COND_LT, dest, vf, zero, - frn, frm); + tcg_gen_movcond_i64(TCG_COND_LT, dest, vf, zero, frn, frm); break; case 2: /* ge: N == V -> N ^ V == 0 */ tmp = tcg_temp_new_i64(); tcg_gen_xor_i64(tmp, vf, nf); - tcg_gen_movcond_i64(TCG_COND_GE, dest, tmp, zero, - frn, frm); + tcg_gen_movcond_i64(TCG_COND_GE, dest, tmp, zero, frn, frm); tcg_temp_free_i64(tmp); break; case 3: /* gt: !Z && N == V */ - tcg_gen_movcond_i64(TCG_COND_NE, dest, zf, zero, - frn, frm); + tcg_gen_movcond_i64(TCG_COND_NE, dest, zf, zero, frn, frm); tmp = tcg_temp_new_i64(); tcg_gen_xor_i64(tmp, vf, nf); - tcg_gen_movcond_i64(TCG_COND_GE, dest, tmp, zero, - dest, frm); + tcg_gen_movcond_i64(TCG_COND_GE, dest, tmp, zero, dest, frm); tcg_temp_free_i64(tmp); break; } @@ -367,13 +361,11 @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) tcg_temp_free_i64(zf); tcg_temp_free_i64(nf); tcg_temp_free_i64(vf); - - tcg_temp_free_i64(zero); } else { TCGv_i32 frn, frm, dest; TCGv_i32 tmp, zero; - zero = tcg_const_i32(0); + zero = tcg_constant_i32(0); frn = tcg_temp_new_i32(); frm = tcg_temp_new_i32(); @@ -382,27 +374,22 @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) vfp_load_reg32(frm, rm); switch (a->cc) { case 0: /* eq: Z */ - tcg_gen_movcond_i32(TCG_COND_EQ, dest, cpu_ZF, zero, - frn, frm); + tcg_gen_movcond_i32(TCG_COND_EQ, dest, cpu_ZF, zero, frn, frm); break; case 1: /* vs: V */ - tcg_gen_movcond_i32(TCG_COND_LT, dest, cpu_VF, zero, - frn, frm); + tcg_gen_movcond_i32(TCG_COND_LT, dest, cpu_VF, zero, frn, frm); break; case 2: /* ge: N == V -> N ^ V == 0 */ tmp = tcg_temp_new_i32(); tcg_gen_xor_i32(tmp, cpu_VF, cpu_NF); - tcg_gen_movcond_i32(TCG_COND_GE, dest, tmp, zero, - frn, frm); + tcg_gen_movcond_i32(TCG_COND_GE, dest, tmp, zero, frn, frm); tcg_temp_free_i32(tmp); break; case 3: /* gt: !Z && N == V */ - tcg_gen_movcond_i32(TCG_COND_NE, dest, cpu_ZF, zero, - frn, frm); + tcg_gen_movcond_i32(TCG_COND_NE, dest, cpu_ZF, zero, frn, frm); tmp = tcg_temp_new_i32(); tcg_gen_xor_i32(tmp, cpu_VF, cpu_NF); - tcg_gen_movcond_i32(TCG_COND_GE, dest, tmp, zero, - dest, frm); + tcg_gen_movcond_i32(TCG_COND_GE, dest, tmp, zero, dest, frm); tcg_temp_free_i32(tmp); break; } @@ -414,8 +401,6 @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a) tcg_temp_free_i32(frn); tcg_temp_free_i32(frm); tcg_temp_free_i32(dest); - - tcg_temp_free_i32(zero); } return true; @@ -547,7 +532,7 @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a) fpst = fpstatus_ptr(FPST_FPCR); } - tcg_shift = tcg_const_i32(0); + tcg_shift = tcg_constant_i32(0); tcg_rmode = tcg_const_i32(arm_rmode_to_sf(rounding)); gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); @@ -595,8 +580,6 @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a) gen_helper_set_rmode(tcg_rmode, tcg_rmode, fpst); tcg_temp_free_i32(tcg_rmode); - tcg_temp_free_i32(tcg_shift); - tcg_temp_free_ptr(fpst); return true; @@ -850,15 +833,11 @@ static bool trans_VMSR_VMRS(DisasContext *s, arg_VMSR_VMRS *a) case ARM_VFP_MVFR2: case ARM_VFP_FPSID: if (s->current_el == 1) { - TCGv_i32 tcg_reg, tcg_rt; - gen_set_condexec(s); gen_set_pc_im(s, s->pc_curr); - tcg_reg = tcg_const_i32(a->reg); - tcg_rt = tcg_const_i32(a->rt); - gen_helper_check_hcr_el2_trap(cpu_env, tcg_rt, tcg_reg); - tcg_temp_free_i32(tcg_reg); - tcg_temp_free_i32(tcg_rt); + gen_helper_check_hcr_el2_trap(cpu_env, + tcg_constant_i32(a->rt), + tcg_constant_i32(a->reg)); } /* fall through */ case ARM_VFP_FPEXC: @@ -2388,8 +2367,6 @@ MAKE_VFM_TRANS_FNS(dp) static bool trans_VMOV_imm_hp(DisasContext *s, arg_VMOV_imm_sp *a) { - TCGv_i32 fd; - if (!dc_isar_feature(aa32_fp16_arith, s)) { return false; } @@ -2402,9 +2379,7 @@ static bool trans_VMOV_imm_hp(DisasContext *s, arg_VMOV_imm_sp *a) return true; } - fd = tcg_const_i32(vfp_expand_imm(MO_16, a->imm)); - vfp_store_reg32(fd, a->vd); - tcg_temp_free_i32(fd); + vfp_store_reg32(tcg_constant_i32(vfp_expand_imm(MO_16, a->imm)), a->vd); return true; } @@ -2440,7 +2415,7 @@ static bool trans_VMOV_imm_sp(DisasContext *s, arg_VMOV_imm_sp *a) } } - fd = tcg_const_i32(vfp_expand_imm(MO_32, a->imm)); + fd = tcg_constant_i32(vfp_expand_imm(MO_32, a->imm)); for (;;) { vfp_store_reg32(fd, vd); @@ -2454,7 +2429,6 @@ static bool trans_VMOV_imm_sp(DisasContext *s, arg_VMOV_imm_sp *a) vd = vfp_advance_sreg(vd, delta_d); } - tcg_temp_free_i32(fd); return true; } @@ -2495,7 +2469,7 @@ static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a) } } - fd = tcg_const_i64(vfp_expand_imm(MO_64, a->imm)); + fd = tcg_constant_i64(vfp_expand_imm(MO_64, a->imm)); for (;;) { vfp_store_reg64(fd, vd); @@ -2509,7 +2483,6 @@ static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a) vd = vfp_advance_dreg(vd, delta_d); } - tcg_temp_free_i64(fd); return true; } @@ -3294,7 +3267,7 @@ static bool trans_VCVT_fix_hp(DisasContext *s, arg_VCVT_fix_sp *a) vfp_load_reg32(vd, a->vd); fpst = fpstatus_ptr(FPST_FPCR_F16); - shift = tcg_const_i32(frac_bits); + shift = tcg_constant_i32(frac_bits); /* Switch on op:U:sx bits */ switch (a->opc) { @@ -3328,7 +3301,6 @@ static bool trans_VCVT_fix_hp(DisasContext *s, arg_VCVT_fix_sp *a) vfp_store_reg32(vd, a->vd); tcg_temp_free_i32(vd); - tcg_temp_free_i32(shift); tcg_temp_free_ptr(fpst); return true; } @@ -3353,7 +3325,7 @@ static bool trans_VCVT_fix_sp(DisasContext *s, arg_VCVT_fix_sp *a) vfp_load_reg32(vd, a->vd); fpst = fpstatus_ptr(FPST_FPCR); - shift = tcg_const_i32(frac_bits); + shift = tcg_constant_i32(frac_bits); /* Switch on op:U:sx bits */ switch (a->opc) { @@ -3387,7 +3359,6 @@ static bool trans_VCVT_fix_sp(DisasContext *s, arg_VCVT_fix_sp *a) vfp_store_reg32(vd, a->vd); tcg_temp_free_i32(vd); - tcg_temp_free_i32(shift); tcg_temp_free_ptr(fpst); return true; } @@ -3418,7 +3389,7 @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a) vfp_load_reg64(vd, a->vd); fpst = fpstatus_ptr(FPST_FPCR); - shift = tcg_const_i32(frac_bits); + shift = tcg_constant_i32(frac_bits); /* Switch on op:U:sx bits */ switch (a->opc) { @@ -3452,7 +3423,6 @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a) vfp_store_reg64(vd, a->vd); tcg_temp_free_i64(vd); - tcg_temp_free_i32(shift); tcg_temp_free_ptr(fpst); return true; } From patchwork Sun Apr 17 17:43:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562844 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1865087map; Sun, 17 Apr 2022 11:14:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqvhxz6ITHgot7PwfsT+o1v7lr9fbAqDX/8w5NGRmM1YmDEP9H3GcZYvjQnWwdH1xz+Bg/ X-Received: by 2002:a05:622a:1386:b0:2e1:e80c:a026 with SMTP id o6-20020a05622a138600b002e1e80ca026mr5027300qtk.596.1650219279602; Sun, 17 Apr 2022 11:14:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650219279; cv=none; d=google.com; s=arc-20160816; b=Sj9tQaNordwLUdB323937kMDHPcVkZpNGGSR4JIuW02gs0BuyTRChSxr7kp/zYUDU4 tKdupvFdaRWeRT1wRLsKrJvd2SbeYSUO4lCl8gzJfYBWcaICWuzpu1zZ1rjfyrth+/qB a3pSa+yS12Uu5VHUjArizDXH0kq4bIjqdB6wwwDCzuw/19bVVHx8pTa4+cdAK/rA+yiN cJKp0RAN1NvbpmIrYrW62uo1fNC15IBv0Qac7fMHWZxfHH4nNNkv3GpeM3vHMMdDc6Ru LGjzjkbHwYyOb/IHRCkNYPzPvcHeLgvmPsXRbcA3sAGoKw3K0py9ItATSO9dbfPEe4Xp iGhw== 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=d/uFztF2R9mSbyAkaIbJngefgd7536mac94QZAXGuz0=; b=b35UUXfNqc+55NHG9lX8KJgLg0Bh7uw8L1S+F191pqb9FsB4aQzeBRSnyd7Di8rJJk be87rBpHfj5naWkEIz+qI6eOFtRpCg8/53w0gWyLuENbj0Jw33xIpmtmhmC39iZHzPO3 Zegd2Bq0v0SVWJFWI85VsK90ebuUWnYTEYzWmMqaaT7rJxTvVxlnvrZAnmU9DW9A+4Hr ycUfcm/FGctuaGoaCgOVhY58brcS0EFqxWw0lb+ramLMgTzlvIwjbyXak+GOtqPWU2sO 0PHzIR+G00RSUQGHdUZ0YDNAMxirDh/P74bMROyabgB+39DtCEppztuXWECxbhzGPW64 9V3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xERJDA75; 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 c1-20020a05622a024100b002e1fbf3bf65si2596635qtx.342.2022.04.17.11.14.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:14:39 -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=xERJDA75; 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]:42452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9Pz-0007R3-75 for patch@linaro.org; Sun, 17 Apr 2022 14:14:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8xB-0000u0-Nk for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:54 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:33300) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8x9-0003Lx-Ef for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:53 -0400 Received: by mail-pj1-x102c.google.com with SMTP id n11-20020a17090a73cb00b001d1d3a7116bso2625391pjk.0 for ; Sun, 17 Apr 2022 10:44:50 -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=d/uFztF2R9mSbyAkaIbJngefgd7536mac94QZAXGuz0=; b=xERJDA756fJ3VZkY5DZkGuGfp2LDg5vlQUqtlbbT/YyGE7Ky5H+Fmti4vuYBqtjigR IlNYHtVb1RsKUiu9N7tJPEoVWShwHhzYpSeafu0xvjnbtxcWpbLbFaLPI8fs1o0tx9T1 wUchWRcG8jgg04mDn9L4IiZiZ0QFoLAYPaQv7Kq5Y7F8Y1nVU4Coxi1fGQXx08Amn7Dd eAYowdbgp6bZ6TZ0kVnj4BqtKh5Isf/y1iMg09uOvrzbBw/QN/Pb5OCcg5xbomuiYc4K az+TLK9dH0dqzy6r+g/9NKz91HWqqOUUFIl9docFXkuOvJele0Ovs8MLcgX05qVLh6Hg asnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d/uFztF2R9mSbyAkaIbJngefgd7536mac94QZAXGuz0=; b=1oc/UDoJFyn+++8CEoqexlrTlRRXETBZ12ZThARRyiC/igMt+pilaTZ3BP9DdepDp4 dLTmhlVvYhFMFcijaiAZy11MipEFQWNQ+pGurrbBsj3+t5BGkm0xNZ5+8W8b/fEPcObY IuUN3L3GCDhem9ceqFdA4J2lE0CAonnX63XJ9UXN2XQRqu+xJL1nIIsHKhk13LsUZ7yz Kxvtj40T1Ou+ABIF+hwpsPRhZpfs6Cwx/vZuzchdYPxLaoD40+pc3EbApVhYcMRlDpC5 HZ7Ov6GDrLavjuSuxVd/Ni3ypyULMIW65GQ30jKaEdBjRnKm7QsJoMKXT6BREx5xUGeD oF2g== X-Gm-Message-State: AOAM530jUQQUDt79uuL81BV06/woKRJzbBDveppZllWvltExB8YC1wYP 4mbusBssy8rnS/zVOdmjRVV024VpoOIxUg== X-Received: by 2002:a17:90a:b307:b0:1bd:37f3:f0fc with SMTP id d7-20020a17090ab30700b001bd37f3f0fcmr14460341pjr.132.1650217489722; Sun, 17 Apr 2022 10:44:49 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 23/60] target/arm: Use tcg_constant_i32 in translate.h Date: Sun, 17 Apr 2022 10:43:49 -0700 Message-Id: <20220417174426.711829-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate.h | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/target/arm/translate.h b/target/arm/translate.h index 050d80f6f9..6f0ebdc88e 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -332,16 +332,9 @@ static inline void gen_ss_advance(DisasContext *s) static inline void gen_exception(int excp, uint32_t syndrome, uint32_t target_el) { - TCGv_i32 tcg_excp = tcg_const_i32(excp); - TCGv_i32 tcg_syn = tcg_const_i32(syndrome); - TCGv_i32 tcg_el = tcg_const_i32(target_el); - - gen_helper_exception_with_syndrome(cpu_env, tcg_excp, - tcg_syn, tcg_el); - - tcg_temp_free_i32(tcg_el); - tcg_temp_free_i32(tcg_syn); - tcg_temp_free_i32(tcg_excp); + gen_helper_exception_with_syndrome(cpu_env, tcg_constant_i32(excp), + tcg_constant_i32(syndrome), + tcg_constant_i32(target_el)); } /* Generate an architectural singlestep exception */ From patchwork Sun Apr 17 17:43:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562843 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1864558map; Sun, 17 Apr 2022 11:13:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygfWtsW71sPOQHvZS1vRACYDmGPE3Ncu/ggIML0E8Txa05TcD+QPFzXhGYtfJBTlANZUfo X-Received: by 2002:a05:6214:c62:b0:444:bfb:799f with SMTP id t2-20020a0562140c6200b004440bfb799fmr5653143qvj.2.1650219204951; Sun, 17 Apr 2022 11:13:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650219204; cv=none; d=google.com; s=arc-20160816; b=XfgQSFLsXBR1yLrQXzyrfXriZ5GJt1VEnHBTto9Iecy9sWswZ+RW/jmTR3zAnHqUWO jYZ+WhKDSgweTnuA1Ex0/VzbPvE80GStOnY+dPfveWguBbY4elUeaSyMBxOQ+5i+nBtk 30+D3DbHMoJJleVExaRN4waxZoyEv4GUF1/0idJFg8FEsm3gGfco214cq1kDmzFQY6We 6PeQrTPwYwJDSr9W2vPMc4phYIoXPGpc0wfuDjL+w22vX5LeYqfGac26jSEDbDSp2y/G GusbllJGLNjvOmvT7KUWHweBY5BMf8UmGUZd0+11N7zs0hVQmaRITa5uBnOaLAi3sARn rn/w== 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=v/4nUFEFhPbECEOcrTf7ZSJ5Kp+IM3GRGZb7ARPXAT8=; b=ZPDra7e25qjqyjUwh5BAdb/ES8KEMoaEUUFd2dqqbFF7pedmgKBtuxVWvYJzuKKf4w VdxQ8fciIhUiCdwGnVogdMnMyQm7JnfLAphLjv61B7B+ZT7oBrth3kTIeH7VWy9w0YcR U4uoTlohsas/14SHTLOZOIYqRNqFjYs1KiUR9pWSZK368K40iKDtxc6W+7atcECxG2sy qoHI4/gz0cDnWd+HaFt2n01PammFUnJdDZB8A60rSa9XrLcH8x698FiqAJl/S/iWsuC9 bK9AWWFo7x2scPK/VE8VMru1+hYKl+4ctlFfBmrYi2XBD7m8Isun6/s+3eBo+8DUkMU1 fqQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yPJTe1c7; 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 x21-20020a05620a449500b0069c10890e3fsi2606829qkp.57.2022.04.17.11.13.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:13:24 -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=yPJTe1c7; 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]:38430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9Om-0004f1-Es for patch@linaro.org; Sun, 17 Apr 2022 14:13:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48528) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8xH-0001BF-2h for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:59 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:34709) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8xC-0003Mu-3c for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:58 -0400 Received: by mail-pl1-x631.google.com with SMTP id n8so10761844plh.1 for ; Sun, 17 Apr 2022 10:44:53 -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=v/4nUFEFhPbECEOcrTf7ZSJ5Kp+IM3GRGZb7ARPXAT8=; b=yPJTe1c7sOJCp/e1oT5nef6QSoIo50mecnTYeB9cY9dK55pG+/Vug8eB15kCD27i5z kJwOHzN8bpfsrN5JRC6JDOKGhr22Pt5x0emPb621Xp2xojObvPLcyUqEjQ4vMJsorjMj fherkXS4QHi2QQ8ZARvNkGqoVvHDL/tstXXS99M6OMyF7SLU67NVgRdUJIxoRNmyGhcV o15tohShjtUW0f9Af6NyuV7U+XaQBMfB0hwIbas6d009q6COjvA+2Sfent8zzcNpXugs G5knGw2Geh1S7jnO444blBKvdsl3F+rBgH5dGyn3bMWD8y5LcurCq4HMvFlIh+j0kPPP jC4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v/4nUFEFhPbECEOcrTf7ZSJ5Kp+IM3GRGZb7ARPXAT8=; b=C8TLxDrXA0t8ba1s208NB7gl7m3kSSghLoj9+Qjkjo9e7w4Dxd3EJk9gisTVg/VZj2 V/wvfN92FwsiQqi2edmXrNfikEghnVavbKJ0/RWkLPL8c7tzidOMfpXP8a+0tGtRHmE4 MEU+9Nv8oysOcQfQ8IuGWWx3wUfGi2mxdGehEkx8ZAdpyg/iiXA21CEQfr62gjW4qtfo bN5ady4628+vfzAtJPJhhaByur+0Wr47zWq3PQ6Vl28pGxNEDQ7584yX1+hDIuYKYxGr 2Fnj4ZZ9IFFUksXtc4cjL4ii/nxrubiOQC/L5bioUJU9TB3bOPtjrW6ln2WPgj6R+APC 0Vkg== X-Gm-Message-State: AOAM531Z0YD66XKbr4pzwRF7bCCLMLuBCei0rm//CGFqtcP946qCVwp+ eiEcsnUDrmXDN3CJoXYOJbyrk1XvdfZ4+w== X-Received: by 2002:a17:902:70c1:b0:156:16c0:dc7b with SMTP id l1-20020a17090270c100b0015616c0dc7bmr7830230plt.85.1650217490615; Sun, 17 Apr 2022 10:44:50 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 24/60] target/arm: Split out cpregs.h Date: Sun, 17 Apr 2022 10:43:50 -0700 Message-Id: <20220417174426.711829-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Move ARMCPRegInfo and all related declarations to a new internal header, out of the public cpu.h. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Reviewed-by: Alex Bennée --- target/arm/cpregs.h | 413 +++++++++++++++++++++++++++++++++++++ target/arm/cpu.h | 368 --------------------------------- hw/arm/pxa2xx.c | 1 + hw/arm/pxa2xx_pic.c | 1 + hw/intc/arm_gicv3_cpuif.c | 1 + hw/intc/arm_gicv3_kvm.c | 2 + target/arm/cpu.c | 1 + target/arm/cpu64.c | 1 + target/arm/cpu_tcg.c | 1 + target/arm/gdbstub.c | 3 +- target/arm/helper.c | 1 + target/arm/op_helper.c | 1 + target/arm/translate-a64.c | 4 +- target/arm/translate.c | 3 +- 14 files changed, 427 insertions(+), 374 deletions(-) create mode 100644 target/arm/cpregs.h diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h new file mode 100644 index 0000000000..005aa2d3a5 --- /dev/null +++ b/target/arm/cpregs.h @@ -0,0 +1,413 @@ +/* + * QEMU ARM CP Register access and descriptions + * + * Copyright (c) 2022 Linaro Ltd + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see + * + */ + +#ifndef TARGET_ARM_CPREGS_H +#define TARGET_ARM_CPREGS_H 1 + +/* + * ARMCPRegInfo type field bits. If the SPECIAL bit is set this is a + * special-behaviour cp reg and bits [11..8] indicate what behaviour + * it has. Otherwise it is a simple cp reg, where CONST indicates that + * TCG can assume the value to be constant (ie load at translate time) + * and 64BIT indicates a 64 bit wide coprocessor register. SUPPRESS_TB_END + * indicates that the TB should not be ended after a write to this register + * (the default is that the TB ends after cp writes). OVERRIDE permits + * a register definition to override a previous definition for the + * same (cp, is64, crn, crm, opc1, opc2) tuple: either the new or the + * old must have the OVERRIDE bit set. + * ALIAS indicates that this register is an alias view of some underlying + * state which is also visible via another register, and that the other + * register is handling migration and reset; registers marked ALIAS will not be + * migrated but may have their state set by syncing of register state from KVM. + * NO_RAW indicates that this register has no underlying state and does not + * support raw access for state saving/loading; it will not be used for either + * migration or KVM state synchronization. (Typically this is for "registers" + * which are actually used as instructions for cache maintenance and so on.) + * IO indicates that this register does I/O and therefore its accesses + * need to be marked with gen_io_start() and also end the TB. In particular, + * registers which implement clocks or timers require this. + * RAISES_EXC is for when the read or write hook might raise an exception; + * the generated code will synchronize the CPU state before calling the hook + * so that it is safe for the hook to call raise_exception(). + * NEWEL is for writes to registers that might change the exception + * level - typically on older ARM chips. For those cases we need to + * re-read the new el when recomputing the translation flags. + */ +#define ARM_CP_SPECIAL 0x0001 +#define ARM_CP_CONST 0x0002 +#define ARM_CP_64BIT 0x0004 +#define ARM_CP_SUPPRESS_TB_END 0x0008 +#define ARM_CP_OVERRIDE 0x0010 +#define ARM_CP_ALIAS 0x0020 +#define ARM_CP_IO 0x0040 +#define ARM_CP_NO_RAW 0x0080 +#define ARM_CP_NOP (ARM_CP_SPECIAL | 0x0100) +#define ARM_CP_WFI (ARM_CP_SPECIAL | 0x0200) +#define ARM_CP_NZCV (ARM_CP_SPECIAL | 0x0300) +#define ARM_CP_CURRENTEL (ARM_CP_SPECIAL | 0x0400) +#define ARM_CP_DC_ZVA (ARM_CP_SPECIAL | 0x0500) +#define ARM_CP_DC_GVA (ARM_CP_SPECIAL | 0x0600) +#define ARM_CP_DC_GZVA (ARM_CP_SPECIAL | 0x0700) +#define ARM_LAST_SPECIAL ARM_CP_DC_GZVA +#define ARM_CP_FPU 0x1000 +#define ARM_CP_SVE 0x2000 +#define ARM_CP_NO_GDB 0x4000 +#define ARM_CP_RAISES_EXC 0x8000 +#define ARM_CP_NEWEL 0x10000 +/* Used only as a terminator for ARMCPRegInfo lists */ +#define ARM_CP_SENTINEL 0xfffff +/* Mask of only the flag bits in a type field */ +#define ARM_CP_FLAG_MASK 0x1f0ff + +/* + * Valid values for ARMCPRegInfo state field, indicating which of + * the AArch32 and AArch64 execution states this register is visible in. + * If the reginfo doesn't explicitly specify then it is AArch32 only. + * If the reginfo is declared to be visible in both states then a second + * reginfo is synthesised for the AArch32 view of the AArch64 register, + * such that the AArch32 view is the lower 32 bits of the AArch64 one. + * Note that we rely on the values of these enums as we iterate through + * the various states in some places. + */ +enum { + ARM_CP_STATE_AA32 = 0, + ARM_CP_STATE_AA64 = 1, + ARM_CP_STATE_BOTH = 2, +}; + +/* + * ARM CP register secure state flags. These flags identify security state + * attributes for a given CP register entry. + * The existence of both or neither secure and non-secure flags indicates that + * the register has both a secure and non-secure hash entry. A single one of + * these flags causes the register to only be hashed for the specified + * security state. + * Although definitions may have any combination of the S/NS bits, each + * registered entry will only have one to identify whether the entry is secure + * or non-secure. + */ +enum { + ARM_CP_SECSTATE_S = (1 << 0), /* bit[0]: Secure state register */ + ARM_CP_SECSTATE_NS = (1 << 1), /* bit[1]: Non-secure state register */ +}; + +/* + * Return true if cptype is a valid type field. This is used to try to + * catch errors where the sentinel has been accidentally left off the end + * of a list of registers. + */ +static inline bool cptype_valid(int cptype) +{ + return ((cptype & ~ARM_CP_FLAG_MASK) == 0) + || ((cptype & ARM_CP_SPECIAL) && + ((cptype & ~ARM_CP_FLAG_MASK) <= ARM_LAST_SPECIAL)); +} + +/* + * Access rights: + * We define bits for Read and Write access for what rev C of the v7-AR ARM ARM + * defines as PL0 (user), PL1 (fiq/irq/svc/abt/und/sys, ie privileged), and + * PL2 (hyp). The other level which has Read and Write bits is Secure PL1 + * (ie any of the privileged modes in Secure state, or Monitor mode). + * If a register is accessible in one privilege level it's always accessible + * in higher privilege levels too. Since "Secure PL1" also follows this rule + * (ie anything visible in PL2 is visible in S-PL1, some things are only + * visible in S-PL1) but "Secure PL1" is a bit of a mouthful, we bend the + * terminology a little and call this PL3. + * In AArch64 things are somewhat simpler as the PLx bits line up exactly + * with the ELx exception levels. + * + * If access permissions for a register are more complex than can be + * described with these bits, then use a laxer set of restrictions, and + * do the more restrictive/complex check inside a helper function. + */ +#define PL3_R 0x80 +#define PL3_W 0x40 +#define PL2_R (0x20 | PL3_R) +#define PL2_W (0x10 | PL3_W) +#define PL1_R (0x08 | PL2_R) +#define PL1_W (0x04 | PL2_W) +#define PL0_R (0x02 | PL1_R) +#define PL0_W (0x01 | PL1_W) + +/* + * For user-mode some registers are accessible to EL0 via a kernel + * trap-and-emulate ABI. In this case we define the read permissions + * as actually being PL0_R. However some bits of any given register + * may still be masked. + */ +#ifdef CONFIG_USER_ONLY +#define PL0U_R PL0_R +#else +#define PL0U_R PL1_R +#endif + +#define PL3_RW (PL3_R | PL3_W) +#define PL2_RW (PL2_R | PL2_W) +#define PL1_RW (PL1_R | PL1_W) +#define PL0_RW (PL0_R | PL0_W) + +typedef enum CPAccessResult { + /* Access is permitted */ + CP_ACCESS_OK = 0, + /* + * Access fails due to a configurable trap or enable which would + * result in a categorized exception syndrome giving information about + * the failing instruction (ie syndrome category 0x3, 0x4, 0x5, 0x6, + * 0xc or 0x18). The exception is taken to the usual target EL (EL1 or + * PL1 if in EL0, otherwise to the current EL). + */ + CP_ACCESS_TRAP = 1, + /* + * Access fails and results in an exception syndrome 0x0 ("uncategorized"). + * Note that this is not a catch-all case -- the set of cases which may + * result in this failure is specifically defined by the architecture. + */ + CP_ACCESS_TRAP_UNCATEGORIZED = 2, + /* As CP_ACCESS_TRAP, but for traps directly to EL2 or EL3 */ + CP_ACCESS_TRAP_EL2 = 3, + CP_ACCESS_TRAP_EL3 = 4, + /* As CP_ACCESS_UNCATEGORIZED, but for traps directly to EL2 or EL3 */ + CP_ACCESS_TRAP_UNCATEGORIZED_EL2 = 5, + CP_ACCESS_TRAP_UNCATEGORIZED_EL3 = 6, +} CPAccessResult; + +typedef struct ARMCPRegInfo ARMCPRegInfo; + +/* + * Access functions for coprocessor registers. These cannot fail and + * may not raise exceptions. + */ +typedef uint64_t CPReadFn(CPUARMState *env, const ARMCPRegInfo *opaque); +typedef void CPWriteFn(CPUARMState *env, const ARMCPRegInfo *opaque, + uint64_t value); +/* Access permission check functions for coprocessor registers. */ +typedef CPAccessResult CPAccessFn(CPUARMState *env, + const ARMCPRegInfo *opaque, + bool isread); +/* Hook function for register reset */ +typedef void CPResetFn(CPUARMState *env, const ARMCPRegInfo *opaque); + +#define CP_ANY 0xff + +/* Definition of an ARM coprocessor register */ +struct ARMCPRegInfo { + /* Name of register (useful mainly for debugging, need not be unique) */ + const char *name; + /* + * Location of register: coprocessor number and (crn,crm,opc1,opc2) + * tuple. Any of crm, opc1 and opc2 may be CP_ANY to indicate a + * 'wildcard' field -- any value of that field in the MRC/MCR insn + * will be decoded to this register. The register read and write + * callbacks will be passed an ARMCPRegInfo with the crn/crm/opc1/opc2 + * used by the program, so it is possible to register a wildcard and + * then behave differently on read/write if necessary. + * For 64 bit registers, only crm and opc1 are relevant; crn and opc2 + * must both be zero. + * For AArch64-visible registers, opc0 is also used. + * Since there are no "coprocessors" in AArch64, cp is purely used as a + * way to distinguish (for KVM's benefit) guest-visible system registers + * from demuxed ones provided to preserve the "no side effects on + * KVM register read/write from QEMU" semantics. cp==0x13 is guest + * visible (to match KVM's encoding); cp==0 will be converted to + * cp==0x13 when the ARMCPRegInfo is registered, for convenience. + */ + uint8_t cp; + uint8_t crn; + uint8_t crm; + uint8_t opc0; + uint8_t opc1; + uint8_t opc2; + /* Execution state in which this register is visible: ARM_CP_STATE_* */ + int state; + /* Register type: ARM_CP_* bits/values */ + int type; + /* Access rights: PL*_[RW] */ + int access; + /* Security state: ARM_CP_SECSTATE_* bits/values */ + int secure; + /* + * The opaque pointer passed to define_arm_cp_regs_with_opaque() when + * this register was defined: can be used to hand data through to the + * register read/write functions, since they are passed the ARMCPRegInfo*. + */ + void *opaque; + /* + * Value of this register, if it is ARM_CP_CONST. Otherwise, if + * fieldoffset is non-zero, the reset value of the register. + */ + uint64_t resetvalue; + /* + * Offset of the field in CPUARMState for this register. + * This is not needed if either: + * 1. type is ARM_CP_CONST or one of the ARM_CP_SPECIALs + * 2. both readfn and writefn are specified + */ + ptrdiff_t fieldoffset; /* offsetof(CPUARMState, field) */ + + /* + * Offsets of the secure and non-secure fields in CPUARMState for the + * register if it is banked. These fields are only used during the static + * registration of a register. During hashing the bank associated + * with a given security state is copied to fieldoffset which is used from + * there on out. + * + * It is expected that register definitions use either fieldoffset or + * bank_fieldoffsets in the definition but not both. It is also expected + * that both bank offsets are set when defining a banked register. This + * use indicates that a register is banked. + */ + ptrdiff_t bank_fieldoffsets[2]; + + /* + * Function for making any access checks for this register in addition to + * those specified by the 'access' permissions bits. If NULL, no extra + * checks required. The access check is performed at runtime, not at + * translate time. + */ + CPAccessFn *accessfn; + /* + * Function for handling reads of this register. If NULL, then reads + * will be done by loading from the offset into CPUARMState specified + * by fieldoffset. + */ + CPReadFn *readfn; + /* + * Function for handling writes of this register. If NULL, then writes + * will be done by writing to the offset into CPUARMState specified + * by fieldoffset. + */ + CPWriteFn *writefn; + /* + * Function for doing a "raw" read; used when we need to copy + * coprocessor state to the kernel for KVM or out for + * migration. This only needs to be provided if there is also a + * readfn and it has side effects (for instance clear-on-read bits). + */ + CPReadFn *raw_readfn; + /* + * Function for doing a "raw" write; used when we need to copy KVM + * kernel coprocessor state into userspace, or for inbound + * migration. This only needs to be provided if there is also a + * writefn and it masks out "unwritable" bits or has write-one-to-clear + * or similar behaviour. + */ + CPWriteFn *raw_writefn; + /* + * Function for resetting the register. If NULL, then reset will be done + * by writing resetvalue to the field specified in fieldoffset. If + * fieldoffset is 0 then no reset will be done. + */ + CPResetFn *resetfn; + + /* + * "Original" writefn and readfn. + * For ARMv8.1-VHE register aliases, we overwrite the read/write + * accessor functions of various EL1/EL0 to perform the runtime + * check for which sysreg should actually be modified, and then + * forwards the operation. Before overwriting the accessors, + * the original function is copied here, so that accesses that + * really do go to the EL1/EL0 version proceed normally. + * (The corresponding EL2 register is linked via opaque.) + */ + CPReadFn *orig_readfn; + CPWriteFn *orig_writefn; +}; + +/* + * Macros which are lvalues for the field in CPUARMState for the + * ARMCPRegInfo *ri. + */ +#define CPREG_FIELD32(env, ri) \ + (*(uint32_t *)((char *)(env) + (ri)->fieldoffset)) +#define CPREG_FIELD64(env, ri) \ + (*(uint64_t *)((char *)(env) + (ri)->fieldoffset)) + +#define REGINFO_SENTINEL { .type = ARM_CP_SENTINEL } + +void define_arm_cp_regs_with_opaque(ARMCPU *cpu, + const ARMCPRegInfo *regs, void *opaque); +void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu, + const ARMCPRegInfo *regs, void *opaque); +static inline void define_arm_cp_regs(ARMCPU *cpu, const ARMCPRegInfo *regs) +{ + define_arm_cp_regs_with_opaque(cpu, regs, 0); +} +static inline void define_one_arm_cp_reg(ARMCPU *cpu, const ARMCPRegInfo *regs) +{ + define_one_arm_cp_reg_with_opaque(cpu, regs, 0); +} +const ARMCPRegInfo *get_arm_cp_reginfo(GHashTable *cpregs, uint32_t encoded_cp); + +/* + * Definition of an ARM co-processor register as viewed from + * userspace. This is used for presenting sanitised versions of + * registers to userspace when emulating the Linux AArch64 CPU + * ID/feature ABI (advertised as HWCAP_CPUID). + */ +typedef struct ARMCPRegUserSpaceInfo { + /* Name of register */ + const char *name; + + /* Is the name actually a glob pattern */ + bool is_glob; + + /* Only some bits are exported to user space */ + uint64_t exported_bits; + + /* Fixed bits are applied after the mask */ + uint64_t fixed_bits; +} ARMCPRegUserSpaceInfo; + +#define REGUSERINFO_SENTINEL { .name = NULL } + +void modify_arm_cp_regs(ARMCPRegInfo *regs, const ARMCPRegUserSpaceInfo *mods); + +/* CPWriteFn that can be used to implement writes-ignored behaviour */ +void arm_cp_write_ignore(CPUARMState *env, const ARMCPRegInfo *ri, + uint64_t value); +/* CPReadFn that can be used for read-as-zero behaviour */ +uint64_t arm_cp_read_zero(CPUARMState *env, const ARMCPRegInfo *ri); + +/* + * CPResetFn that does nothing, for use if no reset is required even + * if fieldoffset is non zero. + */ +void arm_cp_reset_ignore(CPUARMState *env, const ARMCPRegInfo *opaque); + +/* + * Return true if this reginfo struct's field in the cpu state struct + * is 64 bits wide. + */ +static inline bool cpreg_field_is_64bit(const ARMCPRegInfo *ri) +{ + return (ri->state == ARM_CP_STATE_AA64) || (ri->type & ARM_CP_64BIT); +} + +static inline bool cp_access_ok(int current_el, + const ARMCPRegInfo *ri, int isread) +{ + return (ri->access >> ((current_el * 2) + isread)) & 1; +} + +/* Raw read of a coprocessor register (as needed for migration, etc) */ +uint64_t read_raw_cp_reg(CPUARMState *env, const ARMCPRegInfo *ri); + +#endif /* TARGET_ARM_CPREGS_H */ diff --git a/target/arm/cpu.h b/target/arm/cpu.h index e7f669d0a9..76c0dd37cd 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2594,144 +2594,6 @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid) return kvmid; } -/* ARMCPRegInfo type field bits. If the SPECIAL bit is set this is a - * special-behaviour cp reg and bits [11..8] indicate what behaviour - * it has. Otherwise it is a simple cp reg, where CONST indicates that - * TCG can assume the value to be constant (ie load at translate time) - * and 64BIT indicates a 64 bit wide coprocessor register. SUPPRESS_TB_END - * indicates that the TB should not be ended after a write to this register - * (the default is that the TB ends after cp writes). OVERRIDE permits - * a register definition to override a previous definition for the - * same (cp, is64, crn, crm, opc1, opc2) tuple: either the new or the - * old must have the OVERRIDE bit set. - * ALIAS indicates that this register is an alias view of some underlying - * state which is also visible via another register, and that the other - * register is handling migration and reset; registers marked ALIAS will not be - * migrated but may have their state set by syncing of register state from KVM. - * NO_RAW indicates that this register has no underlying state and does not - * support raw access for state saving/loading; it will not be used for either - * migration or KVM state synchronization. (Typically this is for "registers" - * which are actually used as instructions for cache maintenance and so on.) - * IO indicates that this register does I/O and therefore its accesses - * need to be marked with gen_io_start() and also end the TB. In particular, - * registers which implement clocks or timers require this. - * RAISES_EXC is for when the read or write hook might raise an exception; - * the generated code will synchronize the CPU state before calling the hook - * so that it is safe for the hook to call raise_exception(). - * NEWEL is for writes to registers that might change the exception - * level - typically on older ARM chips. For those cases we need to - * re-read the new el when recomputing the translation flags. - */ -#define ARM_CP_SPECIAL 0x0001 -#define ARM_CP_CONST 0x0002 -#define ARM_CP_64BIT 0x0004 -#define ARM_CP_SUPPRESS_TB_END 0x0008 -#define ARM_CP_OVERRIDE 0x0010 -#define ARM_CP_ALIAS 0x0020 -#define ARM_CP_IO 0x0040 -#define ARM_CP_NO_RAW 0x0080 -#define ARM_CP_NOP (ARM_CP_SPECIAL | 0x0100) -#define ARM_CP_WFI (ARM_CP_SPECIAL | 0x0200) -#define ARM_CP_NZCV (ARM_CP_SPECIAL | 0x0300) -#define ARM_CP_CURRENTEL (ARM_CP_SPECIAL | 0x0400) -#define ARM_CP_DC_ZVA (ARM_CP_SPECIAL | 0x0500) -#define ARM_CP_DC_GVA (ARM_CP_SPECIAL | 0x0600) -#define ARM_CP_DC_GZVA (ARM_CP_SPECIAL | 0x0700) -#define ARM_LAST_SPECIAL ARM_CP_DC_GZVA -#define ARM_CP_FPU 0x1000 -#define ARM_CP_SVE 0x2000 -#define ARM_CP_NO_GDB 0x4000 -#define ARM_CP_RAISES_EXC 0x8000 -#define ARM_CP_NEWEL 0x10000 -/* Used only as a terminator for ARMCPRegInfo lists */ -#define ARM_CP_SENTINEL 0xfffff -/* Mask of only the flag bits in a type field */ -#define ARM_CP_FLAG_MASK 0x1f0ff - -/* Valid values for ARMCPRegInfo state field, indicating which of - * the AArch32 and AArch64 execution states this register is visible in. - * If the reginfo doesn't explicitly specify then it is AArch32 only. - * If the reginfo is declared to be visible in both states then a second - * reginfo is synthesised for the AArch32 view of the AArch64 register, - * such that the AArch32 view is the lower 32 bits of the AArch64 one. - * Note that we rely on the values of these enums as we iterate through - * the various states in some places. - */ -enum { - ARM_CP_STATE_AA32 = 0, - ARM_CP_STATE_AA64 = 1, - ARM_CP_STATE_BOTH = 2, -}; - -/* ARM CP register secure state flags. These flags identify security state - * attributes for a given CP register entry. - * The existence of both or neither secure and non-secure flags indicates that - * the register has both a secure and non-secure hash entry. A single one of - * these flags causes the register to only be hashed for the specified - * security state. - * Although definitions may have any combination of the S/NS bits, each - * registered entry will only have one to identify whether the entry is secure - * or non-secure. - */ -enum { - ARM_CP_SECSTATE_S = (1 << 0), /* bit[0]: Secure state register */ - ARM_CP_SECSTATE_NS = (1 << 1), /* bit[1]: Non-secure state register */ -}; - -/* Return true if cptype is a valid type field. This is used to try to - * catch errors where the sentinel has been accidentally left off the end - * of a list of registers. - */ -static inline bool cptype_valid(int cptype) -{ - return ((cptype & ~ARM_CP_FLAG_MASK) == 0) - || ((cptype & ARM_CP_SPECIAL) && - ((cptype & ~ARM_CP_FLAG_MASK) <= ARM_LAST_SPECIAL)); -} - -/* Access rights: - * We define bits for Read and Write access for what rev C of the v7-AR ARM ARM - * defines as PL0 (user), PL1 (fiq/irq/svc/abt/und/sys, ie privileged), and - * PL2 (hyp). The other level which has Read and Write bits is Secure PL1 - * (ie any of the privileged modes in Secure state, or Monitor mode). - * If a register is accessible in one privilege level it's always accessible - * in higher privilege levels too. Since "Secure PL1" also follows this rule - * (ie anything visible in PL2 is visible in S-PL1, some things are only - * visible in S-PL1) but "Secure PL1" is a bit of a mouthful, we bend the - * terminology a little and call this PL3. - * In AArch64 things are somewhat simpler as the PLx bits line up exactly - * with the ELx exception levels. - * - * If access permissions for a register are more complex than can be - * described with these bits, then use a laxer set of restrictions, and - * do the more restrictive/complex check inside a helper function. - */ -#define PL3_R 0x80 -#define PL3_W 0x40 -#define PL2_R (0x20 | PL3_R) -#define PL2_W (0x10 | PL3_W) -#define PL1_R (0x08 | PL2_R) -#define PL1_W (0x04 | PL2_W) -#define PL0_R (0x02 | PL1_R) -#define PL0_W (0x01 | PL1_W) - -/* - * For user-mode some registers are accessible to EL0 via a kernel - * trap-and-emulate ABI. In this case we define the read permissions - * as actually being PL0_R. However some bits of any given register - * may still be masked. - */ -#ifdef CONFIG_USER_ONLY -#define PL0U_R PL0_R -#else -#define PL0U_R PL1_R -#endif - -#define PL3_RW (PL3_R | PL3_W) -#define PL2_RW (PL2_R | PL2_W) -#define PL1_RW (PL1_R | PL1_W) -#define PL0_RW (PL0_R | PL0_W) - /* Return the highest implemented Exception Level */ static inline int arm_highest_el(CPUARMState *env) { @@ -2783,236 +2645,6 @@ static inline int arm_current_el(CPUARMState *env) } } -typedef struct ARMCPRegInfo ARMCPRegInfo; - -typedef enum CPAccessResult { - /* Access is permitted */ - CP_ACCESS_OK = 0, - /* Access fails due to a configurable trap or enable which would - * result in a categorized exception syndrome giving information about - * the failing instruction (ie syndrome category 0x3, 0x4, 0x5, 0x6, - * 0xc or 0x18). The exception is taken to the usual target EL (EL1 or - * PL1 if in EL0, otherwise to the current EL). - */ - CP_ACCESS_TRAP = 1, - /* Access fails and results in an exception syndrome 0x0 ("uncategorized"). - * Note that this is not a catch-all case -- the set of cases which may - * result in this failure is specifically defined by the architecture. - */ - CP_ACCESS_TRAP_UNCATEGORIZED = 2, - /* As CP_ACCESS_TRAP, but for traps directly to EL2 or EL3 */ - CP_ACCESS_TRAP_EL2 = 3, - CP_ACCESS_TRAP_EL3 = 4, - /* As CP_ACCESS_UNCATEGORIZED, but for traps directly to EL2 or EL3 */ - CP_ACCESS_TRAP_UNCATEGORIZED_EL2 = 5, - CP_ACCESS_TRAP_UNCATEGORIZED_EL3 = 6, -} CPAccessResult; - -/* Access functions for coprocessor registers. These cannot fail and - * may not raise exceptions. - */ -typedef uint64_t CPReadFn(CPUARMState *env, const ARMCPRegInfo *opaque); -typedef void CPWriteFn(CPUARMState *env, const ARMCPRegInfo *opaque, - uint64_t value); -/* Access permission check functions for coprocessor registers. */ -typedef CPAccessResult CPAccessFn(CPUARMState *env, - const ARMCPRegInfo *opaque, - bool isread); -/* Hook function for register reset */ -typedef void CPResetFn(CPUARMState *env, const ARMCPRegInfo *opaque); - -#define CP_ANY 0xff - -/* Definition of an ARM coprocessor register */ -struct ARMCPRegInfo { - /* Name of register (useful mainly for debugging, need not be unique) */ - const char *name; - /* Location of register: coprocessor number and (crn,crm,opc1,opc2) - * tuple. Any of crm, opc1 and opc2 may be CP_ANY to indicate a - * 'wildcard' field -- any value of that field in the MRC/MCR insn - * will be decoded to this register. The register read and write - * callbacks will be passed an ARMCPRegInfo with the crn/crm/opc1/opc2 - * used by the program, so it is possible to register a wildcard and - * then behave differently on read/write if necessary. - * For 64 bit registers, only crm and opc1 are relevant; crn and opc2 - * must both be zero. - * For AArch64-visible registers, opc0 is also used. - * Since there are no "coprocessors" in AArch64, cp is purely used as a - * way to distinguish (for KVM's benefit) guest-visible system registers - * from demuxed ones provided to preserve the "no side effects on - * KVM register read/write from QEMU" semantics. cp==0x13 is guest - * visible (to match KVM's encoding); cp==0 will be converted to - * cp==0x13 when the ARMCPRegInfo is registered, for convenience. - */ - uint8_t cp; - uint8_t crn; - uint8_t crm; - uint8_t opc0; - uint8_t opc1; - uint8_t opc2; - /* Execution state in which this register is visible: ARM_CP_STATE_* */ - int state; - /* Register type: ARM_CP_* bits/values */ - int type; - /* Access rights: PL*_[RW] */ - int access; - /* Security state: ARM_CP_SECSTATE_* bits/values */ - int secure; - /* The opaque pointer passed to define_arm_cp_regs_with_opaque() when - * this register was defined: can be used to hand data through to the - * register read/write functions, since they are passed the ARMCPRegInfo*. - */ - void *opaque; - /* Value of this register, if it is ARM_CP_CONST. Otherwise, if - * fieldoffset is non-zero, the reset value of the register. - */ - uint64_t resetvalue; - /* Offset of the field in CPUARMState for this register. - * - * This is not needed if either: - * 1. type is ARM_CP_CONST or one of the ARM_CP_SPECIALs - * 2. both readfn and writefn are specified - */ - ptrdiff_t fieldoffset; /* offsetof(CPUARMState, field) */ - - /* Offsets of the secure and non-secure fields in CPUARMState for the - * register if it is banked. These fields are only used during the static - * registration of a register. During hashing the bank associated - * with a given security state is copied to fieldoffset which is used from - * there on out. - * - * It is expected that register definitions use either fieldoffset or - * bank_fieldoffsets in the definition but not both. It is also expected - * that both bank offsets are set when defining a banked register. This - * use indicates that a register is banked. - */ - ptrdiff_t bank_fieldoffsets[2]; - - /* Function for making any access checks for this register in addition to - * those specified by the 'access' permissions bits. If NULL, no extra - * checks required. The access check is performed at runtime, not at - * translate time. - */ - CPAccessFn *accessfn; - /* Function for handling reads of this register. If NULL, then reads - * will be done by loading from the offset into CPUARMState specified - * by fieldoffset. - */ - CPReadFn *readfn; - /* Function for handling writes of this register. If NULL, then writes - * will be done by writing to the offset into CPUARMState specified - * by fieldoffset. - */ - CPWriteFn *writefn; - /* Function for doing a "raw" read; used when we need to copy - * coprocessor state to the kernel for KVM or out for - * migration. This only needs to be provided if there is also a - * readfn and it has side effects (for instance clear-on-read bits). - */ - CPReadFn *raw_readfn; - /* Function for doing a "raw" write; used when we need to copy KVM - * kernel coprocessor state into userspace, or for inbound - * migration. This only needs to be provided if there is also a - * writefn and it masks out "unwritable" bits or has write-one-to-clear - * or similar behaviour. - */ - CPWriteFn *raw_writefn; - /* Function for resetting the register. If NULL, then reset will be done - * by writing resetvalue to the field specified in fieldoffset. If - * fieldoffset is 0 then no reset will be done. - */ - CPResetFn *resetfn; - - /* - * "Original" writefn and readfn. - * For ARMv8.1-VHE register aliases, we overwrite the read/write - * accessor functions of various EL1/EL0 to perform the runtime - * check for which sysreg should actually be modified, and then - * forwards the operation. Before overwriting the accessors, - * the original function is copied here, so that accesses that - * really do go to the EL1/EL0 version proceed normally. - * (The corresponding EL2 register is linked via opaque.) - */ - CPReadFn *orig_readfn; - CPWriteFn *orig_writefn; -}; - -/* Macros which are lvalues for the field in CPUARMState for the - * ARMCPRegInfo *ri. - */ -#define CPREG_FIELD32(env, ri) \ - (*(uint32_t *)((char *)(env) + (ri)->fieldoffset)) -#define CPREG_FIELD64(env, ri) \ - (*(uint64_t *)((char *)(env) + (ri)->fieldoffset)) - -#define REGINFO_SENTINEL { .type = ARM_CP_SENTINEL } - -void define_arm_cp_regs_with_opaque(ARMCPU *cpu, - const ARMCPRegInfo *regs, void *opaque); -void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu, - const ARMCPRegInfo *regs, void *opaque); -static inline void define_arm_cp_regs(ARMCPU *cpu, const ARMCPRegInfo *regs) -{ - define_arm_cp_regs_with_opaque(cpu, regs, 0); -} -static inline void define_one_arm_cp_reg(ARMCPU *cpu, const ARMCPRegInfo *regs) -{ - define_one_arm_cp_reg_with_opaque(cpu, regs, 0); -} -const ARMCPRegInfo *get_arm_cp_reginfo(GHashTable *cpregs, uint32_t encoded_cp); - -/* - * Definition of an ARM co-processor register as viewed from - * userspace. This is used for presenting sanitised versions of - * registers to userspace when emulating the Linux AArch64 CPU - * ID/feature ABI (advertised as HWCAP_CPUID). - */ -typedef struct ARMCPRegUserSpaceInfo { - /* Name of register */ - const char *name; - - /* Is the name actually a glob pattern */ - bool is_glob; - - /* Only some bits are exported to user space */ - uint64_t exported_bits; - - /* Fixed bits are applied after the mask */ - uint64_t fixed_bits; -} ARMCPRegUserSpaceInfo; - -#define REGUSERINFO_SENTINEL { .name = NULL } - -void modify_arm_cp_regs(ARMCPRegInfo *regs, const ARMCPRegUserSpaceInfo *mods); - -/* CPWriteFn that can be used to implement writes-ignored behaviour */ -void arm_cp_write_ignore(CPUARMState *env, const ARMCPRegInfo *ri, - uint64_t value); -/* CPReadFn that can be used for read-as-zero behaviour */ -uint64_t arm_cp_read_zero(CPUARMState *env, const ARMCPRegInfo *ri); - -/* CPResetFn that does nothing, for use if no reset is required even - * if fieldoffset is non zero. - */ -void arm_cp_reset_ignore(CPUARMState *env, const ARMCPRegInfo *opaque); - -/* Return true if this reginfo struct's field in the cpu state struct - * is 64 bits wide. - */ -static inline bool cpreg_field_is_64bit(const ARMCPRegInfo *ri) -{ - return (ri->state == ARM_CP_STATE_AA64) || (ri->type & ARM_CP_64BIT); -} - -static inline bool cp_access_ok(int current_el, - const ARMCPRegInfo *ri, int isread) -{ - return (ri->access >> ((current_el * 2) + isread)) & 1; -} - -/* Raw read of a coprocessor register (as needed for migration, etc) */ -uint64_t read_raw_cp_reg(CPUARMState *env, const ARMCPRegInfo *ri); - /** * write_list_to_cpustate * @cpu: ARMCPU diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c index a6f938f115..0683714733 100644 --- a/hw/arm/pxa2xx.c +++ b/hw/arm/pxa2xx.c @@ -30,6 +30,7 @@ #include "qemu/cutils.h" #include "qemu/log.h" #include "qom/object.h" +#include "target/arm/cpregs.h" static struct { hwaddr io_base; diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c index ed032fed54..b80d75d839 100644 --- a/hw/arm/pxa2xx_pic.c +++ b/hw/arm/pxa2xx_pic.c @@ -17,6 +17,7 @@ #include "hw/sysbus.h" #include "migration/vmstate.h" #include "qom/object.h" +#include "target/arm/cpregs.h" #define ICIP 0x00 /* Interrupt Controller IRQ Pending register */ #define ICMR 0x04 /* Interrupt Controller Mask register */ diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c index 1a3d440a54..d43ba970f9 100644 --- a/hw/intc/arm_gicv3_cpuif.c +++ b/hw/intc/arm_gicv3_cpuif.c @@ -20,6 +20,7 @@ #include "gicv3_internal.h" #include "hw/irq.h" #include "cpu.h" +#include "target/arm/cpregs.h" static GICv3CPUState *icc_cs_from_env(CPUARMState *env) { diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c index 5ec5ff9ef6..ed2a583b0c 100644 --- a/hw/intc/arm_gicv3_kvm.c +++ b/hw/intc/arm_gicv3_kvm.c @@ -31,6 +31,8 @@ #include "vgic_common.h" #include "migration/blocker.h" #include "qom/object.h" +#include "target/arm/cpregs.h" + #ifdef DEBUG_GICV3_KVM #define DPRINTF(fmt, ...) \ diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 561f180067..066fe6250a 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -43,6 +43,7 @@ #include "kvm_arm.h" #include "disas/capstone.h" #include "fpu/softfloat.h" +#include "cpregs.h" static void arm_cpu_set_pc(CPUState *cs, vaddr value) { diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index eb44c05822..9561714c23 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -34,6 +34,7 @@ #include "hvf_arm.h" #include "qapi/visitor.h" #include "hw/qdev-properties.h" +#include "cpregs.h" #ifndef CONFIG_USER_ONLY diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c index 13d0e9b195..0e693b182e 100644 --- a/target/arm/cpu_tcg.c +++ b/target/arm/cpu_tcg.c @@ -18,6 +18,7 @@ #if !defined(CONFIG_USER_ONLY) #include "hw/boards.h" #endif +#include "cpregs.h" /* CPU models. These are not needed for the AArch64 linux-user build. */ #if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64) diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c index ca1de47511..f01a126108 100644 --- a/target/arm/gdbstub.c +++ b/target/arm/gdbstub.c @@ -19,8 +19,9 @@ */ #include "qemu/osdep.h" #include "cpu.h" -#include "internals.h" #include "exec/gdbstub.h" +#include "internals.h" +#include "cpregs.h" typedef struct RegisterSysregXmlParam { CPUState *cs; diff --git a/target/arm/helper.c b/target/arm/helper.c index 60d9233b7e..8928ffb6a7 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -37,6 +37,7 @@ #include "exec/cpu_ldst.h" #include "semihosting/common-semi.h" #endif +#include "cpregs.h" #define ARM_CPU_FREQ 1000000000 /* FIXME: 1 GHz, should be configurable */ #define PMCR_NUM_COUNTERS 4 /* QEMU IMPDEF choice */ diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 2b87e8808b..67be91c732 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -23,6 +23,7 @@ #include "internals.h" #include "exec/exec-all.h" #include "exec/cpu_ldst.h" +#include "cpregs.h" #define SIGNBIT (uint32_t)0x80000000 #define SIGNBIT64 ((uint64_t)1 << 63) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 3867910ed4..92b91f0307 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -27,14 +27,12 @@ #include "translate.h" #include "internals.h" #include "qemu/host-utils.h" - #include "semihosting/semihost.h" #include "exec/gen-icount.h" - #include "exec/helper-proto.h" #include "exec/helper-gen.h" #include "exec/log.h" - +#include "cpregs.h" #include "translate-a64.h" #include "qemu/atomic128.h" diff --git a/target/arm/translate.c b/target/arm/translate.c index 5cb4b3da33..1fe48e4e1c 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -30,11 +30,10 @@ #include "qemu/bitops.h" #include "arm_ldst.h" #include "semihosting/semihost.h" - #include "exec/helper-proto.h" #include "exec/helper-gen.h" - #include "exec/log.h" +#include "cpregs.h" #define ENABLE_ARCH_4T arm_dc_feature(s, ARM_FEATURE_V4T) From patchwork Sun Apr 17 17:43:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562851 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1868801map; Sun, 17 Apr 2022 11:22:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVEsoEvm+t6ymP54WXQyj3uJ40KIWXShPXI9Yg4zTGD/UVLkaOxicSChL4R4mxN9EYXpvJ X-Received: by 2002:a05:622a:51:b0:2f1:fa66:44b8 with SMTP id y17-20020a05622a005100b002f1fa6644b8mr2333019qtw.498.1650219758347; Sun, 17 Apr 2022 11:22:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650219758; cv=none; d=google.com; s=arc-20160816; b=0FBa/ciDD6ymLOUFymzrZSmA0mMCXhH36X6DoNAvED/h4NocdaXNChrIEd7A2cTtuv IsdQhH8ZQ6Z1UsaDzcJQWVCtTbRECelAiGxrKHj/6GmYIKmEET3heFGgAl2Pg2w7V1xN 9KeLVVlTX8Lj7G3e8v/JiXjeqJkmwk2dFAqH+KqEJv8xKJ0JVesp67Jbt/mBMke9mImI vKbVzQ000386G9efIXHTqx7mb8tkn4gdcYAi0mWwNfLEXUQ5r2FhsTa5pq2isprlvSs1 xVz/OHYwqFVoHo8GhyQyNOciiCW3Dm2HwTX6ywk1QFDPIaO0qETUbA8ZHeORbTSqkXZc nfhA== 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=/kQGH0Cy2HcRWOzQdszvWYCvmoLOtgBt5ZPwOUyma0Q=; b=KK8x1BR4K5u712iRDbGeAfM6YEcglscAO6xihOb6dkqhayEgrDPbQPt3NRwXB6KiOX euH3KaKYcOP6wMjvtj22gNSFKJZK+2VDXs8Q+IdwRMlQVmRiLjXbegLXtMeq6nDGn85D pyn37JqFTjpZZbWmX4kpewj3GgdNuEKu75baYDZN45jSFKrw9b6rtr52qkmbEY+BhKlt mGjXO4iRaRXIB5nx7liZC3jiqWIFQ7WoVe+E0d/QJsWCAOqL0h4psFvq9Vs6ONiRPpF6 5sTW5iACnzaw3o+wAjUi9d6e4FsluhAZb0meijqULztWKGe383+k9KkPm6y2G4Txd8rK BlJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wQAAsmyg; 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 c13-20020ac87dcd000000b002ed0e7c7cecsi2199179qte.594.2022.04.17.11.22.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:22:38 -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=wQAAsmyg; 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]:59896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9Xh-0002GF-FX for patch@linaro.org; Sun, 17 Apr 2022 14:22:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48392) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8xD-0000yW-9x for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:55 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:46649) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8xA-0003MY-Ua for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:54 -0400 Received: by mail-pj1-x1033.google.com with SMTP id h15-20020a17090a054f00b001cb7cd2b11dso12207472pjf.5 for ; Sun, 17 Apr 2022 10:44: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=/kQGH0Cy2HcRWOzQdszvWYCvmoLOtgBt5ZPwOUyma0Q=; b=wQAAsmyg3n5S4LCPwHVToO0VZ2joUjpYmEbZ+5t0AWJ0EgNje3FkibzaA+gW4ndzCp EMcj8aWHiRsksbK7rsBECqUAgNUt7DHZavxlvgUWi2cuamDnuRfAQZ2wadKYkGNDE4o+ uX9/JB/7NFYKHlD8d4kxFGGcYbDdeo1ua2n7otSJWjQE0IBfxC/woMGJHWi5iqtFqGLh jNYggpGlIR5kawCPT/E3aYUpJpBZNp/s4Yr9HSmzkmov03S+u5Loh1kDq9BjGVyDclgE cUjFYhpkSvZTXVpfBV79SMvSd7IouIHokZvdlFbGI5lxazmKjehWrbYzjKyvNpgg9r6M WBYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/kQGH0Cy2HcRWOzQdszvWYCvmoLOtgBt5ZPwOUyma0Q=; b=IaP6hXokvrA2AtAS+RoIsS0cI5JlYT4xNIAoCcOVoqcSUn3VuTSKYVhBSDW3WwELNJ 8SFjATCwfSCONyEVpfNdL52p31+CxPIqIGAaL/X8k7NX9GsYuLwb6pDMFykofOv4hYiz l3CddwE0utxJlJazBbDNZzRTgCnQ+0C77Mk3DX9PPri48YugLJRUE1uN7+BNqQVNzN4W XB1O2oefie4XP2z0v9eLLmSvc4OGSr43E5H+pcYV8CEyvUVbhGJNbk1PX8vPUPe6rrR6 LiVm4dp0Z5cq6fqWzVTxwpse21V1WVJCszxXr8hOinKJD2v2awYXwEX192w72uolPhnG ZBXQ== X-Gm-Message-State: AOAM532TAni9RTtOBVyMixZaPAPiUHTPuJ6ikQUbVEYAGHohOg5tLZsx PtRdmshpjLMXRFugkx6B4H+AlzsMmrDC9A== X-Received: by 2002:a17:902:e0ca:b0:158:cc0a:44f7 with SMTP id e10-20020a170902e0ca00b00158cc0a44f7mr7343242pla.70.1650217491599; Sun, 17 Apr 2022 10:44:51 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 25/60] target/arm: Reorg CPAccessResult and access_check_cp_reg Date: Sun, 17 Apr 2022 10:43:51 -0700 Message-Id: <20220417174426.711829-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Rearrange the values of the enumerators of CPAccessResult so that we may directly extract the target el. For the two special cases in access_check_cp_reg, use CPAccessResult. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Reviewed-by: Alex Bennée --- target/arm/cpregs.h | 26 ++++++++++++-------- target/arm/op_helper.c | 56 +++++++++++++++++++++--------------------- 2 files changed, 44 insertions(+), 38 deletions(-) diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h index 005aa2d3a5..700fcc1478 100644 --- a/target/arm/cpregs.h +++ b/target/arm/cpregs.h @@ -167,26 +167,32 @@ static inline bool cptype_valid(int cptype) typedef enum CPAccessResult { /* Access is permitted */ CP_ACCESS_OK = 0, + + /* + * Combined with one of the following, the low 2 bits indicate the + * target exception level. If 0, the exception is taken to the usual + * target EL (EL1 or PL1 if in EL0, otherwise to the current EL). + */ + CP_ACCESS_EL_MASK = 3, + /* * Access fails due to a configurable trap or enable which would * result in a categorized exception syndrome giving information about * the failing instruction (ie syndrome category 0x3, 0x4, 0x5, 0x6, - * 0xc or 0x18). The exception is taken to the usual target EL (EL1 or - * PL1 if in EL0, otherwise to the current EL). + * 0xc or 0x18). */ - CP_ACCESS_TRAP = 1, + CP_ACCESS_TRAP = (1 << 2), + CP_ACCESS_TRAP_EL2 = CP_ACCESS_TRAP | 2, + CP_ACCESS_TRAP_EL3 = CP_ACCESS_TRAP | 3, + /* * Access fails and results in an exception syndrome 0x0 ("uncategorized"). * Note that this is not a catch-all case -- the set of cases which may * result in this failure is specifically defined by the architecture. */ - CP_ACCESS_TRAP_UNCATEGORIZED = 2, - /* As CP_ACCESS_TRAP, but for traps directly to EL2 or EL3 */ - CP_ACCESS_TRAP_EL2 = 3, - CP_ACCESS_TRAP_EL3 = 4, - /* As CP_ACCESS_UNCATEGORIZED, but for traps directly to EL2 or EL3 */ - CP_ACCESS_TRAP_UNCATEGORIZED_EL2 = 5, - CP_ACCESS_TRAP_UNCATEGORIZED_EL3 = 6, + CP_ACCESS_TRAP_UNCATEGORIZED = (2 << 2), + CP_ACCESS_TRAP_UNCATEGORIZED_EL2 = CP_ACCESS_TRAP_UNCATEGORIZED | 2, + CP_ACCESS_TRAP_UNCATEGORIZED_EL3 = CP_ACCESS_TRAP_UNCATEGORIZED | 3, } CPAccessResult; typedef struct ARMCPRegInfo ARMCPRegInfo; diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 67be91c732..76499ffa14 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -632,11 +632,13 @@ void HELPER(access_check_cp_reg)(CPUARMState *env, void *rip, uint32_t syndrome, uint32_t isread) { const ARMCPRegInfo *ri = rip; + CPAccessResult res = CP_ACCESS_OK; int target_el; if (arm_feature(env, ARM_FEATURE_XSCALE) && ri->cp < 14 && extract32(env->cp15.c15_cpar, ri->cp, 1) == 0) { - raise_exception(env, EXCP_UDEF, syndrome, exception_target_el(env)); + res = CP_ACCESS_TRAP; + goto fail; } /* @@ -655,48 +657,46 @@ void HELPER(access_check_cp_reg)(CPUARMState *env, void *rip, uint32_t syndrome, mask &= ~((1 << 4) | (1 << 14)); if (env->cp15.hstr_el2 & mask) { - target_el = 2; - goto exept; + res = CP_ACCESS_TRAP_EL2; + goto fail; } } - if (!ri->accessfn) { + if (ri->accessfn) { + res = ri->accessfn(env, ri, isread); + } + if (likely(res == CP_ACCESS_OK)) { return; } - switch (ri->accessfn(env, ri, isread)) { - case CP_ACCESS_OK: - return; + fail: + switch (res & ~CP_ACCESS_EL_MASK) { case CP_ACCESS_TRAP: - target_el = exception_target_el(env); - break; - case CP_ACCESS_TRAP_EL2: - /* Requesting a trap to EL2 when we're in EL3 is - * a bug in the access function. - */ - assert(arm_current_el(env) != 3); - target_el = 2; - break; - case CP_ACCESS_TRAP_EL3: - target_el = 3; break; case CP_ACCESS_TRAP_UNCATEGORIZED: - target_el = exception_target_el(env); - syndrome = syn_uncategorized(); - break; - case CP_ACCESS_TRAP_UNCATEGORIZED_EL2: - target_el = 2; - syndrome = syn_uncategorized(); - break; - case CP_ACCESS_TRAP_UNCATEGORIZED_EL3: - target_el = 3; syndrome = syn_uncategorized(); break; default: g_assert_not_reached(); } -exept: + target_el = res & CP_ACCESS_EL_MASK; + switch (target_el) { + case 0: + target_el = exception_target_el(env); + break; + case 2: + assert(arm_current_el(env) != 3); + assert(arm_is_el2_enabled(env)); + break; + case 3: + assert(arm_feature(env, ARM_FEATURE_EL3)); + break; + default: + /* No "direct" traps to EL1 */ + g_assert_not_reached(); + } + raise_exception(env, EXCP_UDEF, syndrome, target_el); } From patchwork Sun Apr 17 17:43:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562837 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1861335map; Sun, 17 Apr 2022 11:06:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzY7qAO1r2Omh/TiDFT8YzA/na/0XW3spMde7EN+JXRSViRmnarQYMSsKx2P/jmNM5Uw37 X-Received: by 2002:a05:620a:1a17:b0:69c:669c:1032 with SMTP id bk23-20020a05620a1a1700b0069c669c1032mr4677112qkb.377.1650218819554; Sun, 17 Apr 2022 11:06:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650218819; cv=none; d=google.com; s=arc-20160816; b=nRxgdbpieO8k6Kge4Tojj+SD16oYPRnYffkxwjBr2iuxpSx5eZQcARL4wG2BkwtUsA dTB96iDeZCp1xtTR/+/CtZZZLoQIpK/DRUp0bpoV0TzWwJiJzsdPSvxzbEfr9W2I8rc6 Cxt8rWPIhBUFl7T2kHM0Ic+Jq3Pzit5C1a4leNrRpEakxPVSHPoD1COzOGcTp7fmSkZ1 nTctQc5blV4J68+5jSCp/xSwo30wl1hx81Fhm/mIgRvBjQaRlMPKb6/6xo+rp8pEYRmN 7ndsfUww8Cptfu5rWSPJ903IvwG0ufrG0pKkLpCyejLjEIn74vy3ICYdMYm7xcNAmLWy 9EZg== 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=Gkgsg3onX5Hjd+QC7tmsSKQPPIxaAKKPbGO7yUYNElE=; b=z22BrEUmX/snjKPA+Vmb+otb6yXMioJ6kgKYFG9CfRnU1h3x7bRMgSC9gds93NrTIH Bwew4rsfDNfyXwKZguhJ0ktcqAza0XjiM3czFGv1+1E2uyQQpO3GQNCVl4mW3Jj3ln8P Lcnz4Lxh9hxc/2jl1nlkAsXx03htLM/h+8A0uLAX5UgljLommLhr+embxvjDUSuOS12S tkOQfHa7ADFq0tnsRs55v14BNrYnZNC1f1sHR/a4LzHFqM2lyGWnRgvyf614ejy5pLu+ qpUDme3uxp0/qMgmker0J+J067NAjUKfRQvDc4TmidN0anOl/pJ/vmDPo6k1ooey2fOg IZNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=umJh2AFu; 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 m19-20020a05620a24d300b0067e4be23a0bsi2622022qkn.592.2022.04.17.11.06.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:06:59 -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=umJh2AFu; 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]:48822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9IZ-00016o-21 for patch@linaro.org; Sun, 17 Apr 2022 14:06:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8xG-00017n-5c for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:58 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]:37663) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8xC-0003Mz-7h for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:57 -0400 Received: by mail-pg1-x52d.google.com with SMTP id t184so1964540pgd.4 for ; Sun, 17 Apr 2022 10:44:53 -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=Gkgsg3onX5Hjd+QC7tmsSKQPPIxaAKKPbGO7yUYNElE=; b=umJh2AFu+eFcKCMhFALZXsAWF9bQ1+3PXOcaeH0ztFhm66dA4WPK2l4qysFtQQi8X8 e1PiAzZamzJatA78kTzaZk2wCrbKjhI2I1EZa07SlaEdnhDkqYt5W/PXFCw+egnGqdAj DlI30Mzj/WM4mpEiyXoCxzn2Rc2kTQEtcrzrU8yEEkTMDlyfYnQ7SPcy/i0ned0/F2V1 zCIhBfEayA7MG3U+Y/dACmDtu+S1XKko8IJTcW+ZCy6ofUqnuiQariVhctxjL6t9DwmM AHVBVo2enRPkKhPNgq9gbe9FLXgIUS+Z8hA3GOhaPs1IBoPRM5hpbh3T7vQzgGO8lHMD wsvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Gkgsg3onX5Hjd+QC7tmsSKQPPIxaAKKPbGO7yUYNElE=; b=MqnEEySIDzsLzUEbZQgRolAidL9YVr2YKzPKENzz//XVpaikWRcrInwA5FJvpQhyJM 7xzEEjk0J3wrI92J3NwNtQpXFPklZXowJUtZGmkNwFh4aTFvAT/wRSJthi0HmZuCpUTy xn3be+TkA1Wogx6Cth/yivhzi3SEYDEfCFIDzF3ECbnAdcXrx/PnDJld2xtqJ4X3GwTq cfSwnlyO4E2MBkAmkIDAa6ECL9PIeDk752NvLa537l/dQofrBSjyoBuVYnAYgscPcHxN AzENy5zo5+VGsYg9LSlQtRuaefNACqLlkHlE6hv6lENkPT74I9385A8kzbJme55xu4/t EOPg== X-Gm-Message-State: AOAM531NklVItKx+tYhKdH/9eEBi3VKR9Hjhz7+hERz9zCOLHd3br8GL wT3lyDIG5ZULzqQuXyRD6mK3kHIwwiQsJg== X-Received: by 2002:a63:fb05:0:b0:39d:a07b:cf4 with SMTP id o5-20020a63fb05000000b0039da07b0cf4mr7168606pgh.440.1650217492723; Sun, 17 Apr 2022 10:44:52 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 26/60] target/arm: Replace sentinels with ARRAY_SIZE in cpregs.h Date: Sun, 17 Apr 2022 10:43:52 -0700 Message-Id: <20220417174426.711829-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52d; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52d.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Remove a possible source of error by removing REGINFO_SENTINEL and using ARRAY_SIZE (convinently hidden inside a macro) to find the end of the set of regs being registered or modified. The space saved by not having the extra array element reduces the executable's .data.rel.ro section by about 9k. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Reviewed-by: Alex Bennée --- target/arm/cpregs.h | 57 +++++++++++--------- hw/arm/pxa2xx.c | 1 - hw/arm/pxa2xx_pic.c | 1 - hw/intc/arm_gicv3_cpuif.c | 5 -- hw/intc/arm_gicv3_kvm.c | 1 - target/arm/cpu64.c | 1 - target/arm/cpu_tcg.c | 4 -- target/arm/helper.c | 111 ++++++++------------------------------ 8 files changed, 52 insertions(+), 129 deletions(-) diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h index 700fcc1478..bd321d6d23 100644 --- a/target/arm/cpregs.h +++ b/target/arm/cpregs.h @@ -71,8 +71,6 @@ #define ARM_CP_NO_GDB 0x4000 #define ARM_CP_RAISES_EXC 0x8000 #define ARM_CP_NEWEL 0x10000 -/* Used only as a terminator for ARMCPRegInfo lists */ -#define ARM_CP_SENTINEL 0xfffff /* Mask of only the flag bits in a type field */ #define ARM_CP_FLAG_MASK 0x1f0ff @@ -108,18 +106,6 @@ enum { ARM_CP_SECSTATE_NS = (1 << 1), /* bit[1]: Non-secure state register */ }; -/* - * Return true if cptype is a valid type field. This is used to try to - * catch errors where the sentinel has been accidentally left off the end - * of a list of registers. - */ -static inline bool cptype_valid(int cptype) -{ - return ((cptype & ~ARM_CP_FLAG_MASK) == 0) - || ((cptype & ARM_CP_SPECIAL) && - ((cptype & ~ARM_CP_FLAG_MASK) <= ARM_LAST_SPECIAL)); -} - /* * Access rights: * We define bits for Read and Write access for what rev C of the v7-AR ARM ARM @@ -346,20 +332,31 @@ struct ARMCPRegInfo { #define CPREG_FIELD64(env, ri) \ (*(uint64_t *)((char *)(env) + (ri)->fieldoffset)) -#define REGINFO_SENTINEL { .type = ARM_CP_SENTINEL } +void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu, const ARMCPRegInfo *reg, + void *opaque); -void define_arm_cp_regs_with_opaque(ARMCPU *cpu, - const ARMCPRegInfo *regs, void *opaque); -void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu, - const ARMCPRegInfo *regs, void *opaque); -static inline void define_arm_cp_regs(ARMCPU *cpu, const ARMCPRegInfo *regs) -{ - define_arm_cp_regs_with_opaque(cpu, regs, 0); -} static inline void define_one_arm_cp_reg(ARMCPU *cpu, const ARMCPRegInfo *regs) { - define_one_arm_cp_reg_with_opaque(cpu, regs, 0); + define_one_arm_cp_reg_with_opaque(cpu, regs, NULL); } + +void define_arm_cp_regs_with_opaque_len(ARMCPU *cpu, const ARMCPRegInfo *regs, + void *opaque, size_t len); + +#define define_arm_cp_regs_with_opaque(CPU, REGS, OPAQUE) \ + do { \ + QEMU_BUILD_BUG_ON(ARRAY_SIZE(REGS) == 0); \ + if (ARRAY_SIZE(REGS) == 1) { \ + define_one_arm_cp_reg_with_opaque(CPU, REGS, OPAQUE); \ + } else { \ + define_arm_cp_regs_with_opaque_len(CPU, REGS, OPAQUE, \ + ARRAY_SIZE(REGS)); \ + } \ + } while (0) + +#define define_arm_cp_regs(CPU, REGS) \ + define_arm_cp_regs_with_opaque(CPU, REGS, NULL) + const ARMCPRegInfo *get_arm_cp_reginfo(GHashTable *cpregs, uint32_t encoded_cp); /* @@ -382,9 +379,17 @@ typedef struct ARMCPRegUserSpaceInfo { uint64_t fixed_bits; } ARMCPRegUserSpaceInfo; -#define REGUSERINFO_SENTINEL { .name = NULL } +void modify_arm_cp_regs_with_len(ARMCPRegInfo *regs, size_t regs_len, + const ARMCPRegUserSpaceInfo *mods, + size_t mods_len); -void modify_arm_cp_regs(ARMCPRegInfo *regs, const ARMCPRegUserSpaceInfo *mods); +#define modify_arm_cp_regs(REGS, MODS) \ + do { \ + QEMU_BUILD_BUG_ON(ARRAY_SIZE(REGS) == 0); \ + QEMU_BUILD_BUG_ON(ARRAY_SIZE(MODS) == 0); \ + modify_arm_cp_regs_with_len(REGS, ARRAY_SIZE(REGS), \ + MODS, ARRAY_SIZE(MODS)); \ + } while (0) /* CPWriteFn that can be used to implement writes-ignored behaviour */ void arm_cp_write_ignore(CPUARMState *env, const ARMCPRegInfo *ri, diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c index 0683714733..f4f687df68 100644 --- a/hw/arm/pxa2xx.c +++ b/hw/arm/pxa2xx.c @@ -384,7 +384,6 @@ static const ARMCPRegInfo pxa_cp_reginfo[] = { { .name = "PWRMODE", .cp = 14, .crn = 7, .crm = 0, .opc1 = 0, .opc2 = 0, .access = PL1_RW, .type = ARM_CP_IO, .readfn = arm_cp_read_zero, .writefn = pxa2xx_pwrmode_write }, - REGINFO_SENTINEL }; static void pxa2xx_setup_cp14(PXA2xxState *s) diff --git a/hw/arm/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c index b80d75d839..47132ab982 100644 --- a/hw/arm/pxa2xx_pic.c +++ b/hw/arm/pxa2xx_pic.c @@ -257,7 +257,6 @@ static const ARMCPRegInfo pxa_pic_cp_reginfo[] = { REGINFO_FOR_PIC_CP("ICLR2", 8), REGINFO_FOR_PIC_CP("ICFP2", 9), REGINFO_FOR_PIC_CP("ICPR2", 0xa), - REGINFO_SENTINEL }; static const MemoryRegionOps pxa2xx_pic_ops = { diff --git a/hw/intc/arm_gicv3_cpuif.c b/hw/intc/arm_gicv3_cpuif.c index d43ba970f9..a4c08f2ff9 100644 --- a/hw/intc/arm_gicv3_cpuif.c +++ b/hw/intc/arm_gicv3_cpuif.c @@ -2309,7 +2309,6 @@ static const ARMCPRegInfo gicv3_cpuif_reginfo[] = { .readfn = icc_igrpen1_el3_read, .writefn = icc_igrpen1_el3_write, }, - REGINFO_SENTINEL }; static uint64_t ich_ap_read(CPUARMState *env, const ARMCPRegInfo *ri) @@ -2559,7 +2558,6 @@ static const ARMCPRegInfo gicv3_cpuif_hcr_reginfo[] = { .readfn = ich_vmcr_read, .writefn = ich_vmcr_write, }, - REGINFO_SENTINEL }; static const ARMCPRegInfo gicv3_cpuif_ich_apxr1_reginfo[] = { @@ -2577,7 +2575,6 @@ static const ARMCPRegInfo gicv3_cpuif_ich_apxr1_reginfo[] = { .readfn = ich_ap_read, .writefn = ich_ap_write, }, - REGINFO_SENTINEL }; static const ARMCPRegInfo gicv3_cpuif_ich_apxr23_reginfo[] = { @@ -2609,7 +2606,6 @@ static const ARMCPRegInfo gicv3_cpuif_ich_apxr23_reginfo[] = { .readfn = ich_ap_read, .writefn = ich_ap_write, }, - REGINFO_SENTINEL }; static void gicv3_cpuif_el_change_hook(ARMCPU *cpu, void *opaque) @@ -2678,7 +2674,6 @@ void gicv3_init_cpuif(GICv3State *s) .readfn = ich_lr_read, .writefn = ich_lr_write, }, - REGINFO_SENTINEL }; define_arm_cp_regs(cpu, lr_regset); } diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c index ed2a583b0c..36accae257 100644 --- a/hw/intc/arm_gicv3_kvm.c +++ b/hw/intc/arm_gicv3_kvm.c @@ -735,7 +735,6 @@ static const ARMCPRegInfo gicv3_cpuif_reginfo[] = { */ .resetfn = arm_gicv3_icc_reset, }, - REGINFO_SENTINEL }; /** diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 9561714c23..c40373bd18 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -91,7 +91,6 @@ static const ARMCPRegInfo cortex_a72_a57_a53_cp_reginfo[] = { { .name = "L2MERRSR", .cp = 15, .opc1 = 3, .crm = 15, .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, - REGINFO_SENTINEL }; static void aarch64_a57_initfn(Object *obj) diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c index 0e693b182e..9338088b22 100644 --- a/target/arm/cpu_tcg.c +++ b/target/arm/cpu_tcg.c @@ -264,7 +264,6 @@ static const ARMCPRegInfo cortexa8_cp_reginfo[] = { .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, { .name = "L2AUXCR", .cp = 15, .crn = 9, .crm = 0, .opc1 = 1, .opc2 = 2, .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - REGINFO_SENTINEL }; static void cortex_a8_initfn(Object *obj) @@ -332,7 +331,6 @@ static const ARMCPRegInfo cortexa9_cp_reginfo[] = { .access = PL1_RW, .resetvalue = 0, .type = ARM_CP_CONST }, { .name = "TLB_ATTR", .cp = 15, .crn = 15, .crm = 7, .opc1 = 5, .opc2 = 2, .access = PL1_RW, .resetvalue = 0, .type = ARM_CP_CONST }, - REGINFO_SENTINEL }; static void cortex_a9_initfn(Object *obj) @@ -398,7 +396,6 @@ static const ARMCPRegInfo cortexa15_cp_reginfo[] = { #endif { .name = "L2ECTLR", .cp = 15, .crn = 9, .crm = 0, .opc1 = 1, .opc2 = 3, .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - REGINFO_SENTINEL }; static void cortex_a7_initfn(Object *obj) @@ -686,7 +683,6 @@ static const ARMCPRegInfo cortexr5_cp_reginfo[] = { .access = PL1_RW, .type = ARM_CP_CONST }, { .name = "DCACHE_INVAL", .cp = 15, .opc1 = 0, .crn = 15, .crm = 5, .opc2 = 0, .access = PL1_W, .type = ARM_CP_NOP }, - REGINFO_SENTINEL }; static void cortex_r5_initfn(Object *obj) diff --git a/target/arm/helper.c b/target/arm/helper.c index 8928ffb6a7..d6c34c7826 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -674,7 +674,6 @@ static const ARMCPRegInfo cp_reginfo[] = { .secure = ARM_CP_SECSTATE_S, .fieldoffset = offsetof(CPUARMState, cp15.contextidr_s), .resetvalue = 0, .writefn = contextidr_write, .raw_writefn = raw_write, }, - REGINFO_SENTINEL }; static const ARMCPRegInfo not_v8_cp_reginfo[] = { @@ -703,7 +702,6 @@ static const ARMCPRegInfo not_v8_cp_reginfo[] = { { .name = "CACHEMAINT", .cp = 15, .crn = 7, .crm = CP_ANY, .opc1 = 0, .opc2 = CP_ANY, .access = PL1_W, .type = ARM_CP_NOP | ARM_CP_OVERRIDE }, - REGINFO_SENTINEL }; static const ARMCPRegInfo not_v6_cp_reginfo[] = { @@ -712,7 +710,6 @@ static const ARMCPRegInfo not_v6_cp_reginfo[] = { */ { .name = "WFI_v5", .cp = 15, .crn = 7, .crm = 8, .opc1 = 0, .opc2 = 2, .access = PL1_W, .type = ARM_CP_WFI }, - REGINFO_SENTINEL }; static const ARMCPRegInfo not_v7_cp_reginfo[] = { @@ -761,7 +758,6 @@ static const ARMCPRegInfo not_v7_cp_reginfo[] = { .opc1 = 0, .opc2 = 0, .access = PL1_RW, .type = ARM_CP_NOP }, { .name = "NMRR", .cp = 15, .crn = 10, .crm = 2, .opc1 = 0, .opc2 = 1, .access = PL1_RW, .type = ARM_CP_NOP }, - REGINFO_SENTINEL }; static void cpacr_write(CPUARMState *env, const ARMCPRegInfo *ri, @@ -890,7 +886,6 @@ static const ARMCPRegInfo v6_cp_reginfo[] = { .crn = 1, .crm = 0, .opc1 = 0, .opc2 = 2, .accessfn = cpacr_access, .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.cpacr_el1), .resetfn = cpacr_reset, .writefn = cpacr_write, .readfn = cpacr_read }, - REGINFO_SENTINEL }; typedef struct pm_event { @@ -2136,7 +2131,6 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { { .name = "TLBIMVAA", .cp = 15, .opc1 = 0, .crn = 8, .crm = 7, .opc2 = 3, .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb, .writefn = tlbimvaa_write }, - REGINFO_SENTINEL }; static const ARMCPRegInfo v7mp_cp_reginfo[] = { @@ -2153,7 +2147,6 @@ static const ARMCPRegInfo v7mp_cp_reginfo[] = { { .name = "TLBIMVAAIS", .cp = 15, .opc1 = 0, .crn = 8, .crm = 3, .opc2 = 3, .type = ARM_CP_NO_RAW, .access = PL1_W, .accessfn = access_ttlb, .writefn = tlbimvaa_is_write }, - REGINFO_SENTINEL }; static const ARMCPRegInfo pmovsset_cp_reginfo[] = { @@ -2171,7 +2164,6 @@ static const ARMCPRegInfo pmovsset_cp_reginfo[] = { .fieldoffset = offsetof(CPUARMState, cp15.c9_pmovsr), .writefn = pmovsset_write, .raw_writefn = raw_write }, - REGINFO_SENTINEL }; static void teecr_write(CPUARMState *env, const ARMCPRegInfo *ri, @@ -2212,7 +2204,6 @@ static const ARMCPRegInfo t2ee_cp_reginfo[] = { { .name = "TEEHBR", .cp = 14, .crn = 1, .crm = 0, .opc1 = 6, .opc2 = 0, .access = PL0_RW, .fieldoffset = offsetof(CPUARMState, teehbr), .accessfn = teehbr_access, .resetvalue = 0 }, - REGINFO_SENTINEL }; static const ARMCPRegInfo v6k_cp_reginfo[] = { @@ -2244,7 +2235,6 @@ static const ARMCPRegInfo v6k_cp_reginfo[] = { .bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.tpidrprw_s), offsetoflow32(CPUARMState, cp15.tpidrprw_ns) }, .resetvalue = 0 }, - REGINFO_SENTINEL }; #ifndef CONFIG_USER_ONLY @@ -3092,7 +3082,6 @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { .fieldoffset = offsetof(CPUARMState, cp15.c14_timer[GTIMER_SEC].cval), .writefn = gt_sec_cval_write, .raw_writefn = raw_write, }, - REGINFO_SENTINEL }; static CPAccessResult e2h_access(CPUARMState *env, const ARMCPRegInfo *ri, @@ -3133,7 +3122,6 @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = { .access = PL0_R, .type = ARM_CP_NO_RAW | ARM_CP_IO, .readfn = gt_virt_cnt_read, }, - REGINFO_SENTINEL }; #endif @@ -3497,7 +3485,6 @@ static const ARMCPRegInfo vapa_cp_reginfo[] = { .access = PL1_W, .accessfn = ats_access, .writefn = ats_write, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC }, #endif - REGINFO_SENTINEL }; /* Return basic MPU access permission bits. */ @@ -3620,7 +3607,6 @@ static const ARMCPRegInfo pmsav7_cp_reginfo[] = { .fieldoffset = offsetof(CPUARMState, pmsav7.rnr[M_REG_NS]), .writefn = pmsav7_rgnr_write, .resetfn = arm_cp_reset_ignore }, - REGINFO_SENTINEL }; static const ARMCPRegInfo pmsav5_cp_reginfo[] = { @@ -3671,7 +3657,6 @@ static const ARMCPRegInfo pmsav5_cp_reginfo[] = { { .name = "946_PRBS7", .cp = 15, .crn = 6, .crm = 7, .opc1 = 0, .opc2 = CP_ANY, .access = PL1_RW, .resetvalue = 0, .fieldoffset = offsetof(CPUARMState, cp15.c6_region[7]) }, - REGINFO_SENTINEL }; static void vmsa_ttbcr_raw_write(CPUARMState *env, const ARMCPRegInfo *ri, @@ -3825,7 +3810,6 @@ static const ARMCPRegInfo vmsa_pmsa_cp_reginfo[] = { .access = PL1_RW, .accessfn = access_tvm_trvm, .fieldoffset = offsetof(CPUARMState, cp15.far_el[1]), .resetvalue = 0, }, - REGINFO_SENTINEL }; static const ARMCPRegInfo vmsa_cp_reginfo[] = { @@ -3858,7 +3842,6 @@ static const ARMCPRegInfo vmsa_cp_reginfo[] = { /* No offsetoflow32 -- pass the entire TCR to writefn/raw_writefn. */ .bank_fieldoffsets = { offsetof(CPUARMState, cp15.tcr_el[3]), offsetof(CPUARMState, cp15.tcr_el[1])} }, - REGINFO_SENTINEL }; /* Note that unlike TTBCR, writing to TTBCR2 does not require flushing @@ -3943,7 +3926,6 @@ static const ARMCPRegInfo omap_cp_reginfo[] = { { .name = "C9", .cp = 15, .crn = 9, .crm = CP_ANY, .opc1 = CP_ANY, .opc2 = CP_ANY, .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_OVERRIDE, .resetvalue = 0 }, - REGINFO_SENTINEL }; static void xscale_cpar_write(CPUARMState *env, const ARMCPRegInfo *ri, @@ -3976,7 +3958,6 @@ static const ARMCPRegInfo xscale_cp_reginfo[] = { { .name = "XSCALE_UNLOCK_DCACHE", .cp = 15, .opc1 = 0, .crn = 9, .crm = 2, .opc2 = 1, .access = PL1_W, .type = ARM_CP_NOP }, - REGINFO_SENTINEL }; static const ARMCPRegInfo dummy_c15_cp_reginfo[] = { @@ -3990,7 +3971,6 @@ static const ARMCPRegInfo dummy_c15_cp_reginfo[] = { .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_NO_RAW | ARM_CP_OVERRIDE, .resetvalue = 0 }, - REGINFO_SENTINEL }; static const ARMCPRegInfo cache_dirty_status_cp_reginfo[] = { @@ -3998,7 +3978,6 @@ static const ARMCPRegInfo cache_dirty_status_cp_reginfo[] = { { .name = "CDSR", .cp = 15, .crn = 7, .crm = 10, .opc1 = 0, .opc2 = 6, .access = PL1_R, .type = ARM_CP_CONST | ARM_CP_NO_RAW, .resetvalue = 0 }, - REGINFO_SENTINEL }; static const ARMCPRegInfo cache_block_ops_cp_reginfo[] = { @@ -4019,7 +3998,6 @@ static const ARMCPRegInfo cache_block_ops_cp_reginfo[] = { .access = PL0_W, .type = ARM_CP_NOP|ARM_CP_64BIT }, { .name = "CIDCR", .cp = 15, .crm = 14, .opc1 = 0, .access = PL1_W, .type = ARM_CP_NOP|ARM_CP_64BIT }, - REGINFO_SENTINEL }; static const ARMCPRegInfo cache_test_clean_cp_reginfo[] = { @@ -4032,7 +4010,6 @@ static const ARMCPRegInfo cache_test_clean_cp_reginfo[] = { { .name = "TCI_DCACHE", .cp = 15, .crn = 7, .crm = 14, .opc1 = 0, .opc2 = 3, .access = PL0_R, .type = ARM_CP_CONST | ARM_CP_NO_RAW, .resetvalue = (1 << 30) }, - REGINFO_SENTINEL }; static const ARMCPRegInfo strongarm_cp_reginfo[] = { @@ -4041,7 +4018,6 @@ static const ARMCPRegInfo strongarm_cp_reginfo[] = { .crm = CP_ANY, .opc1 = CP_ANY, .opc2 = CP_ANY, .access = PL1_RW, .resetvalue = 0, .type = ARM_CP_CONST | ARM_CP_OVERRIDE | ARM_CP_NO_RAW }, - REGINFO_SENTINEL }; static uint64_t midr_read(CPUARMState *env, const ARMCPRegInfo *ri) @@ -4108,7 +4084,6 @@ static const ARMCPRegInfo lpae_cp_reginfo[] = { .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr1_s), offsetof(CPUARMState, cp15.ttbr1_ns) }, .writefn = vmsa_ttbr_write, }, - REGINFO_SENTINEL }; static uint64_t aa64_fpcr_read(CPUARMState *env, const ARMCPRegInfo *ri) @@ -5127,7 +5102,6 @@ static const ARMCPRegInfo v8_cp_reginfo[] = { .access = PL1_RW, .accessfn = access_trap_aa32s_el1, .writefn = sdcr_write, .fieldoffset = offsetoflow32(CPUARMState, cp15.mdcr_el3) }, - REGINFO_SENTINEL }; /* Used to describe the behaviour of EL2 regs when EL2 does not exist. */ @@ -5238,7 +5212,6 @@ static const ARMCPRegInfo el3_no_el2_cp_reginfo[] = { .type = ARM_CP_CONST, .cp = 15, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 2, .access = PL2_RW, .resetvalue = 0 }, - REGINFO_SENTINEL }; /* Ditto, but for registers which exist in ARMv8 but not v7 */ @@ -5247,7 +5220,6 @@ static const ARMCPRegInfo el3_no_el2_v8_cp_reginfo[] = { .cp = 15, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 4, .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - REGINFO_SENTINEL }; static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask) @@ -5680,7 +5652,6 @@ static const ARMCPRegInfo el2_cp_reginfo[] = { .cp = 15, .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 3, .access = PL2_RW, .fieldoffset = offsetof(CPUARMState, cp15.hstr_el2) }, - REGINFO_SENTINEL }; static const ARMCPRegInfo el2_v8_cp_reginfo[] = { @@ -5690,7 +5661,6 @@ static const ARMCPRegInfo el2_v8_cp_reginfo[] = { .access = PL2_RW, .fieldoffset = offsetofhigh32(CPUARMState, cp15.hcr_el2), .writefn = hcr_writehigh }, - REGINFO_SENTINEL }; static CPAccessResult sel2_access(CPUARMState *env, const ARMCPRegInfo *ri, @@ -5711,7 +5681,6 @@ static const ARMCPRegInfo el2_sec_cp_reginfo[] = { .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 6, .opc2 = 2, .access = PL2_RW, .accessfn = sel2_access, .fieldoffset = offsetof(CPUARMState, cp15.vstcr_el2) }, - REGINFO_SENTINEL }; static CPAccessResult nsacr_access(CPUARMState *env, const ARMCPRegInfo *ri, @@ -5837,7 +5806,6 @@ static const ARMCPRegInfo el3_cp_reginfo[] = { .opc0 = 1, .opc1 = 6, .crn = 8, .crm = 7, .opc2 = 5, .access = PL3_W, .type = ARM_CP_NO_RAW, .writefn = tlbi_aa64_vae3_write }, - REGINFO_SENTINEL }; #ifndef CONFIG_USER_ONLY @@ -6123,7 +6091,6 @@ static const ARMCPRegInfo debug_cp_reginfo[] = { .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 0, .crm = 2, .opc2 = 0, .access = PL1_RW, .accessfn = access_tda, .type = ARM_CP_NOP }, - REGINFO_SENTINEL }; static const ARMCPRegInfo debug_lpae_cp_reginfo[] = { @@ -6132,7 +6099,6 @@ static const ARMCPRegInfo debug_lpae_cp_reginfo[] = { .access = PL0_R, .type = ARM_CP_CONST|ARM_CP_64BIT, .resetvalue = 0 }, { .name = "DBGDSAR", .cp = 14, .crm = 2, .opc1 = 0, .access = PL0_R, .type = ARM_CP_CONST|ARM_CP_64BIT, .resetvalue = 0 }, - REGINFO_SENTINEL }; /* Return the exception level to which exceptions should be taken @@ -6618,7 +6584,6 @@ static void define_debug_regs(ARMCPU *cpu) .fieldoffset = offsetof(CPUARMState, cp15.dbgbcr[i]), .writefn = dbgbcr_write, .raw_writefn = raw_write }, - REGINFO_SENTINEL }; define_arm_cp_regs(cpu, dbgregs); } @@ -6637,7 +6602,6 @@ static void define_debug_regs(ARMCPU *cpu) .fieldoffset = offsetof(CPUARMState, cp15.dbgwcr[i]), .writefn = dbgwcr_write, .raw_writefn = raw_write }, - REGINFO_SENTINEL }; define_arm_cp_regs(cpu, dbgregs); } @@ -6700,7 +6664,6 @@ static void define_pmu_regs(ARMCPU *cpu) .type = ARM_CP_IO, .readfn = pmevtyper_readfn, .writefn = pmevtyper_writefn, .raw_writefn = pmevtyper_rawwrite }, - REGINFO_SENTINEL }; define_arm_cp_regs(cpu, pmev_regs); g_free(pmevcntr_name); @@ -6718,7 +6681,6 @@ static void define_pmu_regs(ARMCPU *cpu) .cp = 15, .opc1 = 0, .crn = 9, .crm = 14, .opc2 = 5, .access = PL0_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, .resetvalue = extract64(cpu->pmceid1, 32, 32) }, - REGINFO_SENTINEL }; define_arm_cp_regs(cpu, v81_pmu_regs); } @@ -6815,7 +6777,6 @@ static const ARMCPRegInfo lor_reginfo[] = { .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 4, .opc2 = 7, .access = PL1_R, .accessfn = access_lor_ns, .type = ARM_CP_CONST, .resetvalue = 0 }, - REGINFO_SENTINEL }; #ifdef TARGET_AARCH64 @@ -6878,7 +6839,6 @@ static const ARMCPRegInfo pauth_reginfo[] = { .opc0 = 3, .opc1 = 0, .crn = 2, .crm = 1, .opc2 = 3, .access = PL1_RW, .accessfn = access_pauth, .fieldoffset = offsetof(CPUARMState, keys.apib.hi) }, - REGINFO_SENTINEL }; static const ARMCPRegInfo tlbirange_reginfo[] = { @@ -6990,7 +6950,6 @@ static const ARMCPRegInfo tlbirange_reginfo[] = { .opc0 = 1, .opc1 = 6, .crn = 8, .crm = 6, .opc2 = 5, .access = PL3_W, .type = ARM_CP_NO_RAW, .writefn = tlbi_aa64_rvae3_write }, - REGINFO_SENTINEL }; static const ARMCPRegInfo tlbios_reginfo[] = { @@ -7062,7 +7021,6 @@ static const ARMCPRegInfo tlbios_reginfo[] = { .opc0 = 1, .opc1 = 6, .crn = 8, .crm = 1, .opc2 = 5, .access = PL3_W, .type = ARM_CP_NO_RAW, .writefn = tlbi_aa64_vae3is_write }, - REGINFO_SENTINEL }; static uint64_t rndr_readfn(CPUARMState *env, const ARMCPRegInfo *ri) @@ -7101,7 +7059,6 @@ static const ARMCPRegInfo rndr_reginfo[] = { .type = ARM_CP_NO_RAW | ARM_CP_SUPPRESS_TB_END | ARM_CP_IO, .opc0 = 3, .opc1 = 3, .crn = 2, .crm = 4, .opc2 = 1, .access = PL0_R, .readfn = rndr_readfn }, - REGINFO_SENTINEL }; #ifndef CONFIG_USER_ONLY @@ -7137,7 +7094,6 @@ static const ARMCPRegInfo dcpop_reg[] = { .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 12, .opc2 = 1, .access = PL0_W, .type = ARM_CP_NO_RAW | ARM_CP_SUPPRESS_TB_END, .accessfn = aa64_cacheop_poc_access, .writefn = dccvap_writefn }, - REGINFO_SENTINEL }; static const ARMCPRegInfo dcpodp_reg[] = { @@ -7145,7 +7101,6 @@ static const ARMCPRegInfo dcpodp_reg[] = { .opc0 = 1, .opc1 = 3, .crn = 7, .crm = 13, .opc2 = 1, .access = PL0_W, .type = ARM_CP_NO_RAW | ARM_CP_SUPPRESS_TB_END, .accessfn = aa64_cacheop_poc_access, .writefn = dccvap_writefn }, - REGINFO_SENTINEL }; #endif /*CONFIG_USER_ONLY*/ @@ -7247,14 +7202,12 @@ static const ARMCPRegInfo mte_reginfo[] = { { .name = "DC_CIGDSW", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 14, .opc2 = 6, .type = ARM_CP_NOP, .access = PL1_W, .accessfn = access_tsw }, - REGINFO_SENTINEL }; static const ARMCPRegInfo mte_tco_ro_reginfo[] = { { .name = "TCO", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .crn = 4, .crm = 2, .opc2 = 7, .type = ARM_CP_CONST, .access = PL0_RW, }, - REGINFO_SENTINEL }; static const ARMCPRegInfo mte_el0_cacheop_reginfo[] = { @@ -7306,7 +7259,6 @@ static const ARMCPRegInfo mte_el0_cacheop_reginfo[] = { .accessfn = aa64_zva_access, #endif }, - REGINFO_SENTINEL }; #endif @@ -7352,7 +7304,6 @@ static const ARMCPRegInfo predinv_reginfo[] = { { .name = "CPPRCTX", .state = ARM_CP_STATE_AA32, .cp = 15, .opc1 = 0, .crn = 7, .crm = 3, .opc2 = 7, .type = ARM_CP_NOP, .access = PL0_W, .accessfn = access_predinv }, - REGINFO_SENTINEL }; static uint64_t ccsidr2_read(CPUARMState *env, const ARMCPRegInfo *ri) @@ -7367,7 +7318,6 @@ static const ARMCPRegInfo ccsidr2_reginfo[] = { .access = PL1_R, .accessfn = access_aa64_tid2, .readfn = ccsidr2_read, .type = ARM_CP_NO_RAW }, - REGINFO_SENTINEL }; static CPAccessResult access_aa64_tid3(CPUARMState *env, const ARMCPRegInfo *ri, @@ -7428,7 +7378,6 @@ static const ARMCPRegInfo jazelle_regs[] = { .cp = 14, .crn = 2, .crm = 0, .opc1 = 7, .opc2 = 0, .accessfn = access_joscr_jmcr, .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - REGINFO_SENTINEL }; static const ARMCPRegInfo vhe_reginfo[] = { @@ -7493,7 +7442,6 @@ static const ARMCPRegInfo vhe_reginfo[] = { .access = PL2_RW, .accessfn = e2h_access, .writefn = gt_virt_cval_write, .raw_writefn = raw_write }, #endif - REGINFO_SENTINEL }; #ifndef CONFIG_USER_ONLY @@ -7506,7 +7454,6 @@ static const ARMCPRegInfo ats1e1_reginfo[] = { .opc0 = 1, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 1, .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, .writefn = ats_write64 }, - REGINFO_SENTINEL }; static const ARMCPRegInfo ats1cp_reginfo[] = { @@ -7518,7 +7465,6 @@ static const ARMCPRegInfo ats1cp_reginfo[] = { .cp = 15, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 1, .access = PL1_W, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, .writefn = ats_write }, - REGINFO_SENTINEL }; #endif @@ -7540,7 +7486,6 @@ static const ARMCPRegInfo actlr2_hactlr2_reginfo[] = { .cp = 15, .opc1 = 4, .crn = 1, .crm = 0, .opc2 = 3, .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - REGINFO_SENTINEL }; void register_cp_regs_for_features(ARMCPU *cpu) @@ -7647,7 +7592,6 @@ void register_cp_regs_for_features(ARMCPU *cpu) .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_aa32_tid3, .resetvalue = cpu->isar.id_isar6 }, - REGINFO_SENTINEL }; define_arm_cp_regs(cpu, v6_idregs); define_arm_cp_regs(cpu, v6_cp_reginfo); @@ -7915,7 +7859,6 @@ void register_cp_regs_for_features(ARMCPU *cpu) .opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 7, .access = PL0_R, .accessfn = pmreg_access, .type = ARM_CP_CONST, .resetvalue = cpu->pmceid1 }, - REGINFO_SENTINEL }; #ifdef CONFIG_USER_ONLY ARMCPRegUserSpaceInfo v8_user_idregs[] = { @@ -7945,7 +7888,6 @@ void register_cp_regs_for_features(ARMCPU *cpu) .exported_bits = 0x000000f0ffffffff }, { .name = "ID_AA64ISAR*_EL1_RESERVED", .is_glob = true }, - REGUSERINFO_SENTINEL }; modify_arm_cp_regs(v8_idregs, v8_user_idregs); #endif @@ -7985,7 +7927,6 @@ void register_cp_regs_for_features(ARMCPU *cpu) .access = PL2_RW, .resetvalue = vmpidr_def, .fieldoffset = offsetof(CPUARMState, cp15.vmpidr_el2) }, - REGINFO_SENTINEL }; define_arm_cp_regs(cpu, vpidr_regs); define_arm_cp_regs(cpu, el2_cp_reginfo); @@ -8024,7 +7965,6 @@ void register_cp_regs_for_features(ARMCPU *cpu) .access = PL2_RW, .accessfn = access_el3_aa32ns, .type = ARM_CP_NO_RAW, .writefn = arm_cp_write_ignore, .readfn = mpidr_read }, - REGINFO_SENTINEL }; define_arm_cp_regs(cpu, vpidr_regs); define_arm_cp_regs(cpu, el3_no_el2_cp_reginfo); @@ -8047,7 +7987,6 @@ void register_cp_regs_for_features(ARMCPU *cpu) .raw_writefn = raw_write, .writefn = sctlr_write, .fieldoffset = offsetof(CPUARMState, cp15.sctlr_el[3]), .resetvalue = cpu->reset_sctlr }, - REGINFO_SENTINEL }; define_arm_cp_regs(cpu, el3_regs); @@ -8182,7 +8121,6 @@ void register_cp_regs_for_features(ARMCPU *cpu) { .name = "DUMMY", .cp = 15, .crn = 0, .crm = 7, .opc1 = 0, .opc2 = CP_ANY, .access = PL1_R, .type = ARM_CP_CONST, .resetvalue = 0 }, - REGINFO_SENTINEL }; ARMCPRegInfo id_v8_midr_cp_reginfo[] = { { .name = "MIDR_EL1", .state = ARM_CP_STATE_BOTH, @@ -8202,7 +8140,6 @@ void register_cp_regs_for_features(ARMCPU *cpu) .access = PL1_R, .accessfn = access_aa64_tid1, .type = ARM_CP_CONST, .resetvalue = cpu->revidr }, - REGINFO_SENTINEL }; ARMCPRegInfo id_cp_reginfo[] = { /* These are common to v8 and pre-v8 */ @@ -8220,7 +8157,6 @@ void register_cp_regs_for_features(ARMCPU *cpu) .access = PL1_R, .accessfn = access_aa32_tid1, .type = ARM_CP_CONST, .resetvalue = 0 }, - REGINFO_SENTINEL }; /* TLBTR is specific to VMSA */ ARMCPRegInfo id_tlbtr_reginfo = { @@ -8247,25 +8183,23 @@ void register_cp_regs_for_features(ARMCPU *cpu) { .name = "MIDR_EL1", .exported_bits = 0x00000000ffffffff }, { .name = "REVIDR_EL1" }, - REGUSERINFO_SENTINEL }; modify_arm_cp_regs(id_v8_midr_cp_reginfo, id_v8_user_midr_cp_reginfo); #endif if (arm_feature(env, ARM_FEATURE_OMAPCP) || arm_feature(env, ARM_FEATURE_STRONGARM)) { - ARMCPRegInfo *r; + size_t i; /* Register the blanket "writes ignored" value first to cover the * whole space. Then update the specific ID registers to allow write * access, so that they ignore writes rather than causing them to * UNDEF. */ define_one_arm_cp_reg(cpu, &crn0_wi_reginfo); - for (r = id_pre_v8_midr_cp_reginfo; - r->type != ARM_CP_SENTINEL; r++) { - r->access = PL1_RW; + for (i = 0; i < ARRAY_SIZE(id_pre_v8_midr_cp_reginfo); ++i) { + id_pre_v8_midr_cp_reginfo[i].access = PL1_RW; } - for (r = id_cp_reginfo; r->type != ARM_CP_SENTINEL; r++) { - r->access = PL1_RW; + for (i = 0; i < ARRAY_SIZE(id_cp_reginfo); ++i) { + id_cp_reginfo[i].access = PL1_RW; } id_mpuir_reginfo.access = PL1_RW; id_tlbtr_reginfo.access = PL1_RW; @@ -8288,13 +8222,11 @@ void register_cp_regs_for_features(ARMCPU *cpu) { .name = "MPIDR_EL1", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .crn = 0, .crm = 0, .opc1 = 0, .opc2 = 5, .access = PL1_R, .readfn = mpidr_read, .type = ARM_CP_NO_RAW }, - REGINFO_SENTINEL }; #ifdef CONFIG_USER_ONLY ARMCPRegUserSpaceInfo mpidr_user_cp_reginfo[] = { { .name = "MPIDR_EL1", .fixed_bits = 0x0000000080000000 }, - REGUSERINFO_SENTINEL }; modify_arm_cp_regs(mpidr_cp_reginfo, mpidr_user_cp_reginfo); #endif @@ -8315,7 +8247,6 @@ void register_cp_regs_for_features(ARMCPU *cpu) .opc0 = 3, .opc1 = 6, .crn = 1, .crm = 0, .opc2 = 1, .access = PL3_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - REGINFO_SENTINEL }; define_arm_cp_regs(cpu, auxcr_reginfo); if (cpu_isar_feature(aa32_ac2, cpu)) { @@ -8350,7 +8281,6 @@ void register_cp_regs_for_features(ARMCPU *cpu) .type = ARM_CP_CONST, .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 3, .opc2 = 0, .access = PL1_R, .resetvalue = cpu->reset_cbar }, - REGINFO_SENTINEL }; /* We don't implement a r/w 64 bit CBAR currently */ assert(arm_feature(env, ARM_FEATURE_CBAR_RO)); @@ -8380,7 +8310,6 @@ void register_cp_regs_for_features(ARMCPU *cpu) .bank_fieldoffsets = { offsetof(CPUARMState, cp15.vbar_s), offsetof(CPUARMState, cp15.vbar_ns) }, .resetvalue = 0 }, - REGINFO_SENTINEL }; define_arm_cp_regs(cpu, vbar_cp_reginfo); } @@ -8834,8 +8763,7 @@ void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu, r->writefn); } } - /* Bad type field probably means missing sentinel at end of reg list */ - assert(cptype_valid(r->type)); + for (crm = crmmin; crm <= crmmax; crm++) { for (opc1 = opc1min; opc1 <= opc1max; opc1++) { for (opc2 = opc2min; opc2 <= opc2max; opc2++) { @@ -8881,13 +8809,13 @@ void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu, } } -void define_arm_cp_regs_with_opaque(ARMCPU *cpu, - const ARMCPRegInfo *regs, void *opaque) +/* Define a whole list of registers */ +void define_arm_cp_regs_with_opaque_len(ARMCPU *cpu, const ARMCPRegInfo *regs, + void *opaque, size_t len) { - /* Define a whole list of registers */ - const ARMCPRegInfo *r; - for (r = regs; r->type != ARM_CP_SENTINEL; r++) { - define_one_arm_cp_reg_with_opaque(cpu, r, opaque); + size_t i; + for (i = 0; i < len; ++i) { + define_one_arm_cp_reg_with_opaque(cpu, regs + i, opaque); } } @@ -8899,17 +8827,20 @@ void define_arm_cp_regs_with_opaque(ARMCPU *cpu, * user-space cannot alter any values and dynamic values pertaining to * execution state are hidden from user space view anyway. */ -void modify_arm_cp_regs(ARMCPRegInfo *regs, const ARMCPRegUserSpaceInfo *mods) +void modify_arm_cp_regs_with_len(ARMCPRegInfo *regs, size_t regs_len, + const ARMCPRegUserSpaceInfo *mods, + size_t mods_len) { - const ARMCPRegUserSpaceInfo *m; - ARMCPRegInfo *r; - - for (m = mods; m->name; m++) { + for (size_t mi = 0; mi < mods_len; ++mi) { + const ARMCPRegUserSpaceInfo *m = mods + mi; GPatternSpec *pat = NULL; + if (m->is_glob) { pat = g_pattern_spec_new(m->name); } - for (r = regs; r->type != ARM_CP_SENTINEL; r++) { + for (size_t ri = 0; ri < regs_len; ++ri) { + ARMCPRegInfo *r = regs + ri; + if (pat && g_pattern_match_string(pat, r->name)) { r->type = ARM_CP_CONST; r->access = PL0U_R; From patchwork Sun Apr 17 17:43:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562839 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1862676map; Sun, 17 Apr 2022 11:09:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz25GTKFHD9S/5gz8+JCNHgzAjuRk1WW6weH6T2+5NCfxA6aaRpwgft1Pc2E93VyPfDK8Bl X-Received: by 2002:ad4:5bc1:0:b0:42c:37be:6ac3 with SMTP id t1-20020ad45bc1000000b0042c37be6ac3mr5922738qvt.18.1650218989641; Sun, 17 Apr 2022 11:09:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650218989; cv=none; d=google.com; s=arc-20160816; b=o5gGkUIzPPWrPbq9kLzYHTG+PyRiGM/w3Zql+YDbs0Zy28T5hWcqW6pCfcA7K8r+mD VWMyHI7AfJnY9/3wAC+oji8czh8zAuYW2raZHgWdm4cvXKqgGhxhMiRBXF6XklC1OovF O4sGXJ5VjPiHlvYg3l87NrSVro5Fm1kARPRavgkRA3WOhEorbevwkDpJ6DE4JbjHi2PA O6MfROEjWZhVwNu2hdwsQJMXJOXZjyicIOK7OnK6H85UdEfVSBEb6470akbXQmcuqvEN B5dI9ZpYomWQ9TmXHH/ttSt/yLT6EYgXsyNa66YrH62XdKTiHs0A3YdOZaia+NgKZQHk Xvow== 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=YXryGBC0mqaWtLXkO2uZG/YEkw1cD0lQU+28RrwCGRA=; b=IOor3x9ghXkmd2CwYjDNHek6lFj80KZ5JSFNL3uaLORoS4bImEVuJ33mNFzWBkardZ xXr2sS7Dcwtx5WjrhMEg2Cr6hhuoFq8k4KcmEqS3ndPq4pVwKWxDpoQP4RMe59XJCu2b gzHwUQsD6DUVW9+cL39LqZJhZdugUiIw7EfpAfc6CgISXbmsyDCQ3uHE2jamDsqaFLQ0 jgXVJpctpc7StqFEpxycbQbP5SE3pd6k4IpBvIZrqsNjveGWBaN+rpjb2m6Xhy+UN1nC tSDOnXmtaD6xKWZahn/9X7jxx22pWjYFo8IXEjQGHaK8bc1+bIpwe/nVshKxB4MxWa8t zBkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TweJb6J6; 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 cg11-20020a05622a408b00b002e2074efe92si2415865qtb.670.2022.04.17.11.09.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:09: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=TweJb6J6; 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]:58124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9LJ-0007N2-5a for patch@linaro.org; Sun, 17 Apr 2022 14:09:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8xG-0001AD-Sc for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:58 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:39659) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8xC-0003NM-WE for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:58 -0400 Received: by mail-pl1-x62a.google.com with SMTP id c12so10741230plr.6 for ; Sun, 17 Apr 2022 10:44:54 -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=YXryGBC0mqaWtLXkO2uZG/YEkw1cD0lQU+28RrwCGRA=; b=TweJb6J6wLAoDBG5UGnAOmIKBdjETERRYBwSOQ/kwAwgA5S4bsW792/otcOkCTN7Dv +1KCKqFc5PwrNcWjGvdqlotlZqQreufp6RLV36OWTRhA0F/Cl3Oe/qzuIwfbyVUB0PAq uCxUOna2NzRGMl8mKvApGw/ylIZ8KmG4cUtbaCXt33Qc2pMB/F6mqEQcV/byNVJ+vzcH gQkH/ILdNHebvoOzTIHn0W5vTg/wFU8JnsduZCaf2aR4K/MX2q4+EQ7s8Bl2we4CLTXn cPbBspqyeIUgyyekaotD0grQOHDmSlgBCxOiz0dVlnRcAx3yzP1ypl3LFJLyOIxe24qz X6rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YXryGBC0mqaWtLXkO2uZG/YEkw1cD0lQU+28RrwCGRA=; b=P8CW9v/Tu90v9JM+wskOqzJN2Mn/CVa+GZtUj1Q4LhnWZmv29TYZLYezR85PlfpNki K0Xcw0VhDUyMTmbDc+fsIN8ja0juwvKMwoXWSsikBBb6m63iadXHgkxvqmLof2IZdlLR GLPZmv6qFiyvn5jqOM3NCVRM8BmRDQRaLTf1k2ZrCiTxjHEgO+yRUY6ToyD8N8denN6+ sScbIAPTLnS5EoRuWzHM6H7ukngzQQWGZtZWey1rqjVSOWS+dToy8NRzVHXt3MPUKFjj GL10yEJ/qOvymyw90zVrwu8GK/9B7ODRDNtGnbE5cnfSRDxw06ld3v4yctuZa0lRmn9r wffQ== X-Gm-Message-State: AOAM531Yi+9ZipYrlALwEdf016t6rPBV0ZwDU0aCW8N5QvCFZDhmq05y XQxlwAmw4fd430J1O95WIDNUOouVVE06aA== X-Received: by 2002:a17:902:c412:b0:158:72da:6fdd with SMTP id k18-20020a170902c41200b0015872da6fddmr7673772plk.165.1650217493597; Sun, 17 Apr 2022 10:44:53 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 27/60] target/arm: Make some more cpreg data static const Date: Sun, 17 Apr 2022 10:43:53 -0700 Message-Id: <20220417174426.711829-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" These particular data structures are not modified at runtime. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Reviewed-by: Alex Bennée --- target/arm/helper.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index d6c34c7826..94b41c7e88 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -7861,7 +7861,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) .resetvalue = cpu->pmceid1 }, }; #ifdef CONFIG_USER_ONLY - ARMCPRegUserSpaceInfo v8_user_idregs[] = { + static const ARMCPRegUserSpaceInfo v8_user_idregs[] = { { .name = "ID_AA64PFR0_EL1", .exported_bits = 0x000f000f00ff0000, .fixed_bits = 0x0000000000000011 }, @@ -8001,7 +8001,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) */ if (arm_feature(env, ARM_FEATURE_EL3)) { if (arm_feature(env, ARM_FEATURE_AARCH64)) { - ARMCPRegInfo nsacr = { + static const ARMCPRegInfo nsacr = { .name = "NSACR", .type = ARM_CP_CONST, .cp = 15, .opc1 = 0, .crn = 1, .crm = 1, .opc2 = 2, .access = PL1_RW, .accessfn = nsacr_access, @@ -8009,7 +8009,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) }; define_one_arm_cp_reg(cpu, &nsacr); } else { - ARMCPRegInfo nsacr = { + static const ARMCPRegInfo nsacr = { .name = "NSACR", .cp = 15, .opc1 = 0, .crn = 1, .crm = 1, .opc2 = 2, .access = PL3_RW | PL1_R, @@ -8020,7 +8020,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) } } else { if (arm_feature(env, ARM_FEATURE_V8)) { - ARMCPRegInfo nsacr = { + static const ARMCPRegInfo nsacr = { .name = "NSACR", .type = ARM_CP_CONST, .cp = 15, .opc1 = 0, .crn = 1, .crm = 1, .opc2 = 2, .access = PL1_R, @@ -8173,13 +8173,13 @@ void register_cp_regs_for_features(ARMCPU *cpu) .access = PL1_R, .type = ARM_CP_CONST, .resetvalue = cpu->pmsav7_dregion << 8 }; - ARMCPRegInfo crn0_wi_reginfo = { + static const ARMCPRegInfo crn0_wi_reginfo = { .name = "CRN0_WI", .cp = 15, .crn = 0, .crm = CP_ANY, .opc1 = CP_ANY, .opc2 = CP_ANY, .access = PL1_W, .type = ARM_CP_NOP | ARM_CP_OVERRIDE }; #ifdef CONFIG_USER_ONLY - ARMCPRegUserSpaceInfo id_v8_user_midr_cp_reginfo[] = { + static const ARMCPRegUserSpaceInfo id_v8_user_midr_cp_reginfo[] = { { .name = "MIDR_EL1", .exported_bits = 0x00000000ffffffff }, { .name = "REVIDR_EL1" }, @@ -8224,7 +8224,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) .access = PL1_R, .readfn = mpidr_read, .type = ARM_CP_NO_RAW }, }; #ifdef CONFIG_USER_ONLY - ARMCPRegUserSpaceInfo mpidr_user_cp_reginfo[] = { + static const ARMCPRegUserSpaceInfo mpidr_user_cp_reginfo[] = { { .name = "MPIDR_EL1", .fixed_bits = 0x0000000080000000 }, }; @@ -8303,7 +8303,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) } if (arm_feature(env, ARM_FEATURE_VBAR)) { - ARMCPRegInfo vbar_cp_reginfo[] = { + static const ARMCPRegInfo vbar_cp_reginfo[] = { { .name = "VBAR", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .crn = 12, .crm = 0, .opc1 = 0, .opc2 = 0, .access = PL1_RW, .writefn = vbar_write, From patchwork Sun Apr 17 17:43:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562830 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1858768map; Sun, 17 Apr 2022 11:02:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfJCAyYjEmRkgXilxB5vLLQw/VV6WcZUIAhwe91jbdgh/pUjhS+ACty7dVuVpGXq9+043I X-Received: by 2002:a05:620a:1a25:b0:69c:4a3c:4ffd with SMTP id bk37-20020a05620a1a2500b0069c4a3c4ffdmr4728824qkb.340.1650218532533; Sun, 17 Apr 2022 11:02:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650218532; cv=none; d=google.com; s=arc-20160816; b=fcfLAvI+wIUXXwufP0C3ViMHgQdebeZkhEKaEna6S3og6Zuk6CgLZtJxcQic8WllXR Nt03lYCLhV5ki1d/hx/jMRMrs9tqgcseOWDZIq0zqum+SGy2oRGwYGvsh/MkW3bF2yVt /nJhFZk8CN5nBdwtBbq1lM313DnFwAFpv+3tGxOaeGmAOVHkjpa21K8z3CN+FFt8Z4B0 zyXsxxfi6zs7gmo8tUPpPBnpGhQs4iahA84447djEpr4BjCWa5OLWcC0aX3Uno2Eg0ZB GFUJZsOoyEznur09ZlBJ2kfauxklEdbFPNxOXIVpvcJ+vXXs2Bm+xLCoVqKii1Ydnz1/ nOcw== 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=CZCDzfeb570yxQzv9X4suIogFVnxMMmltWWaLeklfQM=; b=tMpaQqIgd6T45DAHppII5J3Wk1peDY7Vh77QT62y0gWyMZbFZYLQJymYPFKXg1Hqde 0eveB2KmgOiI3fj3Aaw9QDqDg0ixR86+Hn/7T6mk/DBgHoL0MNbiO/mV5EtZ2o9lej1+ f+9heeBN40yo8MVz35No4GUW+9SKIqVThXPamfcONPFvuHeIs5atl3DZvIMrJ+kYWMoN xS9uiuEkAtEsPGxOtu6XhI3KVblOodDUVI3ilY6vSAuqRKKvtY/SJOzqqAga8GloZV6D yKKAAA2MP7O4VRn/ZL4v3PBvKktTshmq8dXLhB8TGy9rmVo3+brwsytAr9Bu0nSEX2pf QbOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="VruFN/U1"; 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 s21-20020a05622a1a9500b002f2012341c8si123815qtc.538.2022.04.17.11.02.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:02: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=pass header.i=@linaro.org header.s=google header.b="VruFN/U1"; 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]:60948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9Dw-0007ED-2e for patch@linaro.org; Sun, 17 Apr 2022 14:02:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48592) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8xI-0001DF-9V for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:00 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:38739) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8xD-0003Nu-Pz for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:44:59 -0400 Received: by mail-pj1-x102c.google.com with SMTP id s14-20020a17090a880e00b001caaf6d3dd1so15525130pjn.3 for ; Sun, 17 Apr 2022 10:44:55 -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=CZCDzfeb570yxQzv9X4suIogFVnxMMmltWWaLeklfQM=; b=VruFN/U1NQfnq457nOEpP+acnNZSJwhJjXQH1yiZe8pGXG/sPD7F/GeEz4QjGb9/Gw zxf/LnzFpFw9Y+CWrSXk5CUtEWRx6+HU8V37RQsrUv7S+iK2EFyLk2FEzy8IiYPuttDd 3tM0IYdDxzzG1u/ju+SsF436LLNcjq2HFrzj8+aJ6lWbZsKRgJCmv64MjUotqPQ0Wuik hObf+NiF5yReCV3lw7n0/ytMtuOkS+G+QhCM+ipqpMvx1HWEwUDTB4VJb9w8Ylj8zxWT sSxfTPVKioCYb6x5zrSdnvcQ/QMqoQDbb0HkReDrlV9/I7jfooTdXvzmircctKBLCK1r kgCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CZCDzfeb570yxQzv9X4suIogFVnxMMmltWWaLeklfQM=; b=b2szmSn1dLV7c/u1uUWMYUb9tEKp/wvmrB5yDjuibVP+T0GQyZ52WMvrBYIZ5RwwF2 cXKNCs8k552fIX+3j8WdVuT/A+nWdU5zNwSyvqMshtPv+7KdA+gKAj5YzJfHtSjMa7hd WL0YVd49sVNlw7Zf/o0Z+zicorUsuMSDc/5gU72Q4GafJb9c+rW3cVjb8eI5TmFpP1WM s5zaPHS3uB78FfTFOvnpYOvOuMGzFRO5MbEvpGBJ2bfq5RkCQVNLQYn/1sb7a5+iQaeU QMdId/cYEdoirig2UdZbhXoM6r7LHkBt5ciwxYk9RRJdrvrowPM2N18O/xJywtRxCg8T WS2Q== X-Gm-Message-State: AOAM530ua07MFWkokocOBelLEpkOMPBUNqwH7L/Oxos/k8BDGKbpaKeb UyiSqE2Ifqb4OHrkk8qwQ1Q6qFR/0SUWzw== X-Received: by 2002:a17:902:9308:b0:158:da34:ab55 with SMTP id bc8-20020a170902930800b00158da34ab55mr7767123plb.84.1650217494365; Sun, 17 Apr 2022 10:44:54 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 28/60] target/arm: Reorg ARMCPRegInfo type field bits Date: Sun, 17 Apr 2022 10:43:54 -0700 Message-Id: <20220417174426.711829-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Instead of defining ARM_CP_FLAG_MASK to remove flags, define ARM_CP_SPECIAL_MASK to isolate special cases. Sort the specials to the low bits. Use an enum. Make ARM_CP_CONST a special case, and ARM_CP_NOP an alias. Split the large comment block so as to document each value separately. Signed-off-by: Richard Henderson --- target/arm/cpregs.h | 134 +++++++++++++++++++++++-------------- target/arm/cpu.c | 4 +- target/arm/helper.c | 4 +- target/arm/translate-a64.c | 21 +++--- target/arm/translate.c | 27 ++++---- 5 files changed, 111 insertions(+), 79 deletions(-) diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h index bd321d6d23..031e4b7ec8 100644 --- a/target/arm/cpregs.h +++ b/target/arm/cpregs.h @@ -22,57 +22,89 @@ #define TARGET_ARM_CPREGS_H 1 /* - * ARMCPRegInfo type field bits. If the SPECIAL bit is set this is a - * special-behaviour cp reg and bits [11..8] indicate what behaviour - * it has. Otherwise it is a simple cp reg, where CONST indicates that - * TCG can assume the value to be constant (ie load at translate time) - * and 64BIT indicates a 64 bit wide coprocessor register. SUPPRESS_TB_END - * indicates that the TB should not be ended after a write to this register - * (the default is that the TB ends after cp writes). OVERRIDE permits - * a register definition to override a previous definition for the - * same (cp, is64, crn, crm, opc1, opc2) tuple: either the new or the - * old must have the OVERRIDE bit set. - * ALIAS indicates that this register is an alias view of some underlying - * state which is also visible via another register, and that the other - * register is handling migration and reset; registers marked ALIAS will not be - * migrated but may have their state set by syncing of register state from KVM. - * NO_RAW indicates that this register has no underlying state and does not - * support raw access for state saving/loading; it will not be used for either - * migration or KVM state synchronization. (Typically this is for "registers" - * which are actually used as instructions for cache maintenance and so on.) - * IO indicates that this register does I/O and therefore its accesses - * need to be marked with gen_io_start() and also end the TB. In particular, - * registers which implement clocks or timers require this. - * RAISES_EXC is for when the read or write hook might raise an exception; - * the generated code will synchronize the CPU state before calling the hook - * so that it is safe for the hook to call raise_exception(). - * NEWEL is for writes to registers that might change the exception - * level - typically on older ARM chips. For those cases we need to - * re-read the new el when recomputing the translation flags. + * ARMCPRegInfo type field bits: */ -#define ARM_CP_SPECIAL 0x0001 -#define ARM_CP_CONST 0x0002 -#define ARM_CP_64BIT 0x0004 -#define ARM_CP_SUPPRESS_TB_END 0x0008 -#define ARM_CP_OVERRIDE 0x0010 -#define ARM_CP_ALIAS 0x0020 -#define ARM_CP_IO 0x0040 -#define ARM_CP_NO_RAW 0x0080 -#define ARM_CP_NOP (ARM_CP_SPECIAL | 0x0100) -#define ARM_CP_WFI (ARM_CP_SPECIAL | 0x0200) -#define ARM_CP_NZCV (ARM_CP_SPECIAL | 0x0300) -#define ARM_CP_CURRENTEL (ARM_CP_SPECIAL | 0x0400) -#define ARM_CP_DC_ZVA (ARM_CP_SPECIAL | 0x0500) -#define ARM_CP_DC_GVA (ARM_CP_SPECIAL | 0x0600) -#define ARM_CP_DC_GZVA (ARM_CP_SPECIAL | 0x0700) -#define ARM_LAST_SPECIAL ARM_CP_DC_GZVA -#define ARM_CP_FPU 0x1000 -#define ARM_CP_SVE 0x2000 -#define ARM_CP_NO_GDB 0x4000 -#define ARM_CP_RAISES_EXC 0x8000 -#define ARM_CP_NEWEL 0x10000 -/* Mask of only the flag bits in a type field */ -#define ARM_CP_FLAG_MASK 0x1f0ff +enum { + /* + * Register must be handled specially during translation. + * The method is one of the values below: + */ + ARM_CP_SPECIAL_MASK = 0x000f, + /* + * Special: sysreg with constant value, writes ignored. + * The nop alias is slightly clearer for describing write-only sysregs. + */ + ARM_CP_CONST = 0x0001, + ARM_CP_NOP = ARM_CP_CONST, + /* Special: sysreg is WFI, for v5 and v6. */ + ARM_CP_WFI = 0x0002, + /* Special: sysreg is NZCV. */ + ARM_CP_NZCV = 0x0003, + /* Special: sysreg is CURRENTEL. */ + ARM_CP_CURRENTEL = 0x0004, + /* Special: sysreg is DC ZVA or similar. */ + ARM_CP_DC_ZVA = 0x0005, + ARM_CP_DC_GVA = 0x0006, + ARM_CP_DC_GZVA = 0x0007, + + /* Flag: For ARM_CP_STATE_AA32, sysreg is 64-bit. */ + ARM_CP_64BIT = 1 << 4, + /* + * Flag: TB should not be ended after a write to this register + * (the default is that the TB ends after cp writes). + */ + ARM_CP_SUPPRESS_TB_END = 1 << 5, + /* + * Flag: Permit a register definition to override a previous definition + * for the same (cp, is64, crn, crm, opc1, opc2) tuple: either the new + * or the old must have the ARM_CP_OVERRIDE bit set. + */ + ARM_CP_OVERRIDE = 1 << 6, + /* + * Flag: Register is an alias view of some underlying state which is also + * visible via another register, and that the other register is handling + * migration and reset; registers marked ARM_CP_ALIAS will not be migrated + * but may have their state set by syncing of register state from KVM. + */ + ARM_CP_ALIAS = 1 << 7, + /* + * Flag: Register does I/O and therefore its accesses need to be marked + * with gen_io_start() and also end the TB. In particular, registers which + * implement clocks or timers require this. + */ + ARM_CP_IO = 1 << 8, + /* + * Flag: Register has no underlying state and does not support raw access + * for state saving/loading; it will not be used for either migration or + * KVM state synchronization. Typically this is for "registers" which are + * actually used as instructions for cache maintenance and so on. + */ + ARM_CP_NO_RAW = 1 << 9, + /* + * Flag: The read or write hook might raise an exception; the generated + * code will synchronize the CPU state before calling the hook so that it + * is safe for the hook to call raise_exception(). + */ + ARM_CP_RAISES_EXC = 1 << 10, + /* + * Flag: Writes to the sysreg might change the exception level - typically + * on older ARM chips. For those cases we need to re-read the new el when + * recomputing the translation flags. + */ + ARM_CP_NEWEL = 1 << 11, + /* + * Flag: Access check for this sysreg is identical to accessing FPU state + * from an instruction: use translation fp_access_check(). + */ + ARM_CP_FPU = 1 << 12, + /* + * Flag: Access check for this sysreg is identical to accessing SVE state + * from an instruction: use translation sve_access_check(). + */ + ARM_CP_SVE = 1 << 13, + /* Flag: Do not expose in gdb sysreg xml. */ + ARM_CP_NO_GDB = 1 << 14, +}; /* * Valid values for ARMCPRegInfo state field, indicating which of @@ -249,7 +281,7 @@ struct ARMCPRegInfo { /* * Offset of the field in CPUARMState for this register. * This is not needed if either: - * 1. type is ARM_CP_CONST or one of the ARM_CP_SPECIALs + * 1. type has ARM_CP_SPECIAL_MASK non-zero * 2. both readfn and writefn are specified */ ptrdiff_t fieldoffset; /* offsetof(CPUARMState, field) */ diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 066fe6250a..92fc75b2bf 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -117,7 +117,7 @@ static void cp_reg_reset(gpointer key, gpointer value, gpointer opaque) ARMCPRegInfo *ri = value; ARMCPU *cpu = opaque; - if (ri->type & (ARM_CP_SPECIAL | ARM_CP_ALIAS)) { + if (ri->type & (ARM_CP_SPECIAL_MASK | ARM_CP_ALIAS)) { return; } @@ -153,7 +153,7 @@ static void cp_reg_check_reset(gpointer key, gpointer value, gpointer opaque) ARMCPU *cpu = opaque; uint64_t oldvalue, newvalue; - if (ri->type & (ARM_CP_SPECIAL | ARM_CP_ALIAS | ARM_CP_NO_RAW)) { + if (ri->type & (ARM_CP_SPECIAL_MASK | ARM_CP_ALIAS | ARM_CP_NO_RAW)) { return; } diff --git a/target/arm/helper.c b/target/arm/helper.c index 94b41c7e88..1bbaf0a3af 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -8601,7 +8601,7 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r, * multiple times. Special registers (ie NOP/WFI) are * never migratable and not even raw-accessible. */ - if ((r->type & ARM_CP_SPECIAL)) { + if (r->type & ARM_CP_SPECIAL_MASK) { r2->type |= ARM_CP_NO_RAW; } if (((r->crm == CP_ANY) && crm != 0) || @@ -8751,7 +8751,7 @@ void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu, /* Check that the register definition has enough info to handle * reads and writes if they are permitted. */ - if (!(r->type & (ARM_CP_SPECIAL|ARM_CP_CONST))) { + if (!(r->type & (ARM_CP_SPECIAL_MASK | ARM_CP_CONST))) { if (r->access & PL3_R) { assert((r->fieldoffset || (r->bank_fieldoffsets[0] && r->bank_fieldoffsets[1])) || diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 92b91f0307..98dbc8203f 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1833,8 +1833,14 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, } /* Handle special cases first */ - switch (ri->type & ~(ARM_CP_FLAG_MASK & ~ARM_CP_SPECIAL)) { - case ARM_CP_NOP: + switch (ri->type & ARM_CP_SPECIAL_MASK) { + case 0: + break; + case ARM_CP_CONST: + if (isread) { + tcg_rt = cpu_reg(s, rt); + tcg_gen_movi_i64(tcg_rt, ri->resetvalue); + } return; case ARM_CP_NZCV: tcg_rt = cpu_reg(s, rt); @@ -1908,7 +1914,7 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, } return; default: - break; + g_assert_not_reached(); } if ((ri->type & ARM_CP_FPU) && !fp_access_check(s)) { return; @@ -1923,18 +1929,13 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, tcg_rt = cpu_reg(s, rt); if (isread) { - if (ri->type & ARM_CP_CONST) { - tcg_gen_movi_i64(tcg_rt, ri->resetvalue); - } else if (ri->readfn) { + if (ri->readfn) { gen_helper_get_cp_reg64(tcg_rt, cpu_env, tcg_constant_ptr(ri)); } else { tcg_gen_ld_i64(tcg_rt, cpu_env, ri->fieldoffset); } } else { - if (ri->type & ARM_CP_CONST) { - /* If not forbidden by access permissions, treat as WI */ - return; - } else if (ri->writefn) { + if (ri->writefn) { gen_helper_set_cp_reg64(cpu_env, tcg_constant_ptr(ri), tcg_rt); } else { tcg_gen_st_i64(tcg_rt, cpu_env, ri->fieldoffset); diff --git a/target/arm/translate.c b/target/arm/translate.c index 1fe48e4e1c..9370b44707 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -4744,8 +4744,16 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, } /* Handle special cases first */ - switch (ri->type & ~(ARM_CP_FLAG_MASK & ~ARM_CP_SPECIAL)) { - case ARM_CP_NOP: + switch (ri->type & ARM_CP_SPECIAL_MASK) { + case 0: + break; + case ARM_CP_CONST: + if (isread) { + store_reg(s, rt, tcg_constant_i32(ri->resetvalue)); + if (is64) { + store_reg(s, rt2, tcg_constant_i32(ri->resetvalue >> 32)); + } + } return; case ARM_CP_WFI: if (isread) { @@ -4756,7 +4764,7 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, s->base.is_jmp = DISAS_WFI; return; default: - break; + g_assert_not_reached(); } if ((tb_cflags(s->base.tb) & CF_USE_ICOUNT) && (ri->type & ARM_CP_IO)) { @@ -4768,9 +4776,7 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, if (is64) { TCGv_i64 tmp64; TCGv_i32 tmp; - if (ri->type & ARM_CP_CONST) { - tmp64 = tcg_constant_i64(ri->resetvalue); - } else if (ri->readfn) { + if (ri->readfn) { tmp64 = tcg_temp_new_i64(); gen_helper_get_cp_reg64(tmp64, cpu_env, tcg_constant_ptr(ri)); @@ -4787,9 +4793,7 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, store_reg(s, rt2, tmp); } else { TCGv_i32 tmp; - if (ri->type & ARM_CP_CONST) { - tmp = tcg_constant_i32(ri->resetvalue); - } else if (ri->readfn) { + if (ri->readfn) { tmp = tcg_temp_new_i32(); gen_helper_get_cp_reg(tmp, cpu_env, tcg_constant_ptr(ri)); } else { @@ -4807,11 +4811,6 @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64, } } else { /* Write */ - if (ri->type & ARM_CP_CONST) { - /* If not forbidden by access permissions, treat as WI */ - return; - } - if (is64) { TCGv_i32 tmplo, tmphi; TCGv_i64 tmp64 = tcg_temp_new_i64(); From patchwork Sun Apr 17 17:43:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562856 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1871155map; Sun, 17 Apr 2022 11:28:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhPNBwda56cqWV5J8YJ9E91BvAr9J2kStZnWyasmv9Wf0eO2GAMueXTllDozvqOQ68LMfA X-Received: by 2002:a05:622a:1822:b0:2e1:b2d4:d877 with SMTP id t34-20020a05622a182200b002e1b2d4d877mr5141011qtc.630.1650220106298; Sun, 17 Apr 2022 11:28:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650220106; cv=none; d=google.com; s=arc-20160816; b=Td+9+PiGqEl0983xRsek2QaWQgWY1toYGWQ7BE2TX/Av4dx5YF6RSHLq5teArpGrVv TtzyQ+c+L/TvqLpqUPBdd9Lrthhb9GtTvcdrr7qs4HNATj3iFPEQ9v/G5atasb6ZoLMG riVGGV28hmHtpdiVScEj9HWkqcEvxYoALmZol3boZgZ9batJ6TtgTuVBE4QYepzGl8cj NJ4vwZQSyHVZtbeMalIp74j1i/sjhgqzTXccuNfNJiOIRFPCMk1xMDC+NJPQRAQaMciM 5TwsgZvxXcfGIzmHnQUmvlQFaqhv/A4p/d0vI2xFo7wNaMuiQSMbjpSMflpDfCr8EIHB kOeQ== 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=cNQuYWlWJo1H5z1dgSCS+oQAsg1LmaUsgazYdgc9pgo=; b=RkWkWOQ5kbZzHyQuI3Rw0IxDjH9XuJZzEs4zJEz3fU4fxER25vceTLig1SpJ8POpJL bhwYXPHc5CXOgaq8pIlBE8QzF8fhTZhPDJ1U7kWXRFp/vGaf3gX3l8YOyp9ATaZTuf7l aiZ/6lijFowD6fQp3qNHZVIwE/bA9iVc0ls+etaYefQI6/rvI8G150unXgx2rdHrMavR wH7muOBnG1zuMuST2MkXkgoMNpljKI8m85tjKgpuQbwQy9yLYYKelVzZBrwlGGNjx12T Xmpj9aMwAESqMuhoPPWDrtEzVpZNMcoWaVPcEUuyhVfnEyPbLpzVSLwcwYEVCholdPG2 o5Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ym3Y2Isq; 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 ca23-20020a05622a1f1700b002e238d2204esi2359411qtb.390.2022.04.17.11.28.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:28:26 -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=ym3Y2Isq; 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]:43326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9dJ-0001pV-Sb for patch@linaro.org; Sun, 17 Apr 2022 14:28:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8xI-0001Ea-Nv for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:00 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:37667) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8xE-0003OD-J6 for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:00 -0400 Received: by mail-pg1-x531.google.com with SMTP id t184so1964636pgd.4 for ; Sun, 17 Apr 2022 10:44:56 -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=cNQuYWlWJo1H5z1dgSCS+oQAsg1LmaUsgazYdgc9pgo=; b=ym3Y2Isq+BXoC2A9zRIR6pePFMeZnt2Y7+I1qAuS3ZvonwR7P9BlWi84Y5W2XNzSpR LpvPOjMiAahrDGD1fqOOMl/a0P/pEgv1/g7sB2O2Q+U0AVgmbBRTEROPJ4SLStTw0UiR UDJcMIArWg4UjD8Gagg+1rzUto7+LWZdpURYxmesbMtCS+Uqq1khyUtNF5DvzVSO5Cmp gwsAB+P/+cVQPaPQnxN+xFLLCyrwklEkyu0QAeqm4RMmteRe/yJbORbp6vEAKvCo0J8n SqvVl4NmghpXqHWuZsjCeawVvU33rPsB+ufwwGhnNWmDuGsvhik4DXyZ6MdRMJ0dkKjb Wg7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cNQuYWlWJo1H5z1dgSCS+oQAsg1LmaUsgazYdgc9pgo=; b=fUb6QVc8/0okXtPpI2feN7dTrftreMidqcGK3QZu0EWNS4OUnJ44hJAYcmLCsj+N2O bCusd9EHtLjhV99b3ZSxxjyz5LuppKFonIcT4Ok66M5FZtK4QEdMcgRwQZETwOov/Hqa R18k9i94/07AplrFkyIAnJa0dqnlWC1+WMBCG56p9KPM2dKdI6bynqUNnSEprdzgpAna 4O75mrEhgbRqBVPsXoDeB7IU0/2LNQy1jaTELhRwJcC8rGed6dRVrk/5CgCuLWFd/1NG yYRjA08nj6x/dj2UIN6grSxt9vIn6nf6Oe4KHKqlepYEsoXSIvxpo0ZgxR5xDGitQS5Y C1kQ== X-Gm-Message-State: AOAM532ThEyv3CJ4jjqczoWksX+/wyefRVtU+/38oVOGW65Mm/QPFWUp K0X9YDgQUpcDS4b3iJWM4HSJPn/KIrRdqw== X-Received: by 2002:a63:cf0c:0:b0:380:fb66:fa2a with SMTP id j12-20020a63cf0c000000b00380fb66fa2amr7099075pgg.273.1650217495172; Sun, 17 Apr 2022 10:44:55 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 29/60] target/arm: Change cpreg access permissions to enum Date: Sun, 17 Apr 2022 10:43:55 -0700 Message-Id: <20220417174426.711829-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Create a typedef as well, and use it in ARMCPRegInfo. This won't be perfect for debugging, but it'll nicely display the most common cases. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/cpregs.h | 44 +++++++++++++++++++++++--------------------- target/arm/helper.c | 5 ++--- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h index 031e4b7ec8..2c991ab5df 100644 --- a/target/arm/cpregs.h +++ b/target/arm/cpregs.h @@ -156,31 +156,33 @@ enum { * described with these bits, then use a laxer set of restrictions, and * do the more restrictive/complex check inside a helper function. */ -#define PL3_R 0x80 -#define PL3_W 0x40 -#define PL2_R (0x20 | PL3_R) -#define PL2_W (0x10 | PL3_W) -#define PL1_R (0x08 | PL2_R) -#define PL1_W (0x04 | PL2_W) -#define PL0_R (0x02 | PL1_R) -#define PL0_W (0x01 | PL1_W) +typedef enum { + PL3_R = 0x80, + PL3_W = 0x40, + PL2_R = 0x20 | PL3_R, + PL2_W = 0x10 | PL3_W, + PL1_R = 0x08 | PL2_R, + PL1_W = 0x04 | PL2_W, + PL0_R = 0x02 | PL1_R, + PL0_W = 0x01 | PL1_W, -/* - * For user-mode some registers are accessible to EL0 via a kernel - * trap-and-emulate ABI. In this case we define the read permissions - * as actually being PL0_R. However some bits of any given register - * may still be masked. - */ + /* + * For user-mode some registers are accessible to EL0 via a kernel + * trap-and-emulate ABI. In this case we define the read permissions + * as actually being PL0_R. However some bits of any given register + * may still be masked. + */ #ifdef CONFIG_USER_ONLY -#define PL0U_R PL0_R + PL0U_R = PL0_R, #else -#define PL0U_R PL1_R + PL0U_R = PL1_R, #endif -#define PL3_RW (PL3_R | PL3_W) -#define PL2_RW (PL2_R | PL2_W) -#define PL1_RW (PL1_R | PL1_W) -#define PL0_RW (PL0_R | PL0_W) + PL3_RW = PL3_R | PL3_W, + PL2_RW = PL2_R | PL2_W, + PL1_RW = PL1_R | PL1_W, + PL0_RW = PL0_R | PL0_W, +} CPAccessRights; typedef enum CPAccessResult { /* Access is permitted */ @@ -264,7 +266,7 @@ struct ARMCPRegInfo { /* Register type: ARM_CP_* bits/values */ int type; /* Access rights: PL*_[RW] */ - int access; + CPAccessRights access; /* Security state: ARM_CP_SECSTATE_* bits/values */ int secure; /* diff --git a/target/arm/helper.c b/target/arm/helper.c index 1bbaf0a3af..33ba77890b 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -8712,7 +8712,7 @@ void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu, * to encompass the generic architectural permission check. */ if (r->state != ARM_CP_STATE_AA32) { - int mask = 0; + CPAccessRights mask; switch (r->opc1) { case 0: /* min_EL EL1, but some accessible to EL0 via kernel ABI */ @@ -8741,8 +8741,7 @@ void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu, break; default: /* broken reginfo with out-of-range opc1 */ - assert(false); - break; + g_assert_not_reached(); } /* assert our permissions are not too lax (stricter is fine) */ assert((r->access & ~mask) == 0); From patchwork Sun Apr 17 17:43:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562845 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1865106map; Sun, 17 Apr 2022 11:14:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxsLJNovztsrYEbLz2Usir5qMUsDU4Fe4KZRLqOQXfV6RJur5Qexo4x+u0BIRitAIqPyBH X-Received: by 2002:ac8:5bd6:0:b0:2e1:c841:35f6 with SMTP id b22-20020ac85bd6000000b002e1c84135f6mr5095343qtb.120.1650219281557; Sun, 17 Apr 2022 11:14:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650219281; cv=none; d=google.com; s=arc-20160816; b=gVjuhYL4KVhS3mG+M/8YyUxYcUC6XNjTaWXN7EqmVPn61p9ZrSl8H1UFerz31yh04X 8Fij6LnH0AWjGuMECzpJFnp6IhOIBie21hTX1Ip4qUOjSGoLP5zN8CyZhYTIQAEsS7c6 K/516FNz1WGsuCQ8DR8rKMc0GO/LYqmJEaGJD2Ij6Af2TL2rgRJNc3kfDYjOBb6nDQFw thbmmW6BXWuuauZaXcAfxVHm3K6I9Nwm63wHkKr5jkucPxsIZ2DDJnp0T4BYFXQFa9Mw 8e1eitpjC7z1wwdCs1nu+F78w9mbvWPGRpwNL+T10hGoaJXmBJuS0sQsS+kqHCMPYzZq IsNA== 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=25C7iOsGqfSeEIqOCeDhxny3HAl1dQf5ZHtQgWZYi98=; b=di++Gqi2D/Mcr3eXem6ZvKqkfSx0nSZjIkNUgYw6BTXWFlxCata3tf3dj4K65WTEFO 8xnt33SBmT7wqEtb8CtzUJHS6WJep4ibuJPWWmeZv13CBxgsqoUNBTG6TY2eWcCT1T3H SW2NHVwXlOfYCib16NOLxiWtOEcD+YGEXe1JDB2oQ+ZgT9LXrzSQV5xE2AW+muuAUA9W Sjh9zbhDzMLcMJB7Yyc/nKhz55XDfPItF/51tej4LJFt1ZcxHEkvGOc7w8Qiklx+tBOk t7E9uBkA496IQ8u2tD/eLoi+ZsAOrbQ8/5XMvYmsinzlSHg2+RBztZMFrdJ8+CUq5hmf mnXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PNrKfzbz; 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 ey8-20020a0562140b6800b00443f329e298si2227056qvb.335.2022.04.17.11.14.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:14:41 -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=PNrKfzbz; 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]:42686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9Q1-0007af-4w for patch@linaro.org; Sun, 17 Apr 2022 14:14:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48612) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8xI-0001EM-Ko for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:00 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]:39817) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8xF-0003OQ-54 for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:00 -0400 Received: by mail-pj1-x1029.google.com with SMTP id mp16-20020a17090b191000b001cb5efbcab6so15506215pjb.4 for ; Sun, 17 Apr 2022 10:44:56 -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=25C7iOsGqfSeEIqOCeDhxny3HAl1dQf5ZHtQgWZYi98=; b=PNrKfzbz8AE8ekSFNMGR/HM/6UM1sgoNIs/tQLjBoA+Ic/j46APdoa0qZ++o2E65Qq +gXHNqcdf1brdqNSPqBngM25HU3XkBlK4zyjBkNmnrJX/H3/jo2DneEqQqa7QkMQET5D s2WA9jFW4KzJxlUFQJp3G/Y133ISZfHtjzVxmJPNsv+tM0QhrB2PQQDXHaC0fDS66ETA xhsXwndF/NzIqB52UdIhwstF9V8K95an/lMCYRnuErODWtz8fyfwZHjPMhUxNqOEwB9r BQwoLq1JGnGrmoZ86GgWKQ0b3v2ORB0j+u3rg81DehCnbhsO7US5WWNZtMOu5Pl5i8pJ 68Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=25C7iOsGqfSeEIqOCeDhxny3HAl1dQf5ZHtQgWZYi98=; b=KytMhme5xEeE9nhVpBITwmRMW1+QGQWLEDrfdKh0LHG4IkjfZ5nUVVHzO4/tcxpGRp h+eeksx9N/uMhIC9nO3NH0GkEJMpu7ZMPUVQWQq1bqlmyqp2Ya9uM6JPwLYXNqFo80ii qjOtEdTeL095SZol1DbcnOxnGIrHS3PWqVPd+AOBZwJ2hw0f9w5LSRQljKiQ5D/Uu0qk 6I91pFiuRITmI1yGvlw0r0L6JxeCx+NWoDq8K93WktF2rqw9k5oPn545SV6t1XBXsuY3 6qCaVL7d+Av1x2Dc7kFeyEvCe0PGfLDrAz0ZgCxNVMJcKjmPISJA5aucDvgZUwxIgPNR tdkw== X-Gm-Message-State: AOAM532Z82KPFopu01xWdNXcA3m9O3Q+wymy7S9cnP99OE3oZv7XwnwF 8gaRB46oCNSZolMibkLJNPf7rhdD+98jTQ== X-Received: by 2002:a17:902:6bc9:b0:158:a0d3:d080 with SMTP id m9-20020a1709026bc900b00158a0d3d080mr7753890plt.24.1650217495858; Sun, 17 Apr 2022 10:44:55 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 30/60] target/arm: Name CPState type Date: Sun, 17 Apr 2022 10:43:56 -0700 Message-Id: <20220417174426.711829-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Give this enum a name and use in ARMCPRegInfo, add_cpreg_to_hashtable and define_one_arm_cp_reg_with_opaque. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Reviewed-by: Alex Bennée --- target/arm/cpregs.h | 6 +++--- target/arm/helper.c | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h index 2c991ab5df..fe338730ab 100644 --- a/target/arm/cpregs.h +++ b/target/arm/cpregs.h @@ -116,11 +116,11 @@ enum { * Note that we rely on the values of these enums as we iterate through * the various states in some places. */ -enum { +typedef enum { ARM_CP_STATE_AA32 = 0, ARM_CP_STATE_AA64 = 1, ARM_CP_STATE_BOTH = 2, -}; +} CPState; /* * ARM CP register secure state flags. These flags identify security state @@ -262,7 +262,7 @@ struct ARMCPRegInfo { uint8_t opc1; uint8_t opc2; /* Execution state in which this register is visible: ARM_CP_STATE_* */ - int state; + CPState state; /* Register type: ARM_CP_* bits/values */ int type; /* Access rights: PL*_[RW] */ diff --git a/target/arm/helper.c b/target/arm/helper.c index 33ba77890b..8b89039667 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -8503,7 +8503,7 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) } static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r, - void *opaque, int state, int secstate, + void *opaque, CPState state, int secstate, int crm, int opc1, int opc2, const char *name) { @@ -8663,13 +8663,15 @@ void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu, * bits; the ARM_CP_64BIT* flag applies only to the AArch32 view of * the register, if any. */ - int crm, opc1, opc2, state; + int crm, opc1, opc2; int crmmin = (r->crm == CP_ANY) ? 0 : r->crm; int crmmax = (r->crm == CP_ANY) ? 15 : r->crm; int opc1min = (r->opc1 == CP_ANY) ? 0 : r->opc1; int opc1max = (r->opc1 == CP_ANY) ? 7 : r->opc1; int opc2min = (r->opc2 == CP_ANY) ? 0 : r->opc2; int opc2max = (r->opc2 == CP_ANY) ? 7 : r->opc2; + CPState state; + /* 64 bit registers have only CRm and Opc1 fields */ assert(!((r->type & ARM_CP_64BIT) && (r->opc2 || r->crn))); /* op0 only exists in the AArch64 encodings */ From patchwork Sun Apr 17 17:43:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562849 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1867096map; Sun, 17 Apr 2022 11:19:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmKDzlLTHRENshk9AcuISrFb8YXAiNL6IwCRiYSx/9W3QX8la78huBPX3EMYzvhFrBCyN6 X-Received: by 2002:ad4:5aac:0:b0:446:5ce1:10a8 with SMTP id u12-20020ad45aac000000b004465ce110a8mr1146586qvg.72.1650219546708; Sun, 17 Apr 2022 11:19:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650219546; cv=none; d=google.com; s=arc-20160816; b=IUi6aqJMfs2XTgHfJhTnr4NJ8fR7XkPzF7KOA0fRDnOan1KBZWzgoaXMQLdnJcGrdF AHIB6Y/1kLHCzCv94emiSgDFOioij+2BSkTmPIRrfoAkxmCpq2ORiW2/3fecmGuF9QH4 0U3JPMw51dqX+CvDIHUycDpWIcrqADhRhF9SK4okcKKQ0TAXike/i6zc8JtOUCqqYw9y hQrzbB55xg2NlY9OHhIkupu8/kdEPC38lf0qak750FJywW1hbtMBiU3u3hs2nkccZsL5 DiLe0yHTzbp2SdOc6TxMnjm56XuKAOv0zKHc9si6KYjITAqoxBB1cjO3rzSfDKkaX0rE DVBw== 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=BnQW0DvgaZN0T2yAGdSifoOIby01eTPtmMKzkfkFCKA=; b=Q31zWXJ3YNcbFRoNliP3nT/ScobzYRvjRjEklyrpJHeCLtY+pEBJqqcK3gc0Pkerlk 2/13jfTgieC/EPBvPE9RrM2Y/ZoTFJFs8n1mPihPZR3skY9mpwPKmrgp/mfQ3WDTsyNE qdpNPlHiv4khL/3cpKq7iiqR8pSjcFRjU5TZWEE/gVyR9LbhzUuzlFUQo1XTTk2Jfgf5 bVueI0Zptbr6Ypf/LNwE2WauGI0KTO5uQ+WcBWypnXhvC9UuZx+6WFJ+Jh0TUqqOD6rp ZzhFDN5jfx41z/L1eHl2kDfJGsUvSe6EqzYMpWdUM9df8xcRUsuVjUEQPG+XZvBa2cOD iLzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hcuQu8vo; 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 59-20020aed3141000000b002f1e9d80e8asi2281458qtg.617.2022.04.17.11.19.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:19:06 -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=hcuQu8vo; 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]:51590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9UI-00059w-4Y for patch@linaro.org; Sun, 17 Apr 2022 14:19:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8xK-0001K2-4A for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:02 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:37670) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8xF-0003Os-Tx for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:01 -0400 Received: by mail-pg1-x534.google.com with SMTP id t184so1964669pgd.4 for ; Sun, 17 Apr 2022 10:44:57 -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=BnQW0DvgaZN0T2yAGdSifoOIby01eTPtmMKzkfkFCKA=; b=hcuQu8voPCRuXAiORVOPesCbSkdH/eGScTBpwFhlgYfLw1Lshzg9bCPpCOTA61qUHX 7cVDId3AoNvzBn8j6vhwREthUp1eLRzyCzlMPSjYcGrEj9pcGdMnH4PUYy1UbfCf1BQD MfVImbJXqfJJ00RYdAHblQ6MYqFkrdeXxaP/DAG56tvS9M+qwoOjy+u6AzR0N/5j6ktS 00EYgcfy7Zrulu42RD3roya+q7WTZjQAZV2p1a/bicsLEWHa+E4vKDO4hdb5a8qubwdW GFx1uenOzx9LGE3LU6/sKkcSoCdR5S6z/T1pMqgfBF9zg1+bOKefO1zgRBkFcbeYTCLG umIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BnQW0DvgaZN0T2yAGdSifoOIby01eTPtmMKzkfkFCKA=; b=0opnDS3Z8NbtgF0D+1z6+UL7BLgW1IOu+LPxCzAippqqF4cRd4TVufK8vH3eCl2YMb pxpLLuArSiBjJOC+EnH4vVMqI23EDpLgot+aGxcdMoLc9BFq5ZYXDRYYCJzeAWCPpFUz yC4ZYqUF+phDs2GHburfsgbB78o79bBqvbYnfIYkn2mi+SbVDhLvbuF7TmPtD8QHM3Ju 4QDU6cHhrORlev6/MS7+ghIVAswzNB4WNy3eIVF6k53Ms5nivZZnoBV2CGXAvEVWx0NE sJabdYrZe7bqCXSqagOgBSgZZ7hD1akj5kh1MkuVp1rqQwjeXmn2Yc7YJeWMFBxsfWE3 iKZw== X-Gm-Message-State: AOAM533V+vKz/3VM1rXbzq6h63BOMc0+j/hUeh0xMNQN2Dz6qKqNvk5/ cDQHCEy93x6MdoqrBhyIwKm1vb6DJ2Fudw== X-Received: by 2002:a65:6216:0:b0:39d:5e6c:7578 with SMTP id d22-20020a656216000000b0039d5e6c7578mr6921313pgv.114.1650217496699; Sun, 17 Apr 2022 10:44:56 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 31/60] target/arm: Name CPSecureState type Date: Sun, 17 Apr 2022 10:43:57 -0700 Message-Id: <20220417174426.711829-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x534.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Give this enum a name and use in ARMCPRegInfo and add_cpreg_to_hashtable. Add the enumerator ARM_CP_SECSTATE_BOTH to clarify how 0 is handled in define_one_arm_cp_reg_with_opaque. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/cpregs.h | 7 ++++--- target/arm/helper.c | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h index fe338730ab..3528c0ebb1 100644 --- a/target/arm/cpregs.h +++ b/target/arm/cpregs.h @@ -133,10 +133,11 @@ typedef enum { * registered entry will only have one to identify whether the entry is secure * or non-secure. */ -enum { +typedef enum { + ARM_CP_SECSTATE_BOTH = 0, /* define one cpreg for each secstate */ ARM_CP_SECSTATE_S = (1 << 0), /* bit[0]: Secure state register */ ARM_CP_SECSTATE_NS = (1 << 1), /* bit[1]: Non-secure state register */ -}; +} CPSecureState; /* * Access rights: @@ -268,7 +269,7 @@ struct ARMCPRegInfo { /* Access rights: PL*_[RW] */ CPAccessRights access; /* Security state: ARM_CP_SECSTATE_* bits/values */ - int secure; + CPSecureState secure; /* * The opaque pointer passed to define_arm_cp_regs_with_opaque() when * this register was defined: can be used to hand data through to the diff --git a/target/arm/helper.c b/target/arm/helper.c index 8b89039667..7c569a569a 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -8503,7 +8503,8 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) } static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r, - void *opaque, CPState state, int secstate, + void *opaque, CPState state, + CPSecureState secstate, int crm, int opc1, int opc2, const char *name) { From patchwork Sun Apr 17 17:43:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562834 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1860716map; Sun, 17 Apr 2022 11:05:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzG6+jUDDKYqMq5EIXR4i1iTB5/5DLKtiM3gnfMKogXd6vWNSVA9oiTdD0860c86TlcKJuU X-Received: by 2002:a05:622a:48e:b0:2e0:706f:1d4 with SMTP id p14-20020a05622a048e00b002e0706f01d4mr5042598qtx.326.1650218756555; Sun, 17 Apr 2022 11:05:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650218756; cv=none; d=google.com; s=arc-20160816; b=nE2EtHHyoDkRF9rV885n1UD9yMTVmPx9zcHtyt07w3yxyQG34oLU4KUrrjfqXneBuG BXLVHXQmv1xsj2wVvBKA0avXQNyvyTLkwK+LbNxLh8Yl5xIlnX+8zZnN5gTv1qaiCzAH XfN327rFv6Vc9dVrBXI9aPkdvoPYaxik5n07MgpiQWZfWUYug49/ltMcoDVJmiY6b/bO nbsMMChaIU4ROiKOKr20IAQhvkuh6V0GELb7bx+wcpXQNfM595Usik6ts3CVsrEKFj5a Qeq8LN6bCYkht3O9i2DwaX5hlDs1gFH7dbXJGTu2xUgxwlibxwPi/fFAdFlni/xc4LQ9 Dk6w== 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=S1tmxjtzChOlXlFN2H8r9mWpojIz96JDvEta62yTA5I=; b=Uh/zAC9ANKjtXjhHd5ZmF508b3CmsxHBYtWEAWvhLWU075Q8QXeEqQrkGaHa+nwG5r bbcZlnLpbsnC5JCl/so74u5WnYf+PObg6kg/Nnn2Izvs/a3UTFq+DfOqs0+Ec+JurSSd WSL6DxfHGJUvtVV7xQXAnDnnzM6DpT4kDzIoIaO4joueTPjKSgcqyRPX35nGfq+MFMGa gTfgpKpuF3ciZdHlqTcK9vM2JJb2nSBPf6rZM3Pp0/k6e7Q2W+j5AAWU6WRiGvb7Rp8N i1veejKdpnmf2W6gVPDlYZghbjJrQatCsheURDsjkEtUZDnWByon/xysqmz2P/yCv3u0 m6Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zne17NRU; 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 bb9-20020a05622a1b0900b002e1fbf3bfdesi2236894qtb.463.2022.04.17.11.05.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:05:56 -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=Zne17NRU; 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]:44776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9HY-0006qo-5Q for patch@linaro.org; Sun, 17 Apr 2022 14:05:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8xK-0001KC-AU for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:02 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]:38898) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8xG-0003P6-SU for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:01 -0400 Received: by mail-pg1-x535.google.com with SMTP id s137so14960264pgs.5 for ; Sun, 17 Apr 2022 10:44:58 -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=S1tmxjtzChOlXlFN2H8r9mWpojIz96JDvEta62yTA5I=; b=Zne17NRUnh0wV0VRNjlf17bWBhR6aWhrYRfQZQQqXWiJJV446MgEBy89v0vWksqDOG fvaGxpOQViz2x6FcpbsKhcmcAcVBA7zafyDVRH2ISVowbzAvFoySKOzCgc9DDwKwV0R+ NJytjU2kLtiOlny2peLrTeoMovw7IZ+ubG9rtJ6rI/w7Hzk6L4pIuDEYWu2PeV94strA pZ3jt5IpS3Y6hTg0+fU0lIlXqBUBrgm1/xZiO6ldH5HkmRp6F9GT6iJK2t92Te7g137d iLXM35ugMD5K5yt5+DM36gL6ThOH0bo4um5qlKVWvLE4NqpQ5unmM/3Wff603FPPSEWm QsEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S1tmxjtzChOlXlFN2H8r9mWpojIz96JDvEta62yTA5I=; b=v32OeWQv4TCFe/G/0t3zPHiKba8tRPGhY4Ju202lIerTsAFLWTZlsd//PLLIiyF10N V0utz4J2Df74FIif/ok4lVJD6ghsGrpbs8Hb1dbBNtf39z3OZUtWKFWuogwAgk3qQX8m d92HlVbed+j+LxGK55O/sB3F2aCNpqIxUA6Fe/DZ8waOBLBbuVSBtSZExrQ7UflrO7Ya NW1DcJuYhTgNzGVGKnSOAwJ8G2Q3vnwYfGgqqT2n8nj4NaBtuqvXOeLzj6RK2bTqlQvi x+MYQNrP7+IBqBItWq9fg2DeioBQiLxTC61Or7kGb2zQbstohX4N667e+qwRKdkAEb+U crFA== X-Gm-Message-State: AOAM531z8N3y/KC05NOxIZKJARkogD5PUnmKNsJFsOPOHtEQcLZZKODl p1QSNK8K5G1M1TPohG3Ip1XKKlL6E4vzdw== X-Received: by 2002:a65:614e:0:b0:380:bfd9:d4ea with SMTP id o14-20020a65614e000000b00380bfd9d4eamr7020955pgv.92.1650217497383; Sun, 17 Apr 2022 10:44:57 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 32/60] target/arm: Update sysreg fields when redirecting for E2H Date: Sun, 17 Apr 2022 10:43:58 -0700 Message-Id: <20220417174426.711829-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The new_key is always non-zero during redirection, so remove the if. Update opc0 et al from the new key. Signed-off-by: Richard Henderson --- target/arm/helper.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 7c569a569a..aee195400b 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -5915,7 +5915,9 @@ static void define_arm_vh_e2h_redirects_aliases(ARMCPU *cpu) for (i = 0; i < ARRAY_SIZE(aliases); i++) { const struct E2HAlias *a = &aliases[i]; - ARMCPRegInfo *src_reg, *dst_reg; + ARMCPRegInfo *src_reg, *dst_reg, *new_reg; + uint32_t *new_key; + bool ok; if (a->feature && !a->feature(&cpu->isar)) { continue; @@ -5934,19 +5936,28 @@ static void define_arm_vh_e2h_redirects_aliases(ARMCPU *cpu) g_assert(src_reg->opaque == NULL); /* Create alias before redirection so we dup the right data. */ - if (a->new_key) { - ARMCPRegInfo *new_reg = g_memdup(src_reg, sizeof(ARMCPRegInfo)); - uint32_t *new_key = g_memdup(&a->new_key, sizeof(uint32_t)); - bool ok; + new_reg = g_memdup(src_reg, sizeof(ARMCPRegInfo)); + new_key = g_memdup(&a->new_key, sizeof(uint32_t)); - new_reg->name = a->new_name; - new_reg->type |= ARM_CP_ALIAS; - /* Remove PL1/PL0 access, leaving PL2/PL3 R/W in place. */ - new_reg->access &= PL2_RW | PL3_RW; + new_reg->name = a->new_name; + new_reg->type |= ARM_CP_ALIAS; + /* Remove PL1/PL0 access, leaving PL2/PL3 R/W in place. */ + new_reg->access &= PL2_RW; - ok = g_hash_table_insert(cpu->cp_regs, new_key, new_reg); - g_assert(ok); - } +#define E(X, N) \ + ((X & CP_REG_ARM64_SYSREG_##N##_MASK) >> CP_REG_ARM64_SYSREG_##N##_SHIFT) + + /* Update the sysreg fields */ + new_reg->opc0 = E(a->new_key, OP0); + new_reg->opc1 = E(a->new_key, OP1); + new_reg->crn = E(a->new_key, CRN); + new_reg->crm = E(a->new_key, CRM); + new_reg->opc2 = E(a->new_key, OP2); + +#undef E + + ok = g_hash_table_insert(cpu->cp_regs, new_key, new_reg); + g_assert(ok); src_reg->opaque = dst_reg; src_reg->orig_readfn = src_reg->readfn ?: raw_read; From patchwork Sun Apr 17 17:43:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562838 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1862130map; Sun, 17 Apr 2022 11:08:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwx38Y/kcwd6ITkCghdzyTrmDS0G/p8pRvG8ad/9x0lZUTJIvkrf31x9gSC7UUjgsf4lx8 X-Received: by 2002:a05:622a:40a:b0:2e0:7235:f7a9 with SMTP id n10-20020a05622a040a00b002e07235f7a9mr5102534qtx.500.1650218912946; Sun, 17 Apr 2022 11:08:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650218912; cv=none; d=google.com; s=arc-20160816; b=HR0AwqPXNqOAjovhXaHPP0ayLbQ7Tuy4JBQTgpT6cGr7QfCSrDC907QVxY4gIDUJyF 3MOH235ly97W7ix1b5G4Gt99/rq3pPoooQYCcrD+z5iPeO38y9Af7sPLl8EHeA+Ym9UB m0vuU+rt6P7YV9HdvbXCFXGr5br38KV37nV+cCyWtRLrDuNJidYr1dAP2AgEW6rdJYUm +oxLp0AfufTapkpCiwBMjdKkegPL6WHE8T4NCzJ7Y8m9mVc6wD8+3soHRB82jxz3BAJX 2ko/2Tlu48ROKXwrsSZoAp4Uf1KN+MKwa3Zmsp/WBHVWRsHty1A9gh4uqeAsPUZlzOd7 ouFQ== 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=aDgvjaxwViELgB4ykiyMAgIgM6sZRWkjwRFfHxxhnR0=; b=c6M+lBIcBfrnD6lJapOoKATkCt7c8UyghfeMtHSsaqu+dSLWG6iJnu16SRerx93oeo 6tzrDASdbDi30UD2ce/tEUmZwqlpRxzqLfAIGB3SBO+tsnqHRAGELP9kbRgwSp/trY0X jrsigR0GPpHT7rTUb+RA7c9RMmuw3orUhiRXIjaZ7Q5PI5IbVQg5ALlCD8SkDDHNZe+8 qT6Gue+mGBdb+qx1gk9oafkWbf4fpId7QOmpCAH9E4QZpIBsTSMQMjt+MZ57OjeFjecz yV6Wa9lKVC8Yr3oSioXev/KArggUXDxKPJulteQ6CRGhDFw5T/cTZQ54h2vIpjUgcjqL 38rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=q+10ZK4Q; 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 3-20020a0562140dc300b0044454e9b3f2si1327673qvt.323.2022.04.17.11.08.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:08:32 -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=q+10ZK4Q; 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]:53440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9K4-0004F2-Fl for patch@linaro.org; Sun, 17 Apr 2022 14:08:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8xM-0001PE-09 for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:04 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:46663) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8xH-0003Pb-Hm for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:03 -0400 Received: by mail-pl1-x634.google.com with SMTP id be5so10713848plb.13 for ; Sun, 17 Apr 2022 10:44:59 -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=aDgvjaxwViELgB4ykiyMAgIgM6sZRWkjwRFfHxxhnR0=; b=q+10ZK4QziaY93HK4YRlUUL5E30RQARthfc6o4zouS9fSYBBEM1Cmf9bcC6LbhWJI+ P2MBwBI5kjOhkGR2faHETErquGN/Tu5b6pvpfju1I8Malon3SCrW5y5vHWZF97n+dPPl BlDzPP89Lh1xQy62Klv0m1umntPrV/DO3GM+JVqnJ3dR2zzRspyQVSRz11g6S5AsQAT5 HU8/GdHjArTwVfD0YDRIdPnQe3I3rgyYr/wTGoQGaTXV3WvC8umqzkRMHry64wnSgSD9 nweyMu79SxtGMPem61MWoNIAJv3nX0g/84ktjiPoHapK5wIHW/F7xUTZWKmZSqWm+yvW tsrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aDgvjaxwViELgB4ykiyMAgIgM6sZRWkjwRFfHxxhnR0=; b=zrxeKQyulkScvvSDgcGqVH4f5NXCLMjIftkXAO08vPWR7ut8UhJypau8bzUwavU1T4 igmYhpDSbvm7KiORdLv+/Tjp158WlEJaq082Ar7rY59C2W9bMTlW25+8roWePnGCzE+n kP1Cg9cSwUgFJmq7zDsR7sNeh3H672At3O794HlvDWe1hAHhlekWIFNqqwsLyfX/ougJ vxZXXWsHp0RFLuYjX6Fzkaxo+qQ/lyffp7RgahTSva9lGESe+Fu2k3wv5rehMaXSdN1t Q9G2z976kfLuOwTMpeJO5dwabiJPth+kD9YaggvSGwlUbsjM0zt35Jf4Sre2iBO8L61t jr+A== X-Gm-Message-State: AOAM532NlmIcvrUElREEQ1kkNcR2mQ8cW7FYf3IcXIPkQ4gBztb1Hho+ kNmZEiQqxTZhwP9+nJa/EGtwgtm7OS0ZTQ== X-Received: by 2002:a17:902:cece:b0:158:d875:e6d6 with SMTP id d14-20020a170902cece00b00158d875e6d6mr7354133plg.165.1650217498102; Sun, 17 Apr 2022 10:44:58 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 33/60] target/arm: Store cpregs key in the hash table directly Date: Sun, 17 Apr 2022 10:43:59 -0700 Message-Id: <20220417174426.711829-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Cast the uint32_t key into a gpointer directly, which allows us to avoid allocating storage for each key. Signed-off-by: Richard Henderson --- target/arm/cpu.c | 4 ++-- target/arm/gdbstub.c | 2 +- target/arm/helper.c | 45 ++++++++++++++++++++------------------------ 3 files changed, 23 insertions(+), 28 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 92fc75b2bf..af13b34697 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1080,8 +1080,8 @@ static void arm_cpu_initfn(Object *obj) ARMCPU *cpu = ARM_CPU(obj); cpu_set_cpustate_pointers(cpu); - cpu->cp_regs = g_hash_table_new_full(g_int_hash, g_int_equal, - g_free, cpreg_hashtable_data_destroy); + cpu->cp_regs = g_hash_table_new_full(g_direct_hash, g_direct_equal, + NULL, cpreg_hashtable_data_destroy); QLIST_INIT(&cpu->pre_el_change_hooks); QLIST_INIT(&cpu->el_change_hooks); diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c index f01a126108..f5b35cd55f 100644 --- a/target/arm/gdbstub.c +++ b/target/arm/gdbstub.c @@ -273,7 +273,7 @@ static void arm_gen_one_xml_sysreg_tag(GString *s, DynamicGDBXMLInfo *dyn_xml, static void arm_register_sysreg_for_xml(gpointer key, gpointer value, gpointer p) { - uint32_t ri_key = *(uint32_t *)key; + uint32_t ri_key = (uintptr_t)key; ARMCPRegInfo *ri = value; RegisterSysregXmlParam *param = (RegisterSysregXmlParam *)p; GString *s = param->s; diff --git a/target/arm/helper.c b/target/arm/helper.c index aee195400b..db9e75a42d 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -215,11 +215,8 @@ bool write_list_to_cpustate(ARMCPU *cpu) static void add_cpreg_to_list(gpointer key, gpointer opaque) { ARMCPU *cpu = opaque; - uint64_t regidx; - const ARMCPRegInfo *ri; - - regidx = *(uint32_t *)key; - ri = get_arm_cp_reginfo(cpu->cp_regs, regidx); + uint32_t regidx = (uintptr_t)key; + const ARMCPRegInfo *ri = get_arm_cp_reginfo(cpu->cp_regs, regidx); if (!(ri->type & (ARM_CP_NO_RAW|ARM_CP_ALIAS))) { cpu->cpreg_indexes[cpu->cpreg_array_len] = cpreg_to_kvm_id(regidx); @@ -231,11 +228,9 @@ static void add_cpreg_to_list(gpointer key, gpointer opaque) static void count_cpreg(gpointer key, gpointer opaque) { ARMCPU *cpu = opaque; - uint64_t regidx; const ARMCPRegInfo *ri; - regidx = *(uint32_t *)key; - ri = get_arm_cp_reginfo(cpu->cp_regs, regidx); + ri = g_hash_table_lookup(cpu->cp_regs, key); if (!(ri->type & (ARM_CP_NO_RAW|ARM_CP_ALIAS))) { cpu->cpreg_array_len++; @@ -244,8 +239,8 @@ static void count_cpreg(gpointer key, gpointer opaque) static gint cpreg_key_compare(gconstpointer a, gconstpointer b) { - uint64_t aidx = cpreg_to_kvm_id(*(uint32_t *)a); - uint64_t bidx = cpreg_to_kvm_id(*(uint32_t *)b); + uint64_t aidx = cpreg_to_kvm_id((uintptr_t)a); + uint64_t bidx = cpreg_to_kvm_id((uintptr_t)b); if (aidx > bidx) { return 1; @@ -5915,16 +5910,17 @@ static void define_arm_vh_e2h_redirects_aliases(ARMCPU *cpu) for (i = 0; i < ARRAY_SIZE(aliases); i++) { const struct E2HAlias *a = &aliases[i]; - ARMCPRegInfo *src_reg, *dst_reg, *new_reg; - uint32_t *new_key; + const ARMCPRegInfo *dst_reg; + ARMCPRegInfo *src_reg; + ARMCPRegInfo *new_reg; bool ok; if (a->feature && !a->feature(&cpu->isar)) { continue; } - src_reg = g_hash_table_lookup(cpu->cp_regs, &a->src_key); - dst_reg = g_hash_table_lookup(cpu->cp_regs, &a->dst_key); + src_reg = (ARMCPRegInfo *)get_arm_cp_reginfo(cpu->cp_regs, a->src_key); + dst_reg = get_arm_cp_reginfo(cpu->cp_regs, a->dst_key); g_assert(src_reg != NULL); g_assert(dst_reg != NULL); @@ -5937,7 +5933,6 @@ static void define_arm_vh_e2h_redirects_aliases(ARMCPU *cpu) /* Create alias before redirection so we dup the right data. */ new_reg = g_memdup(src_reg, sizeof(ARMCPRegInfo)); - new_key = g_memdup(&a->new_key, sizeof(uint32_t)); new_reg->name = a->new_name; new_reg->type |= ARM_CP_ALIAS; @@ -5956,10 +5951,11 @@ static void define_arm_vh_e2h_redirects_aliases(ARMCPU *cpu) #undef E - ok = g_hash_table_insert(cpu->cp_regs, new_key, new_reg); + ok = g_hash_table_insert(cpu->cp_regs, + (gpointer)(uintptr_t)a->new_key, new_reg); g_assert(ok); - src_reg->opaque = dst_reg; + src_reg->opaque = (void *)dst_reg; src_reg->orig_readfn = src_reg->readfn ?: raw_read; src_reg->orig_writefn = src_reg->writefn ?: raw_write; if (!src_reg->raw_readfn) { @@ -8522,7 +8518,7 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r, /* Private utility function for define_one_arm_cp_reg_with_opaque(): * add a single reginfo struct to the hash table. */ - uint32_t *key = g_new(uint32_t, 1); + uint32_t key; ARMCPRegInfo *r2 = g_memdup(r, sizeof(ARMCPRegInfo)); int is64 = (r->type & ARM_CP_64BIT) ? 1 : 0; int ns = (secstate & ARM_CP_SECSTATE_NS) ? 1 : 0; @@ -8589,10 +8585,10 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r, if (r->cp == 0 || r->state == ARM_CP_STATE_BOTH) { r2->cp = CP_REG_ARM64_SYSREG_CP; } - *key = ENCODE_AA64_CP_REG(r2->cp, r2->crn, crm, - r2->opc0, opc1, opc2); + key = ENCODE_AA64_CP_REG(r2->cp, r2->crn, crm, + r2->opc0, opc1, opc2); } else { - *key = ENCODE_CP_REG(r2->cp, is64, ns, r2->crn, crm, opc1, opc2); + key = ENCODE_CP_REG(r2->cp, is64, ns, r2->crn, crm, opc1, opc2); } if (opaque) { r2->opaque = opaque; @@ -8634,8 +8630,7 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r, * requested. */ if (!(r->type & ARM_CP_OVERRIDE)) { - ARMCPRegInfo *oldreg; - oldreg = g_hash_table_lookup(cpu->cp_regs, key); + const ARMCPRegInfo *oldreg = get_arm_cp_reginfo(cpu->cp_regs, key); if (oldreg && !(oldreg->type & ARM_CP_OVERRIDE)) { fprintf(stderr, "Register redefined: cp=%d %d bit " "crn=%d crm=%d opc1=%d opc2=%d, " @@ -8645,7 +8640,7 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r, g_assert_not_reached(); } } - g_hash_table_insert(cpu->cp_regs, key, r2); + g_hash_table_insert(cpu->cp_regs, (gpointer)(uintptr_t)key, r2); } @@ -8875,7 +8870,7 @@ void modify_arm_cp_regs_with_len(ARMCPRegInfo *regs, size_t regs_len, const ARMCPRegInfo *get_arm_cp_reginfo(GHashTable *cpregs, uint32_t encoded_cp) { - return g_hash_table_lookup(cpregs, &encoded_cp); + return g_hash_table_lookup(cpregs, (gpointer)(uintptr_t)encoded_cp); } void arm_cp_write_ignore(CPUARMState *env, const ARMCPRegInfo *ri, From patchwork Sun Apr 17 17:44:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562854 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1870484map; Sun, 17 Apr 2022 11:26:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxL2JdOGsQbEiqoU1E94ZhKYA09PHOxbeaEj4Vw/cjL2OKkhIlk6xvr5HlFHPXApG+Bggb2 X-Received: by 2002:ad4:5caf:0:b0:446:61d0:bba4 with SMTP id q15-20020ad45caf000000b0044661d0bba4mr441551qvh.89.1650220018466; Sun, 17 Apr 2022 11:26:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650220018; cv=none; d=google.com; s=arc-20160816; b=SUyozetdQ1H+fODgQ2PjIkOmYzM3/CknaEn7Sfsq65YLkYYlN6Jj1rUvOFnJILyoN8 tCEK1J2sVZnsPWLZr+9T2DXkqKU+uHb2t1X5Dcf1RN95d6mIyH8xUPMbNVgaINBytuHg 2NMKDcyC51esG1nT88xlJLH2db1XbiH39jCxTaiSGGBhZfA8LBzUBDdLc+O0W4L51d8n DGqvmLDI0MVYaUzA+ypQ/4npwuk3A4QhHS9uBQZaFP2utHVCIhYa+J9DAFckamLE6YJB f/6ca0jZ+Txdi+NofaKLHMl7rDEJZzlyiLV3nrHy5uFzcKEpjP85or+TJphPjWcsxPx1 FjqA== 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=KVOnCjEQiAnuJHjeIoAiZ0aHmG7YiIy0zMzqF1b7fG4=; b=uOcCnQRN7veHPbCNqFQI5T4AZle0KIAi3km2C9NwKI3XXAOdefXXImxsy57vz/gymd MNE30hmdOKJgUa2LJ9HmWR0mBl7/h62bcXbIBELwzee3OfPgezIrFOXCWfMsR4qOjwgs LN27l5UzDo3s7heKQybZvxdu7T0JOY5shgHYJ8hVufAUL3SltL3RpvZRepkeitWQjxRY 7grx1tj1luudWoFblVhBaM1hYxur4DMJCOa5mcnXH7o0AEuNS5lGqNuxfgyjxUNkqP/v 8aK1i/Dvr8LTuGuIyCDpsxpHMb5MgWEQWCwRXnzuSefwx8RSA7We1yjYiIQiihHQKkJW CLqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TqDEJM02; 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 n10-20020a05620a294a00b0067e4be2387bsi1026951qkp.192.2022.04.17.11.26.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:26:58 -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=TqDEJM02; 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]:41400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9bu-0000Yv-1n for patch@linaro.org; Sun, 17 Apr 2022 14:26:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48782) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8xM-0001QN-BW for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:04 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:35498) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8xI-0003QB-8Q for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:03 -0400 Received: by mail-pg1-x536.google.com with SMTP id k62so8888438pgd.2 for ; Sun, 17 Apr 2022 10:44:59 -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=KVOnCjEQiAnuJHjeIoAiZ0aHmG7YiIy0zMzqF1b7fG4=; b=TqDEJM02ssx29JOqmz9Ai/+UgG1EM0RDDecBUXMP9J+WMfeXKpilxyLuyJJFIPn19B B9DYeglGHwX0uURJL+g9eJSz5yj1GWODAKqBkZchjbrOBRzZ0LABrkSArdMJEBUJu20Q iz/gPVM18G8ayOY+FUEWdbGWdpysESPccDmN64MRouWzPuS6BJ7Db8DWOQL2FTz+xtyg 1AiJjOQZMq3qWQ2LnLqt/zJy8xI4MRD54gshSr1/3LSZl5ZRg488lPmxA2er17cPz8Hr pYDGZ4DxjYpnv6v5/SzEKqn41gvfv83ndUq5PtFkvTdFTiE/FYIi0BMkUQDQ6NhOq514 MdeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KVOnCjEQiAnuJHjeIoAiZ0aHmG7YiIy0zMzqF1b7fG4=; b=HdG+2Xe+SFQ56GzQl8YHV4jbw33CVGoVgVqfb7ggNOKvtr9exNTBBNlxwXmlIdyHz5 XWDQpQS4VG5uSKgxC0lSKBGcTkvNLFBqgs16wShC4h08Te24JZfl75iqxqV+B+PXPHIQ l8Rxt4LqHagryhGWIgVNAAmXUl6UtyDWweCEhOJbMBHYBLbkTZH1u11Mc1/c2DLPkdhC bSfYGkhTv4jLAFvyWoqPU/WifciLglITF6BBnqZapBadl6h5a0bRPuWe011aVF3SvuEB iziiG84FPuSQyUKl0hV37ojjw7uJUBVr7RSRS2Vn1S1ZM94ujAA5QSkzNVXSdnGIQxd4 vQ8g== X-Gm-Message-State: AOAM533rM3s+G8Cj80BxPZrE+faGBuzLD+DotOmXu9StRPG9RYF9soWH O55qfpSNj52MJf5GM3qgOdOQbqtzICe9kw== X-Received: by 2002:a63:444f:0:b0:39d:3aa5:c9f0 with SMTP id t15-20020a63444f000000b0039d3aa5c9f0mr7176015pgk.363.1650217498857; Sun, 17 Apr 2022 10:44:58 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 34/60] target/arm: Cleanup add_cpreg_to_hashtable Date: Sun, 17 Apr 2022 10:44:00 -0700 Message-Id: <20220417174426.711829-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use a single memory allocation for name and reginfo. Perform the override check early; use assert not printf+abort. Use a switch statement to validate state. Signed-off-by: Richard Henderson --- target/arm/cpu.c | 16 +---- target/arm/helper.c | 154 +++++++++++++++++++++++--------------------- 2 files changed, 81 insertions(+), 89 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index af13b34697..3da8841eb2 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1061,27 +1061,13 @@ uint64_t arm_cpu_mp_affinity(int idx, uint8_t clustersz) return (Aff1 << ARM_AFF1_SHIFT) | Aff0; } -static void cpreg_hashtable_data_destroy(gpointer data) -{ - /* - * Destroy function for cpu->cp_regs hashtable data entries. - * We must free the name string because it was g_strdup()ed in - * add_cpreg_to_hashtable(). It's OK to cast away the 'const' - * from r->name because we know we definitely allocated it. - */ - ARMCPRegInfo *r = data; - - g_free((void *)r->name); - g_free(r); -} - static void arm_cpu_initfn(Object *obj) { ARMCPU *cpu = ARM_CPU(obj); cpu_set_cpustate_pointers(cpu); cpu->cp_regs = g_hash_table_new_full(g_direct_hash, g_direct_equal, - NULL, cpreg_hashtable_data_destroy); + NULL, g_free); QLIST_INIT(&cpu->pre_el_change_hooks); QLIST_INIT(&cpu->el_change_hooks); diff --git a/target/arm/helper.c b/target/arm/helper.c index db9e75a42d..562ea5c418 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -8509,37 +8509,90 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) return cpu_list; } +/* + * Private utility function for define_one_arm_cp_reg_with_opaque(): + * add a single reginfo struct to the hash table. + */ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r, void *opaque, CPState state, CPSecureState secstate, int crm, int opc1, int opc2, const char *name) { - /* Private utility function for define_one_arm_cp_reg_with_opaque(): - * add a single reginfo struct to the hash table. - */ uint32_t key; - ARMCPRegInfo *r2 = g_memdup(r, sizeof(ARMCPRegInfo)); - int is64 = (r->type & ARM_CP_64BIT) ? 1 : 0; - int ns = (secstate & ARM_CP_SECSTATE_NS) ? 1 : 0; + ARMCPRegInfo *r2; + bool is64 = r->type & ARM_CP_64BIT; + bool ns = secstate & ARM_CP_SECSTATE_NS; + int cp = r->cp; + bool isbanked; + size_t name_len; - r2->name = g_strdup(name); - /* Reset the secure state to the specific incoming state. This is - * necessary as the register may have been defined with both states. + switch (state) { + case ARM_CP_STATE_AA32: + /* We assume it is a cp15 register if the .cp field is left unset. */ + if (cp == 0 && r->state == ARM_CP_STATE_BOTH) { + cp = 15; + } + key = ENCODE_CP_REG(cp, is64, ns, r->crn, crm, opc1, opc2); + break; + case ARM_CP_STATE_AA64: + /* + * To allow abbreviation of ARMCPRegInfo definitions, we treat + * cp == 0 as equivalent to the value for "standard guest-visible + * sysreg". STATE_BOTH definitions are also always "standard sysreg" + * in their AArch64 view (the .cp value may be non-zero for the + * benefit of the AArch32 view). + */ + if (cp == 0 || r->state == ARM_CP_STATE_BOTH) { + cp = CP_REG_ARM64_SYSREG_CP; + } + key = ENCODE_AA64_CP_REG(cp, r->crn, crm, r->opc0, opc1, opc2); + break; + default: + g_assert_not_reached(); + } + + /* Overriding of an existing definition must be explicitly requested. */ + if (!(r->type & ARM_CP_OVERRIDE)) { + const ARMCPRegInfo *oldreg = get_arm_cp_reginfo(cpu->cp_regs, key); + if (oldreg) { + assert(oldreg->type & ARM_CP_OVERRIDE); + } + } + + /* Combine cpreg and name into one allocation. */ + name_len = strlen(name) + 1; + r2 = g_malloc(sizeof(*r2) + name_len); + *r2 = *r; + r2->name = memcpy(r2 + 1, name, name_len); + + /* + * Update fields to match the instantiation, overwiting wildcards + * such as CP_ANY, ARM_CP_STATE_BOTH, or ARM_CP_SECSTATE_BOTH. */ + r2->cp = cp; + r2->crm = crm; + r2->opc1 = opc1; + r2->opc2 = opc2; + r2->state = state; r2->secure = secstate; + if (opaque) { + r2->opaque = opaque; + } - if (r->bank_fieldoffsets[0] && r->bank_fieldoffsets[1]) { - /* Register is banked (using both entries in array). + isbanked = r->bank_fieldoffsets[0] && r->bank_fieldoffsets[1]; + if (isbanked) { + /* + * Register is banked (using both entries in array). * Overwriting fieldoffset as the array is only used to define * banked registers but later only fieldoffset is used. */ r2->fieldoffset = r->bank_fieldoffsets[ns]; } - if (state == ARM_CP_STATE_AA32) { - if (r->bank_fieldoffsets[0] && r->bank_fieldoffsets[1]) { - /* If the register is banked then we don't need to migrate or + if (isbanked) { + /* + * If the register is banked then we don't need to migrate or * reset the 32-bit instance in certain cases: * * 1) If the register has both 32-bit and 64-bit instances then we @@ -8554,56 +8607,22 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r, r2->type |= ARM_CP_ALIAS; } } else if ((secstate != r->secure) && !ns) { - /* The register is not banked so we only want to allow migration of - * the non-secure instance. + /* + * The register is not banked so we only want to allow migration + * of the non-secure instance. */ r2->type |= ARM_CP_ALIAS; } - if (r->state == ARM_CP_STATE_BOTH) { - /* We assume it is a cp15 register if the .cp field is left unset. - */ - if (r2->cp == 0) { - r2->cp = 15; - } - + if (r->state == ARM_CP_STATE_BOTH && r->fieldoffset) { #ifdef HOST_WORDS_BIGENDIAN - if (r2->fieldoffset) { - r2->fieldoffset += sizeof(uint32_t); - } + r2->fieldoffset += sizeof(uint32_t); #endif } } - if (state == ARM_CP_STATE_AA64) { - /* To allow abbreviation of ARMCPRegInfo - * definitions, we treat cp == 0 as equivalent to - * the value for "standard guest-visible sysreg". - * STATE_BOTH definitions are also always "standard - * sysreg" in their AArch64 view (the .cp value may - * be non-zero for the benefit of the AArch32 view). - */ - if (r->cp == 0 || r->state == ARM_CP_STATE_BOTH) { - r2->cp = CP_REG_ARM64_SYSREG_CP; - } - key = ENCODE_AA64_CP_REG(r2->cp, r2->crn, crm, - r2->opc0, opc1, opc2); - } else { - key = ENCODE_CP_REG(r2->cp, is64, ns, r2->crn, crm, opc1, opc2); - } - if (opaque) { - r2->opaque = opaque; - } - /* reginfo passed to helpers is correct for the actual access, - * and is never ARM_CP_STATE_BOTH: - */ - r2->state = state; - /* Make sure reginfo passed to helpers for wildcarded regs - * has the correct crm/opc1/opc2 for this reg, not CP_ANY: - */ - r2->crm = crm; - r2->opc1 = opc1; - r2->opc2 = opc2; - /* By convention, for wildcarded registers only the first + + /* + * By convention, for wildcarded registers only the first * entry is used for migration; the others are marked as * ALIAS so we don't try to transfer the register * multiple times. Special registers (ie NOP/WFI) are @@ -8612,13 +8631,14 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r, if (r->type & ARM_CP_SPECIAL_MASK) { r2->type |= ARM_CP_NO_RAW; } - if (((r->crm == CP_ANY) && crm != 0) || - ((r->opc1 == CP_ANY) && opc1 != 0) || - ((r->opc2 == CP_ANY) && opc2 != 0)) { + if ((r->crm == CP_ANY && crm != 0) || + (r->opc1 == CP_ANY && opc1 != 0) || + (r->opc2 == CP_ANY && opc2 != 0)) { r2->type |= ARM_CP_ALIAS | ARM_CP_NO_GDB; } - /* Check that raw accesses are either forbidden or handled. Note that + /* + * Check that raw accesses are either forbidden or handled. Note that * we can't assert this earlier because the setup of fieldoffset for * banked registers has to be done first. */ @@ -8626,20 +8646,6 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r, assert(!raw_accessors_invalid(r2)); } - /* Overriding of an existing definition must be explicitly - * requested. - */ - if (!(r->type & ARM_CP_OVERRIDE)) { - const ARMCPRegInfo *oldreg = get_arm_cp_reginfo(cpu->cp_regs, key); - if (oldreg && !(oldreg->type & ARM_CP_OVERRIDE)) { - fprintf(stderr, "Register redefined: cp=%d %d bit " - "crn=%d crm=%d opc1=%d opc2=%d, " - "was %s, now %s\n", r2->cp, 32 + 32 * is64, - r2->crn, r2->crm, r2->opc1, r2->opc2, - oldreg->name, r2->name); - g_assert_not_reached(); - } - } g_hash_table_insert(cpu->cp_regs, (gpointer)(uintptr_t)key, r2); } From patchwork Sun Apr 17 17:44:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562848 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1867086map; Sun, 17 Apr 2022 11:19:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNjCoeWIMObHBda35BkXaa88R2mvMysuVloMzThVtJzIZ1WcQRqeKxcSUnTiLCAz5exm2K X-Received: by 2002:a37:9442:0:b0:699:fd32:bc7d with SMTP id w63-20020a379442000000b00699fd32bc7dmr4670670qkd.615.1650219545043; Sun, 17 Apr 2022 11:19:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650219545; cv=none; d=google.com; s=arc-20160816; b=e8BsVb0gFPnAdcWqmUhvtzdSEgiiWJfclBprwd/3BOZeD2cZkajXeCOLfx9HOuS/Ts cJy8vtbX/+zEoJkDZ3jhWIaoM7GtJgYpWWC30N0EgL9yuT83sIQEwb+FiDSAgvm41Tx+ i0Oc4FoE7XaHOgvF1aLIxliqtxWYTvBdsiQO7aTTQ8k48SYCiFpvsEBJ+TVYbPsRRlFh /Kr9ZGhCc5G//wNbY2KDaPjvMShSRA2B7Sh51VzXvRygiET6AfJ/t9q1V4wCiI3+UdJW 8M5W5vb9WcO4GTBt1g9BU4m5IYvkpORM3HW3SQ9AWZD1g2s1f6I1NX8CyTDLTYVgVaGD 2Nzg== 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=5StdWYGeCOlRyUwqJZ4tniRcd6lDfQV+KGHmy0NGmEs=; b=RKV8pbXLTUnG8mAadw3jPTbwEE3qyCefF76eb2NkQaOWin5zrXbgxqkcQhO/Tp54oo MxXEFdAqZ2Mv/ehjwhyFboUDFJPRzW3XC2jfx/PyXdYBU8UNgKvMSSf7OzVyY1DLGfhb Cf5VJV6sEdwIJBl1voyTjeSySaQPfXNkbNbqgbzev6bn+DBRQnqdLrHMfNa11pYvOgF8 8+/deZjJabQHpYxdwyUgUu1SJ8eNX8iJ/st+oKtSFLFg7mHfFUJTxLWTK04RRS1p0n2s tXZAQvfgAS07ipsgCQia4oEwDg0Rqh9ICWkKejiqAWwXwtd92f5lQRt5YEL/99rwmU/i 7xww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sGMHhfGM; 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 bp30-20020a05622a1b9e00b002e1fbf3c0cbsi2054504qtb.700.2022.04.17.11.19.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:19:05 -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=sGMHhfGM; 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]:51418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9UG-00052Z-9F for patch@linaro.org; Sun, 17 Apr 2022 14:19:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48844) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8xN-0001St-Ks for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:05 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:46641) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8xJ-0003Qf-6t for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:05 -0400 Received: by mail-pj1-x102a.google.com with SMTP id h15-20020a17090a054f00b001cb7cd2b11dso12207611pjf.5 for ; Sun, 17 Apr 2022 10:45:00 -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=5StdWYGeCOlRyUwqJZ4tniRcd6lDfQV+KGHmy0NGmEs=; b=sGMHhfGMu4AyH73jaartkjimFmwe4BN4cvzK6EbMrQ//YXEMVxgtrLRSO92nv27n+W nIP4MeZwQBCnqgnRznep81tFU1LqaYLPQ6BlNW8AGUhuxer7gts8xDnK4YLbLF/hshIm mIYMDQt7kr+ubwmoXAF3sC1ucKSS3azskLCYdEX/Y0rLdsEgkKCqHJorVgpgHaBHeHVJ e4hoL6U0Q96IojvRIs4ijxOVg7v+ByAaPib/59YCwS8NBJTwl9UtON8SENQjhdTu6Rpx uSb/kdmcgEA5JcYxOz/Lw7zyLGdUTbFCxXWzelpBV+KPxCpen56l4JZsL2d67A5YCmgs z8ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5StdWYGeCOlRyUwqJZ4tniRcd6lDfQV+KGHmy0NGmEs=; b=JJdpQgtt3WWmgjB2+SZA+yEVCflWVSS3T9VQYOvsGab3fT0VjQGFm3KQh7Q/9ghea9 8D4aXr5t2V1RXW7hMbENG4Q05dOjIbAloXpz+4qU+78RgIu8/rcQK/EdcpXi5CkITwjW URZSflA3WS8qasm5Y9c4mmSiQoeqEfST3kF4itd5zVsWqS8f+KqHWAuCM61sdVZgfGah VB5P1QGpUkIX5d8rIMbs9NSzBu3vLUNAPElSPBv4VGvsL1Us52P8bFAUVnnNvBcpMqbu 15au+PZl5Yi9bvYHv3lgMMg/eQiFOqvwpuEjHUIW1OUzo52pbU+y5Z0lWiK1oimrqMXs iguA== X-Gm-Message-State: AOAM530mF0kagvLPBDI4V//Jez3KAdXncmX8E2qMQJJGClBObjrsosMy Y/dkaKcrqr0ivaymEjIZPzBDSMhaILwTFA== X-Received: by 2002:a17:902:cec3:b0:158:d5b4:2572 with SMTP id d3-20020a170902cec300b00158d5b42572mr7955297plg.52.1650217499754; Sun, 17 Apr 2022 10:44:59 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:44:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 35/60] target/arm: Handle cpreg registration for missing EL Date: Sun, 17 Apr 2022 10:44:01 -0700 Message-Id: <20220417174426.711829-36-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" More gracefully handle cpregs when EL2 and/or EL3 are missing. If the reg is entirely inaccessible, do not register it at all. If the reg is for EL2, and EL3 is present but EL2 is not, squash to ARM_CP_CONST. This will simplify cpreg registration for conditional arm features. Signed-off-by: Richard Henderson --- target/arm/helper.c | 109 ++++++++++++++++++++++++++++++++------------ 1 file changed, 79 insertions(+), 30 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 562ea5c418..d9837b5bd2 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -8519,13 +8519,14 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r, int crm, int opc1, int opc2, const char *name) { + CPUARMState *env = &cpu->env; uint32_t key; ARMCPRegInfo *r2; bool is64 = r->type & ARM_CP_64BIT; bool ns = secstate & ARM_CP_SECSTATE_NS; int cp = r->cp; - bool isbanked; size_t name_len; + bool make_const; switch (state) { case ARM_CP_STATE_AA32: @@ -8560,6 +8561,24 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r, } } + /* + * Eliminate registers that are not present because the EL is missing. + * Doing this here makes it easier to put all registers for a given + * feature into the same ARMCPRegInfo array and define them all at once. + */ + if (arm_feature(env, ARM_FEATURE_EL3)) { + /* An EL2 register without EL2 but with EL3 is (usually) RES0. */ + int min_el = ctz32(r->access) / 2; + make_const = min_el == 2 && !arm_feature(env, ARM_FEATURE_EL2); + } else { + CPAccessRights max_el = (arm_feature(env, ARM_FEATURE_EL2) + ? PL2_RW : PL1_RW); + if ((r->access & max_el) == 0) { + return; + } + make_const = false; + } + /* Combine cpreg and name into one allocation. */ name_len = strlen(name) + 1; r2 = g_malloc(sizeof(*r2) + name_len); @@ -8580,44 +8599,74 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r, r2->opaque = opaque; } - isbanked = r->bank_fieldoffsets[0] && r->bank_fieldoffsets[1]; - if (isbanked) { + if (make_const) { + /* This should not have been a very special register to begin. */ + int old_special = r2->type & ARM_CP_SPECIAL_MASK; + assert(old_special == 0 || old_special == ARM_CP_CONST); /* - * Register is banked (using both entries in array). - * Overwriting fieldoffset as the array is only used to define - * banked registers but later only fieldoffset is used. + * Set the special function to CONST, retaining the flags. + * This is important for e.g. ARM_CP_SVE so that we still + * take the SVE trap if CPTR_EL3.EZ == 0. */ - r2->fieldoffset = r->bank_fieldoffsets[ns]; - } - if (state == ARM_CP_STATE_AA32) { + r2->type |= ARM_CP_CONST; + /* + * Usually, these registers become RES0, but there are a few + * special cases like VPIDR_EL2 which have a constant non-zero + * value with writes ignored. So leave resetvalue as is. + * + * ARM_CP_SPECIAL_MASK has precedence, so removing the callbacks + * and offsets are not strictly necessary, but is potentially + * less confusing to debug later. + */ + r2->readfn = NULL; + r2->writefn = NULL; + r2->raw_readfn = NULL; + r2->raw_writefn = NULL; + r2->resetfn = NULL; + r2->fieldoffset = 0; + r2->bank_fieldoffsets[0] = 0; + r2->bank_fieldoffsets[1] = 0; + } else { + bool isbanked = r->bank_fieldoffsets[0] && r->bank_fieldoffsets[1]; + if (isbanked) { /* - * If the register is banked then we don't need to migrate or - * reset the 32-bit instance in certain cases: - * - * 1) If the register has both 32-bit and 64-bit instances then we - * can count on the 64-bit instance taking care of the - * non-secure bank. - * 2) If ARMv8 is enabled then we can count on a 64-bit version - * taking care of the secure bank. This requires that separate - * 32 and 64-bit definitions are provided. + * Register is banked (using both entries in array). + * Overwriting fieldoffset as the array is only used to define + * banked registers but later only fieldoffset is used. */ - if ((r->state == ARM_CP_STATE_BOTH && ns) || - (arm_feature(&cpu->env, ARM_FEATURE_V8) && !ns)) { + r2->fieldoffset = r->bank_fieldoffsets[ns]; + } + if (state == ARM_CP_STATE_AA32) { + if (isbanked) { + /* + * If the register is banked then we don't need to migrate or + * reset the 32-bit instance in certain cases: + * + * 1) If the register has both 32-bit and 64-bit instances + * then we can count on the 64-bit instance taking care + * of the non-secure bank. + * 2) If ARMv8 is enabled then we can count on a 64-bit + * version taking care of the secure bank. This requires + * that separate 32 and 64-bit definitions are provided. + */ + if ((r->state == ARM_CP_STATE_BOTH && ns) || + (arm_feature(env, ARM_FEATURE_V8) && !ns)) { + r2->type |= ARM_CP_ALIAS; + } + } else if ((secstate != r->secure) && !ns) { + /* + * The register is not banked so we only want to allow + * migration of the non-secure instance. + */ r2->type |= ARM_CP_ALIAS; } - } else if ((secstate != r->secure) && !ns) { - /* - * The register is not banked so we only want to allow migration - * of the non-secure instance. - */ - r2->type |= ARM_CP_ALIAS; - } - if (r->state == ARM_CP_STATE_BOTH && r->fieldoffset) { + if (r->state == ARM_CP_STATE_BOTH && r->fieldoffset) { #ifdef HOST_WORDS_BIGENDIAN - r2->fieldoffset += sizeof(uint32_t); + r2->fieldoffset += sizeof(uint32_t); #endif + } } } @@ -8628,7 +8677,7 @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r, * multiple times. Special registers (ie NOP/WFI) are * never migratable and not even raw-accessible. */ - if (r->type & ARM_CP_SPECIAL_MASK) { + if (r2->type & ARM_CP_SPECIAL_MASK) { r2->type |= ARM_CP_NO_RAW; } if ((r->crm == CP_ANY && crm != 0) || From patchwork Sun Apr 17 17:44:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562858 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1872214map; Sun, 17 Apr 2022 11:31:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5hG7onuV8xq+ijjOstfdQuJNknTdGVFwT6mxAW9F2c75CxW1+0M8eWQ4U3VIFF/NcRAzw X-Received: by 2002:a05:620a:d4f:b0:67e:9cbf:a969 with SMTP id o15-20020a05620a0d4f00b0067e9cbfa969mr4697528qkl.509.1650220272189; Sun, 17 Apr 2022 11:31:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650220272; cv=none; d=google.com; s=arc-20160816; b=G0AWInrERgXZgixGQWr2fFN3RCb7kq3K2EPOBp0e4MZKdhOAeS7emNcpBuFHrf1JMH DD5i/8VmC5VShG5EgdR0hbzwIiL7Po26Pk1f3Iv0zsQFiS3QiXUUH08imEU7n3vmjXo0 StvFWcc5H8Q/noTIEf6XhnwzQeAxiI9xuhWh3NNI8WVqqx12tnodtCKZR3ZuCk8X5Hcv q73xNajIYZ5PqtormBsiUcGrIuwVuKohSP6n9kNGVUZpK830AATyB+wG73ZA4Op5VdQy Feo1Mt4E5ajNrSSbAALAJ5bdOdKART4VJTRxQziUnM+YMvMCkLObGNTC1vvbvKWDm7Vq 8yig== 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=ejRoUXpC9pNdpYPEkTcVE2TTGW1PPspJDDIBjsGqdiY=; b=EmPX+eEK3ZTRD1KCXaSgYkzsJFBkeA5zDnl25KkiMTms1innXs1ru6UNYtTYXt7oHt Se765/C56uftieyMYVQW7lZmamgk9dxpUtL6yCN/3F4qOjl4HtqPKqavD1SaSt/fjxvJ vfnvYMT/5U7pJF2inH5nMofuPJWconGIvpMGW1O3HNqkdWUG45J/VKstGJRcl0Ny3tqa KRxDPe+fRNw/7xKDRoYxqSm1yaQru9d8qovK/XoHWzAPt2wUSp8YOf2eFrhffo2l3SRT B218t6ANVFnaqRQpJCSgUlZt8AzUh6xwi+Zcp74wDAibr3L18Pah3h3EZ9WLikZFJ0nz OFQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TAaqPBvr; 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 f6-20020a05620a15a600b0069ea0e6a3b3si165943qkk.400.2022.04.17.11.31.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:31: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=pass header.i=@linaro.org header.s=google header.b=TAaqPBvr; 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]:50094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9fy-0006Oq-Cv for patch@linaro.org; Sun, 17 Apr 2022 14:31:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48868) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8xO-0001Up-57 for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:06 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]:33594) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8xK-0003RR-7V for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:05 -0400 Received: by mail-pg1-x52a.google.com with SMTP id k14so14987254pga.0 for ; Sun, 17 Apr 2022 10:45:01 -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=ejRoUXpC9pNdpYPEkTcVE2TTGW1PPspJDDIBjsGqdiY=; b=TAaqPBvrORxDPELRwR1iQbWOef+kBL+uSVObm9hvkQ4J+5EkNRxtuEP3U0YnBtVj7u RGj15rLxFPGSjESNSYc7u4aun0q1np7JvN3TNXZZdCtMSgnk9AdS67LaRroc1SAIYEQH 3IDJhk/TqjUViY+3AeCPYHYjvdD9/fw3P6tonRPHnfqtIOajdjf3MqBmD41ZYlKA9niw Qa9cxyliN+pEAiZ6842tMdfTXq/8b3hx818rJnMKoAFjHOKPluDgY3jbxqPJPssqtII6 yv4DodSPbMfbuOx2MR+t/h0ybuaiY83yWnuGvMkhlUnjzM3+UjXBVfL+UACfOPgWo7JX Nq5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ejRoUXpC9pNdpYPEkTcVE2TTGW1PPspJDDIBjsGqdiY=; b=Q2v/JAgNrG+uTXbqxHbQl3VCbtRTr4XcRsGyeCjX91HRQ7Yanoci7+8fIdnVGDkMq6 HEkVMLxVNk2tInub8N0oVmQw/Gnu1yuV9t+/GIDz7vtrxGzIbdn1OgSr2GdT+Lr4kUEa lN2zIwcb3v+1uoxdBSsHV0VftoAN8+pNyF1VAO3CRfqqvegFJXW4/kUi1Pak7onmd205 05DwJsB3GjkdCVNlgt2HUwavzD1suyUCs+RnKkC+T4R72c4SYV064C8SAL4IwL4IvJPp Z4U5bisua7wF67oK5fyW65Z5WMr514hAtSeQpV91xxyVwp6hql5yKrXJtshCy06kGO3t eerw== X-Gm-Message-State: AOAM531u3iZ3qWeIHHe5cdNzU/LOOF/xllIH7Qe5iHhbCnTih9HzAi5b IEvIWfQxQhy9ExxOw8hgkMEonaz19gVL7w== X-Received: by 2002:a63:f642:0:b0:386:53e:9cd4 with SMTP id u2-20020a63f642000000b00386053e9cd4mr6990379pgj.265.1650217500650; Sun, 17 Apr 2022 10:45:00 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.44.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:45:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 36/60] target/arm: Drop EL3 no EL2 fallbacks Date: Sun, 17 Apr 2022 10:44:02 -0700 Message-Id: <20220417174426.711829-37-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52a.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Drop el3_no_el2_cp_reginfo, el3_no_el2_v8_cp_reginfo, and the local vpidr_regs definition, and rely on the squasing to ARM_CP_CONST while registering. Signed-off-by: Richard Henderson --- target/arm/helper.c | 158 ++++---------------------------------------- 1 file changed, 13 insertions(+), 145 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index d9837b5bd2..cc65ab887e 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -5099,124 +5099,6 @@ static const ARMCPRegInfo v8_cp_reginfo[] = { .fieldoffset = offsetoflow32(CPUARMState, cp15.mdcr_el3) }, }; -/* Used to describe the behaviour of EL2 regs when EL2 does not exist. */ -static const ARMCPRegInfo el3_no_el2_cp_reginfo[] = { - { .name = "VBAR_EL2", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 4, .crn = 12, .crm = 0, .opc2 = 0, - .access = PL2_RW, - .readfn = arm_cp_read_zero, .writefn = arm_cp_write_ignore }, - { .name = "HCR_EL2", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 0, - .access = PL2_RW, - .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "HACR_EL2", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 7, - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "ESR_EL2", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 2, .opc2 = 0, - .access = PL2_RW, - .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "CPTR_EL2", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 2, - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "MAIR_EL2", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 4, .crn = 10, .crm = 2, .opc2 = 0, - .access = PL2_RW, .type = ARM_CP_CONST, - .resetvalue = 0 }, - { .name = "HMAIR1", .state = ARM_CP_STATE_AA32, - .cp = 15, .opc1 = 4, .crn = 10, .crm = 2, .opc2 = 1, - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "AMAIR_EL2", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 4, .crn = 10, .crm = 3, .opc2 = 0, - .access = PL2_RW, .type = ARM_CP_CONST, - .resetvalue = 0 }, - { .name = "HAMAIR1", .state = ARM_CP_STATE_AA32, - .cp = 15, .opc1 = 4, .crn = 10, .crm = 3, .opc2 = 1, - .access = PL2_RW, .type = ARM_CP_CONST, - .resetvalue = 0 }, - { .name = "AFSR0_EL2", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 1, .opc2 = 0, - .access = PL2_RW, .type = ARM_CP_CONST, - .resetvalue = 0 }, - { .name = "AFSR1_EL2", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 1, .opc2 = 1, - .access = PL2_RW, .type = ARM_CP_CONST, - .resetvalue = 0 }, - { .name = "TCR_EL2", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 0, .opc2 = 2, - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "VTCR_EL2", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 1, .opc2 = 2, - .access = PL2_RW, .accessfn = access_el3_aa32ns, - .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "VTTBR", .state = ARM_CP_STATE_AA32, - .cp = 15, .opc1 = 6, .crm = 2, - .access = PL2_RW, .accessfn = access_el3_aa32ns, - .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, - { .name = "VTTBR_EL2", .state = ARM_CP_STATE_AA64, - .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 1, .opc2 = 0, - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "SCTLR_EL2", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 0, .opc2 = 0, - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "TPIDR_EL2", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 4, .crn = 13, .crm = 0, .opc2 = 2, - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "TTBR0_EL2", .state = ARM_CP_STATE_AA64, - .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 0, .opc2 = 0, - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "HTTBR", .cp = 15, .opc1 = 4, .crm = 2, - .access = PL2_RW, .type = ARM_CP_64BIT | ARM_CP_CONST, - .resetvalue = 0 }, - { .name = "CNTHCTL_EL2", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 1, .opc2 = 0, - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "CNTVOFF_EL2", .state = ARM_CP_STATE_AA64, - .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 0, .opc2 = 3, - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "CNTVOFF", .cp = 15, .opc1 = 4, .crm = 14, - .access = PL2_RW, .type = ARM_CP_64BIT | ARM_CP_CONST, - .resetvalue = 0 }, - { .name = "CNTHP_CVAL_EL2", .state = ARM_CP_STATE_AA64, - .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 2, .opc2 = 2, - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "CNTHP_CVAL", .cp = 15, .opc1 = 6, .crm = 14, - .access = PL2_RW, .type = ARM_CP_64BIT | ARM_CP_CONST, - .resetvalue = 0 }, - { .name = "CNTHP_TVAL_EL2", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 2, .opc2 = 0, - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "CNTHP_CTL_EL2", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 2, .opc2 = 1, - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "MDCR_EL2", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 1, - .access = PL2_RW, .accessfn = access_tda, - .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "HPFAR_EL2", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 4, - .access = PL2_RW, .accessfn = access_el3_aa32ns, - .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "HSTR_EL2", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 3, - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "FAR_EL2", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 0, - .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "HIFAR", .state = ARM_CP_STATE_AA32, - .type = ARM_CP_CONST, - .cp = 15, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 2, - .access = PL2_RW, .resetvalue = 0 }, -}; - -/* Ditto, but for registers which exist in ARMv8 but not v7 */ -static const ARMCPRegInfo el3_no_el2_v8_cp_reginfo[] = { - { .name = "HCR2", .state = ARM_CP_STATE_AA32, - .cp = 15, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 4, - .access = PL2_RW, - .type = ARM_CP_CONST, .resetvalue = 0 }, -}; - static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask) { ARMCPU *cpu = env_archcpu(env); @@ -7912,7 +7794,17 @@ void register_cp_regs_for_features(ARMCPU *cpu) define_arm_cp_regs(cpu, v8_idregs); define_arm_cp_regs(cpu, v8_cp_reginfo); } - if (arm_feature(env, ARM_FEATURE_EL2)) { + + /* + * Register the base EL2 cpregs. + * Pre v8, these registers are implemented only as part of the + * Virtualization Extensions (EL2 present). Beginning with v8, + * if EL2 is missing but EL3 is enabled, mostly these become + * RES0 from EL3, with some specific exceptions. + */ + if (arm_feature(env, ARM_FEATURE_EL2) + || (arm_feature(env, ARM_FEATURE_EL3) + && arm_feature(env, ARM_FEATURE_V8))) { uint64_t vmpidr_def = mpidr_read_val(env); ARMCPRegInfo vpidr_regs[] = { { .name = "VPIDR", .state = ARM_CP_STATE_AA32, @@ -7953,33 +7845,9 @@ void register_cp_regs_for_features(ARMCPU *cpu) }; define_one_arm_cp_reg(cpu, &rvbar); } - } else { - /* If EL2 is missing but higher ELs are enabled, we need to - * register the no_el2 reginfos. - */ - if (arm_feature(env, ARM_FEATURE_EL3)) { - /* When EL3 exists but not EL2, VPIDR and VMPIDR take the value - * of MIDR_EL1 and MPIDR_EL1. - */ - ARMCPRegInfo vpidr_regs[] = { - { .name = "VPIDR_EL2", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 4, .crn = 0, .crm = 0, .opc2 = 0, - .access = PL2_RW, .accessfn = access_el3_aa32ns, - .type = ARM_CP_CONST, .resetvalue = cpu->midr, - .fieldoffset = offsetof(CPUARMState, cp15.vpidr_el2) }, - { .name = "VMPIDR_EL2", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 4, .crn = 0, .crm = 0, .opc2 = 5, - .access = PL2_RW, .accessfn = access_el3_aa32ns, - .type = ARM_CP_NO_RAW, - .writefn = arm_cp_write_ignore, .readfn = mpidr_read }, - }; - define_arm_cp_regs(cpu, vpidr_regs); - define_arm_cp_regs(cpu, el3_no_el2_cp_reginfo); - if (arm_feature(env, ARM_FEATURE_V8)) { - define_arm_cp_regs(cpu, el3_no_el2_v8_cp_reginfo); - } - } } + + /* Register the base EL3 cpregs. */ if (arm_feature(env, ARM_FEATURE_EL3)) { define_arm_cp_regs(cpu, el3_cp_reginfo); ARMCPRegInfo el3_regs[] = { From patchwork Sun Apr 17 17:44:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562842 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1863351map; Sun, 17 Apr 2022 11:11:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaL6ljh+R716hAnbTHKWiuJMzhR0PE3ewwDZXQ9JJF6fQTWMQB41gZEddpZ1GIHMzrYEqn X-Received: by 2002:ae9:dc01:0:b0:69c:7c3d:aba0 with SMTP id q1-20020ae9dc01000000b0069c7c3daba0mr4801062qkf.368.1650219063025; Sun, 17 Apr 2022 11:11:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650219063; cv=none; d=google.com; s=arc-20160816; b=e6EGaFkzwcQVCRP0AnnEQWq3l2IPkXnGyZNfkr8RSZnavOCyhnxHUQT1NbtTzXZNsO EyxyxCI5r0dIzkFVg2njYhvo6MalQXHc0IRPvnrXv383elggMSSZflC7A/9u004qbyif OkKCUfmc3ZNlGuLXGyuwJWQpDPBZJ1A6WoWOueV8IskVVO1HlIiryDsf1CJt3uM0gSTD 7wilHgQX4lesIJgyAAB40jmcSUY7WePeVhmipt+Bub6RtPD4nGbASzZt2trxDrR+VY02 zJEnTHeGIltZ4PF/PU0CX1PnJAdPepFfyL/1vWUmQxG9dGF32UXfln4IvIx4Q4gM6d7Z yjPQ== 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=X9GROJ2XF7+CSyCmZaDichiw/5K3bO7LPiqj5yPTM2o=; b=kNFwo0fchIh9NapMvulW+VrK6Cv/aIUMxTj9GNW5cykjUnc4Up1ufpGQ1PbOts/18r Rv+plViikutX0RlOpVQ75qQyCajZfL1aSQ1eoq5GPDzdKNVqJGUgyUwCKE9ktHVmEQoz NuFFTMvQzHjH0HTNoKZmc30uK8+GQIrJMfToltBSLpxtM+5OH/Tlgx7SDzrhYpLB33JZ JYsShm4gSwaaqR2zs2pb6qVUTP79e0VDmHKmmsMBEsjr+tTgM0DXte3B6TarONm3VtrK OZzB4orhPRbyI61RjzeDyAJ7T98SoYwJVao91Y2InA1Pth0S2u2PqD8Zdu/akcvQX2wz gSsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="TiJ/iHh+"; 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 q2-20020ad45742000000b00445a1f282f7si2197245qvx.455.2022.04.17.11.11.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:11:03 -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="TiJ/iHh+"; 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]:33764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9MU-0001Wn-Gm for patch@linaro.org; Sun, 17 Apr 2022 14:11:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8xN-0001T8-Mu for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:05 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:42705) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8xK-0003S2-Sh for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:05 -0400 Received: by mail-pg1-x534.google.com with SMTP id bg9so14932516pgb.9 for ; Sun, 17 Apr 2022 10:45:02 -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=X9GROJ2XF7+CSyCmZaDichiw/5K3bO7LPiqj5yPTM2o=; b=TiJ/iHh+jx0A4f0aUVSWgh+fNcmuIZfwpS5D7JDnZ2AZp/mHW1sXqA814ap6ZQfI2C OviNEvii8EHqK7SaDXi2QnkNPIkmBFIRLskgQEeyTc3kOEuwbwjOEU3DsC4OGw4nR8W9 eeG9IBP5+ZFzBMSDJ2DhL2p8KP5v7rAkjGk/IKzrv4hARZ2+35gf+tW+wDXq7lGSQK8/ SnZlOdsiqWtjGUAdU/0YNUOIz5BjUgot2bHEecifCTS3E1scBG2xeZyzAz6q7uiSZ74C XRZJzLD44PVdYE5Gzx/I3vK29tWX3bqZKGpu+9kbgSd64XmygePzMOFvWC+ighkt7gMV rumg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=X9GROJ2XF7+CSyCmZaDichiw/5K3bO7LPiqj5yPTM2o=; b=g2CcrnrmMX4TfDs1xIWgl/A9Zrzrxl0zQ5OoZncMpvJapQ/1tJviplWBH8sUTEgNM1 LyWF9hk9qMqARUbyFJ6hl0QAc0daFy94CKR6CXl9KV+yuvRe5a9UbEXZcgIAkaFPKLU1 Jovqv6ifA+5cDXwXLwwHfETL1NgCVWLy4U1ceJ4D6jPNsEO80dQ+G4MaMXoEh6pYNPa4 eOTRRAa8FeAOjySQ6saW+stVMXoXmUBwuPDJfstDkV3X0UpcSN/QthhT+ep9s2y9gtkT EZRsxwA/dAj6NONHfQKedKZjTTzuGQ8GF+DXxOske4Cdl9s2LT1UJDbnIs4DnoJTMRvp 8O/A== X-Gm-Message-State: AOAM530AOU2vre1e93MnHedDenY7czOCphX9JAsh+/nATgTEzmhhDf3p TbW0G5k4nEhDmcNa7ngtQj9IRFK6KWo+Jg== X-Received: by 2002:a05:6a00:23d2:b0:4fa:f262:719 with SMTP id g18-20020a056a0023d200b004faf2620719mr8494563pfc.4.1650217501473; Sun, 17 Apr 2022 10:45:01 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.45.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:45:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 37/60] target/arm: Merge zcr reginfo Date: Sun, 17 Apr 2022 10:44:03 -0700 Message-Id: <20220417174426.711829-38-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x534.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Drop zcr_no_el2_reginfo and merge the 3 registers into one array, now that ZCR_EL2 can be squashed to RES0 and ZCR_EL3 dropped while registering. Signed-off-by: Richard Henderson --- target/arm/helper.c | 55 ++++++++++++++------------------------------- 1 file changed, 17 insertions(+), 38 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index cc65ab887e..e762054b5d 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6132,35 +6132,22 @@ static void zcr_write(CPUARMState *env, const ARMCPRegInfo *ri, } } -static const ARMCPRegInfo zcr_el1_reginfo = { - .name = "ZCR_EL1", .state = ARM_CP_STATE_AA64, - .opc0 = 3, .opc1 = 0, .crn = 1, .crm = 2, .opc2 = 0, - .access = PL1_RW, .type = ARM_CP_SVE, - .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[1]), - .writefn = zcr_write, .raw_writefn = raw_write -}; - -static const ARMCPRegInfo zcr_el2_reginfo = { - .name = "ZCR_EL2", .state = ARM_CP_STATE_AA64, - .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 2, .opc2 = 0, - .access = PL2_RW, .type = ARM_CP_SVE, - .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[2]), - .writefn = zcr_write, .raw_writefn = raw_write -}; - -static const ARMCPRegInfo zcr_no_el2_reginfo = { - .name = "ZCR_EL2", .state = ARM_CP_STATE_AA64, - .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 2, .opc2 = 0, - .access = PL2_RW, .type = ARM_CP_SVE, - .readfn = arm_cp_read_zero, .writefn = arm_cp_write_ignore -}; - -static const ARMCPRegInfo zcr_el3_reginfo = { - .name = "ZCR_EL3", .state = ARM_CP_STATE_AA64, - .opc0 = 3, .opc1 = 6, .crn = 1, .crm = 2, .opc2 = 0, - .access = PL3_RW, .type = ARM_CP_SVE, - .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[3]), - .writefn = zcr_write, .raw_writefn = raw_write +static const ARMCPRegInfo zcr_reginfo[] = { + { .name = "ZCR_EL1", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 0, .crn = 1, .crm = 2, .opc2 = 0, + .access = PL1_RW, .type = ARM_CP_SVE, + .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[1]), + .writefn = zcr_write, .raw_writefn = raw_write }, + { .name = "ZCR_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 2, .opc2 = 0, + .access = PL2_RW, .type = ARM_CP_SVE, + .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[2]), + .writefn = zcr_write, .raw_writefn = raw_write }, + { .name = "ZCR_EL3", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 6, .crn = 1, .crm = 2, .opc2 = 0, + .access = PL3_RW, .type = ARM_CP_SVE, + .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[3]), + .writefn = zcr_write, .raw_writefn = raw_write }, }; void hw_watchpoint_update(ARMCPU *cpu, int n) @@ -8240,15 +8227,7 @@ void register_cp_regs_for_features(ARMCPU *cpu) } if (cpu_isar_feature(aa64_sve, cpu)) { - define_one_arm_cp_reg(cpu, &zcr_el1_reginfo); - if (arm_feature(env, ARM_FEATURE_EL2)) { - define_one_arm_cp_reg(cpu, &zcr_el2_reginfo); - } else { - define_one_arm_cp_reg(cpu, &zcr_no_el2_reginfo); - } - if (arm_feature(env, ARM_FEATURE_EL3)) { - define_one_arm_cp_reg(cpu, &zcr_el3_reginfo); - } + define_arm_cp_regs(cpu, zcr_reginfo); } #ifdef TARGET_AARCH64 From patchwork Sun Apr 17 17:44:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562861 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1873271map; Sun, 17 Apr 2022 11:33:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFfvoQZjAbZrp8Bvx5bxd/uOrdrEGvTDdQ5Ts9BN+gv+ZZNQxujmKB0nC2RnxQlbIsuWVy X-Received: by 2002:a37:90e:0:b0:69e:a0f0:215c with SMTP id 14-20020a37090e000000b0069ea0f0215cmr575425qkj.139.1650220417603; Sun, 17 Apr 2022 11:33:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650220417; cv=none; d=google.com; s=arc-20160816; b=NdWh303HJlJWkiH37/Fr5w/lVYmBWHWJ+6/OYLT3xe/61UDf+ZofwUdjIbX80Rovfe JUn8axJU2lsPY7olL/uQEpb5Mnk01A7BiK2ZiQFCGdzsooVgDp90Am8aBPQJb4coN9sP xS+9OhoLY6E1s3WgeNHuHvvuPy9o5OzPGLtaKhLDSCg5VxjlV1tJljvXDyOp2q8NsPSF UnPxJFUCtpqUrpIXU8UxnoOB9DIc1MdLBf89tmg+HY2G1Z6etm58NLme25rC+P79CVcw 9I+zKu5OJE8z6ygpBy7zq++DG/WEC7+tiT2CweMbMjeVihGtAKOA+S2e65WEQ6tVwBoX SXMw== 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=iHPYNe1DqPRag9orJ+BvIVcsXKhWsdyBbed7JfVXS9Y=; b=stUOInnodzQsxkjROpQpIZv6G9lN/bfvp4vE5a9XAT28HftPCf9Rkc8cJR5ZXqNaLH j9fA09BwVngaCI6xSA8ByIzxf6c+WuK/ZoEj6Wyt+BUdjcEOrvNYFZQnpvpBw63Wp/JQ OcxdvPql6c766SEbgTwcRRpV1KBoO21m0I62KsbA3jOKya3kRe08lUe4yHK4ocyzaMbf IaWMeSOuqcGM1jbqkXwr2O5gtHXvfYMLLD8fiu6a1kzAlvGin4UMq4w06qnpff9E9A1p 9jOKsAodo9Pef7FE9sf791/wwRQcQmvzTikX7Q40lu+GOB9e4NOy6dnRvAuDqhoeRsGL 2Sww== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=v3ifIdMX; 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 w9-20020a05620a444900b006998fbf0de1si2605936qkp.537.2022.04.17.11.33.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:33:37 -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=v3ifIdMX; 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]:58076 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9iL-0003Tp-6c for patch@linaro.org; Sun, 17 Apr 2022 14:33:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48892) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8xO-0001YP-VP for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:07 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:33595) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8xL-0003TI-OZ for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:06 -0400 Received: by mail-pg1-x52b.google.com with SMTP id k14so14987299pga.0 for ; Sun, 17 Apr 2022 10:45:03 -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=iHPYNe1DqPRag9orJ+BvIVcsXKhWsdyBbed7JfVXS9Y=; b=v3ifIdMXFqxZJbts6cFfjOHvY7Q27JcEX/6KmdKmxur1sReuVOSq0IKVlQWM1hbcJT LMAKoVVOMy5ONsRHL9GdfIEc/TnSQtgK1exhU5jXL6LuM9ApH2Kw4N92Jc0JIR1twpIF mml99lA89i5+vBeg6lDV4cp4JCzyNZpw25UaoGmVll/KByXyn98BUMGCFPyXDOsvsCgH GLqPu5Czsws/mQB0K4Dcmx+0i7oVNt6tGImbmJZFpwRvOpdx2/US54AtFvpJNZMO9Ocw vpy1Sxt8blAv+kDMIRM1chNkPGWKKK251eIvrJ1VcoVGOZ7cn6tsQCpqnx3Ng15059Mo QoMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iHPYNe1DqPRag9orJ+BvIVcsXKhWsdyBbed7JfVXS9Y=; b=Mu7xleGfUCkHdxK54wwOnamMvY03KlzZxtFzqkxEXpEg7LDdz12a7uWuG7VlNGB8V2 P+PcA0L7+WltNs/Hit6ABwEeD4jOLrTpXt+36I9k/CipisZEW2CP7JTboLH5f1Nd6Tm3 yofrhbh94C1WzH6rLrwAnKP6kIdSCSk3/URaHGlTA91lvfDOruaL7zvZrxzJnvaIVHtW 6PcqN+8/fScuHssIdFQGBRrGuEPWqP3X2tVKEgzDfN8ktPuMkLGnh5HJC8g09EYZtxE8 aPLbIQ0UoShDQ5opDCTrQZGz8AP6EmdfXUGKu617LKXkq4xbldwWfIjjeGFq6CQscoSX YvhQ== X-Gm-Message-State: AOAM531nPqh9Jb/xBF4AuhOMyt/FS2GRb6HgsKSpzQJ49gGjDsVh2l5m 7HmSMKgEeT+vYG4C775BGPDdgXaJI4D99w== X-Received: by 2002:a63:602:0:b0:3a1:ec9d:1533 with SMTP id 2-20020a630602000000b003a1ec9d1533mr7035496pgg.470.1650217502402; Sun, 17 Apr 2022 10:45:02 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.45.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:45:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 38/60] target/arm: Add isar predicates for FEAT_Debugv8p2 Date: Sun, 17 Apr 2022 10:44:04 -0700 Message-Id: <20220417174426.711829-39-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/cpu.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 76c0dd37cd..20bf70545e 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3703,6 +3703,11 @@ static inline bool isar_feature_aa32_ssbs(const ARMISARegisters *id) return FIELD_EX32(id->id_pfr2, ID_PFR2, SSBS) != 0; } +static inline bool isar_feature_aa32_debugv8p2(const ARMISARegisters *id) +{ + return FIELD_EX32(id->id_dfr0, ID_DFR0, COPDBG) >= 8; +} + /* * 64-bit feature tests via id registers. */ @@ -4009,6 +4014,11 @@ static inline bool isar_feature_aa64_ssbs(const ARMISARegisters *id) return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, SSBS) != 0; } +static inline bool isar_feature_aa64_debugv8p2(const ARMISARegisters *id) +{ + return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, DEBUGVER) >= 8; +} + static inline bool isar_feature_aa64_sve2(const ARMISARegisters *id) { return FIELD_EX64(id->id_aa64zfr0, ID_AA64ZFR0, SVEVER) != 0; @@ -4092,6 +4102,11 @@ static inline bool isar_feature_any_tts2uxn(const ARMISARegisters *id) return isar_feature_aa64_tts2uxn(id) || isar_feature_aa32_tts2uxn(id); } +static inline bool isar_feature_any_debugv8p2(const ARMISARegisters *id) +{ + return isar_feature_aa64_debugv8p2(id) || isar_feature_aa32_debugv8p2(id); +} + /* * Forward to the above feature tests given an ARMCPU pointer. */ From patchwork Sun Apr 17 17:44:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562852 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1869183map; Sun, 17 Apr 2022 11:23:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8VTFtiA9gQ50fvjOlq41vNSHaGTROCfXIU+Acz3mdTp1qzjKimpsKncgBUQ/MGZHY4oVI X-Received: by 2002:a37:a247:0:b0:69d:5e7d:42b7 with SMTP id l68-20020a37a247000000b0069d5e7d42b7mr4729303qke.320.1650219821602; Sun, 17 Apr 2022 11:23:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650219821; cv=none; d=google.com; s=arc-20160816; b=jonm8DSBFiyhYE1mqxTT2Li5WyOtOcOAbLC8ZzQf5J6HKvQBiqJQyvpxdPN+6gTx0b mgj9f+MNFhiCaOqqZjf5K+Fk018C6Wo+lWQeTKFhevXDSEnAAb/6cl9x3cCfpR9+ai2/ jjkA6U3oUi2DWaoRxt52ZF7vLvRS41bb7XL9bEFXj+BF+k4+2jFF690D7dhKMpcLIiw5 Eh7LZ8Yj8YM2B7+z0XBeimc2ingvVh/qcQWzfeXBr/oWdGQ1sD2gHnD1+yJK/VwIyxg+ SmdvOLAWlhjdv6B55iAdVDVOdHuI6g1+1D1twemPkAqfikgmyzhOJ0GH9fhH0v/Xit7h RTsQ== 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=hifCwEGN2LJwACcTt38/T1y33ShijigpbIfXemOwv90=; b=QlIp6dplkJHHD4hbecLgSWeqTCHzXn0ueLaftCQ+KlCP60OERYYhDCh+cvxqRgQxaq eD1/jMprv8e72yVy4qLxNkBkt1rsBX1VwpUmcrs+EEYsW+a3ecQZPAZ2wm4reUO8HLpj 7UsHlS1vqYJFS5eNWzrfBo5NrD6cxlRFxEbTEkXmIkQUxDTw1TW4cT1v8WQ1+ucYnAZK e2Xuboe5zKJ2MfBFW7EPJakrf7FKzI61sZy2UW1ABAtFoWtTYmsS5f1P/X54dW7Jxm1X H642BfmE2jOryjplhJXjkapHlueYgAZuB98hTJQY+nK6A3NOUaZHuVs8OSiZ7yKYNtun TFqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=bIU79iLY; 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 15-20020a37060f000000b00699e528c823si2242724qkg.340.2022.04.17.11.23.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:23:41 -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=bIU79iLY; 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]:33032 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9Yj-0003AB-5t for patch@linaro.org; Sun, 17 Apr 2022 14:23:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48902) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng8xP-0001Zz-Ap for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:07 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]:39552) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng8xN-0003Ue-8U for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:45:06 -0400 Received: by mail-pg1-x52a.google.com with SMTP id q19so14969381pgm.6 for ; Sun, 17 Apr 2022 10:45:04 -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=hifCwEGN2LJwACcTt38/T1y33ShijigpbIfXemOwv90=; b=bIU79iLYpnr7IjvMxoxod5GuDpIgVIn1Avh2GoMgxsmZLL2IoqwwzjcNoIuS/a+W8z s9dKhfNRJwa8u4nfYbN2PwoV1ppvEBt+C+ptX4nDlv3UEmc2zKqUY43kZ8JhpUkb+GS9 MapzNxpClvFm2U1cGk+hxTnsrtTGqQZVsqrZ0ECWAqBBakG94xgvL9TwmWSAlpR94nsQ vuTR0IFstPBZZKfaeGFCz/sJwo6OIHHHzlLHws0QejNpsl7bSZppGL1MSMCYVXfzxkzl M8Mag44UVqQ09aUtSv/yZdgWhSFeFAhDcxS4zJ5VMXdVzT8oxj1ydXILyOQ399NAR59q QMSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hifCwEGN2LJwACcTt38/T1y33ShijigpbIfXemOwv90=; b=SsYl74+VmrsG4xJA2zbnqaejGD4wvbkKLf02PXFfebZigrbRu7jNGdaSIo1Ri4AJOa kc9D7Sl05txwyqiRmP0iHOLp7cRW/Cwst2uOpjoZJ3Ie26pbugZsudECh/AMrcDMphGs pQTMgD7lvTX172T2VqeTRX5Qg5msT+1mRuXgqD2HIZFcCP1ZGj/arxqF0M97XOwdlLWQ s68gXSCGn9Sj9gQY7BR1eF8Mj5c3w0e0AKV9ZYuBInLWLAGWxPsDN6F+4UeUv5OlLheq XJ80PStvxxvCA0D2O70myDl+0UoIfLbaTiRQBSTz9RIF8hNFVfDmM6386p7g/EVkYcMD UAKw== X-Gm-Message-State: AOAM5313gXnda6fOHsTIkxYeN9rm8xVbrUjtY0SVgulvBd/n+X/W//GA NoQHV6DDrCbWYJ6qLUfQcu6gWsSrN4u8xw== X-Received: by 2002:aa7:9522:0:b0:4e1:d277:ce8 with SMTP id c2-20020aa79522000000b004e1d2770ce8mr8479794pfp.16.1650217503114; Sun, 17 Apr 2022 10:45:03 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id i2-20020a17090a138200b001cb6512b579sm10372119pja.44.2022.04.17.10.45.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:45:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 39/60] target/arm: Adjust definition of CONTEXTIDR_EL2 Date: Sun, 17 Apr 2022 10:44:05 -0700 Message-Id: <20220417174426.711829-40-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52a.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This register is present for either VHE or Debugv8p2. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- v3: Rely on EL3-no-EL2 squashing during registration. --- target/arm/helper.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index e762054b5d..3570212089 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -7256,11 +7256,14 @@ static const ARMCPRegInfo jazelle_regs[] = { .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, }; +static const ARMCPRegInfo contextidr_el2 = { + .name = "CONTEXTIDR_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 13, .crm = 0, .opc2 = 1, + .access = PL2_RW, + .fieldoffset = offsetof(CPUARMState, cp15.contextidr_el[2]) +}; + static const ARMCPRegInfo vhe_reginfo[] = { - { .name = "CONTEXTIDR_EL2", .state = ARM_CP_STATE_AA64, - .opc0 = 3, .opc1 = 4, .crn = 13, .crm = 0, .opc2 = 1, - .access = PL2_RW, - .fieldoffset = offsetof(CPUARMState, cp15.contextidr_el[2]) }, { .name = "TTBR1_EL2", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 0, .opc2 = 1, .access = PL2_RW, .writefn = vmsa_tcr_ttbr_el2_write, @@ -8222,6 +8225,10 @@ void register_cp_regs_for_features(ARMCPU *cpu) define_one_arm_cp_reg(cpu, &ssbs_reginfo); } + if (cpu_isar_feature(aa64_vh, cpu) || + cpu_isar_feature(aa64_debugv8p2, cpu)) { + define_one_arm_cp_reg(cpu, &contextidr_el2); + } if (arm_feature(env, ARM_FEATURE_EL2) && cpu_isar_feature(aa64_vh, cpu)) { define_arm_cp_regs(cpu, vhe_reginfo); } From patchwork Sun Apr 17 17:44:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562855 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1870510map; Sun, 17 Apr 2022 11:27:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyC2rQXJtsyK61JHZYKxaQST+hw2Rh3ME6PF2+2aFcQQlGEZIBX2s7iqjNN2WW8DgP2GY8C X-Received: by 2002:a05:6214:767:b0:446:4144:87 with SMTP id f7-20020a056214076700b0044641440087mr5649563qvz.18.1650220021869; Sun, 17 Apr 2022 11:27:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650220021; cv=none; d=google.com; s=arc-20160816; b=TPC4LWVbk5y8tYn8K1mLw4vnCylmQSTIl0fuGkZg7IZHkUIiFJKFOzGI5Qu9Y0GH7n p52FNGLvnK9qp9EkpWTvCzMAiezVdw1MwpRB6oTUjNMlmbGIsV5IFuHfalUTQX+bZCH0 aVm2lTmxV5Xe2FscsyKmh91389DVpQ5dOT6jpn+sGF0uZzAf8PDHngShd50BZ8RiLGmV 6mvHYTwrJeBeqfBp7NozhHGNFTRfjLY2Z+KEJJYw7GcJpCDBwz6wXFwPkpwof3FC61OO 4Tfh5vmnLsXRjPaFSNyJBJBYtm0BJ594FmG0fn1Lgzr48ED/L8buLYPwcP5AVLzdhTx6 C99Q== 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=SQLjPgr/00ZHzz+LXu9cgSfnxSwNm0BkUh4Gx2ZNmzI=; b=j1eDjoyy6GFLKw8/FUCnAgDn3HSvOr6sT1buSnzY4hKR0xGqIiBb4GyQoAvbOdlzKn gIxALkJAxyk44JuIyZM8JhWOSgdMhdcb5YvkdSBkZTpQwEs+NeC8VNbycbV0BB6hTimS kfNvM6TOP63dwM/QQ2AtL2RzowgYnn0VjKNKBfwxmjsNj2CzmNpnelH29FhGO/qC0luK +X+xX8z1jrbAhrMhlo2JnzkKqHWMM6G+4/zHmjLl1WzXLBbgypPwSG5uOjdUeDIF8sOe QC7vsISmo1vx/T4ajObhzCX6PAXB/pDM6yfUqf0KAngC8HoBsvVVtFd4Rh/VvBPW44Pg iD9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mIyi9tON; 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 g5-20020a0562141cc500b00440e46a7c26si2398296qvd.196.2022.04.17.11.27.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:27:01 -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=mIyi9tON; 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]:41758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9bx-0000ma-F3 for patch@linaro.org; Sun, 17 Apr 2022 14:27:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49304) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng90K-0004Lm-2k for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:08 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:37746) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng90I-00041T-1y for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:07 -0400 Received: by mail-pl1-x62a.google.com with SMTP id v12so10752466plv.4 for ; Sun, 17 Apr 2022 10:48:05 -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=SQLjPgr/00ZHzz+LXu9cgSfnxSwNm0BkUh4Gx2ZNmzI=; b=mIyi9tON29gCMputm9X387391rlIQRigK/2td+qN81SyAhQ0d22YW7PCoxlsh/mMpH PylBOWsaBCK3yEbbCVTBKU8ygZsxCUp8+lfwQIA9uYo1iVltbaPPJymwqyMzrGDpQv6o YySd8xchjrIJ/D8y14i4jByoSzy46K8ADqXfldvy/xuEY9K8849cAwaUwLcstmaROEtU ijnhgBmvMZSE5Nse732dIkF5SqeVghln0+sHqBOd34QwLwfQnsmGcZX/ZMFJtPF00AxX LYIwDwjrz80vrZ66iAqOoBqcPzMmVbQpunRvGWfPm9ONlko2SHzmU1PLnZlHY9tpXrFh pzCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SQLjPgr/00ZHzz+LXu9cgSfnxSwNm0BkUh4Gx2ZNmzI=; b=n+vTKODzJI8EYNHOWShHYF+sG+10jGuL9VXbQU+1ktm5nc0g9NOYiPY76Go+YUk04+ MklrLua+LCQKgwTOXiCzfwhoKDkXEDQQzaP35yYSokPA/1rgasg5NR2L+X8ukvEnNbrP 7os+YOgmPKTesVpnSaVgz2y0IKvP3ESl/byC91ZJeXV2ex/jW/A+/tdP2kgr3AFIJHwx Zta1ezmmUsHVv7cXebLMEm98dpTI7KqoDUGiK2Zb2e1QXlGQtFs9rh4/6v7Og7xeAl+y APc3Ih7T4AvWRQze39LtXQizd6F00J2Ldcgzw3AiKrWo6UstrpF7mCxLdQElIocpIQhb QBWA== X-Gm-Message-State: AOAM532W2SRDqWxk4jk/sGeLDejiyFwkbujd9T+fGz6A4GK71CZF5wvT bV+3AI+rbAkEprO83nRa55UYSkx6lgsnFA== X-Received: by 2002:a17:90b:38cb:b0:1d2:6c52:5be0 with SMTP id nn11-20020a17090b38cb00b001d26c525be0mr6620290pjb.32.1650217684476; Sun, 17 Apr 2022 10:48:04 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020aa78c4e000000b00506475da4cesm9372055pfd.49.2022.04.17.10.48.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:48:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 40/60] target/arm: Move cortex impdef sysregs to cpu_tcg.c Date: Sun, 17 Apr 2022 10:44:06 -0700 Message-Id: <20220417174426.711829-41-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Previously we were defining some of these in user-only mode, but none of them are accessible from user-only, therefore define them only in system mode. This will shortly be used from cpu_tcg.c also. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- v2: New patch. --- target/arm/internals.h | 6 ++++ target/arm/cpu64.c | 64 +++--------------------------------------- target/arm/cpu_tcg.c | 59 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 60 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index 7f696cd36a..96a57ee68f 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1295,4 +1295,10 @@ int aarch64_fpu_gdb_get_reg(CPUARMState *env, GByteArray *buf, int reg); int aarch64_fpu_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg); #endif +#ifdef CONFIG_USER_ONLY +static inline void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu) { } +#else +void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu); +#endif + #endif diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index c40373bd18..67d628c0af 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -34,65 +34,9 @@ #include "hvf_arm.h" #include "qapi/visitor.h" #include "hw/qdev-properties.h" -#include "cpregs.h" +#include "internals.h" -#ifndef CONFIG_USER_ONLY -static uint64_t a57_a53_l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri) -{ - ARMCPU *cpu = env_archcpu(env); - - /* Number of cores is in [25:24]; otherwise we RAZ */ - return (cpu->core_count - 1) << 24; -} -#endif - -static const ARMCPRegInfo cortex_a72_a57_a53_cp_reginfo[] = { -#ifndef CONFIG_USER_ONLY - { .name = "L2CTLR_EL1", .state = ARM_CP_STATE_AA64, - .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 2, - .access = PL1_RW, .readfn = a57_a53_l2ctlr_read, - .writefn = arm_cp_write_ignore }, - { .name = "L2CTLR", - .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 2, - .access = PL1_RW, .readfn = a57_a53_l2ctlr_read, - .writefn = arm_cp_write_ignore }, -#endif - { .name = "L2ECTLR_EL1", .state = ARM_CP_STATE_AA64, - .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 3, - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "L2ECTLR", - .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 3, - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "L2ACTLR", .state = ARM_CP_STATE_BOTH, - .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 0, .opc2 = 0, - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "CPUACTLR_EL1", .state = ARM_CP_STATE_AA64, - .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 0, - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "CPUACTLR", - .cp = 15, .opc1 = 0, .crm = 15, - .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, - { .name = "CPUECTLR_EL1", .state = ARM_CP_STATE_AA64, - .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 1, - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "CPUECTLR", - .cp = 15, .opc1 = 1, .crm = 15, - .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, - { .name = "CPUMERRSR_EL1", .state = ARM_CP_STATE_AA64, - .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 2, - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "CPUMERRSR", - .cp = 15, .opc1 = 2, .crm = 15, - .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, - { .name = "L2MERRSR_EL1", .state = ARM_CP_STATE_AA64, - .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 3, - .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, - { .name = "L2MERRSR", - .cp = 15, .opc1 = 3, .crm = 15, - .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, -}; - static void aarch64_a57_initfn(Object *obj) { ARMCPU *cpu = ARM_CPU(obj); @@ -143,7 +87,7 @@ static void aarch64_a57_initfn(Object *obj) cpu->gic_num_lrs = 4; cpu->gic_vpribits = 5; cpu->gic_vprebits = 5; - define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo); + define_cortex_a72_a57_a53_cp_reginfo(cpu); } static void aarch64_a53_initfn(Object *obj) @@ -196,7 +140,7 @@ static void aarch64_a53_initfn(Object *obj) cpu->gic_num_lrs = 4; cpu->gic_vpribits = 5; cpu->gic_vprebits = 5; - define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo); + define_cortex_a72_a57_a53_cp_reginfo(cpu); } static void aarch64_a72_initfn(Object *obj) @@ -247,7 +191,7 @@ static void aarch64_a72_initfn(Object *obj) cpu->gic_num_lrs = 4; cpu->gic_vpribits = 5; cpu->gic_vprebits = 5; - define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo); + define_cortex_a72_a57_a53_cp_reginfo(cpu); } void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c index 9338088b22..d078f06931 100644 --- a/target/arm/cpu_tcg.c +++ b/target/arm/cpu_tcg.c @@ -20,6 +20,65 @@ #endif #include "cpregs.h" +#ifndef CONFIG_USER_ONLY +static uint64_t l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri) +{ + ARMCPU *cpu = env_archcpu(env); + + /* Number of cores is in [25:24]; otherwise we RAZ */ + return (cpu->core_count - 1) << 24; +} + +static const ARMCPRegInfo cortex_a72_a57_a53_cp_reginfo[] = { + { .name = "L2CTLR_EL1", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 2, + .access = PL1_RW, .readfn = l2ctlr_read, + .writefn = arm_cp_write_ignore }, + { .name = "L2CTLR", + .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 2, + .access = PL1_RW, .readfn = l2ctlr_read, + .writefn = arm_cp_write_ignore }, + { .name = "L2ECTLR_EL1", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 3, + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, + { .name = "L2ECTLR", + .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 3, + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, + { .name = "L2ACTLR", .state = ARM_CP_STATE_BOTH, + .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 0, .opc2 = 0, + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, + { .name = "CPUACTLR_EL1", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 0, + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, + { .name = "CPUACTLR", + .cp = 15, .opc1 = 0, .crm = 15, + .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, + { .name = "CPUECTLR_EL1", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 1, + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, + { .name = "CPUECTLR", + .cp = 15, .opc1 = 1, .crm = 15, + .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, + { .name = "CPUMERRSR_EL1", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 2, + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, + { .name = "CPUMERRSR", + .cp = 15, .opc1 = 2, .crm = 15, + .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, + { .name = "L2MERRSR_EL1", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 3, + .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, + { .name = "L2MERRSR", + .cp = 15, .opc1 = 3, .crm = 15, + .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 }, +}; + +void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu) +{ + define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo); +} +#endif /* !CONFIG_USER_ONLY */ + /* CPU models. These are not needed for the AArch64 linux-user build. */ #if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64) From patchwork Sun Apr 17 17:44:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562865 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1875308map; Sun, 17 Apr 2022 11:37:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaVP4w0Srzd/6V5alr1BoWLZz6sYeppltBlQz3+ZZqeko2UhSx6IvEM3qS+BCfUiBzkQYm X-Received: by 2002:a05:622a:4290:b0:2ed:2383:c652 with SMTP id cr16-20020a05622a429000b002ed2383c652mr5060226qtb.581.1650220671431; Sun, 17 Apr 2022 11:37:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650220671; cv=none; d=google.com; s=arc-20160816; b=nn/R1EjXYOREY39gTr0D+YxXRCo13qQxmDH4m7kCnFAQF2Gs1RPBXLPxjWVNq6Ie+a JJQSbUu57QU7w0BYRNwqVdeuQROxK/83cwZax656Nb53HebZ99pee0p8k7SSee5GQwaT b583d4FLDg/hgsxH4hGfcDTeSNbR7L1QVl/TUVzIJv2tcvsd/RPZXuAHC6W22mlPKHkC y4czUIjqVCl20HatDNbVtGlxglu69oXlIytg/WXIgLK6e4oeZKXVrPmuOtysqCboLsEc WUVc7PEuttZnM0PKTJ27ULfSrRgL4LwHQIZrCBswcPwq9nxBizOuvpXIdI//m/rSQyrj C5Zg== 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=jZO2s2Dq5qIWYyOsW4ddvrBCzFuwwq3hNNH5bBMwhnA=; b=hgcyHGIbdxzdnK/OCaEcJe4/LJSVf4NKxDpeceuUTQTJ3Pu+AgoWdjZGvt1UiyIzt3 RA0TOsipYKjqohr17apk7Hp0Cit2UtQYS7fRtqXH96jc2ggscr7BtWE6Ephh9QTItg+W sgzCrrBwNC/AMhBOH/Bp8c22+LQNXaF0EFxr51H4yUmIQrh3VI3Q3Ncmb/hP9pNQV7qF EkpfIcpNzsVJVTn3IU51OjmQXAUmwEGddyo/eyuU4bcf17hA3g8+eQ0zseSQvQ4iDf0z 3dvG0zSXfisgT94AzlPCkf4/Jd6fYPdOCYkrgnxSuftbgZRjMzBN8gNxZ5gjntS1FxRK 6cUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G9t9ymgX; 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 l22-20020a05620a28d600b0069c7f40cd9asi2488532qkp.565.2022.04.17.11.37.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:37:51 -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=G9t9ymgX; 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]:38668 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9mP-00015Z-Fm for patch@linaro.org; Sun, 17 Apr 2022 14:37:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49390) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng90M-0004Mb-79 for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:10 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:41899) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng90I-00041b-O6 for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:09 -0400 Received: by mail-pj1-x1035.google.com with SMTP id e8-20020a17090a118800b001cb13402ea2so12268357pja.0 for ; Sun, 17 Apr 2022 10:48: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=jZO2s2Dq5qIWYyOsW4ddvrBCzFuwwq3hNNH5bBMwhnA=; b=G9t9ymgXECL3lYrFCM65aJJ00LL6+XU5nUFcmgLdS5K/3O5QjXT2PxvJodG6ao8IjM BFQcM5fVwXRYZ9mXgPD0QPmfaA2bXsiVR7WmGHmqU3fn433EGesnVx6A6gEbuZia+jUn mV7eDqD9R+tUVIVvX1aZ4eEa8Zay8UV/o3tu8EOdOd5RkHvlhLWB6Yk3rw+/Gg/oIjqD pPShJpnfqEjpoLW2iIdW6dBqTbhX0K8oJHnSHZ3NN1fdgtYonfkVWx/LV9BVgsHrI3AY 2KjSzzf7lbsc8Fu3k96w/vJPfCJzbx3j29IWH3siwXKm/WmPb1myhqDd0Mdo714c4RLd h34A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jZO2s2Dq5qIWYyOsW4ddvrBCzFuwwq3hNNH5bBMwhnA=; b=rzs11OK2qPmgZkR3v26C1Nx31qZ6iHWAe4et49QkXd+SQT9u9bddgfEClau96tCVqn 6D+lgo0bEsS32CCQouTptma5gOcuA4BV30j86fT903j1Jn5QF6C1qYIMB5RbmBaKGpZu 6lmrJK+EmVWzH6I9JnAS9EMX9/GRHlBa+oain2/DkF/kRvqvIYiqRSKbRjQFZ03dCLQd tBv+1gD+s+gCc+RB/VrjXchiLCTSHxvlD12yYbVZ9VtuloekzK0SkJvT6qRZtYlJhxTS E773PuBBXAwCQRjLn+RDnIjPsRv3bTU2u2fM2tRVnFKL4GJ5BgQR+EuFtiO7SOhE33h/ 0Hxg== X-Gm-Message-State: AOAM532E3VPGmfmHLvGs0MOim+dwcc9R8aaIVs3c5kDW5zlDTWsvY2JE Ne9W9Nbgcp9/9vgbWPMaw5DxrRk6V+j3FA== X-Received: by 2002:a17:90b:3852:b0:1d2:7cae:220a with SMTP id nl18-20020a17090b385200b001d27cae220amr5039570pjb.197.1650217685301; Sun, 17 Apr 2022 10:48:05 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020aa78c4e000000b00506475da4cesm9372055pfd.49.2022.04.17.10.48.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:48:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 41/60] target/arm: Update qemu-system-arm -cpu max to cortex-a57 Date: Sun, 17 Apr 2022 10:44:07 -0700 Message-Id: <20220417174426.711829-42-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Instead of starting with cortex-a15 and adding v8 features to a v7 cpu, begin with a v8 cpu stripped of its aarch64 features. This fixes the long-standing to-do where we only enabled v8 features for user-only. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- v2: Create impdef sysregs; only enable short-vector support for user-only. --- target/arm/cpu_tcg.c | 151 ++++++++++++++++++++++++++----------------- 1 file changed, 92 insertions(+), 59 deletions(-) diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c index d078f06931..f9094c1752 100644 --- a/target/arm/cpu_tcg.c +++ b/target/arm/cpu_tcg.c @@ -994,71 +994,104 @@ static void arm_v7m_class_init(ObjectClass *oc, void *data) static void arm_max_initfn(Object *obj) { ARMCPU *cpu = ARM_CPU(obj); + uint32_t t; - cortex_a15_initfn(obj); + /* aarch64_a57_initfn, advertising none of the aarch64 features */ + cpu->dtb_compatible = "arm,cortex-a57"; + set_feature(&cpu->env, ARM_FEATURE_V8); + set_feature(&cpu->env, ARM_FEATURE_NEON); + set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); + set_feature(&cpu->env, ARM_FEATURE_CBAR_RO); + set_feature(&cpu->env, ARM_FEATURE_EL2); + set_feature(&cpu->env, ARM_FEATURE_EL3); + set_feature(&cpu->env, ARM_FEATURE_PMU); + cpu->midr = 0x411fd070; + cpu->revidr = 0x00000000; + cpu->reset_fpsid = 0x41034070; + cpu->isar.mvfr0 = 0x10110222; + cpu->isar.mvfr1 = 0x12111111; + cpu->isar.mvfr2 = 0x00000043; + cpu->ctr = 0x8444c004; + cpu->reset_sctlr = 0x00c50838; + cpu->isar.id_pfr0 = 0x00000131; + cpu->isar.id_pfr1 = 0x00011011; + cpu->isar.id_dfr0 = 0x03010066; + cpu->id_afr0 = 0x00000000; + cpu->isar.id_mmfr0 = 0x10101105; + cpu->isar.id_mmfr1 = 0x40000000; + cpu->isar.id_mmfr2 = 0x01260000; + cpu->isar.id_mmfr3 = 0x02102211; + cpu->isar.id_isar0 = 0x02101110; + cpu->isar.id_isar1 = 0x13112111; + cpu->isar.id_isar2 = 0x21232042; + cpu->isar.id_isar3 = 0x01112131; + cpu->isar.id_isar4 = 0x00011142; + cpu->isar.id_isar5 = 0x00011121; + cpu->isar.id_isar6 = 0; + cpu->isar.dbgdidr = 0x3516d000; + cpu->clidr = 0x0a200023; + cpu->ccsidr[0] = 0x701fe00a; /* 32KB L1 dcache */ + cpu->ccsidr[1] = 0x201fe012; /* 48KB L1 icache */ + cpu->ccsidr[2] = 0x70ffe07a; /* 2048KB L2 cache */ + define_cortex_a72_a57_a53_cp_reginfo(cpu); - /* old-style VFP short-vector support */ - cpu->isar.mvfr0 = FIELD_DP32(cpu->isar.mvfr0, MVFR0, FPSHVEC, 1); + /* Add additional features supported by QEMU */ + t = cpu->isar.id_isar5; + t = FIELD_DP32(t, ID_ISAR5, AES, 2); + t = FIELD_DP32(t, ID_ISAR5, SHA1, 1); + t = FIELD_DP32(t, ID_ISAR5, SHA2, 1); + t = FIELD_DP32(t, ID_ISAR5, CRC32, 1); + t = FIELD_DP32(t, ID_ISAR5, RDM, 1); + t = FIELD_DP32(t, ID_ISAR5, VCMA, 1); + cpu->isar.id_isar5 = t; + + t = cpu->isar.id_isar6; + t = FIELD_DP32(t, ID_ISAR6, JSCVT, 1); + t = FIELD_DP32(t, ID_ISAR6, DP, 1); + t = FIELD_DP32(t, ID_ISAR6, FHM, 1); + t = FIELD_DP32(t, ID_ISAR6, SB, 1); + t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1); + t = FIELD_DP32(t, ID_ISAR6, BF16, 1); + t = FIELD_DP32(t, ID_ISAR6, I8MM, 1); + cpu->isar.id_isar6 = t; + + t = cpu->isar.mvfr1; + t = FIELD_DP32(t, MVFR1, FPHP, 3); /* v8.2-FP16 */ + t = FIELD_DP32(t, MVFR1, SIMDHP, 2); /* v8.2-FP16 */ + cpu->isar.mvfr1 = t; + + t = cpu->isar.mvfr2; + t = FIELD_DP32(t, MVFR2, SIMDMISC, 3); /* SIMD MaxNum */ + t = FIELD_DP32(t, MVFR2, FPMISC, 4); /* FP MaxNum */ + cpu->isar.mvfr2 = t; + + t = cpu->isar.id_mmfr3; + t = FIELD_DP32(t, ID_MMFR3, PAN, 2); /* ATS1E1 */ + cpu->isar.id_mmfr3 = t; + + t = cpu->isar.id_mmfr4; + t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */ + t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ + t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */ + t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* TTS2UXN */ + cpu->isar.id_mmfr4 = t; + + t = cpu->isar.id_pfr0; + t = FIELD_DP32(t, ID_PFR0, DIT, 1); + cpu->isar.id_pfr0 = t; + + t = cpu->isar.id_pfr2; + t = FIELD_DP32(t, ID_PFR2, SSBS, 1); + cpu->isar.id_pfr2 = t; #ifdef CONFIG_USER_ONLY /* - * We don't set these in system emulation mode for the moment, - * since we don't correctly set (all of) the ID registers to - * advertise them. + * Break with true ARMv8 and add back old-style VFP short-vector support. + * Only do this for user-mode, where -cpu max is the default, so that + * older v6 and v7 programs are more likely to work without adjustment. */ - set_feature(&cpu->env, ARM_FEATURE_V8); - { - uint32_t t; - - t = cpu->isar.id_isar5; - t = FIELD_DP32(t, ID_ISAR5, AES, 2); - t = FIELD_DP32(t, ID_ISAR5, SHA1, 1); - t = FIELD_DP32(t, ID_ISAR5, SHA2, 1); - t = FIELD_DP32(t, ID_ISAR5, CRC32, 1); - t = FIELD_DP32(t, ID_ISAR5, RDM, 1); - t = FIELD_DP32(t, ID_ISAR5, VCMA, 1); - cpu->isar.id_isar5 = t; - - t = cpu->isar.id_isar6; - t = FIELD_DP32(t, ID_ISAR6, JSCVT, 1); - t = FIELD_DP32(t, ID_ISAR6, DP, 1); - t = FIELD_DP32(t, ID_ISAR6, FHM, 1); - t = FIELD_DP32(t, ID_ISAR6, SB, 1); - t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1); - t = FIELD_DP32(t, ID_ISAR6, BF16, 1); - t = FIELD_DP32(t, ID_ISAR6, I8MM, 1); - cpu->isar.id_isar6 = t; - - t = cpu->isar.mvfr1; - t = FIELD_DP32(t, MVFR1, FPHP, 3); /* v8.2-FP16 */ - t = FIELD_DP32(t, MVFR1, SIMDHP, 2); /* v8.2-FP16 */ - cpu->isar.mvfr1 = t; - - t = cpu->isar.mvfr2; - t = FIELD_DP32(t, MVFR2, SIMDMISC, 3); /* SIMD MaxNum */ - t = FIELD_DP32(t, MVFR2, FPMISC, 4); /* FP MaxNum */ - cpu->isar.mvfr2 = t; - - t = cpu->isar.id_mmfr3; - t = FIELD_DP32(t, ID_MMFR3, PAN, 2); /* ATS1E1 */ - cpu->isar.id_mmfr3 = t; - - t = cpu->isar.id_mmfr4; - t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */ - t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ - t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */ - t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* TTS2UXN */ - cpu->isar.id_mmfr4 = t; - - t = cpu->isar.id_pfr0; - t = FIELD_DP32(t, ID_PFR0, DIT, 1); - cpu->isar.id_pfr0 = t; - - t = cpu->isar.id_pfr2; - t = FIELD_DP32(t, ID_PFR2, SSBS, 1); - cpu->isar.id_pfr2 = t; - } -#endif /* CONFIG_USER_ONLY */ + cpu->isar.mvfr0 = FIELD_DP32(cpu->isar.mvfr0, MVFR0, FPSHVEC, 1); +#endif } #endif /* !TARGET_AARCH64 */ From patchwork Sun Apr 17 17:44:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562862 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1873452map; Sun, 17 Apr 2022 11:34:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxj6KKoqtszTzpXGZxIYIe0fu9Bb/JPE0ZsvAUU3edBl498j9nCX+Ulb9DrLmHks8EO4wKQ X-Received: by 2002:a05:620a:371f:b0:69e:898a:d154 with SMTP id de31-20020a05620a371f00b0069e898ad154mr2307189qkb.644.1650220442152; Sun, 17 Apr 2022 11:34:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650220442; cv=none; d=google.com; s=arc-20160816; b=F981rwvlD4VyeASpHO0hyhYxqobL45TMPlMyjY68XxcVmb3F/AE9gbi6sIm+FwY34j j/QklzKXYf1JAXxJgeZRuhq3Ijlk+jZqDTKPyma4ADpGHlkxKWhHj4PZNfl7CKAHbwdl y7id9X5L1f/P/54ReApCTW4AU9V6xlJK31n2YWxggeqxmu9wdAkF4KL2DmTwZa8KxXNm VN4vrbsqRWetzSG+nkp0g4Lv2MNN9NFhAcrS9Magg8s+3WavlyZrExKhTyMd1B4FEfDn 7Hv5SN73PbDkiJT4UdvO0DnTjPjFYVTY3wuvI2+81em0FcuhvHSzNawB1XFqd25QWcvc /F7g== 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=dXnzIOLVWxiQUUxJDgWm+uk0rCunZPcvtv01su9duzA=; b=uKyHCqDIXo0qCWA4vCf7mCBEiA6CcLM8ZHuSmLKgE0mfvpgCsYLM5laWCzw1jYJ/IH vOz0L7Ic6/cnCKwA/4rBE87F3wwxAo8x5mA6Xp3xkH44hBSNSbF/adtBw1va7dOosgo3 mF847ZB3MRKxD8rnQiHRPhh6wmNOy1xsn2CKlzHoEcKyeA/gQ8/gu1jSwLLkegKp/YLM 9paclJUn3Kc7jk591uTrZ/OCKOCyYEuVtZjSHRfkGxcsvK94gFCBQjCaN8V9q9blUJ34 yKjU1cWVmP+rH78g8oULI0HZ1dD4RvQ5IZBSnMCvlv1N+704TF3xSfm0JRqu9RxkZLaS JDFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IwyoYnQ3; 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 s2-20020a0562140ca200b00446562ab5a8si555162qvs.590.2022.04.17.11.34.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:34:02 -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=IwyoYnQ3; 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]:59114 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9ij-0004AJ-Hf for patch@linaro.org; Sun, 17 Apr 2022 14:34:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng90M-0004MY-18 for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:10 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:53778) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng90J-00041k-HD for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:09 -0400 Received: by mail-pj1-x1035.google.com with SMTP id bx5so11322162pjb.3 for ; Sun, 17 Apr 2022 10:48:07 -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=dXnzIOLVWxiQUUxJDgWm+uk0rCunZPcvtv01su9duzA=; b=IwyoYnQ3gcGuhO0cGuMFU6sYQovqwQ/KBdTKSL+LakbeC9SNFcYpPGtfJyc8us6hUU IvHVl3rFlQvyxN1mwiQSvDYnVoX6yS96xdbJT+p2aJPmrx/DoFTo+/AC6SWmDSgrLHsG Zpbd4W6j9bXEav5vHd6sO1FYNvH+kr97mnh37aPIcliVFXtciwQokPAwljIdLEkd/Dmm YkoPGb0zzvurqI0cIdZyhaZQFYH5p7NZOKchSjhJ6uZCujtROVWQKU4Kg1DBBUQNTozk ETMshohEnweRB+j3IsfCZtGrFfVso9MrEhfGNvasc4vZEpeQpTLXK2mIo743zf72AFGN XxNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dXnzIOLVWxiQUUxJDgWm+uk0rCunZPcvtv01su9duzA=; b=cSJ/8UbhE2bf89z2xZ0BmEg8BT0ymeRbnHFVa+0R3OvxFha0XzCpgSvzYAQE/VMoi1 TKxVX5ycIjWl7Rhd54ExevncLNYy3UmIFZ1BXrbbxV9Vq0s9/XRRmA/6AZKsbV08THyN qj7jdWExKSiiuYdzvei9fIVsdH7q1yG4Chcc130YA6162hbRl9CC4665S2c3YAW7XOg/ tpPT3WJVrZHuzLxNp+IfYqccsGsio4U9WQZG+cidBU5vGSlLvJPOAKtc/ruuUbuYwAnT 6RlyGpWx2nayCFpkB4Vlzh7KfdhYwqT59zVnK1TVBefQ9cyBWD3/0BLGXZNKyAQ9L+jI 0NFg== X-Gm-Message-State: AOAM531ub09x6q/Vo8XkKfnKO4Qubz0E9hMq6Z1ZXy0zo5YBanFbyeL+ zSbgThn0P8mrdSd8MIewocL83nS6MAGSLw== X-Received: by 2002:a17:90b:268b:b0:1cd:3f24:d52d with SMTP id pl11-20020a17090b268b00b001cd3f24d52dmr9072835pjb.174.1650217686237; Sun, 17 Apr 2022 10:48:06 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020aa78c4e000000b00506475da4cesm9372055pfd.49.2022.04.17.10.48.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:48:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 42/60] target/arm: Set ID_DFR0.PerfMon for qemu-system-arm -cpu max Date: Sun, 17 Apr 2022 10:44:08 -0700 Message-Id: <20220417174426.711829-43-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We set this for qemu-system-aarch64, but failed to do so for the strictly 32-bit emulation. Fixes: 3bec78447a9 ("target/arm: Provide ARMv8.4-PMU in '-cpu max'") Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/cpu_tcg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c index f9094c1752..9aa2f737c1 100644 --- a/target/arm/cpu_tcg.c +++ b/target/arm/cpu_tcg.c @@ -1084,6 +1084,10 @@ static void arm_max_initfn(Object *obj) t = FIELD_DP32(t, ID_PFR2, SSBS, 1); cpu->isar.id_pfr2 = t; + t = cpu->isar.id_dfr0; + t = FIELD_DP32(t, ID_DFR0, PERFMON, 5); /* v8.4-PMU */ + cpu->isar.id_dfr0 = t; + #ifdef CONFIG_USER_ONLY /* * Break with true ARMv8 and add back old-style VFP short-vector support. From patchwork Sun Apr 17 17:44:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562869 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1877342map; Sun, 17 Apr 2022 11:43:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTQN7kN4HbAp4QYiY9PxWjrHm8JZdEW9r2Sog51c1d0phaPNGLsq7e0wMYpGGE8vj6/FqW X-Received: by 2002:a05:620a:2456:b0:69e:9fa0:6479 with SMTP id h22-20020a05620a245600b0069e9fa06479mr789934qkn.414.1650220986421; Sun, 17 Apr 2022 11:43:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650220986; cv=none; d=google.com; s=arc-20160816; b=s4g5IXUC0VEm7nFGJL2aiX4DNZHUmGxHzHK3IzPnRJVccV0EtjSe0/s0rfOtn7LOJA oq2GSBhebj1XiwGaPb1sTl/FldvdwSFt3NEZa41cGgcraMXp1Jeg2KPwz2o4Y/cBnRdh DYta1hKebHjAZsgO0oBSedGj8t8pZZ/zadQmST7tuPR+Y3C2bRU7TeFQbfFtFZJ3ZQp5 qFbZZavunCEvOiQkvXXW4Jun/qHuK84ap4CAl19r4u8ZQI2Awyts8N7L7h5izKmrgTy5 kdaIt4R+f+0CCHmJYjZAhPuC3rYM3ogsgGx285vKU/HdJTYeUePub2ueqo3w4mz0uOa8 /Oiw== 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=GHF+a2Qyrz5F/3+6IDTyiWH9/YuVGk55F/V8AQHmA28=; b=SUl04LwdeGJvODTGXjYNlEcVGPYr9PgGGbbqXd4EE0IBCuEaz/5EZy3geszSF4t0A8 8eEepyand6rhL3/noDQCju93mVmvya0gdrgUAjxQnnvdlks865lAWpwGJB0KLhxxdmN+ O5DA48FYr12wWU/be537opALNzUhcQ+eTecZu+iv9DBsyni4xqS0Q3PLEADT9jtoJO7F PUsZdWTAYJ6tAxDrgVxahN9N28LlF6V0gZ3h9C8jlnPPdIxcCRmIai6z0IoXDLUI9xgG UUBWyNCNepSyy1vFdQLXoU44w+DWyXy1KbCaWx5zYGWoTZ7Wkas/TAL6nVk/7TdFJvfl A6PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DrAa0WWw; 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 s5-20020ac85ec5000000b002ebce4d788fsi2254367qtx.595.2022.04.17.11.43.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:43:06 -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=DrAa0WWw; 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]:47556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9rV-00076a-Tr for patch@linaro.org; Sun, 17 Apr 2022 14:43:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng90N-0004O5-3a for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:11 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:46655) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng90K-00041w-E4 for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:10 -0400 Received: by mail-pj1-x102e.google.com with SMTP id h15-20020a17090a054f00b001cb7cd2b11dso12210984pjf.5 for ; Sun, 17 Apr 2022 10:48:08 -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=GHF+a2Qyrz5F/3+6IDTyiWH9/YuVGk55F/V8AQHmA28=; b=DrAa0WWw/F/0hcMlPC+j+px3kp/pyL9uHgbgDVXU3yxbIWxmi31xmEBgqKjV6vJE9S m5/rAUt0M2tuSvnpKCwixvNRdTgYRxpaj+FMSYXgonxSYbYfxBaOQYpgnI4aZPY/GBLn +8NKuSCMvkJ/kEDUsIghAqVc5Yntj6Hdnnxg34/4E2DzzHCgClSp4N65aw3uZ+wsStpm uDz4Qj6WvSnw8bOrctAhv/aFn/cIzgRKR2V4xC9uCXAMuPa6R/jgZmC+tiJ7WVpC9lcc bYIwCIKsaIqNkgyjEPi15xdMDnb21HI3rKoCdtseML91gpSWoGA5gU2CrXa9DANtibAF 3Rew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GHF+a2Qyrz5F/3+6IDTyiWH9/YuVGk55F/V8AQHmA28=; b=scvKIIgnOgk7NbfbGT/RRqyDyf8j1I0gJYmJnY7HISqt6NB6o06hxBRGHcDNCkFhq/ uQ8jngURGBWXhi2Up3ePkhovKkzhg+i0p/vSibzoGbUyR5Tbw/fI4eqoKRV3q8DovZSJ waHm7P2L2nqmtQFm2A+BU27NXnVH5ZohMzg6UbDQfwIzSuyXzB5xQjndTeyhzD2KsGeH klBAmEIvFeIaOvdDNSIOOGnWsiKkjFbjkkdnSthbhxz2Hr3AQvNZUgSUHBO3z1QtbW05 +YCs3GrT+cdGh2cvArXz+pcrOgLlda23RK7smj3ryQ6aNtMxLNXyd8UPKRRsG9afUzVK jRrA== X-Gm-Message-State: AOAM5311uYqmoWytQaSUfNsQgxaGe3cqpRRfLzFtyY/+PNZQFAtYf5CO d5xwKgdj5iFxan6AXmSsHen5PjlnCSbD0A== X-Received: by 2002:a17:902:b941:b0:14d:af72:3f23 with SMTP id h1-20020a170902b94100b0014daf723f23mr7896592pls.6.1650217687176; Sun, 17 Apr 2022 10:48:07 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020aa78c4e000000b00506475da4cesm9372055pfd.49.2022.04.17.10.48.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:48:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 43/60] target/arm: Split out aa32_max_features Date: Sun, 17 Apr 2022 10:44:09 -0700 Message-Id: <20220417174426.711829-44-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Share the code to set AArch32 max features so that we no longer have code drift between qemu{-system,}-{arm,aarch64}. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/internals.h | 2 + target/arm/cpu64.c | 50 +----------------- target/arm/cpu_tcg.c | 114 ++++++++++++++++++++++------------------- 3 files changed, 65 insertions(+), 101 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index 96a57ee68f..baa2a7e1f4 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1301,4 +1301,6 @@ static inline void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu) { } void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu); #endif +void aa32_max_features(ARMCPU *cpu); + #endif diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 67d628c0af..8f9e9d6dff 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -682,7 +682,6 @@ static void aarch64_max_initfn(Object *obj) { ARMCPU *cpu = ARM_CPU(obj); uint64_t t; - uint32_t u; if (kvm_enabled() || hvf_enabled()) { /* With KVM or HVF, '-cpu max' is identical to '-cpu host' */ @@ -797,57 +796,12 @@ static void aarch64_max_initfn(Object *obj) t = FIELD_DP64(t, ID_AA64ZFR0, F64MM, 1); cpu->isar.id_aa64zfr0 = t; - /* Replicate the same data to the 32-bit id registers. */ - u = cpu->isar.id_isar5; - u = FIELD_DP32(u, ID_ISAR5, AES, 2); /* AES + PMULL */ - u = FIELD_DP32(u, ID_ISAR5, SHA1, 1); - u = FIELD_DP32(u, ID_ISAR5, SHA2, 1); - u = FIELD_DP32(u, ID_ISAR5, CRC32, 1); - u = FIELD_DP32(u, ID_ISAR5, RDM, 1); - u = FIELD_DP32(u, ID_ISAR5, VCMA, 1); - cpu->isar.id_isar5 = u; - - u = cpu->isar.id_isar6; - u = FIELD_DP32(u, ID_ISAR6, JSCVT, 1); - u = FIELD_DP32(u, ID_ISAR6, DP, 1); - u = FIELD_DP32(u, ID_ISAR6, FHM, 1); - u = FIELD_DP32(u, ID_ISAR6, SB, 1); - u = FIELD_DP32(u, ID_ISAR6, SPECRES, 1); - u = FIELD_DP32(u, ID_ISAR6, BF16, 1); - u = FIELD_DP32(u, ID_ISAR6, I8MM, 1); - cpu->isar.id_isar6 = u; - - u = cpu->isar.id_pfr0; - u = FIELD_DP32(u, ID_PFR0, DIT, 1); - cpu->isar.id_pfr0 = u; - - u = cpu->isar.id_pfr2; - u = FIELD_DP32(u, ID_PFR2, SSBS, 1); - cpu->isar.id_pfr2 = u; - - u = cpu->isar.id_mmfr3; - u = FIELD_DP32(u, ID_MMFR3, PAN, 2); /* ATS1E1 */ - cpu->isar.id_mmfr3 = u; - - u = cpu->isar.id_mmfr4; - u = FIELD_DP32(u, ID_MMFR4, HPDS, 1); /* AA32HPD */ - u = FIELD_DP32(u, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ - u = FIELD_DP32(u, ID_MMFR4, CNP, 1); /* TTCNP */ - u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */ - cpu->isar.id_mmfr4 = u; - t = cpu->isar.id_aa64dfr0; t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */ cpu->isar.id_aa64dfr0 = t; - u = cpu->isar.id_dfr0; - u = FIELD_DP32(u, ID_DFR0, PERFMON, 5); /* v8.4-PMU */ - cpu->isar.id_dfr0 = u; - - u = cpu->isar.mvfr1; - u = FIELD_DP32(u, MVFR1, FPHP, 3); /* v8.2-FP16 */ - u = FIELD_DP32(u, MVFR1, SIMDHP, 2); /* v8.2-FP16 */ - cpu->isar.mvfr1 = u; + /* Replicate the same data to the 32-bit id registers. */ + aa32_max_features(cpu); #ifdef CONFIG_USER_ONLY /* diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c index 9aa2f737c1..b0dbf2c991 100644 --- a/target/arm/cpu_tcg.c +++ b/target/arm/cpu_tcg.c @@ -20,6 +20,66 @@ #endif #include "cpregs.h" + +/* Share AArch32 -cpu max features with AArch64. */ +void aa32_max_features(ARMCPU *cpu) +{ + uint32_t t; + + /* Add additional features supported by QEMU */ + t = cpu->isar.id_isar5; + t = FIELD_DP32(t, ID_ISAR5, AES, 2); + t = FIELD_DP32(t, ID_ISAR5, SHA1, 1); + t = FIELD_DP32(t, ID_ISAR5, SHA2, 1); + t = FIELD_DP32(t, ID_ISAR5, CRC32, 1); + t = FIELD_DP32(t, ID_ISAR5, RDM, 1); + t = FIELD_DP32(t, ID_ISAR5, VCMA, 1); + cpu->isar.id_isar5 = t; + + t = cpu->isar.id_isar6; + t = FIELD_DP32(t, ID_ISAR6, JSCVT, 1); + t = FIELD_DP32(t, ID_ISAR6, DP, 1); + t = FIELD_DP32(t, ID_ISAR6, FHM, 1); + t = FIELD_DP32(t, ID_ISAR6, SB, 1); + t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1); + t = FIELD_DP32(t, ID_ISAR6, BF16, 1); + t = FIELD_DP32(t, ID_ISAR6, I8MM, 1); + cpu->isar.id_isar6 = t; + + t = cpu->isar.mvfr1; + t = FIELD_DP32(t, MVFR1, FPHP, 3); /* v8.2-FP16 */ + t = FIELD_DP32(t, MVFR1, SIMDHP, 2); /* v8.2-FP16 */ + cpu->isar.mvfr1 = t; + + t = cpu->isar.mvfr2; + t = FIELD_DP32(t, MVFR2, SIMDMISC, 3); /* SIMD MaxNum */ + t = FIELD_DP32(t, MVFR2, FPMISC, 4); /* FP MaxNum */ + cpu->isar.mvfr2 = t; + + t = cpu->isar.id_mmfr3; + t = FIELD_DP32(t, ID_MMFR3, PAN, 2); /* ATS1E1 */ + cpu->isar.id_mmfr3 = t; + + t = cpu->isar.id_mmfr4; + t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */ + t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ + t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */ + t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* TTS2UXN */ + cpu->isar.id_mmfr4 = t; + + t = cpu->isar.id_pfr0; + t = FIELD_DP32(t, ID_PFR0, DIT, 1); + cpu->isar.id_pfr0 = t; + + t = cpu->isar.id_pfr2; + t = FIELD_DP32(t, ID_PFR2, SSBS, 1); + cpu->isar.id_pfr2 = t; + + t = cpu->isar.id_dfr0; + t = FIELD_DP32(t, ID_DFR0, PERFMON, 5); /* v8.4-PMU */ + cpu->isar.id_dfr0 = t; +} + #ifndef CONFIG_USER_ONLY static uint64_t l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri) { @@ -994,7 +1054,6 @@ static void arm_v7m_class_init(ObjectClass *oc, void *data) static void arm_max_initfn(Object *obj) { ARMCPU *cpu = ARM_CPU(obj); - uint32_t t; /* aarch64_a57_initfn, advertising none of the aarch64 features */ cpu->dtb_compatible = "arm,cortex-a57"; @@ -1035,58 +1094,7 @@ static void arm_max_initfn(Object *obj) cpu->ccsidr[2] = 0x70ffe07a; /* 2048KB L2 cache */ define_cortex_a72_a57_a53_cp_reginfo(cpu); - /* Add additional features supported by QEMU */ - t = cpu->isar.id_isar5; - t = FIELD_DP32(t, ID_ISAR5, AES, 2); - t = FIELD_DP32(t, ID_ISAR5, SHA1, 1); - t = FIELD_DP32(t, ID_ISAR5, SHA2, 1); - t = FIELD_DP32(t, ID_ISAR5, CRC32, 1); - t = FIELD_DP32(t, ID_ISAR5, RDM, 1); - t = FIELD_DP32(t, ID_ISAR5, VCMA, 1); - cpu->isar.id_isar5 = t; - - t = cpu->isar.id_isar6; - t = FIELD_DP32(t, ID_ISAR6, JSCVT, 1); - t = FIELD_DP32(t, ID_ISAR6, DP, 1); - t = FIELD_DP32(t, ID_ISAR6, FHM, 1); - t = FIELD_DP32(t, ID_ISAR6, SB, 1); - t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1); - t = FIELD_DP32(t, ID_ISAR6, BF16, 1); - t = FIELD_DP32(t, ID_ISAR6, I8MM, 1); - cpu->isar.id_isar6 = t; - - t = cpu->isar.mvfr1; - t = FIELD_DP32(t, MVFR1, FPHP, 3); /* v8.2-FP16 */ - t = FIELD_DP32(t, MVFR1, SIMDHP, 2); /* v8.2-FP16 */ - cpu->isar.mvfr1 = t; - - t = cpu->isar.mvfr2; - t = FIELD_DP32(t, MVFR2, SIMDMISC, 3); /* SIMD MaxNum */ - t = FIELD_DP32(t, MVFR2, FPMISC, 4); /* FP MaxNum */ - cpu->isar.mvfr2 = t; - - t = cpu->isar.id_mmfr3; - t = FIELD_DP32(t, ID_MMFR3, PAN, 2); /* ATS1E1 */ - cpu->isar.id_mmfr3 = t; - - t = cpu->isar.id_mmfr4; - t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */ - t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ - t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */ - t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* TTS2UXN */ - cpu->isar.id_mmfr4 = t; - - t = cpu->isar.id_pfr0; - t = FIELD_DP32(t, ID_PFR0, DIT, 1); - cpu->isar.id_pfr0 = t; - - t = cpu->isar.id_pfr2; - t = FIELD_DP32(t, ID_PFR2, SSBS, 1); - cpu->isar.id_pfr2 = t; - - t = cpu->isar.id_dfr0; - t = FIELD_DP32(t, ID_DFR0, PERFMON, 5); /* v8.4-PMU */ - cpu->isar.id_dfr0 = t; + aa32_max_features(cpu); #ifdef CONFIG_USER_ONLY /* From patchwork Sun Apr 17 17:44:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562872 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1879255map; Sun, 17 Apr 2022 11:47:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwy30ercUzXFNnSPYW1YLWB+NQ583z8rzzMj8Y/++DegjnWtjMLZbIhNZwRq2bhIkTdAvFE X-Received: by 2002:a05:620a:318d:b0:69e:6f03:7950 with SMTP id bi13-20020a05620a318d00b0069e6f037950mr4596973qkb.493.1650221254096; Sun, 17 Apr 2022 11:47:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650221254; cv=none; d=google.com; s=arc-20160816; b=Xfm3ZmWuaTfQokqcz7Wa3ZeK+IBOq+mgwbqUpQnIbZvS44g7D+WWxaugCYD3+mmz3M l8/HFWVRcARLxqM2E07E8ApDFJCx3DnpUIIAt1LN+Tay9YScvTKmM/ufCMpoyhAXafi/ TxEE120ZPT+95gubXLwNeIDmkzbiYT1M7PmdiRkUZuuH6QpkzmR6xbBUb4v1HMN9Nfu6 6EMcHJwNFH4VxiGC4h/fzLnszWDoATljME3SORoQovQKZTqMD0BddAFxcd8gEoiB3QCx Qx3qvdQizbXuBVfYVlC0h/3kGzDn6LF2Cj0i7B9PtBcR0nFVJ1xZTODXSHjNKMxBe3vs NaAA== 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=Mn5JAnPbX/HurKUs1s7BoD9tJ2ismYowQ5yfOSBMbhQ=; b=tcURqqPNTkazVbPQZhFOWKSJnE9yB5DNZvn9KxXGt1J5C3sKwPPBeTqT91VJn0Mk6H xxN9ELmnY7GYbax05QPtbZEZnarl2MALI6nzKjgqv2NPdnvB4ED01tn2oYNkXtL/N3CS ch1qnMcYwToTc3Om24kVkltWyc/KC0NQlayT2dm+s8pd9rWWzQkOMLx3V5wJy54DEpfg sLLh20D69Qqn4EX95TGucnxu63VYGvsubE7CL0YHM9GC7eLBEI8Ji0cXul0iuDX/VrQ8 q6JWcgz2mrgZj7CfajcYpJPJE46dAxPMWRscTMiFfMxwRLGQ22uRTO4eodA+9ZhO6voF d8rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Tjsib9k8; 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 a67-20020a376646000000b0069e9992cf66si350012qkc.351.2022.04.17.11.47.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:47:34 -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=Tjsib9k8; 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]:57592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9vp-0005OR-LG for patch@linaro.org; Sun, 17 Apr 2022 14:47:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49478) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng90O-0004Qk-Dm for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:12 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:43674) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng90L-00042K-LM for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:11 -0400 Received: by mail-pj1-x1030.google.com with SMTP id j8-20020a17090a060800b001cd4fb60dccso12244593pjj.2 for ; Sun, 17 Apr 2022 10:48:09 -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=Mn5JAnPbX/HurKUs1s7BoD9tJ2ismYowQ5yfOSBMbhQ=; b=Tjsib9k8ZsIN/wvDuHPchkYDSpMMfZBWaOa+fMvddO5H0psHzmExhKyXkOGljum7/y 0umvITqL/4XJ+RaIgprdfProK4E8OJ+Z4tntMsr2fL3pz6cL3I0EGj/HML8Q9uXSrG9F cyS+3Z6aehnHeN/WueYrvgGDP9PfeSZXkr8JNhEWDfYiU+50scSXwH+Fgqh++HtZWCMp a9PyjDwiVLYFdOCAtJMrXIAJQcIoumtzuewf6G0ilMXRiCYWQMT3NJ1iYjnxcjrx9jzt wMWTzeh6i+0se8O9Ezd+hGhy6I81bor99/WbEs3JQ0yJb8tBu/xWf4VsIJhQAr87DJU9 C+6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Mn5JAnPbX/HurKUs1s7BoD9tJ2ismYowQ5yfOSBMbhQ=; b=ANtBBrPahwiO9IBDxvG3Ih+H2DqFZ5K2MeVZEcpghLR1IiIvSq/PuMKMkfSwapFN4y gfbnocmy4j1cNU2jrUmfhUvNn+jsndSOZHEO7J563UwHv0mb97RIngikji7dtzhTgGJm OaS/aexYZAoCwG3TIwXwNoqPdjHvvfcBjNJHWmYaaha0c5vo2pge30PkQpZ17r9DIWIP NL9GWpiqpQegxnC5yOFSnTfMAZeTpxSokAtNDaEkaJKTzZTfUTa6sOZW0HnufLc92g3/ Z/JDdiELRmqB6S5s9snl0EUQeWtXtr2R+MCQ7utX0HH98t33+hhhLT1mM6WKhqlPA41b lbVg== X-Gm-Message-State: AOAM532JNUz1QweukHzejlaUU4FB0U9vRw/VQxjiW/KHXkoQU7KkXd19 t9VpoIcdf8tAA82SseYpI9gqPfjM7+EtpA== X-Received: by 2002:a17:902:8f94:b0:14f:d9b3:52c2 with SMTP id z20-20020a1709028f9400b0014fd9b352c2mr7482183plo.103.1650217688188; Sun, 17 Apr 2022 10:48:08 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020aa78c4e000000b00506475da4cesm9372055pfd.49.2022.04.17.10.48.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:48:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 44/60] target/arm: Annotate arm_max_initfn with FEAT identifiers Date: Sun, 17 Apr 2022 10:44:10 -0700 Message-Id: <20220417174426.711829-45-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.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, T_SCC_BODY_TEXT_LINE=-0.01, UPPERCASE_50_75=0.008 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Update the legacy feature names to the current names. Provide feature names for id changes that were not marked. Sort the field updates into increasing bitfield order. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/cpu64.c | 96 ++++++++++++++++++++++---------------------- target/arm/cpu_tcg.c | 48 +++++++++++----------- 2 files changed, 72 insertions(+), 72 deletions(-) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 8f9e9d6dff..c9476680d4 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -713,51 +713,51 @@ static void aarch64_max_initfn(Object *obj) cpu->midr = t; t = cpu->isar.id_aa64isar0; - t = FIELD_DP64(t, ID_AA64ISAR0, AES, 2); /* AES + PMULL */ - t = FIELD_DP64(t, ID_AA64ISAR0, SHA1, 1); - t = FIELD_DP64(t, ID_AA64ISAR0, SHA2, 2); /* SHA512 */ + t = FIELD_DP64(t, ID_AA64ISAR0, AES, 2); /* FEAT_PMULL */ + t = FIELD_DP64(t, ID_AA64ISAR0, SHA1, 1); /* FEAT_SHA1 */ + t = FIELD_DP64(t, ID_AA64ISAR0, SHA2, 2); /* FEAT_SHA512 */ t = FIELD_DP64(t, ID_AA64ISAR0, CRC32, 1); - t = FIELD_DP64(t, ID_AA64ISAR0, ATOMIC, 2); - t = FIELD_DP64(t, ID_AA64ISAR0, RDM, 1); - t = FIELD_DP64(t, ID_AA64ISAR0, SHA3, 1); - t = FIELD_DP64(t, ID_AA64ISAR0, SM3, 1); - t = FIELD_DP64(t, ID_AA64ISAR0, SM4, 1); - t = FIELD_DP64(t, ID_AA64ISAR0, DP, 1); - t = FIELD_DP64(t, ID_AA64ISAR0, FHM, 1); - t = FIELD_DP64(t, ID_AA64ISAR0, TS, 2); /* v8.5-CondM */ - t = FIELD_DP64(t, ID_AA64ISAR0, TLB, 2); /* FEAT_TLBIRANGE */ - t = FIELD_DP64(t, ID_AA64ISAR0, RNDR, 1); + t = FIELD_DP64(t, ID_AA64ISAR0, ATOMIC, 2); /* FEAT_LSE */ + t = FIELD_DP64(t, ID_AA64ISAR0, RDM, 1); /* FEAT_RDM */ + t = FIELD_DP64(t, ID_AA64ISAR0, SHA3, 1); /* FEAT_SHA3 */ + t = FIELD_DP64(t, ID_AA64ISAR0, SM3, 1); /* FEAT_SM3 */ + t = FIELD_DP64(t, ID_AA64ISAR0, SM4, 1); /* FEAT_SM4 */ + t = FIELD_DP64(t, ID_AA64ISAR0, DP, 1); /* FEAT_DotProd */ + t = FIELD_DP64(t, ID_AA64ISAR0, FHM, 1); /* FEAT_FHM */ + t = FIELD_DP64(t, ID_AA64ISAR0, TS, 2); /* FEAT_FlagM2 */ + t = FIELD_DP64(t, ID_AA64ISAR0, TLB, 2); /* FEAT_TLBIRANGE */ + t = FIELD_DP64(t, ID_AA64ISAR0, RNDR, 1); /* FEAT_RNG */ cpu->isar.id_aa64isar0 = t; t = cpu->isar.id_aa64isar1; - t = FIELD_DP64(t, ID_AA64ISAR1, DPB, 2); - t = FIELD_DP64(t, ID_AA64ISAR1, JSCVT, 1); - t = FIELD_DP64(t, ID_AA64ISAR1, FCMA, 1); - t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1); - t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1); - t = FIELD_DP64(t, ID_AA64ISAR1, BF16, 1); - t = FIELD_DP64(t, ID_AA64ISAR1, FRINTTS, 1); - t = FIELD_DP64(t, ID_AA64ISAR1, LRCPC, 2); /* ARMv8.4-RCPC */ - t = FIELD_DP64(t, ID_AA64ISAR1, I8MM, 1); + t = FIELD_DP64(t, ID_AA64ISAR1, DPB, 2); /* FEAT_DPB2 */ + t = FIELD_DP64(t, ID_AA64ISAR1, JSCVT, 1); /* FEAT_JSCVT */ + t = FIELD_DP64(t, ID_AA64ISAR1, FCMA, 1); /* FEAT_FCMA */ + t = FIELD_DP64(t, ID_AA64ISAR1, LRCPC, 2); /* FEAT_LRCPC2 */ + t = FIELD_DP64(t, ID_AA64ISAR1, FRINTTS, 1); /* FEAT_FRINTTS */ + t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1); /* FEAT_SB */ + t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1); /* FEAT_SPECRES */ + t = FIELD_DP64(t, ID_AA64ISAR1, BF16, 1); /* FEAT_BF16 */ + t = FIELD_DP64(t, ID_AA64ISAR1, I8MM, 1); /* FEAT_I8MM */ cpu->isar.id_aa64isar1 = t; t = cpu->isar.id_aa64pfr0; + t = FIELD_DP64(t, ID_AA64PFR0, FP, 1); /* FEAT_FP16 */ + t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1); /* FEAT_FP16 */ t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1); - t = FIELD_DP64(t, ID_AA64PFR0, FP, 1); - t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1); - t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); - t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); + t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); /* FEAT_SEL2 */ + t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); /* FEAT_DIT */ cpu->isar.id_aa64pfr0 = t; t = cpu->isar.id_aa64pfr1; - t = FIELD_DP64(t, ID_AA64PFR1, BT, 1); - t = FIELD_DP64(t, ID_AA64PFR1, SSBS, 2); + t = FIELD_DP64(t, ID_AA64PFR1, BT, 1); /* FEAT_BTI */ + t = FIELD_DP64(t, ID_AA64PFR1, SSBS, 2); /* FEAT_SSBS2 */ /* * Begin with full support for MTE. This will be downgraded to MTE=0 * during realize if the board provides no tag memory, much like * we do for EL2 with the virtualization=on property. */ - t = FIELD_DP64(t, ID_AA64PFR1, MTE, 3); + t = FIELD_DP64(t, ID_AA64PFR1, MTE, 3); /* FEAT_MTE3 */ cpu->isar.id_aa64pfr1 = t; t = cpu->isar.id_aa64mmfr0; @@ -769,35 +769,35 @@ static void aarch64_max_initfn(Object *obj) cpu->isar.id_aa64mmfr0 = t; t = cpu->isar.id_aa64mmfr1; - t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* HPD */ - t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1); - t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1); - t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* ATS1E1 */ - t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* VMID16 */ - t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* TTS2UXN */ + t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* FEAT_VMID16 */ + t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1); /* FEAT_VHE */ + t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* FEAT_HPDS */ + t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1); /* FEAT_LOR */ + t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* FEAT_PAN2 */ + t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* FEAT_XNX */ cpu->isar.id_aa64mmfr1 = t; t = cpu->isar.id_aa64mmfr2; - t = FIELD_DP64(t, ID_AA64MMFR2, UAO, 1); - t = FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* TTCNP */ - t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* TTST */ - t = FIELD_DP64(t, ID_AA64MMFR2, VARANGE, 1); /* FEAT_LVA */ + t = FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* FEAT_TTCNP */ + t = FIELD_DP64(t, ID_AA64MMFR2, UAO, 1); /* FEAT_UAO */ + t = FIELD_DP64(t, ID_AA64MMFR2, VARANGE, 1); /* FEAT_LVA */ + t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* FEAT_TTST */ cpu->isar.id_aa64mmfr2 = t; t = cpu->isar.id_aa64zfr0; t = FIELD_DP64(t, ID_AA64ZFR0, SVEVER, 1); - t = FIELD_DP64(t, ID_AA64ZFR0, AES, 2); /* PMULL */ - t = FIELD_DP64(t, ID_AA64ZFR0, BITPERM, 1); - t = FIELD_DP64(t, ID_AA64ZFR0, BFLOAT16, 1); - t = FIELD_DP64(t, ID_AA64ZFR0, SHA3, 1); - t = FIELD_DP64(t, ID_AA64ZFR0, SM4, 1); - t = FIELD_DP64(t, ID_AA64ZFR0, I8MM, 1); - t = FIELD_DP64(t, ID_AA64ZFR0, F32MM, 1); - t = FIELD_DP64(t, ID_AA64ZFR0, F64MM, 1); + t = FIELD_DP64(t, ID_AA64ZFR0, AES, 2); /* FEAT_SVE_PMULL128 */ + t = FIELD_DP64(t, ID_AA64ZFR0, BITPERM, 1); /* FEAT_SVE_BitPerm */ + t = FIELD_DP64(t, ID_AA64ZFR0, BFLOAT16, 1); /* FEAT_BF16 */ + t = FIELD_DP64(t, ID_AA64ZFR0, SHA3, 1); /* FEAT_SVE_SHA3 */ + t = FIELD_DP64(t, ID_AA64ZFR0, SM4, 1); /* FEAT_SVE_SM4 */ + t = FIELD_DP64(t, ID_AA64ZFR0, I8MM, 1); /* FEAT_I8MM */ + t = FIELD_DP64(t, ID_AA64ZFR0, F32MM, 1); /* FEAT_F32MM */ + t = FIELD_DP64(t, ID_AA64ZFR0, F64MM, 1); /* FEAT_F64MM */ cpu->isar.id_aa64zfr0 = t; t = cpu->isar.id_aa64dfr0; - t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */ + t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* FEAT_PMUv3p4 */ cpu->isar.id_aa64dfr0 = t; /* Replicate the same data to the 32-bit id registers. */ diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c index b0dbf2c991..bc8f9d0edf 100644 --- a/target/arm/cpu_tcg.c +++ b/target/arm/cpu_tcg.c @@ -28,55 +28,55 @@ void aa32_max_features(ARMCPU *cpu) /* Add additional features supported by QEMU */ t = cpu->isar.id_isar5; - t = FIELD_DP32(t, ID_ISAR5, AES, 2); - t = FIELD_DP32(t, ID_ISAR5, SHA1, 1); - t = FIELD_DP32(t, ID_ISAR5, SHA2, 1); + t = FIELD_DP32(t, ID_ISAR5, AES, 2); /* FEAT_PMULL */ + t = FIELD_DP32(t, ID_ISAR5, SHA1, 1); /* FEAT_SHA1 */ + t = FIELD_DP32(t, ID_ISAR5, SHA2, 1); /* FEAT_SHA256 */ t = FIELD_DP32(t, ID_ISAR5, CRC32, 1); - t = FIELD_DP32(t, ID_ISAR5, RDM, 1); - t = FIELD_DP32(t, ID_ISAR5, VCMA, 1); + t = FIELD_DP32(t, ID_ISAR5, RDM, 1); /* FEAT_RDM */ + t = FIELD_DP32(t, ID_ISAR5, VCMA, 1); /* FEAT_FCMA */ cpu->isar.id_isar5 = t; t = cpu->isar.id_isar6; - t = FIELD_DP32(t, ID_ISAR6, JSCVT, 1); - t = FIELD_DP32(t, ID_ISAR6, DP, 1); - t = FIELD_DP32(t, ID_ISAR6, FHM, 1); - t = FIELD_DP32(t, ID_ISAR6, SB, 1); - t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1); - t = FIELD_DP32(t, ID_ISAR6, BF16, 1); - t = FIELD_DP32(t, ID_ISAR6, I8MM, 1); + t = FIELD_DP32(t, ID_ISAR6, JSCVT, 1); /* FEAT_JSCVT */ + t = FIELD_DP32(t, ID_ISAR6, DP, 1); /* Feat_DotProd */ + t = FIELD_DP32(t, ID_ISAR6, FHM, 1); /* FEAT_FHM */ + t = FIELD_DP32(t, ID_ISAR6, SB, 1); /* FEAT_SB */ + t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1); /* FEAT_SPECRES */ + t = FIELD_DP32(t, ID_ISAR6, BF16, 1); /* FEAT_AA32BF16 */ + t = FIELD_DP32(t, ID_ISAR6, I8MM, 1); /* FEAT_AA32I8MM */ cpu->isar.id_isar6 = t; t = cpu->isar.mvfr1; - t = FIELD_DP32(t, MVFR1, FPHP, 3); /* v8.2-FP16 */ - t = FIELD_DP32(t, MVFR1, SIMDHP, 2); /* v8.2-FP16 */ + t = FIELD_DP32(t, MVFR1, FPHP, 3); /* FEAT_FP16 */ + t = FIELD_DP32(t, MVFR1, SIMDHP, 2); /* FEAT_FP16 */ cpu->isar.mvfr1 = t; t = cpu->isar.mvfr2; - t = FIELD_DP32(t, MVFR2, SIMDMISC, 3); /* SIMD MaxNum */ - t = FIELD_DP32(t, MVFR2, FPMISC, 4); /* FP MaxNum */ + t = FIELD_DP32(t, MVFR2, SIMDMISC, 3); /* SIMD MaxNum */ + t = FIELD_DP32(t, MVFR2, FPMISC, 4); /* FP MaxNum */ cpu->isar.mvfr2 = t; t = cpu->isar.id_mmfr3; - t = FIELD_DP32(t, ID_MMFR3, PAN, 2); /* ATS1E1 */ + t = FIELD_DP32(t, ID_MMFR3, PAN, 2); /* FEAT_PAN2 */ cpu->isar.id_mmfr3 = t; t = cpu->isar.id_mmfr4; - t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */ - t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ - t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */ - t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* TTS2UXN */ + t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* FEAT_AA32HPD */ + t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ + t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* FEAT_TTCNP */ + t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* FEAT_XNX*/ cpu->isar.id_mmfr4 = t; t = cpu->isar.id_pfr0; - t = FIELD_DP32(t, ID_PFR0, DIT, 1); + t = FIELD_DP32(t, ID_PFR0, DIT, 1); /* FEAT_DIT */ cpu->isar.id_pfr0 = t; t = cpu->isar.id_pfr2; - t = FIELD_DP32(t, ID_PFR2, SSBS, 1); + t = FIELD_DP32(t, ID_PFR2, SSBS, 1); /* FEAT_SSBS */ cpu->isar.id_pfr2 = t; t = cpu->isar.id_dfr0; - t = FIELD_DP32(t, ID_DFR0, PERFMON, 5); /* v8.4-PMU */ + t = FIELD_DP32(t, ID_DFR0, PERFMON, 5); /* FEAT_PMUv3p4 */ cpu->isar.id_dfr0 = t; } From patchwork Sun Apr 17 17:44:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562859 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1872675map; Sun, 17 Apr 2022 11:32:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3goA0R0h5IRjlb1+IKB8zkTvfnKuyo0VVH7TCUrZirs4VWhv7k8JOHcytQuaBhfEDm6aY X-Received: by 2002:ac8:5a94:0:b0:2f2:17f:484b with SMTP id c20-20020ac85a94000000b002f2017f484bmr231433qtc.568.1650220339952; Sun, 17 Apr 2022 11:32:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650220339; cv=none; d=google.com; s=arc-20160816; b=l8KGcJO+7acpEaxoHv724SxqDzgu2f530Im3nGEEiDf/4AmwGGaOV30kZcXnFjJ+n+ jZjb5Iek4JBW8kpI6wBgJF9gQiWM4jJpwq7opSx3i3hQKkmWr1GLtnM5HmB+Qwk/4P/0 paW4exhD6PjWWDiz1VuBaAThCchTA15Ck/46kq0pzN4HC0CdoPYamjYD1Bt3gt7toWS6 1aZDvRYTiXo5DL7C4Xja7no7EQirLmgHrgsXprppqHcypQGMl5Pw/DL9LjAg0eqeA2OF 2YSlnAbj34t+l9gia5tnBdVUzcgjo9eS8iabGMqRnsmtBFJXkknXymPSZEA0AXkvoWlw 2hcQ== 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=xLPmYgqDe1CN+qFThm+PXn8LkgCmKzZ27jOhFMTIeFk=; b=bSOCIfGi2exaIm2qTqVVff4LpHk/NedA59WVGyCxWIoRFpj/xaXMABR+osNoOvz1MD jFLNxHi4zJ0Irdxvpj6GSgL2Qed7NSkAUvv1pfVKk0X882Qm2gu3YeN1+F4iOIeZFc+8 gq/EK8anoTqdz3N995UMYj5DERaIKu58eLYrZFLhLOfIjd/vW6ged/vPZfKyg6x2TmRy 1lxFbsn3OKzIpRxiYwkz6/FHBISx5gYo/vRS2aLtR0vUgymB/sKeH6O1utCrgs5QDTZP Xx2eP8UgNfMej5Sx71euNAYDsMB/ppppXa9GcOGxrOopoX5pfDtTPcLNuFWXlmxyHmzJ XhfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=yPoF9KWz; 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 t9-20020a05621421a900b0044447905968si1754458qvc.153.2022.04.17.11.32.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:32:19 -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=yPoF9KWz; 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]:52854 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9h5-0008CY-Hl for patch@linaro.org; Sun, 17 Apr 2022 14:32:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49482) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng90O-0004Qw-Eu for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:12 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:35552) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng90M-00042Y-FF for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:11 -0400 Received: by mail-pl1-x629.google.com with SMTP id b7so1089979plh.2 for ; Sun, 17 Apr 2022 10:48:10 -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=xLPmYgqDe1CN+qFThm+PXn8LkgCmKzZ27jOhFMTIeFk=; b=yPoF9KWzys3/WPeMOlwKtIfxR2KTN/W6FHj9xpcKodjmop9nihstHGsGy6LHWRaM1b a2DLVl95EF3osz00hw4zPAyyEXFvOCS4HGJHGq48/JnWq26d9A+rpwit2bDVWP/133Jq NIwopTiiSpaNCQWLhP8XQXv6neFcJ2IBudaqAGfCw1Z13EthoUD7jyS1nfDNDUR0C0sC d/ID/32E/tXpFegCZs/YcKnF6UsH3jm3W3Kv2vUTgjq8dUhXO0x3bZhNOlLLAq0/5zKo UF7rmHowu2KAxhkFMc7bD8e589hXv9mdN8kU16B9YmpGXK6gPvSKlT5jrGK0xuqR9Eng vYcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xLPmYgqDe1CN+qFThm+PXn8LkgCmKzZ27jOhFMTIeFk=; b=dc6bpP7phPtZ7B1sN10AoQ/84SH5nSJj5PiTZSHPuIOYOxgN89GoQkjbtEHNGfzO7G ut6jnFPPZMLSDEktRbr1q96WQmwg6Ql9HNxCKWXlym7txdHMseYIvYlOxU8FdHt2W5Yg 52XegtvVW8sUigwi9Ia+Z5oYDUJsTe974UXj3vFHr2BrfaRuuV5B96BgUFmNXNgrL7bH fMD4RMjakdytoK9HfixlxdsLZxjOiqp2iLRK5jHVmuPHGlP+9bASA3hR5bhCaYG/PQQA UHlLd0lyqnM8LfmKUOnjrbOFtv+PGHbnfA2QeeQCLXhk9ScCnsJSQ2OR1qu4tX/qvsIO HCyg== X-Gm-Message-State: AOAM530si3XNgEdlUYeEKi8rcvIYQ2Z81lirhUXS57o59jotgFxHCD3R 7NQF0/aUvOrKkCo6YqWeC0vN5I6BOAaY0w== X-Received: by 2002:a17:90a:6c64:b0:1cb:a150:52d with SMTP id x91-20020a17090a6c6400b001cba150052dmr9133416pjj.111.1650217689193; Sun, 17 Apr 2022 10:48:09 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020aa78c4e000000b00506475da4cesm9372055pfd.49.2022.04.17.10.48.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:48:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 45/60] target/arm: Use field names for manipulating EL2 and EL3 modes Date: Sun, 17 Apr 2022 10:44:11 -0700 Message-Id: <20220417174426.711829-46-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Use FIELD_DP{32,64} to manipulate id_pfr1 and id_aa64pfr0 during arm_cpu_realizefn. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/cpu.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 3da8841eb2..33451cecf7 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1782,11 +1782,13 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) */ unset_feature(env, ARM_FEATURE_EL3); - /* Disable the security extension feature bits in the processor feature - * registers as well. These are id_pfr1[7:4] and id_aa64pfr0[15:12]. + /* + * Disable the security extension feature bits in the processor + * feature registers as well. */ - cpu->isar.id_pfr1 &= ~0xf0; - cpu->isar.id_aa64pfr0 &= ~0xf000; + cpu->isar.id_pfr1 = FIELD_DP32(cpu->isar.id_pfr1, ID_PFR1, SECURITY, 0); + cpu->isar.id_aa64pfr0 = FIELD_DP64(cpu->isar.id_aa64pfr0, + ID_AA64PFR0, EL3, 0); } if (!cpu->has_el2) { @@ -1817,12 +1819,14 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) } if (!arm_feature(env, ARM_FEATURE_EL2)) { - /* Disable the hypervisor feature bits in the processor feature - * registers if we don't have EL2. These are id_pfr1[15:12] and - * id_aa64pfr0_el1[11:8]. + /* + * Disable the hypervisor feature bits in the processor feature + * registers if we don't have EL2. */ - cpu->isar.id_aa64pfr0 &= ~0xf00; - cpu->isar.id_pfr1 &= ~0xf000; + cpu->isar.id_aa64pfr0 = FIELD_DP64(cpu->isar.id_aa64pfr0, + ID_AA64PFR0, EL2, 0); + cpu->isar.id_pfr1 = FIELD_DP32(cpu->isar.id_pfr1, + ID_PFR1, VIRTUALIZATION, 0); } #ifndef CONFIG_USER_ONLY From patchwork Sun Apr 17 17:44:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562846 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1865282map; Sun, 17 Apr 2022 11:15:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbHCBGof7jWSieMPSPE1JvPx8uhHachfNl43ZdLN/ADn6Ln917k37OnWISo4GK72j8CdNO X-Received: by 2002:ac8:65d1:0:b0:2f1:e3fe:2b5d with SMTP id t17-20020ac865d1000000b002f1e3fe2b5dmr5163625qto.382.1650219312341; Sun, 17 Apr 2022 11:15:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650219312; cv=none; d=google.com; s=arc-20160816; b=nLXR08EI+I8Ikmbg/nQjDYhFWiRHSa366WlO+pfE0Ry1L99rbB1K54fYqJNkoRjhcW SgsG/c6UosETa3kUYjIGwocrruhb85Io8D2d6LHhlOWfl0Hem1gjVyHy3okeoK9hHdB5 ycD+jUry3A2vTHDlMrLd2A15SK05vS6QIfJoDwisinbDV5/m/hxkjPF7c2mGlIpw/ztf pun5ebUvHvWb8JKeToxVD6xuHzgCN9z04jqvxhynZ1Xiyw9kNM2yskyObCbE8VM1E/vY F5UKrXJCwDPtLuPAO/uH8i1EWrniFiF2XKlQcYKyXOb3jpUewfBEiz0EQl+3Za161LW7 s2IQ== 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=5kb+iTgkLaSEzVf4MDtkdZKydBzZHBfZ2pA462UB2xc=; b=Pc1g/nhj/u9f16lc3D4vtwvIBVK4KpX7CYHO7xPol9qxHlDe3ve3Bv8IfhYm9npFvf lLosDhtiVbj346xjCJ6aiygXRHxHr3evwMXW1Ec0yx2LlhRxRXNG10kYZYQXamRYPT4X TMH5Ne4XEtHdSY56uopoVso86h8b4u7XAmsKlCWM9uiU3EyTJWEJ1izGSI9oyjdBscVj FqYjZinEYWQNtHCwSxzKFJUGb/rpnRaGgwsBGELQqxABJi1B36e6lPsweFRkOVZDPam/ YJji8ZYATlHWi0vzuh8VDMkwUxobIeJvNypAkz5lTa1RYnPwCgS6VRqn30Gm5Fj4hGk+ ibZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=LAnuF1jO; 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 z126-20020a376584000000b0069c29298504si2278428qkb.292.2022.04.17.11.15.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:15: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=LAnuF1jO; 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]:45358 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9QV-0000vY-OF for patch@linaro.org; Sun, 17 Apr 2022 14:15:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49526) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng90P-0004Ts-EN for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:13 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:41889) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng90N-000433-KL for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:13 -0400 Received: by mail-pj1-x102a.google.com with SMTP id e8-20020a17090a118800b001cb13402ea2so12268436pja.0 for ; Sun, 17 Apr 2022 10:48:11 -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=5kb+iTgkLaSEzVf4MDtkdZKydBzZHBfZ2pA462UB2xc=; b=LAnuF1jOKOzfPTqMmI3XRB1A8iNc9BUZJHTEgtEiSYvltLlKIP59zk+EAI7Jp1Zf9n in6qEe74gknIMt1rzPX2JQum+fultlfARmW15Q/SpVGo/l5uIgp7ZABtocKh3ganTXVG pCLcr3Z4XDKxNasLY8nnLFuyi+fW0IGmijNzKbLkqp5hJIoXetEzCHjbvUCFEt4EkAcC rqkrNEsRYjm+LAunjXXgXilOXtNuNNr8IGwy6w0rIvcHLWbyAItOrgET3xEZbrp5eJKC 9nXZcvqPqkPZgj7fQmxoqYTXjcHC9egwcVPcLbslJ0DvajVCHyoz4DaLrKV6W+xTBZHq oOmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5kb+iTgkLaSEzVf4MDtkdZKydBzZHBfZ2pA462UB2xc=; b=EySsdkT5Jv834ZqjoR7O3luMBQC+hcpFo65KNLSId0RcPcDP7uugpArr3shpWUr2cI hBZdvP1OvxQ6d8SQKhH4ttenktG4LrnwZcnLovIKZAZ5J45FvCSRwGuvq/qqsKUXhCgq zj3gja4THVydoSKLqbRh3YYKlYjJv9KXzAh2hGGY1vWRVSNN/6s1LtNlLE9EQLVGm31N WNU5KJKDtovOXpLFNrkiUwTcLM4icjphdEuoctqYi0CdQ3LCluRA0OH5xgMonfFSzHzi Ov0bC/WmdXWIZ/6X3NwKrCOylasFu4vWL63z/+0KdN8FYH49WsE4ILc2ewHRj66FdhlH RvwA== X-Gm-Message-State: AOAM532lFP4V33Q4XGVT9sM55kWrCckVacKjKtolZSSHrngxZIV8s0CC jODWqYECRVCiL+SCXYzWw4bmZAOIBMfRTA== X-Received: by 2002:a17:90a:fa8d:b0:1d2:8126:ce15 with SMTP id cu13-20020a17090afa8d00b001d28126ce15mr4284693pjb.162.1650217690072; Sun, 17 Apr 2022 10:48:10 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020aa78c4e000000b00506475da4cesm9372055pfd.49.2022.04.17.10.48.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:48:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 46/60] target/arm: Enable FEAT_Debugv8p2 for -cpu max Date: Sun, 17 Apr 2022 10:44:12 -0700 Message-Id: <20220417174426.711829-47-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The only portion of FEAT_Debugv8p2 that is relevant to QEMU is CONTEXTIDR_EL2, which is also conditionally implemented with FEAT_VHE. The rest of the debug extension concerns the External debug interface, which is outside the scope of QEMU. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- v2: Update emulation.rst --- docs/system/arm/emulation.rst | 1 + target/arm/cpu.c | 1 + target/arm/cpu64.c | 1 + target/arm/cpu_tcg.c | 2 ++ 4 files changed, 5 insertions(+) diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst index 520fd39071..035f7cf9d0 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -13,6 +13,7 @@ the following architecture extensions: - FEAT_BTI (Branch Target Identification) - FEAT_DIT (Data Independent Timing instructions) - FEAT_DPB (DC CVAP instruction) +- FEAT_Debugv8p2 (Debug changes for v8.2) - FEAT_DotProd (Advanced SIMD dot product instructions) - FEAT_FCMA (Floating-point complex number instructions) - FEAT_FHM (Floating-point half-precision multiplication instructions) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 33451cecf7..fc0d74b4d1 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1787,6 +1787,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) * feature registers as well. */ cpu->isar.id_pfr1 = FIELD_DP32(cpu->isar.id_pfr1, ID_PFR1, SECURITY, 0); + cpu->isar.id_dfr0 = FIELD_DP32(cpu->isar.id_dfr0, ID_DFR0, COPSDBG, 0); cpu->isar.id_aa64pfr0 = FIELD_DP64(cpu->isar.id_aa64pfr0, ID_AA64PFR0, EL3, 0); } diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index c9476680d4..2003d0a8c9 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -797,6 +797,7 @@ static void aarch64_max_initfn(Object *obj) cpu->isar.id_aa64zfr0 = t; t = cpu->isar.id_aa64dfr0; + t = FIELD_DP64(t, ID_AA64DFR0, DEBUGVER, 8); /* FEAT_Debugv8p2 */ t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* FEAT_PMUv3p4 */ cpu->isar.id_aa64dfr0 = t; diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c index bc8f9d0edf..b6fc3752f2 100644 --- a/target/arm/cpu_tcg.c +++ b/target/arm/cpu_tcg.c @@ -76,6 +76,8 @@ void aa32_max_features(ARMCPU *cpu) cpu->isar.id_pfr2 = t; t = cpu->isar.id_dfr0; + t = FIELD_DP32(t, ID_DFR0, COPDBG, 8); /* FEAT_Debugv8p2 */ + t = FIELD_DP32(t, ID_DFR0, COPSDBG, 8); /* FEAT_Debugv8p2 */ t = FIELD_DP32(t, ID_DFR0, PERFMON, 5); /* FEAT_PMUv3p4 */ cpu->isar.id_dfr0 = t; } From patchwork Sun Apr 17 17:44:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562850 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1868031map; Sun, 17 Apr 2022 11:20:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJt9B1T1abhfzs8TQrZW6XDPAfBCpv4gvCzwklkKdHeYAuAll4Bb67bZ6WwfgNA0doWPQI X-Received: by 2002:ac8:5a05:0:b0:2e1:a657:54ce with SMTP id n5-20020ac85a05000000b002e1a65754cemr5018667qta.161.1650219649304; Sun, 17 Apr 2022 11:20:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650219649; cv=none; d=google.com; s=arc-20160816; b=Hrn4ocS9JelNGjhfBWl7bPSsB/c/M58dHw1kba4Nz9SCXQLkRRxzX1ZcQl4i4sWlUl 9qiI+b+zwiY26QCccqO57nXD73469yMGHOZtdGKN+rD+V+lce+KT2DVXGPwmg8kOrx6Y D3xb0popvj9C3p+oGMoQCcf9Cifk7m/qM+TVJCPz1xYAtQS5OzNmfnzN2dAGOZgRIi1U XzdONQs1hW2oieXKjKkyaGSPnjR8uZTxnZN23dRopUbqN3n3PG2SgxPNL9UzqwZU1IBw toHVfOx0y8d+sg+2BJrtjYBIQ92kQYGV34cekqgyme1J4Cp4hYyTCmTF7++fF9oud6XL HAZg== 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=9f+PlxCLNeNyBioSPuOwi62FLmam0QN4BYbQ6xWfffE=; b=X1djDKyzCJ0xCZqDwXOBr2e6oAGw6bdmjJhYwwYIpXDKrtXa35ppzs6EXMUcqAtVtO PVXFYs+ws4B7i/GApr7aMpI2ELWBF1eStw6uBUIT6vkc3Pw5g6llQ3jWw1kDc7Q1euHC II/VgpZStIGfKnG52bd9slGN3OvYGjwPulw3iOIIfHK/lk6uZ+6/B75ywfe28UcvTEIG 865lO/t7gugn90Kf4aRMDSKiXPQY6ZTXw331C6V/2A1jJYF47YwbnUJeMOQnEBRVW/Wp YW0CHLfKf0Q/BlGjhMaH8tQsX2t0PQPm2YqA0eQ1xFyJsKNy+fPUWj9Lo1YuACiaJL4c md2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Q5+ie27f; 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 h65-20020a37b744000000b00680e0b65fd8si2189119qkf.429.2022.04.17.11.20.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:20: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=fail header.i=@linaro.org header.s=google header.b=Q5+ie27f; 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]:53944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9Vw-0006kE-Sw for patch@linaro.org; Sun, 17 Apr 2022 14:20:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49538) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng90P-0004V7-Sk for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:13 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:39669) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng90O-00043K-4G for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:13 -0400 Received: by mail-pl1-x62b.google.com with SMTP id c12so10744597plr.6 for ; Sun, 17 Apr 2022 10:48:11 -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=9f+PlxCLNeNyBioSPuOwi62FLmam0QN4BYbQ6xWfffE=; b=Q5+ie27fkjujR7+dLFpBF91AX5F3BvHYwsbkr8De1huyL94ArsSChoJUZmrQXO7LfG 7lcBEO8PLMVMAxVmSH9VJz0li4YBEmsmLyfC46jQovSyXFbdL+PL4LrBivLjZ2y8aJ1r s6TM6ujXsmXQAzJ03mlQ/HjOwONiK+C+D6GAjb7zt/jsfU+VwkyKzfs6Hs3/AODNoHg+ cfLpUyUQWQY1zetbNN6u50nuQlX3JIf8zGuejP01XQKQQtZ9u8/G+P+cB5WkQXVZvqAi VQkuNDMFE3D8pbe+M9yb6OWNHNqXqNKYmDCSyCHGgr/Vp9lkN4+lGH67rmDHXM2v32Pi i3ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9f+PlxCLNeNyBioSPuOwi62FLmam0QN4BYbQ6xWfffE=; b=TvDF0OkUc8r9AMSB7QhgQ9jDH3dUiwtACKs7MogbNSVCM6xQQJLnggL9eXRcXHQqEg tHjEkxvIQIb9YC5rHyp9Q79zjviKCnuc5rN9SMZ7MsHdKLu+mqYZPCZeuSyL+QnFkky2 2VKJ/S58Gh1slYA1ET+VpRMpsj6T2HgJF1p4AXERO5Wh2l+WkLPDvZpx21GszwWyML94 J/ycslVWTD+E97aQhUw3V6SN1FiRVvF7D782LVGoz0ZLuSAoH27rJQGccc3htYhrKdsv zPdF+/9Z4sMs6Yo3IHKbD0QZUd3uE1IEPkRK+WnmF5rbeNWRTaF4ZRoNytf/hTdy7rA5 8aNg== X-Gm-Message-State: AOAM533qzoeb+Qv/yy7MW+XmHK3rgsvOiCObY6JPeACEpraV0cYiTsZ3 OUsD+yq4fZLHo4/hVFHrze4qLYYCXxJppQ== X-Received: by 2002:a17:902:8217:b0:156:9c4f:90eb with SMTP id x23-20020a170902821700b001569c4f90ebmr7423442pln.121.1650217690787; Sun, 17 Apr 2022 10:48:10 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020aa78c4e000000b00506475da4cesm9372055pfd.49.2022.04.17.10.48.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:48:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 47/60] target/arm: Enable FEAT_Debugv8p4 for -cpu max Date: Sun, 17 Apr 2022 10:44:13 -0700 Message-Id: <20220417174426.711829-48-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This extension concerns changes to the External Debug interface, with Secure and Non-secure access to the debug registers, and all of it is outside the scope of QEMU. Indicating support for this is mandatory with FEAT_SEL2, which we do implement. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- v2: Update emulation.rst --- docs/system/arm/emulation.rst | 1 + target/arm/cpu64.c | 2 +- target/arm/cpu_tcg.c | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst index 035f7cf9d0..c89c344de1 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -14,6 +14,7 @@ the following architecture extensions: - FEAT_DIT (Data Independent Timing instructions) - FEAT_DPB (DC CVAP instruction) - FEAT_Debugv8p2 (Debug changes for v8.2) +- FEAT_Debugv8p4 (Debug changes for v8.4) - FEAT_DotProd (Advanced SIMD dot product instructions) - FEAT_FCMA (Floating-point complex number instructions) - FEAT_FHM (Floating-point half-precision multiplication instructions) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 2003d0a8c9..136590382a 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -797,7 +797,7 @@ static void aarch64_max_initfn(Object *obj) cpu->isar.id_aa64zfr0 = t; t = cpu->isar.id_aa64dfr0; - t = FIELD_DP64(t, ID_AA64DFR0, DEBUGVER, 8); /* FEAT_Debugv8p2 */ + t = FIELD_DP64(t, ID_AA64DFR0, DEBUGVER, 9); /* FEAT_Debugv8p4 */ t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* FEAT_PMUv3p4 */ cpu->isar.id_aa64dfr0 = t; diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c index b6fc3752f2..337598e949 100644 --- a/target/arm/cpu_tcg.c +++ b/target/arm/cpu_tcg.c @@ -76,8 +76,8 @@ void aa32_max_features(ARMCPU *cpu) cpu->isar.id_pfr2 = t; t = cpu->isar.id_dfr0; - t = FIELD_DP32(t, ID_DFR0, COPDBG, 8); /* FEAT_Debugv8p2 */ - t = FIELD_DP32(t, ID_DFR0, COPSDBG, 8); /* FEAT_Debugv8p2 */ + t = FIELD_DP32(t, ID_DFR0, COPDBG, 9); /* FEAT_Debugv8p4 */ + t = FIELD_DP32(t, ID_DFR0, COPSDBG, 9); /* FEAT_Debugv8p4 */ t = FIELD_DP32(t, ID_DFR0, PERFMON, 5); /* FEAT_PMUv3p4 */ cpu->isar.id_dfr0 = t; } From patchwork Sun Apr 17 17:44:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562853 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1869317map; Sun, 17 Apr 2022 11:24:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyM2+bvjlMqb282s+RJwD3ylAnG2qg53rG7y+3o6DkVDdCjWr/wKAEhWKxyOj+yWZlNlgTg X-Received: by 2002:a05:622a:1e9a:b0:2f1:ef2c:6ab1 with SMTP id bz26-20020a05622a1e9a00b002f1ef2c6ab1mr5122348qtb.264.1650219841096; Sun, 17 Apr 2022 11:24:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650219841; cv=none; d=google.com; s=arc-20160816; b=0AVIrDsXLzb5Gnjtwke+EMr4WQFIJ32eLkq/O+OsX3K9IViz/iKY57DTCnMXaPzhH9 Wusgf2y8Gf1rUMm9p82PohLGK5tWW0W3Rel1oprEEgaAC1NcCISTsKn9xE48YqBKkxaG kyHC3zqXgy9nK4oL8tvh4aeQ9Lf4jh7i9oM5rn+6l5GHJUHP/zgYfyMoBe8Y9d3uTI4B haoqwVQ5I69pxcVgiatfU1Q8vzTeNAL+p1XqRFViqKvw38Co5HLaUHan6JlkDazG/s9w ik8csfopGNXTCsuKy4GV9+mm0TUQvuEryt0rDKmRjGsQar136kK1uoD1JhmSrFQ7Hakx ZCVA== 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=QrZ4LAIma7K6buALjtxKDFsEKoasy1WK64ZnNEpjen0=; b=rQvOowznas1xUJdypzQBebaFZ4VUpif9oKCoh61dbAvGD+4Xt2J3JBC+LH815b7zaq hxu1HH77y5jgDkw3E4347ICHniWnpHxs4hftib6dDI9s9Ao+k+EOWLn/drZb8iPtH+TB rPe1imaqfdPz3WZIom09PVjLzeZnFdT3WiN77q0GqZ6wlk6Odd403IGWr1X23n+KhfkM YzG5N0OopHph1c6RB+gRlfJEoIuEzbnocB/NpQPPXPhbnIN1RASA3iZ+WJEcnLRaAtMq F9TPBgaGmTmk+dw2Q38fdBBtUNWr4bmZZxFxUFOnPmnmLEFAQqLWRhKldl+mxNOzbaKX hlcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=dh+0OvM+; 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 t22-20020a05622a01d600b002f1fa6644e7si761368qtw.272.2022.04.17.11.24.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:24:01 -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=dh+0OvM+; 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]:34302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9Z2-000433-N2 for patch@linaro.org; Sun, 17 Apr 2022 14:24:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng90Q-0004X6-T1 for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:14 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:37522) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng90P-00043b-0l for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:14 -0400 Received: by mail-pj1-x102b.google.com with SMTP id mm4-20020a17090b358400b001cb93d8b137so15541256pjb.2 for ; Sun, 17 Apr 2022 10:48:12 -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=QrZ4LAIma7K6buALjtxKDFsEKoasy1WK64ZnNEpjen0=; b=dh+0OvM+1fhLJ5bLIEGS34EBfRXobJqfZ4g+YfjBUCBNpnDWxyhwJusLJ4uQoofIXP huKVukvqdIuC3uTFs3MfQq6GrGEkEPA3CI7QuSTVjE7D3ZE5yomy1UoO4iooxmXalve2 SIkHTviXYlJzQsGxF2fYheHU7Zrw6eaa+GGRgNeEj4t6pX1+7dNlmv43nPFLcyMl7eGk Vi0gv2mNUd8trkS3EvvIcjgNvrPYK7voooZzRq/tkseFkSseOJfR9ap5OregW3rP334X NnrrEd+IQnc4PFKPTyvP/SPvX/NFeShcrSRclFPGKt8PWWvME00nu93SCgzwQjAowfHs s8VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QrZ4LAIma7K6buALjtxKDFsEKoasy1WK64ZnNEpjen0=; b=7KSgOudYzNy0KiatftXkVtRPAODA75+gF9kJ+CEUua8Z7pOCu/ElfQvJCxdsYpt7F/ ay+6Dp9KE2K/8qzx87PZ8Fhq5Qj5QCf2H+9nggyiP0SbzAnIJv9l3NtGOyG6Rzs0cApM b7J/Up/e+gRa+VrnbhmLzzqA4YDQySB2DnHJ+RI9H4p/rGnt3gLCepupH8Wa3Co4gOQe QfmMN82PyPOd4Wc6XtXF+y4f5x0jNsVC/rs+TdeEJ+/Z7kOzAw3pldT1YgEmft+NJ+sK 4qQ837wnm3eJvbMGoQKKAT6J+S9KfUzFYAFe2LK/wec8ZemAt9jym1b3/jciKlItuyIM UsMA== X-Gm-Message-State: AOAM530cortTe1D+nIHnK/3sK+LDBp37ODdNcdS1+4HLAk/8WvEF/qFO +u+yGJC6fArBIhHgcyIuVeFcfF02nxxvzA== X-Received: by 2002:a17:90b:255:b0:1cf:39e7:a7aa with SMTP id fz21-20020a17090b025500b001cf39e7a7aamr9111100pjb.137.1650217691657; Sun, 17 Apr 2022 10:48:11 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020aa78c4e000000b00506475da4cesm9372055pfd.49.2022.04.17.10.48.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:48:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 48/60] target/arm: Add isar_feature_{aa64,any}_ras Date: Sun, 17 Apr 2022 10:44:14 -0700 Message-Id: <20220417174426.711829-49-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Add the aa64 predicate for detecting RAS support from id registers. We already have the aa32 version from the M-profile work. Add the 'any' predicate for testing both aa64 and aa32. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/cpu.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 20bf70545e..d71edfc1c1 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3885,6 +3885,11 @@ static inline bool isar_feature_aa64_aa32_el1(const ARMISARegisters *id) return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, EL1) >= 2; } +static inline bool isar_feature_aa64_ras(const ARMISARegisters *id) +{ + return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, RAS) != 0; +} + static inline bool isar_feature_aa64_sve(const ARMISARegisters *id) { return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, SVE) != 0; @@ -4107,6 +4112,11 @@ static inline bool isar_feature_any_debugv8p2(const ARMISARegisters *id) return isar_feature_aa64_debugv8p2(id) || isar_feature_aa32_debugv8p2(id); } +static inline bool isar_feature_any_ras(const ARMISARegisters *id) +{ + return isar_feature_aa64_ras(id) || isar_feature_aa32_ras(id); +} + /* * Forward to the above feature tests given an ARMCPU pointer. */ From patchwork Sun Apr 17 17:44:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562863 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1874705map; Sun, 17 Apr 2022 11:36:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykdDSKODA52JcdPlHbxCZYoeI3rq1ve0qNlU0C0hv0z/cZLPgzH21PoP9sIFysh0cgons2 X-Received: by 2002:a05:622a:294:b0:2f1:f87c:53be with SMTP id z20-20020a05622a029400b002f1f87c53bemr3600208qtw.121.1650220599377; Sun, 17 Apr 2022 11:36:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650220599; cv=none; d=google.com; s=arc-20160816; b=pT2DjohnNtNpWRw9Aekor2iG+H9zZtKXH01sxwKALKUjW6HDcLa2bCN2AaHlcoNHPN iNt1qezJDSFZ1zTD2U8zhQgiRKsT5IefT5n7FzOVcNzu6njeSxLTcXPybQmQMFYrWEjg 1cKqOenOcjflF8AcdoIXiENq0NhUBIvRcUZ8HqBHuV11KZ3b5hGq5BiTfA56YzoaRJ8x yZrcxiX7pPJm03QDhpjhEApqi8Imr7nU/TbzC6cDeSmsPCuvJTvu5pxqEJ6nXEpIZIIy dB25BYYJNZlfsU/L7DT7/2uu0GxjsCXNnkm/blIyF5FGEb4fg55YF1/YjF02HxUcBMeB WTgw== 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=/2nhgssP4ozHtkanpGxF4AjgUdqOVfu1fnJToSIqjPk=; b=zLumGoyeKRKAgCToeV8UhQvvtBp1mUAnB85JVIzANZ8iI946aTe17HJ33SEMT0GBT/ V+cuhKb8mfU14uCOVDFyI515cfHPjr+S1xr7LPKS4EsqYXA4mR7xUD3vWU9z03bcAWQf r6nVhBhXODDxpF5GqCzz3ZRUPTHVASSN7BmxEaRf1qwey4aoB0vjrlpfF69gkEvz/Ri2 kqkD2PGY2cBzg89D3UXePC5AQ7UJ6hXKsYMl8EUShuZ6Vnw43F8GkOhQ9UOMOu9Nr7qY i5TvASyLNEBIGuv9LeA52EflQSYGXg8hClg5frF75FuDWm8lwY9BUFWsil5Tox7fcP2U wWvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UCpPlrx2; 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 t22-20020ac85896000000b002f1f86af835si1215028qta.54.2022.04.17.11.36.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:36:39 -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=UCpPlrx2; 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]:34800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9lG-0006mU-VD for patch@linaro.org; Sun, 17 Apr 2022 14:36:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49624) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng90R-0004Zk-SP for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:15 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:41891) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng90P-000445-UH for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:15 -0400 Received: by mail-pj1-x102c.google.com with SMTP id e8-20020a17090a118800b001cb13402ea2so12268475pja.0 for ; Sun, 17 Apr 2022 10:48:13 -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=/2nhgssP4ozHtkanpGxF4AjgUdqOVfu1fnJToSIqjPk=; b=UCpPlrx21KIcmgbDRdTOFwmykcYLUpzv/jUoYAou4AyXOn4fRDpyIHwk3ZHR4dUIUJ yxad8LsJb8UPnr9Mys9L5N+b7Ydv+IwlEI6sy6ghylOs0HfMioRIedXyTkE99702dlww nn1LgmlyoZdQ+0UiJVvT05+zqbzit2eJK609QdBSnHIXx63HocpVU8SHKxVqCT2GfMM+ UqkG4yVzNHO9PLZx2xFrEcrsHJBTlZCcQNTZXMfpxKcO21nyIiU8L4rH/UJk40/ndIlk 0Bd6qx40T1Jf9qWR+efRZvuMHnG/bpNSEzwvgdNJPel88peciE9FrEV/MMjdkrRJyzkj NtZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/2nhgssP4ozHtkanpGxF4AjgUdqOVfu1fnJToSIqjPk=; b=TF6e01hHFFeC3TrWTYiQDQPGwXjUC1RojvX5DB2WmYcNP925LrQ/xH5M7pwQl78cxD I2pGUeI1aBZ0e4Fi1okQR4B5pM913VpP7cxnj9ze2fSHq0OBYquHhef8xvv3lo3+RbnD ksea/79WbgUIaq+alCDMr/cy6aMew1af8aXuQSUjgOD6JkMsWAbMmuVOM4R4JTNURfTz My84lE7914ZmR2ngZNYuDszqJbVm6JBP5dY1z14yzFHX3gsf/lGj/466ByGeHsy3UMND wW6GTReVLUq467WfribykQcy9SLG//kN123PcSmk44iQymIOSeIwIqELIBAef1FtZbXT qcYw== X-Gm-Message-State: AOAM53011E1uADIuI5hgc1ycA52kkyE9LJ/h8TxgM4gf9cMFIMq64kQ1 GuBu1UgfT9xNGFRmgocaLMSzDieeUNp8XA== X-Received: by 2002:a17:902:7c01:b0:156:17a5:a68 with SMTP id x1-20020a1709027c0100b0015617a50a68mr7612430pll.166.1650217692666; Sun, 17 Apr 2022 10:48:12 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020aa78c4e000000b00506475da4cesm9372055pfd.49.2022.04.17.10.48.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:48:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 49/60] target/arm: Add minimal RAS registers Date: Sun, 17 Apr 2022 10:44:15 -0700 Message-Id: <20220417174426.711829-50-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Add only the system registers required to implement zero error records. This means we need to save state for ERRSELR, but all values are out of range, so none of the indexed error record registers need be implemented. Add the EL2 registers required for injecting virtual SError. Signed-off-by: Richard Henderson --- v2: Leave ERRSELR_EL1 undefined. v3: Rely on EL3-no-EL2 squashing during registration. --- target/arm/cpu.h | 5 +++ target/arm/helper.c | 84 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index d71edfc1c1..a6d1923a78 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -524,6 +524,11 @@ typedef struct CPUArchState { uint64_t tfsr_el[4]; /* tfsre0_el1 is index 0. */ uint64_t gcr_el1; uint64_t rgsr_el1; + + /* Minimal RAS registers */ + uint64_t disr_el1; + uint64_t vdisr_el2; + uint64_t vsesr_el2; } cp15; struct { diff --git a/target/arm/helper.c b/target/arm/helper.c index 3570212089..655beba3d6 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -5990,6 +5990,87 @@ static const ARMCPRegInfo debug_lpae_cp_reginfo[] = { .access = PL0_R, .type = ARM_CP_CONST|ARM_CP_64BIT, .resetvalue = 0 }, }; +/* + * Check for traps to RAS registers, which are controlled + * by HCR_EL2.TERR and SCR_EL3.TERR. + */ +static CPAccessResult access_terr(CPUARMState *env, const ARMCPRegInfo *ri, + bool isread) +{ + int el = arm_current_el(env); + + if (el < 2 && (arm_hcr_el2_eff(env) & HCR_TERR)) { + return CP_ACCESS_TRAP_EL2; + } + if (el < 3 && (env->cp15.scr_el3 & SCR_TERR)) { + return CP_ACCESS_TRAP_EL3; + } + return CP_ACCESS_OK; +} + +static uint64_t disr_read(CPUARMState *env, const ARMCPRegInfo *ri) +{ + int el = arm_current_el(env); + + if (el < 2 && (arm_hcr_el2_eff(env) & HCR_AMO)) { + return env->cp15.vdisr_el2; + } + if (el < 3 && (env->cp15.scr_el3 & SCR_EA)) { + return 0; /* RAZ/WI */ + } + return env->cp15.disr_el1; +} + +static void disr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t val) +{ + int el = arm_current_el(env); + + if (el < 2 && (arm_hcr_el2_eff(env) & HCR_AMO)) { + env->cp15.vdisr_el2 = val; + return; + } + if (el < 3 && (env->cp15.scr_el3 & SCR_EA)) { + return; /* RAZ/WI */ + } + env->cp15.disr_el1 = val; +} + +/* + * Minimal RAS implementation with no Error Records. + * Which means that all of the Error Record registers: + * ERXADDR_EL1 + * ERXCTLR_EL1 + * ERXFR_EL1 + * ERXMISC0_EL1 + * ERXMISC1_EL1 + * ERXMISC2_EL1 + * ERXMISC3_EL1 + * ERXPFGCDN_EL1 (RASv1p1) + * ERXPFGCTL_EL1 (RASv1p1) + * ERXPFGF_EL1 (RASv1p1) + * ERXSTATUS_EL1 + * and + * ERRSELR_EL1 + * may generate UNDEFINED, which is the effect we get by not + * listing them at all. + */ +static const ARMCPRegInfo minimal_ras_reginfo[] = { + { .name = "DISR_EL1", .state = ARM_CP_STATE_BOTH, + .opc0 = 3, .opc1 = 0, .crn = 12, .crm = 1, .opc2 = 1, + .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.disr_el1), + .readfn = disr_read, .writefn = disr_write, .raw_writefn = raw_write }, + { .name = "ERRIDR_EL1", .state = ARM_CP_STATE_BOTH, + .opc0 = 3, .opc1 = 0, .crn = 5, .crm = 3, .opc2 = 0, + .access = PL1_R, .accessfn = access_terr, + .type = ARM_CP_CONST, .resetvalue = 0 }, + { .name = "VDISR_EL2", .state = ARM_CP_STATE_BOTH, + .opc0 = 3, .opc1 = 4, .crn = 12, .crm = 1, .opc2 = 1, + .access = PL2_RW, .fieldoffset = offsetof(CPUARMState, cp15.vdisr_el2) }, + { .name = "VSESR_EL2", .state = ARM_CP_STATE_BOTH, + .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 2, .opc2 = 3, + .access = PL2_RW, .fieldoffset = offsetof(CPUARMState, cp15.vsesr_el2) }, +}; + /* Return the exception level to which exceptions should be taken * via SVEAccessTrap. If an exception should be routed through * AArch64.AdvSIMDFPAccessTrap, return 0; fp_exception_el should @@ -8224,6 +8305,9 @@ void register_cp_regs_for_features(ARMCPU *cpu) if (cpu_isar_feature(aa64_ssbs, cpu)) { define_one_arm_cp_reg(cpu, &ssbs_reginfo); } + if (cpu_isar_feature(any_ras, cpu)) { + define_arm_cp_regs(cpu, minimal_ras_reginfo); + } if (cpu_isar_feature(aa64_vh, cpu) || cpu_isar_feature(aa64_debugv8p2, cpu)) { From patchwork Sun Apr 17 17:44:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562868 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1876813map; Sun, 17 Apr 2022 11:41:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5dIonYhHyzUEQn3CLvpj5M00qHy7OmrlC1Q8Fu73eTEo0y4XaYYPvoHyLk5KfMjUYdiJb X-Received: by 2002:ac8:7e8a:0:b0:2f1:ebd6:b28b with SMTP id w10-20020ac87e8a000000b002f1ebd6b28bmr5173954qtj.286.1650220897164; Sun, 17 Apr 2022 11:41:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650220897; cv=none; d=google.com; s=arc-20160816; b=Qq28WBi/cjnhF+vbHm7u7E05u8CpnPUgrq4mq+TBHays/Yz9dY9ORL6sGjcBThBVe1 i/0Z3hFemYCo7yI6yKylN0JffAqSOz65lL1jZJqZGfzoHEASuFLaHCIYIUfTKx7a352L E8rGZz6RiGEXHk0PTz/32EkX/sFPiKNNcP59JwzJXdxJ7AtbWV6m0qp4HTiFAc4/lUr0 2BfsDP4v6JFP8+v6jYemlncXDK46Z8cnax+/k4p5mb2D+W5s2Yqc+R6iB+zdbGggeu9a i+XGKSDor6PRSuNPVP/aKi0Xch1xbkffHJQJtr49NKmscQrsyTw/5ynW5VUSChWkUb5H EwhQ== 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=PxOmMqRSvIQcvxQ1QLjNH0K+vq0MOnh5ihTSPnn1yGI=; b=uzNKwCL1+xv8Jyts8ITYvK0bMf5G8YquBWfxMzGLKtdH55kF6HBdOcahw8tsXzpg7l /rY6Djf+3xdK3G+AIkJMYbRgFj32tK6KFx+6F8NTCr3WZM255dkaiJSy4Ja8jchj9S80 tyvtALTZokHzFuwU4uj95JYJwlCSPeG0JdqTY2ylkSMrLKwKcgrEA+19lY8+otVkJYga Lq/8hhn2Eb9pc+OvPAE7G6HYsZAM3wAu56zSvLk6iwGgYaJk9dmP2yucj/erSlUH83kc T/fMZyJTEUZ10yXmvkapYIl1AzBywOAXQfeNcUoTKQSkTnaJF8oZjl+s5F8v7DyGjo8b L6gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cmxHgcJs; 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 r10-20020ad4576a000000b0044444b2381esi2288991qvx.316.2022.04.17.11.41.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:41:37 -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=cmxHgcJs; 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]:44932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9q4-0005FN-ON for patch@linaro.org; Sun, 17 Apr 2022 14:41:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49638) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng90S-0004bf-Cw for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:16 -0400 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]:46660) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng90Q-00044Y-O1 for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:16 -0400 Received: by mail-pj1-x1033.google.com with SMTP id h15-20020a17090a054f00b001cb7cd2b11dso12211090pjf.5 for ; Sun, 17 Apr 2022 10:48:14 -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=PxOmMqRSvIQcvxQ1QLjNH0K+vq0MOnh5ihTSPnn1yGI=; b=cmxHgcJskDgWgdaJMnoFeuogHnTiZyMzSg7LyYwHUv64jnpgY1o3IEXeaQlx8uK+9L F5g25XWhDk4s/7iWO2PvAiVE7XnfAbTMnHDLhlwjJ9qBx1qUxdNw21JuMT51GK78OzfG zQsHagG0olVq/xzIiVlZTCP1voYRyesAk+igpjpk+GS3T5EV8nr30rPpSQlviA0UyiA/ S5GAe7aeoIXZfKrIv39JEDCmkzTrbJeonG8geBryiRxPHJngNnuS5EZ5Ku4gLTp8o52G m6TvfYe/o2ReOaRtMgvsLaqtah6O7pRw4uDaQBwQ9N9zWS0I9HbaGLJK6XKPcS0YUhBA DSlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PxOmMqRSvIQcvxQ1QLjNH0K+vq0MOnh5ihTSPnn1yGI=; b=gnirp25lxy1eK/FZ7ZOQCY9Rpn1romizu6GtG90wbG9/7tzPw72+3/jJsvchvbKiEX 8eS+1WmI1g1fvHpWG2w/kPZ+G/w3Te7Uo9ypsZiuUp57MFAy/Gm5LWfLiKflb+L4H46M A3dLjugBw9ICvtZWgq7uUAgmC/BvyDGSwG1za/tgmD1fAwXbhkHRiAf1zn3NqLhtKAE7 2LUmVH1jTfmayaj6wESlpVeL9gk7+PaupqKIVYBxudJhVXedW9VFqE09N9OJf+n1ypRt 6LBq1VKmTtqzloOvafI/p4KkB8Ym1F4bj3at1RXWREvL1YDwleFJC1A7FIIBFiIetmcs ZEMA== X-Gm-Message-State: AOAM530GxnBCzB68F01rmaOzF8Hyk3P0TI0Pi8ARvSuILuihZYnMUgT5 CRvRt2jLk0g5aauwz74nnbL1FvB+QmQO0A== X-Received: by 2002:a17:90b:4d0d:b0:1ce:ef5d:f1ef with SMTP id mw13-20020a17090b4d0d00b001ceef5df1efmr14266570pjb.91.1650217693490; Sun, 17 Apr 2022 10:48:13 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020aa78c4e000000b00506475da4cesm9372055pfd.49.2022.04.17.10.48.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:48:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 50/60] target/arm: Enable SCR and HCR bits for RAS Date: Sun, 17 Apr 2022 10:44:16 -0700 Message-Id: <20220417174426.711829-51-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1033; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1033.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Enable writes to the TERR and TEA bits when RAS is enabled. These bits are otherwise RES0. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/target/arm/helper.c b/target/arm/helper.c index 655beba3d6..f6468fed43 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -1756,6 +1756,9 @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) } valid_mask &= ~SCR_NET; + if (cpu_isar_feature(aa64_ras, cpu)) { + valid_mask |= SCR_TERR; + } if (cpu_isar_feature(aa64_lor, cpu)) { valid_mask |= SCR_TLOR; } @@ -1770,6 +1773,9 @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) } } else { valid_mask &= ~(SCR_RW | SCR_ST); + if (cpu_isar_feature(aa32_ras, cpu)) { + valid_mask |= SCR_TERR; + } } if (!arm_feature(env, ARM_FEATURE_EL2)) { @@ -5126,6 +5132,9 @@ static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask) if (cpu_isar_feature(aa64_vh, cpu)) { valid_mask |= HCR_E2H; } + if (cpu_isar_feature(aa64_ras, cpu)) { + valid_mask |= HCR_TERR | HCR_TEA; + } if (cpu_isar_feature(aa64_lor, cpu)) { valid_mask |= HCR_TLOR; } From patchwork Sun Apr 17 17:44:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562871 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1879058map; Sun, 17 Apr 2022 11:47:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBsQd5PZordikToDDj/fb90RvvWoNn7qoNMrQ/7k3g6CXOD2POSGsUwzByawTxJMLU1jU4 X-Received: by 2002:a05:620a:4590:b0:69c:6f54:77e with SMTP id bp16-20020a05620a459000b0069c6f54077emr4849617qkb.179.1650221223920; Sun, 17 Apr 2022 11:47:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650221223; cv=none; d=google.com; s=arc-20160816; b=fmfUIGgZBLhRtt8emADU1hCjn7FK2QDLHLrsVk9vFknRSpohYsQXelHSWNIGeB4GHW iwKf4SnbgG3iFJ2u2UumeSk60qM8dScYho0/BmHdwhpcDcHJdffpIs0fVBQvi3KV6/tu 3I4XH0fXDNIHgwg+b1UbpSb4PkyxWJT1k5Rm39Dw2zJFhGnYzT46PSvDDdhOj7O6b/9c +Hejy7nkB8ceMtjGe54GdWxxdSShFfD/AGD3Z7sYbe/UxooMUQYFbuBWdyvdjZy0/aes ZuEZoCNZtI5winzWcU+R0WeZFhsJ2rIormoJj2aydN//KzD4/qLe4nDSGUqodLlu9Wz+ kZrw== 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=WEUJ3ZdOA9PTVRw0mKKElsPVyH1qTnSIppSOTeNDGHQ=; b=m93WgOZuklPGq8ICESNPICumkUm6IpwBezB0ycDn0EgxHsw5HIL4FlRQEnr06pCaDN 3eNI+u6GTEgIiXBQj0k3LluCR9cT603g8hGVNOZiINKCML7CI6Ek9YffFaFbblmUIGHj RkyV7XUJtR7lX6CJexgxcflyGkvSk1O1pA/cR4SGkL8d5zo5aE205AuJjoiTTOogMPTb DB3eE8zzqMKb+q90LZwC+71RROZwtEE/cS39Vp2jhRZCHePicIpyax/mkIPTl4hWseSA nXvBjvArQ051Zn2DIK6lpSpjJf+T61W0Y+UWBqMYv5I3A2o/TTKW4f7/1/TMR1MjZS8+ VcRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="sg/tHhaY"; 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 jt14-20020a05621427ee00b00440e46a7d10si2390643qvb.430.2022.04.17.11.47.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:47:03 -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="sg/tHhaY"; 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]:55902 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9vL-0004FK-Fv for patch@linaro.org; Sun, 17 Apr 2022 14:47:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng90T-0004e6-Hc for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:17 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:45725) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng90R-00044o-Ib for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:17 -0400 Received: by mail-pj1-x102f.google.com with SMTP id n33-20020a17090a5aa400b001d28f5ee3f9so736633pji.4 for ; Sun, 17 Apr 2022 10:48:15 -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=WEUJ3ZdOA9PTVRw0mKKElsPVyH1qTnSIppSOTeNDGHQ=; b=sg/tHhaYw20Yi24QuT+JA7WdAWfTB/c9E+mdzrCNstCM3Gw+MchIIXfTKf/VtswOQ9 8915hSAumOR7rli6v3TZtkJniUNVCCFShM0suWnlrjmvT6hQGhaVoNgi8+fp8wGUBRuf GDJIOmdEM7L2Y3UVjk5s0RQ7DV9mpDG1D4t20nBX2yTJ3htOMjBaGbO553vUjNkWkF3m pIMvCjKPOevRkKqXojAZLFaop2wGxuUKDzcOQ7TMw6OUX3rulfU1I1oZcsHV8o0Sdl1H xPZ5PDeWBlrL5AKf7peIwacuzyA3/XU43DIR/aPKHOcgHxSonHuacsMfAUBW16/FBWG3 vd8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WEUJ3ZdOA9PTVRw0mKKElsPVyH1qTnSIppSOTeNDGHQ=; b=wNl/B+lF6y6XXWMNZ9uVpDAKlD1+CBvDkCiXltDKIHGhbmESvYtOIjYGm9Vl0uD5uM l3u5oUsGRG5kpV16mlKJW0tluo8G237aiFeu2Plt2ygSO2Oz0LEh+YQc07Yvs3DXjVLV PKOQPOrFB2knO1dRHlbz5KPs1XyJL2keMJbt/cr3tESp1qTlPYjkYgMh9NCr6/o+jwjh 73BZzvRQkoncQxhrsbvsYfR5AODLZsLvbiDrcDf94PziNSGZLLOcRkndSeAljGBLJq6R 1MbrGZBQappBDwDyRxkcXj0d0Saji7UZNXXqN6aGhcgn69VQ59fscGs7jI8kmGkoQm8/ IkgQ== X-Gm-Message-State: AOAM531CjgIulZA6Sp1NG3IGfXNr2DnNGQbEgaIum8Yeq2Vf2SYKmNr2 NcJ+dHUZqTTB+glVMa482CdTAVZdVXWpxQ== X-Received: by 2002:a17:903:11c7:b0:151:9769:3505 with SMTP id q7-20020a17090311c700b0015197693505mr7727181plh.72.1650217694204; Sun, 17 Apr 2022 10:48:14 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020aa78c4e000000b00506475da4cesm9372055pfd.49.2022.04.17.10.48.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:48:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 51/60] target/arm: Implement virtual SError exceptions Date: Sun, 17 Apr 2022 10:44:17 -0700 Message-Id: <20220417174426.711829-52-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102f.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Virtual SError exceptions are raised by setting HCR_EL2.VSE, and are routed to EL1 just like other virtual exceptions. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- v2: Honor EAE for reporting VSERR to aa32. --- target/arm/cpu.h | 2 ++ target/arm/internals.h | 8 ++++++++ target/arm/syndrome.h | 5 +++++ target/arm/cpu.c | 38 +++++++++++++++++++++++++++++++++++++- target/arm/helper.c | 40 +++++++++++++++++++++++++++++++++++++++- 5 files changed, 91 insertions(+), 2 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index a6d1923a78..b90b6d91bd 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -55,6 +55,7 @@ #define EXCP_LSERR 21 /* v8M LSERR SecureFault */ #define EXCP_UNALIGNED 22 /* v7M UNALIGNED UsageFault */ #define EXCP_DIVBYZERO 23 /* v7M DIVBYZERO UsageFault */ +#define EXCP_VSERR 24 /* NB: add new EXCP_ defines to the array in arm_log_exception() too */ #define ARMV7M_EXCP_RESET 1 @@ -88,6 +89,7 @@ enum { #define CPU_INTERRUPT_FIQ CPU_INTERRUPT_TGT_EXT_1 #define CPU_INTERRUPT_VIRQ CPU_INTERRUPT_TGT_EXT_2 #define CPU_INTERRUPT_VFIQ CPU_INTERRUPT_TGT_EXT_3 +#define CPU_INTERRUPT_VSERR CPU_INTERRUPT_TGT_INT_0 /* The usual mapping for an AArch64 system register to its AArch32 * counterpart is for the 32 bit world to have access to the lower diff --git a/target/arm/internals.h b/target/arm/internals.h index baa2a7e1f4..2e55c9a8ae 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -935,6 +935,14 @@ void arm_cpu_update_virq(ARMCPU *cpu); */ void arm_cpu_update_vfiq(ARMCPU *cpu); +/** + * arm_cpu_update_vserr: Update CPU_INTERRUPT_VSERR bit + * + * Update the CPU_INTERRUPT_VSERR bit in cs->interrupt_request, + * following a change to the HCR_EL2.VSE bit. + */ +void arm_cpu_update_vserr(ARMCPU *cpu); + /** * arm_mmu_idx_el: * @env: The cpu environment diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index 8cde8e7243..0cb26dde7d 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -287,4 +287,9 @@ static inline uint32_t syn_pcalignment(void) return (EC_PCALIGNMENT << ARM_EL_EC_SHIFT) | ARM_EL_IL; } +static inline uint32_t syn_serror(uint32_t extra) +{ + return (EC_SERROR << ARM_EL_EC_SHIFT) | ARM_EL_IL | extra; +} + #endif /* TARGET_ARM_SYNDROME_H */ diff --git a/target/arm/cpu.c b/target/arm/cpu.c index fc0d74b4d1..20ae69e83b 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -85,7 +85,7 @@ static bool arm_cpu_has_work(CPUState *cs) return (cpu->power_state != PSCI_OFF) && cs->interrupt_request & (CPU_INTERRUPT_FIQ | CPU_INTERRUPT_HARD - | CPU_INTERRUPT_VFIQ | CPU_INTERRUPT_VIRQ + | CPU_INTERRUPT_VFIQ | CPU_INTERRUPT_VIRQ | CPU_INTERRUPT_VSERR | CPU_INTERRUPT_EXITTB); } @@ -509,6 +509,12 @@ static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx, return false; } return !(env->daif & PSTATE_I); + case EXCP_VSERR: + if (!(hcr_el2 & HCR_AMO) || (hcr_el2 & HCR_TGE)) { + /* VIRQs are only taken when hypervized. */ + return false; + } + return !(env->daif & PSTATE_A); default: g_assert_not_reached(); } @@ -630,6 +636,17 @@ static bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request) goto found; } } + if (interrupt_request & CPU_INTERRUPT_VSERR) { + excp_idx = EXCP_VSERR; + target_el = 1; + if (arm_excp_unmasked(cs, excp_idx, target_el, + cur_el, secure, hcr_el2)) { + /* Taking a virtual abort clears HCR_EL2.VSE */ + env->cp15.hcr_el2 &= ~HCR_VSE; + cpu_reset_interrupt(cs, CPU_INTERRUPT_VSERR); + goto found; + } + } return false; found: @@ -682,6 +699,25 @@ void arm_cpu_update_vfiq(ARMCPU *cpu) } } +void arm_cpu_update_vserr(ARMCPU *cpu) +{ + /* + * Update the interrupt level for VSERR, which is the HCR_EL2.VSE bit. + */ + CPUARMState *env = &cpu->env; + CPUState *cs = CPU(cpu); + + bool new_state = env->cp15.hcr_el2 & HCR_VSE; + + if (new_state != ((cs->interrupt_request & CPU_INTERRUPT_VSERR) != 0)) { + if (new_state) { + cpu_interrupt(cs, CPU_INTERRUPT_VSERR); + } else { + cpu_reset_interrupt(cs, CPU_INTERRUPT_VSERR); + } + } +} + #ifndef CONFIG_USER_ONLY static void arm_cpu_set_irq(void *opaque, int irq, int level) { diff --git a/target/arm/helper.c b/target/arm/helper.c index f6468fed43..7e4178c594 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -1864,7 +1864,12 @@ static uint64_t isr_read(CPUARMState *env, const ARMCPRegInfo *ri) } } - /* External aborts are not possible in QEMU so A bit is always clear */ + if (hcr_el2 & HCR_AMO) { + if (cs->interrupt_request & CPU_INTERRUPT_VSERR) { + ret |= CPSR_A; + } + } + return ret; } @@ -5175,6 +5180,7 @@ static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask) g_assert(qemu_mutex_iothread_locked()); arm_cpu_update_virq(cpu); arm_cpu_update_vfiq(cpu); + arm_cpu_update_vserr(cpu); } static void hcr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) @@ -9325,6 +9331,7 @@ void arm_log_exception(CPUState *cs) [EXCP_LSERR] = "v8M LSERR UsageFault", [EXCP_UNALIGNED] = "v7M UNALIGNED UsageFault", [EXCP_DIVBYZERO] = "v7M DIVBYZERO UsageFault", + [EXCP_VSERR] = "Virtual SERR", }; if (idx >= 0 && idx < ARRAY_SIZE(excnames)) { @@ -9837,6 +9844,31 @@ static void arm_cpu_do_interrupt_aarch32(CPUState *cs) mask = CPSR_A | CPSR_I | CPSR_F; offset = 4; break; + case EXCP_VSERR: + { + /* + * Note that this is reported as a data abort, but the DFAR + * has an UNKNOWN value. Construct the SError syndrome from + * AET and ExT fields. + */ + ARMMMUFaultInfo fi = { .type = ARMFault_AsyncExternal, }; + + if (extended_addresses_enabled(env)) { + env->exception.fsr = arm_fi_to_lfsc(&fi); + } else { + env->exception.fsr = arm_fi_to_sfsc(&fi); + } + env->exception.fsr |= env->cp15.vsesr_el2 & 0xd000; + A32_BANKED_CURRENT_REG_SET(env, dfsr, env->exception.fsr); + qemu_log_mask(CPU_LOG_INT, "...with IFSR 0x%x\n", + env->exception.fsr); + + new_mode = ARM_CPU_MODE_ABT; + addr = 0x10; + mask = CPSR_A | CPSR_I; + offset = 8; + } + break; case EXCP_SMC: new_mode = ARM_CPU_MODE_MON; addr = 0x08; @@ -10057,6 +10089,12 @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs) case EXCP_VFIQ: addr += 0x100; break; + case EXCP_VSERR: + addr += 0x180; + /* Construct the SError syndrome from IDS and ISS fields. */ + env->exception.syndrome = syn_serror(env->cp15.vsesr_el2 & 0x1ffffff); + env->cp15.esr_el[new_el] = env->exception.syndrome; + break; default: cpu_abort(cs, "Unhandled exception 0x%x\n", cs->exception_index); } From patchwork Sun Apr 17 17:44:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562857 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1871416map; Sun, 17 Apr 2022 11:29:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz83uF4HYRxR0NRekTsB8o3iAEPmtCfU/ABNrL1/RErED/vihWk36KS8jDKilBPbgjMOtd7 X-Received: by 2002:ac8:4446:0:b0:2f1:ece0:ee9a with SMTP id m6-20020ac84446000000b002f1ece0ee9amr5136746qtn.352.1650220149039; Sun, 17 Apr 2022 11:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650220149; cv=none; d=google.com; s=arc-20160816; b=EFIiXAOTRRveA2q8Chshp2T5/v94YyHWjSdi58L7WKm/dsjEtklUiwJ+t7GG/uYCol Cvhdvapz/9rMOftD8y4XPfz3YJJzJqqW/7X5oGRdrCJ7eVVA3iw2oKDwsn9BRRJhd1Qo vn7C8hr1Bg1BrielNvRTpNlhOBdZMw39u1f3KOq+ilNoPaEFTNLkdNEW3mVITFgFjy9l 4nCUSe6crnlmTa8/F3wrdeR2t4Z1ZYwDb8jVTOaLaR54dilqiZtF4yWF4povJ1nWSpWR oTd48Etcmf/B6FxGfNrII38j7jzfjootXG0pzYdPIvYLbDP2clOIxKRCBgu8rrjzJVsL LjlA== 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=zYEZAarhcV8VbvRrhZATBlBb0FycBEBDo1cg0e6bHok=; b=UVRhXlWESHCm05F9usQpXPGVdhTU41j4B8BS2GhNkWeQiR7pjzVXvLQ0kl0p1LwgQl 2xomLuN1fgUZk3DtOU6tOPDVNVMMoE3PxFT0IWv9/GMkLXbEdXh0DohfUFfItUXE+lbF rM9ObNtfkbwwQN1v2N6rLuQdyngmpyAWzon+S9UKjTMg5vjTekuMOnYMvDz/yyGpIgMw 4oOEJi7IozCVSFEDnduIUKyGHLK7LqDUtCn94Vym0v8Rjd1h7dshK/KsmByiTTMmpVNZ Z6Jnq0dkWplqmudVv0cZfY/SqG5gQv1jK2gRp2xqmmghF542DwjMBnUFdlvMtIUB7Olb 3GFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=v9w9ZfsW; 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 cb21-20020a05622a1f9500b002f1ef9cc106si2172200qtb.601.2022.04.17.11.29.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:29:09 -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=v9w9ZfsW; 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]:44328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9dz-0002UJ-KD for patch@linaro.org; Sun, 17 Apr 2022 14:29:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng90U-0004gc-OY for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:18 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:53771) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng90S-00045K-Kd for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:18 -0400 Received: by mail-pj1-x102d.google.com with SMTP id bx5so11322322pjb.3 for ; Sun, 17 Apr 2022 10:48:16 -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=zYEZAarhcV8VbvRrhZATBlBb0FycBEBDo1cg0e6bHok=; b=v9w9ZfsWI/2WgL1V2DeC4tQa3BRlHstrcoOpXegpv1ZZHoihPt6CUWGbq6V8iEx/we vT8eb//mBxmzxQMvNG/n3eiKxbuYstOLbjYXyhcQgLL5GmZest0LoXJkJRxQRwxpWgXp d7csZvBBM/lCCpLD5i8yB8XLq74YkkmALza1hm+0JDgKwjrnnfZgMHk1lm+an8n07nDH jTE5r2v16fYJ4OOKFvkTBi1TxeqAi/0q3tTp/4kgN5jupizHH3nnhH/tq1ASmiXi5msM shgi5Fk8rtoUnM6hLeGpIp4ey2AkemZketNZGCd4bw+FDDLcWBIfIUWF4URre5GRAKgp fP0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zYEZAarhcV8VbvRrhZATBlBb0FycBEBDo1cg0e6bHok=; b=VBCoiIllBqDJpy6k7OKiuqMIGyJlhGM2qsuykG17edayyYfHObUfJHwiOm0akd5qlh l/W23kq7bkNbrd3zaOLMh2ES3KoClWmnzyd7HAlNASTcLys3sahfkjEnoPgTQtfS7rib RWI4F/m0i37YEp2aRuhHQ2G8cIz/kifFRVOmfNRI8TL0+vQMp1JI1+OvGWlJgsn9wUFm fOMMZKVBzU1m0gpNCl5IxZtT6C8U6v2GtqF1FcDgQutcZ5zDYv1Tu+bgmbAuoetlg5PE Oxe1Lbci0fH36FVVNGeflWqmjX54Z1Jym2DhA1ulZTty20Lw4w2zn7k5ahaAv5XMbVhH 0lXQ== X-Gm-Message-State: AOAM532FRSlotRqSA+PdjrJmhNpmtK0LDTvTD7lCWHCAw5YysAYczhIg FPnSnAmtW4X93OXYhnPvwM5SEsu8jmAyoA== X-Received: by 2002:a17:90a:e7cd:b0:1c7:acbd:215d with SMTP id kb13-20020a17090ae7cd00b001c7acbd215dmr9045455pjb.153.1650217695242; Sun, 17 Apr 2022 10:48:15 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020aa78c4e000000b00506475da4cesm9372055pfd.49.2022.04.17.10.48.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:48:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 52/60] target/arm: Implement ESB instruction Date: Sun, 17 Apr 2022 10:44:18 -0700 Message-Id: <20220417174426.711829-53-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Check for and defer any pending virtual SError. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- v2: Retain m-profile check; improve comments. --- target/arm/helper.h | 1 + target/arm/a32.decode | 16 ++++++++------ target/arm/t32.decode | 18 ++++++++-------- target/arm/op_helper.c | 43 ++++++++++++++++++++++++++++++++++++++ target/arm/translate-a64.c | 17 +++++++++++++++ target/arm/translate.c | 23 ++++++++++++++++++++ 6 files changed, 103 insertions(+), 15 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index b463d9343b..b1334e0c42 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -54,6 +54,7 @@ DEF_HELPER_1(wfe, void, env) DEF_HELPER_1(yield, void, env) DEF_HELPER_1(pre_hvc, void, env) DEF_HELPER_2(pre_smc, void, env, i32) +DEF_HELPER_1(vesb, void, env) DEF_HELPER_3(cpsr_write, void, env, i32, i32) DEF_HELPER_2(cpsr_write_eret, void, env, i32) diff --git a/target/arm/a32.decode b/target/arm/a32.decode index fcd8cd4f7d..f2ca480949 100644 --- a/target/arm/a32.decode +++ b/target/arm/a32.decode @@ -187,13 +187,17 @@ SMULTT .... 0001 0110 .... 0000 .... 1110 .... @rd0mn { { - YIELD ---- 0011 0010 0000 1111 ---- 0000 0001 - WFE ---- 0011 0010 0000 1111 ---- 0000 0010 - WFI ---- 0011 0010 0000 1111 ---- 0000 0011 + [ + YIELD ---- 0011 0010 0000 1111 ---- 0000 0001 + WFE ---- 0011 0010 0000 1111 ---- 0000 0010 + WFI ---- 0011 0010 0000 1111 ---- 0000 0011 - # TODO: Implement SEV, SEVL; may help SMP performance. - # SEV ---- 0011 0010 0000 1111 ---- 0000 0100 - # SEVL ---- 0011 0010 0000 1111 ---- 0000 0101 + # TODO: Implement SEV, SEVL; may help SMP performance. + # SEV ---- 0011 0010 0000 1111 ---- 0000 0100 + # SEVL ---- 0011 0010 0000 1111 ---- 0000 0101 + + ESB ---- 0011 0010 0000 1111 ---- 0001 0000 + ] # The canonical nop ends in 00000000, but the whole of the # rest of the space executes as nop if otherwise unsupported. diff --git a/target/arm/t32.decode b/target/arm/t32.decode index 78fadef9d6..f21ad0167a 100644 --- a/target/arm/t32.decode +++ b/target/arm/t32.decode @@ -364,17 +364,17 @@ CLZ 1111 1010 1011 ---- 1111 .... 1000 .... @rdm [ # Hints, and CPS { - YIELD 1111 0011 1010 1111 1000 0000 0000 0001 - WFE 1111 0011 1010 1111 1000 0000 0000 0010 - WFI 1111 0011 1010 1111 1000 0000 0000 0011 + [ + YIELD 1111 0011 1010 1111 1000 0000 0000 0001 + WFE 1111 0011 1010 1111 1000 0000 0000 0010 + WFI 1111 0011 1010 1111 1000 0000 0000 0011 - # TODO: Implement SEV, SEVL; may help SMP performance. - # SEV 1111 0011 1010 1111 1000 0000 0000 0100 - # SEVL 1111 0011 1010 1111 1000 0000 0000 0101 + # TODO: Implement SEV, SEVL; may help SMP performance. + # SEV 1111 0011 1010 1111 1000 0000 0000 0100 + # SEVL 1111 0011 1010 1111 1000 0000 0000 0101 - # For M-profile minimal-RAS ESB can be a NOP, which is the - # default behaviour since it is in the hint space. - # ESB 1111 0011 1010 1111 1000 0000 0001 0000 + ESB 1111 0011 1010 1111 1000 0000 0001 0000 + ] # The canonical nop ends in 0000 0000, but the whole rest # of the space is "reserved hint, behaves as nop". diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 76499ffa14..390b6578a8 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -960,3 +960,46 @@ void HELPER(probe_access)(CPUARMState *env, target_ulong ptr, access_type, mmu_idx, ra); } } + +/* + * This function corresponds to AArch64.vESBOperation(). + * Note that the AArch32 version is not functionally different. + */ +void HELPER(vesb)(CPUARMState *env) +{ + /* + * The EL2Enabled() check is done inside arm_hcr_el2_eff, + * and will return HCR_EL2.VSE == 0, so nothing happens. + */ + uint64_t hcr = arm_hcr_el2_eff(env); + bool enabled = !(hcr & HCR_TGE) && (hcr & HCR_AMO); + bool pending = enabled && (hcr & HCR_VSE); + bool masked = (env->daif & PSTATE_A); + + /* If VSE pending and masked, defer the exception. */ + if (pending && masked) { + uint32_t syndrome; + + if (arm_el_is_aa64(env, 1)) { + /* Copy across IDS and ISS from VSESR. */ + syndrome = env->cp15.vsesr_el2 & 0x1ffffff; + } else { + ARMMMUFaultInfo fi = { .type = ARMFault_AsyncExternal }; + + if (extended_addresses_enabled(env)) { + syndrome = arm_fi_to_lfsc(&fi); + } else { + syndrome = arm_fi_to_sfsc(&fi); + } + /* Copy across AET and ExT from VSESR. */ + syndrome |= env->cp15.vsesr_el2 & 0xd000; + } + + /* Set VDISR_EL2.A along with the syndrome. */ + env->cp15.vdisr_el2 = syndrome | (1u << 31); + + /* Clear pending virtual SError */ + env->cp15.hcr_el2 &= ~HCR_VSE; + cpu_reset_interrupt(env_cpu(env), CPU_INTERRUPT_VSERR); + } +} diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 98dbc8203f..fc0b3ebf44 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1454,6 +1454,23 @@ static void handle_hint(DisasContext *s, uint32_t insn, gen_helper_autib(cpu_X[17], cpu_env, cpu_X[17], cpu_X[16]); } break; + case 0b10000: /* ESB */ + /* Without RAS, we must implement this as NOP. */ + if (dc_isar_feature(aa64_ras, s)) { + /* + * QEMU does not have a source of physical SErrors, + * so we are only concerned with virtual SErrors. + * The pseudocode in the ARM for this case is + * if PSTATE.EL IN {EL0, EL1} && EL2Enabled() then + * AArch64.vESBOperation(); + * Most of the condition can be evaluated at translation time. + * Test for EL2 present, and defer test for SEL2 to runtime. + */ + if (s->current_el <= 1 && arm_dc_feature(s, ARM_FEATURE_EL2)) { + gen_helper_vesb(cpu_env); + } + } + break; case 0b11000: /* PACIAZ */ if (s->pauth_active) { gen_helper_pacia(cpu_X[30], cpu_env, cpu_X[30], diff --git a/target/arm/translate.c b/target/arm/translate.c index 9370b44707..fef7ccea5c 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -6236,6 +6236,29 @@ static bool trans_WFI(DisasContext *s, arg_WFI *a) return true; } +static bool trans_ESB(DisasContext *s, arg_ESB *a) +{ + /* + * For M-profile, minimal-RAS ESB can be a NOP. + * Without RAS, we must implement this as NOP. + */ + if (!arm_dc_feature(s, ARM_FEATURE_M) && dc_isar_feature(aa32_ras, s)) { + /* + * QEMU does not have a source of physical SErrors, + * so we are only concerned with virtual SErrors. + * The pseudocode in the ARM for this case is + * if PSTATE.EL IN {EL0, EL1} && EL2Enabled() then + * AArch32.vESBOperation(); + * Most of the condition can be evaluated at translation time. + * Test for EL2 present, and defer test for SEL2 to runtime. + */ + if (s->current_el <= 1 && arm_dc_feature(s, ARM_FEATURE_EL2)) { + gen_helper_vesb(cpu_env); + } + } + return true; +} + static bool trans_NOP(DisasContext *s, arg_NOP *a) { return true; From patchwork Sun Apr 17 17:44:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562860 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1872678map; Sun, 17 Apr 2022 11:32:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvS6N8IAcWWwnXUij0KLLdqZtJhiQnPXmMQ8kAo+Pc9VYLGpb20ckESyN13WGRSQT4dRkf X-Received: by 2002:a37:de12:0:b0:69b:f132:c606 with SMTP id h18-20020a37de12000000b0069bf132c606mr4588676qkj.695.1650220340478; Sun, 17 Apr 2022 11:32:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650220340; cv=none; d=google.com; s=arc-20160816; b=Vw5M8KVVOuCQPzpV8kQjqWhFOIIsN5FHCV1zyCMsVArC4CCIQ4fcNkFNSLNZ6dUpvu 0b9IUjfC3Ba6nbrXJmXUusc3aO4G3pzZgR3geUPwqbIBhQJraYMCDD3e5RHxtlbGvoZP caBo7gT+pOKn1B/t35zJ1HJYz9sjLIVma6VjUvFqpyX/UiPwi3nIA2zgBHj8jztu4GBh k0U4ufWdBeo10eDidTFA5eV5Hy5GVddrmpcKwEQQV8vKiTk4WE1zJQpjHJEAi5gs550d eIz7NbCaNHe3zjX8yKZhvDrfIBlrcHU+MS3OxeqPXx1apcr6LMiRPnVrG2ledyHPqJvc CoEg== 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=ROdZ8Y/MGQK0am4sMfTHzXw787CsxnIyvG7dCwMmzsg=; b=jnGF6Fmv5Sc4uJiGm0S2TBEf7mk1SZVUcjpGOMh/tPAGnPAJLjqL5nwzE9XVM/Opvl hVt9t8y1If48s+eOG95Ba6O9Jo0xI1MpQ3YDKc/Kg+V7J2sApsMjzt/aHxLW6P/9Ejqs 6TRYg611vvMT46EQSuP4HBXxBgos2VYH/bXBIwP8gnW4JMgeMZ45t/RUA6q8qjmGmHxk mn3CfuEC6zI/nhwFyAXB5NDZJoT+xLrb1QwM8JVLVDLLdlv++7RNZtyzQ1YJYvdh9f/j Ij+JRhk9GnKTcoB5VzqyusXnawpVuJnUijFnbNeky7HkMoBl6JHvua8euNiOQXDlJ+Cm rKTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=eji1jbkE; 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 bq35-20020a05620a46a300b0069c6af8cb9fsi2682648qkb.6.2022.04.17.11.32.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:32:20 -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=eji1jbkE; 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]:52966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9h6-0008H1-38 for patch@linaro.org; Sun, 17 Apr 2022 14:32:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49742) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng90U-0004gz-Tq for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:19 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:45727) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng90T-00045e-Bj for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:18 -0400 Received: by mail-pj1-x1031.google.com with SMTP id n33-20020a17090a5aa400b001d28f5ee3f9so736669pji.4 for ; Sun, 17 Apr 2022 10:48:16 -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=ROdZ8Y/MGQK0am4sMfTHzXw787CsxnIyvG7dCwMmzsg=; b=eji1jbkEL0wsoKqW8CX+3Da7Ve/88N1ePhPItro9WfnLubvEIz+dJYqHw1J2WD3XPP sG0h5XLLr7y5YlzU61WktWnIqc3z2+I+VhZcEr+ECXlz6bqnBZ0Il0ndDRTLzJOkSCm4 6DWDXA7cRsgsraW5XunzgtvN+2HRAZS64R990FpihsBjb63DWNY/n5WaMNpomc/gaksi /l50pruFaEVy8Tfwa7z+RxNxnb+O0Bu2q9IJSUMYLhSfBTPobcr+U+GaW5u0IA+NOye6 4+Kq7X/gA7VlzCSIvD25YUhfuf1X1HJQWu0B0RSIILBZnrmHZgISvhH6MqAwKtGYU9/j cl0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ROdZ8Y/MGQK0am4sMfTHzXw787CsxnIyvG7dCwMmzsg=; b=VWznftLhmVzrEiYJuaDRG77zRRruHbq/4f9AQ5kkc2tlLtrgzDkLcgt5v3pOj86VpZ RkjLwlElxcEy87Db6+gAqME1J9hJC4xoJHErkCXRRSgBOB1OcaLdaOkzc6CEcAb2zVuf JtXvyDtD5DHnYl/5xyAsyMrROZ4U7ahLVR6kqbTkrKrhygzkonqZJNtPQI0JqbrHZokD 8CH6UWmqGOMCyxy+JRKHe1gbIk/3vtZOGrovFy9ywg7RxJO9Xgi6R5uUzUsmH4NqbC3/ poG8yOz9X2yOBxA1oiK5YThbzIGf4YPQcdIImRzMNO8gwd106wnPjuqpIdXildKM9ai8 pCVg== X-Gm-Message-State: AOAM531Vf4Oqsn9FWKSH5SWGFK8dOtDip2DQTb4pAOhr78Xw9JkiCsBE eXSLPgpWfbK/fZ6L85JUEFO7ksTmP+qY7A== X-Received: by 2002:a17:902:b7c1:b0:158:9a1b:31d6 with SMTP id v1-20020a170902b7c100b001589a1b31d6mr7696921plz.94.1650217696138; Sun, 17 Apr 2022 10:48:16 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020aa78c4e000000b00506475da4cesm9372055pfd.49.2022.04.17.10.48.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:48:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 53/60] target/arm: Enable FEAT_RAS for -cpu max Date: Sun, 17 Apr 2022 10:44:19 -0700 Message-Id: <20220417174426.711829-54-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- v2: Update emulation.rst --- docs/system/arm/emulation.rst | 1 + target/arm/cpu64.c | 1 + target/arm/cpu_tcg.c | 1 + 3 files changed, 3 insertions(+) diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst index c89c344de1..35b6f7d4de 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -41,6 +41,7 @@ the following architecture extensions: - FEAT_PMULL (PMULL, PMULL2 instructions) - FEAT_PMUv3p1 (PMU Extensions v3.1) - FEAT_PMUv3p4 (PMU Extensions v3.4) +- FEAT_RAS (Reliability, availability, and serviceability) - FEAT_RDM (Advanced SIMD rounding double multiply accumulate instructions) - FEAT_RNG (Random number generator) - FEAT_SB (Speculation Barrier) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 136590382a..72fe7885f0 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -744,6 +744,7 @@ static void aarch64_max_initfn(Object *obj) t = cpu->isar.id_aa64pfr0; t = FIELD_DP64(t, ID_AA64PFR0, FP, 1); /* FEAT_FP16 */ t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1); /* FEAT_FP16 */ + t = FIELD_DP64(t, ID_AA64PFR0, RAS, 1); /* FEAT_RAS */ t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1); t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); /* FEAT_SEL2 */ t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); /* FEAT_DIT */ diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c index 337598e949..c5cf7efe95 100644 --- a/target/arm/cpu_tcg.c +++ b/target/arm/cpu_tcg.c @@ -69,6 +69,7 @@ void aa32_max_features(ARMCPU *cpu) t = cpu->isar.id_pfr0; t = FIELD_DP32(t, ID_PFR0, DIT, 1); /* FEAT_DIT */ + t = FIELD_DP32(t, ID_PFR0, RAS, 1); /* FEAT_RAS */ cpu->isar.id_pfr0 = t; t = cpu->isar.id_pfr2; From patchwork Sun Apr 17 17:44:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562874 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1880925map; Sun, 17 Apr 2022 11:51:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMOquY5XMSH7zTB1ieLf3Vfm4sE9SBf4m3XHROlhzSBhm3cI/3xZIdRppTw3YEhP8XH7bn X-Received: by 2002:a05:6214:b6b:b0:444:45c2:fc64 with SMTP id ey11-20020a0562140b6b00b0044445c2fc64mr6080914qvb.103.1650221500199; Sun, 17 Apr 2022 11:51:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650221500; cv=none; d=google.com; s=arc-20160816; b=TBYQSYwslh7v5ockmvAJaIxUPRdSO95iNRfNDVuHOIgf3P64stprAFk1RmD1p9Jn2m 3d9HXNLj9cHpjk5bUxtA9azewF0JplCQDMvqx+JBNX46IvWV8DeKtyTk9iwVAgd/GwHQ 87KZbLpTo2+s+NPEpBfLvc41VW25/vshamMLD4CP2d4Y7jOfan+vlqn0z+b+xw7ZMbK+ 54RBvKIBjsMs/brelt9ZP/uMMkE0xat6KK/S6Q5ib/Bk37f/v73+OKaCJ/l7wnSxQtBF YH3zGXU8DjZG2YNfUN+kJ+NZ25GOVaB9djXDLehOz1y77ku7DmOkDB8JTrcUL6g/rwuW gPoQ== 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=DoRumaxtRe3qsin4W3djn/6A+2lT9q58rZZ6KjoMUec=; b=CfBGtxRBEobaQLuFrDu+BmRXIz5OzDd92EmXI9Ma8oYs9WJJ7ruEwxud9yYDWO+QIY aEwkAg4qaPaqBNht15Tuy4f1g/YxTxXQQ0iDGmPI1iUZPFpq+yDnSZ5mbiNopqchP62f s/Wn1Gszcdn7Hcw/1HZM3b13RUgQ+vIkXddaWONbY5FLjSqAzoiVmKcYf/Rix4MtevM/ Lub32IqrWuLtO3mcq3BMgVv5cau1JoVqJBfPkhVJzBo5lPzlGxSTXt7o2XxxZTIsNA3k 0bxaOi1SvTlow+Kj2ddmi/E2/ErBwB0B9sjc59/SbLdk9dGF+p0aRVOlwWIqGHsdKw8O /i/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jmlC4sOq; 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 x13-20020a05620a258d00b0069c7c0d7870si2587075qko.475.2022.04.17.11.51.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:51:40 -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=jmlC4sOq; 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]:40942 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9zn-0004ln-PO for patch@linaro.org; Sun, 17 Apr 2022 14:51:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49784) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng90V-0004ix-Uj for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:20 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:41896) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng90U-00045w-71 for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:19 -0400 Received: by mail-pj1-x1031.google.com with SMTP id e8-20020a17090a118800b001cb13402ea2so12268554pja.0 for ; Sun, 17 Apr 2022 10:48:17 -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=DoRumaxtRe3qsin4W3djn/6A+2lT9q58rZZ6KjoMUec=; b=jmlC4sOqvOtfOzkh6swWRWx8MeweAKGvhFO4hOjhRwDyYr4nlxBTYFGudoMQyO6zCQ GjRIxl5kH+SNWL4B2fPPgh0Z8JGwCL9PdjbFy5evEOL4ByzNH1Yx2T1DFdsJlqVwpKVR UfhcTMs1HZ6MWJ8jT0xNL5D8uKv+FK7f2VbZwUmVmrv4kmIa4/7kB3GwlVRFaGccgcQW 4M4zU9xZwkS8yMB4sQ/QgAnhGSl6e7gqF+cnhj3Rbp2Wb3juuJJxtar1SkhBAEbkgdyM 1M3azCIR4m0x8Uz3tDYyvoFRXWVBF/MXEZD53ljpPK9xahQNrHLsp/hT+W/LsRRnkj1O wlfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DoRumaxtRe3qsin4W3djn/6A+2lT9q58rZZ6KjoMUec=; b=pieT3mhiKDcXlsx/L+EUgNYCDHvj++QgJhDA3PVPzRngkBkgza+7/IMDZJ2jc862RK htyIdCBqi5imzvRX1kajYDqFzFws6zIav2FsdHPsGXgQTnOzn7fAhIvNeVImCsGySdAc 1Pu40G0VguxjwaOxuxmJ1vIAS4+9jD44lyZHlTMyD4rV65CztnC96kZ/36e3KPTF61DW 7po6pOn8WnT5KlSStR/l1DkOvUIKbb3EtP58xbqxtj22sN6aKwexNablbl6QsxmO7rTW 8ynlzfueH5DElKCTunUZ0YNIKes6t4io7uDbVNiBLPOLbFwWB8Bhs1tUWc54ruQUczW2 rQoQ== X-Gm-Message-State: AOAM532WBm32okQPaxSvLGDHJCun8Mx+MbSPT4oixo/hX+L45GCAAnCV FTV4aSpHYBGWAk91d72bXU+uFSpHdn7xSA== X-Received: by 2002:a17:90b:3806:b0:1d2:6e95:f5cc with SMTP id mq6-20020a17090b380600b001d26e95f5ccmr6507650pjb.23.1650217696971; Sun, 17 Apr 2022 10:48:16 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020aa78c4e000000b00506475da4cesm9372055pfd.49.2022.04.17.10.48.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:48:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 54/60] target/arm: Enable FEAT_IESB for -cpu max Date: Sun, 17 Apr 2022 10:44:20 -0700 Message-Id: <20220417174426.711829-55-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This feature is AArch64 only, and applies to physical SErrors, which QEMU does not implement, thus the feature is a nop. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- v2: Update emulation.rst --- docs/system/arm/emulation.rst | 1 + target/arm/cpu64.c | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst index 35b6f7d4de..ebd9e418cc 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -24,6 +24,7 @@ the following architecture extensions: - FEAT_FlagM2 (Enhancements to flag manipulation instructions) - FEAT_HPDS (Hierarchical permission disables) - FEAT_I8MM (AArch64 Int8 matrix multiplication instructions) +- FEAT_IESB (Implicit error synchronization event) - FEAT_JSCVT (JavaScript conversion instructions) - FEAT_LOR (Limited ordering regions) - FEAT_LPA (Large Physical Address space) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 72fe7885f0..03fbb34e4e 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -781,6 +781,7 @@ static void aarch64_max_initfn(Object *obj) t = cpu->isar.id_aa64mmfr2; t = FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* FEAT_TTCNP */ t = FIELD_DP64(t, ID_AA64MMFR2, UAO, 1); /* FEAT_UAO */ + t = FIELD_DP64(t, ID_AA64MMFR2, IESB, 1); /* FEAT_IESB */ t = FIELD_DP64(t, ID_AA64MMFR2, VARANGE, 1); /* FEAT_LVA */ t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* FEAT_TTST */ cpu->isar.id_aa64mmfr2 = t; From patchwork Sun Apr 17 17:44:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562867 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1876805map; Sun, 17 Apr 2022 11:41:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKPpDRIlDC/G2dZK6eC4WgcDoapFwHnaeL0A+UwHfVwAHLjY9cFJX50NyuGsh1Vqv0vZxX X-Received: by 2002:a05:622a:151:b0:2f1:fe9f:9177 with SMTP id v17-20020a05622a015100b002f1fe9f9177mr1127881qtw.628.1650220896594; Sun, 17 Apr 2022 11:41:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650220896; cv=none; d=google.com; s=arc-20160816; b=w6/+IIpa8zq91ymUpoVAzt6L6SBnfVAhFuJtkCL1PJ2FsJrt1Vr05Elh9tPrDI0bYr roNtmaycjaDqO/J4J9lZ0gkBbkRydZlisvddQFMWFg1aJ5A990eRPlAqiZrzC4y1yOzF jzMCD8q1nqFK6a/GKqtGX1v7uZPK1ddiIvNBTSSI55aSSSICJayiq7Iymf8G6KgZ5YUJ /yD17x70Wl2rfsXNOuvgBOLDNSdNqdgRGITVgSwM8UsBfHFa64u8iC7zfysB6HkKdX70 CXDNIDibhanaxzOMvJEpYzEqoykHPwyGcHlIapGuvw3nXQFmmOSiYUmi6t48f21NK78a wiMQ== 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=4gebW4IdC/Bc62zWIHS5hydZkGTIlOLeMNTIUwSy2Ks=; b=D/Fp+zmApqaac44GpYaQHQ0IZCPfbwBq1RFv1GvkkZ+ouxHEc4faq9lFurSJ6UYtJw V0azeN2A5Jm0A339+mb3YCfYJd6093SeTyQp+3rl74aLcb7FvkKvYMm4no1BWCziPMSB xkq3yp8TU74mjqNcVmUZWBowlhYEUfNAHexEVcbGXOFNUxL3RKhvGijMevVldcKtmsVT do+CxLoE8zXeEEnCo00SdqKIDKLV1U/JCadmrDYB5Eh0Y5Xgo/uhk8z+KSSiIfJL7Cwt jdpC3KaHRR21zYtsNX0RnrogasdZMukmjBn4PKRg7PBDo39aQDnT5+sSg10tczg2uSQG sAAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=CetYLbkr; 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 18-20020ac85912000000b002f1ff6ba371si286535qty.446.2022.04.17.11.41.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:41:36 -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=CetYLbkr; 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]:44918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9q4-0005F0-64 for patch@linaro.org; Sun, 17 Apr 2022 14:41:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49828) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng90W-0004jW-VW for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:21 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:44613) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng90V-00046C-3d for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:20 -0400 Received: by mail-pg1-x534.google.com with SMTP id j71so1451371pge.11 for ; Sun, 17 Apr 2022 10:48:18 -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=4gebW4IdC/Bc62zWIHS5hydZkGTIlOLeMNTIUwSy2Ks=; b=CetYLbkrh2Emx4+viVrzNk2w06xK1Rh0zkQV/5RcLrJr2HpgyqKgR2xAFCrHXBm9Gh +xQKrxnGaTeocMQFYsn3+hpAl7IcOwCf+UVpYqGx9ENdsRGW3jxvAowQ5kDSIGKpIXBR VyGYdVEyzu1PZ2H/yOsov+XnQD7ChckHXaAvPFhdaAZsd9cGgY3OVVaeI61kqjqmkPrh zLGbLpSyXEdlXBTCEeWU+mBJ6c79GjO7UeonwJ1DCdREvt0Ld1TGAd23smVc6FDjxkqa jcw3M1m8gACwiH5M/+cB/9IVva5br17T8TFx5booqwz4Mfia9yyBfT8ayioPzYWpt6Sj hRlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4gebW4IdC/Bc62zWIHS5hydZkGTIlOLeMNTIUwSy2Ks=; b=wKp2vN4mxp6dF1aAFtQWptqFJOgzROXfy2NIfDJ+oU4HLklJAjWKvLsLEVtB4NvQ2Z Xe/JPS62Hwbr30BEWnYFnxNwUjHLH9kOB1hMLJ38m4SWRjmn8ROoAxHW5qymwOuD/t65 ds8n9mEXoo2H42j71wAGUtPfAXK3479IeML1xbJuINNBDxfwlgpwe3yfpqeOsJVBps7g 3rCCjDQFCBHpBEzZzLYNAVy1KZArcSBEz8gA/Lm4auwWfJOog+w937h+l70N8lkj9TDy bDp3HYJPc69MpV9ljePP3bZIRttmx6CNkpRkFIRM/jmp4YioTX8p1919WMm1Iv4Aw258 IQOQ== X-Gm-Message-State: AOAM531TqTge3/Aetst0lqyt37NneKgM9njzze2hWxWFQc1w8Sm4QrP4 Hk/7+3MrTJZHN/ZyFaD1WRVSPFJOKlFxnw== X-Received: by 2002:a05:6a00:8c5:b0:4fe:134d:30d3 with SMTP id s5-20020a056a0008c500b004fe134d30d3mr8405509pfu.3.1650217697790; Sun, 17 Apr 2022 10:48:17 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020aa78c4e000000b00506475da4cesm9372055pfd.49.2022.04.17.10.48.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:48:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 55/60] target/arm: Enable FEAT_CSV2 for -cpu max Date: Sun, 17 Apr 2022 10:44:21 -0700 Message-Id: <20220417174426.711829-56-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x534.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This extension concerns branch speculation, which TCG does not implement. Thus we can trivially enable this feature. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- v2: Update emulation.rst --- docs/system/arm/emulation.rst | 1 + target/arm/cpu64.c | 1 + target/arm/cpu_tcg.c | 1 + 3 files changed, 3 insertions(+) diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst index ebd9e418cc..91fb06c579 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -11,6 +11,7 @@ the following architecture extensions: - FEAT_AES (AESD and AESE instructions) - FEAT_BF16 (AArch64 BFloat16 instructions) - FEAT_BTI (Branch Target Identification) +- FEAT_CSV2 (Cache speculation variant 2) - FEAT_DIT (Data Independent Timing instructions) - FEAT_DPB (DC CVAP instruction) - FEAT_Debugv8p2 (Debug changes for v8.2) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 03fbb34e4e..b62656f3c3 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -748,6 +748,7 @@ static void aarch64_max_initfn(Object *obj) t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1); t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); /* FEAT_SEL2 */ t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); /* FEAT_DIT */ + t = FIELD_DP64(t, ID_AA64PFR0, CSV2, 1); /* FEAT_CSV2 */ cpu->isar.id_aa64pfr0 = t; t = cpu->isar.id_aa64pfr1; diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c index c5cf7efe95..762b961707 100644 --- a/target/arm/cpu_tcg.c +++ b/target/arm/cpu_tcg.c @@ -68,6 +68,7 @@ void aa32_max_features(ARMCPU *cpu) cpu->isar.id_mmfr4 = t; t = cpu->isar.id_pfr0; + t = FIELD_DP32(t, ID_PFR0, CSV2, 2); /* FEAT_CVS2 */ t = FIELD_DP32(t, ID_PFR0, DIT, 1); /* FEAT_DIT */ t = FIELD_DP32(t, ID_PFR0, RAS, 1); /* FEAT_RAS */ cpu->isar.id_pfr0 = t; From patchwork Sun Apr 17 17:44:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562864 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1874723map; Sun, 17 Apr 2022 11:36:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydULIRTqv+/jbMhsFoyciHgzvC9lBmq27pxn6gpbzugqEhlRx/8EmPa/YxQ1I9us1SkNXF X-Received: by 2002:a05:620a:4586:b0:67e:d240:ed1d with SMTP id bp6-20020a05620a458600b0067ed240ed1dmr4681013qkb.630.1650220600976; Sun, 17 Apr 2022 11:36:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650220600; cv=none; d=google.com; s=arc-20160816; b=loGuwh3/M1MyEesTsEQPZ2+BbnTu/UROmIv+/je1cMjGGDeJzIOw9xDM5aA+pZIqGw mtQ5ryoeRp+LClMSGeYC4P6PNmvek4z+GThR6/CFi+d88seoRxY4HvS/D9vEddvB2dwp Os1eRENojPgENBCmaIYfxsWB4JlwqtehIsWA0d749uQMOUjX1f070kCPFox4339zRxY1 G/oMefwzOifQndQUp4qKfaWUDA21diocP+rK2w36fYv+eIp09/CRD99tD9t3AweCA8FN Qc/RrrvKbs5L35A87qqI80v+dzeNx/ThQvsoYKN/Mz3VGahNXEYsdCtir+/0kXRTHfIh jV+g== 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=tg97pAzl6c8fQ/INZXGM16Pyz/AbXSyAlqpVeNxoRMU=; b=dv3gsas5d868PTMZvDQDlEAY4OikkPuxpxLeIvPdeHVMydpQI9v8zRWsjaHlSUaxKC B8HiNVs2nAZMI1VcKxHoU39i/yS+vNjuro1p8dblGaNn4Ok4eSFYAABPH2UfActGrVYP 4DntlsfuoMBZUwpgyx8Xwu6afGzzJpB7QbtJ+ToA1/qRSOa2zYAFhJGhKi3zMBXW8In9 DVHbI62lZ+mJPJeY12tu8kFBOzIhqUYagVxTibgMoMch/Z41Oi9CVPTLld8I47DrpIo6 1onQWgSyTnLr9666kefkbBMug0FCar8GratYC1JUeBMAXjqlSK2dpVzqmUxVLFSEi8eZ 0FaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RmAFVP8t; 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 z26-20020ac8101a000000b002ebaf6a3030si2240268qti.614.2022.04.17.11.36.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:36:40 -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=RmAFVP8t; 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]:34904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9lH-0006r5-Ir for patch@linaro.org; Sun, 17 Apr 2022 14:36:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49866) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng90X-0004kt-Og for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:21 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:52114) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng90V-00046c-Ps for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:21 -0400 Received: by mail-pj1-x1035.google.com with SMTP id bg24so11340804pjb.1 for ; Sun, 17 Apr 2022 10:48:19 -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=tg97pAzl6c8fQ/INZXGM16Pyz/AbXSyAlqpVeNxoRMU=; b=RmAFVP8t2BZ3/Cg/otdBUbyo2kR5iHJiQLLbA32jJOgbJMLGq0QPxuo6ScgdFDwm8X TFoNDttTlTZaZvI0A8lmlUXWkvCZf03Aa/H/ECYj4LtL1fHt9ATZsum5ZlgokTyBWg1s IFxIyDXnuTHG2zwsEqTc4wYuwt2Lnk/qbPNGgNuSMrzkApgfUlljzN+Cd8dSGdWAYbXP mzcMY+yDD81PjJiczZkTw77b6tl1KDJLp9+dK0ASfjODoDNWmJiGQQP1vGeS1MqEx/CD IERE4/2L3dLudWVTe1Oemdi2mGDYh3nQkJw2ykj9wVdg/WeUEZgAtMvpj5Ft8Bzo+c4F y5Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tg97pAzl6c8fQ/INZXGM16Pyz/AbXSyAlqpVeNxoRMU=; b=0rJkKPNV29EfrGQt+tFg5c9eId6VLEx7ysAybf7f9ny5zW4KMRipH4vMsxnxRVQ7r6 Ck6juPwSQRG3/GmnGMegjOnxOAUASxkXpTCKgWb+3DQenqmJl8fC7sVQPx/Yh/s8aqGH o72Z3MFdjheRbknOk+h/7WD3yxe1tjuKhBecHpKy9GNiHL5yGSBibkDGF28s6eew8cY9 4sqbPTY3ZFeT2ztKBvBUD/gr6AuR5i8YrF9fYvN2FsF4KBhnd9kNKqMmweEH68ht2svZ yio6odCAKDDTTzysAzNPy2Yf6MUA6g2d1ZRC6TG5lDr1i1CkHRVLVBLWiTPhs5N+ZuAw rnRQ== X-Gm-Message-State: AOAM531T3JfXf9FQVhzFMzA3ARJb231uce8a4FjsWxoeOeKzuX0wOKum 2Uw/YDx8Et4+ZSPrIqJ2/UOTAMXfA+W/9Q== X-Received: by 2002:a17:90b:1e49:b0:1d2:9d82:8bb1 with SMTP id pi9-20020a17090b1e4900b001d29d828bb1mr1224747pjb.226.1650217698502; Sun, 17 Apr 2022 10:48:18 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020aa78c4e000000b00506475da4cesm9372055pfd.49.2022.04.17.10.48.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:48:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 56/60] target/arm: Enable FEAT_CSV2_2 for -cpu max Date: Sun, 17 Apr 2022 10:44:22 -0700 Message-Id: <20220417174426.711829-57-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" There is no branch prediction in TCG, therefore there is no need to actually include the context number into the predictor. Therefore all we need to do is add the state for SCXTNUM_ELx. Signed-off-by: Richard Henderson --- v2: Update emulation.rst; clear CSV2_FRAC; use decimal; tidy access_scxtnum. v3: Rely on EL3-no-EL2 squashing during registration. --- docs/system/arm/emulation.rst | 3 ++ target/arm/cpu.h | 16 +++++++++ target/arm/cpu64.c | 3 +- target/arm/helper.c | 66 ++++++++++++++++++++++++++++++++++- 4 files changed, 86 insertions(+), 2 deletions(-) diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst index 91fb06c579..aebe3be1ba 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -12,6 +12,9 @@ the following architecture extensions: - FEAT_BF16 (AArch64 BFloat16 instructions) - FEAT_BTI (Branch Target Identification) - FEAT_CSV2 (Cache speculation variant 2) +- FEAT_CSV2_1p1 (Cache speculation variant 2, version 1.1) +- FEAT_CSV2_1p2 (Cache speculation variant 2, version 1.2) +- FEAT_CSV2_2 (Cache speculation variant 2, version 2) - FEAT_DIT (Data Independent Timing instructions) - FEAT_DPB (DC CVAP instruction) - FEAT_Debugv8p2 (Debug changes for v8.2) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index b90b6d91bd..a7582da7c2 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -687,6 +687,8 @@ typedef struct CPUArchState { ARMPACKey apdb; ARMPACKey apga; } keys; + + uint64_t scxtnum_el[4]; #endif #if defined(CONFIG_USER_ONLY) @@ -1210,6 +1212,7 @@ void pmu_init(ARMCPU *cpu); #define SCTLR_WXN (1U << 19) #define SCTLR_ST (1U << 20) /* up to ??, RAZ in v6 */ #define SCTLR_UWXN (1U << 20) /* v7 onward, AArch32 only */ +#define SCTLR_TSCXT (1U << 20) /* FEAT_CSV2_1p2, AArch64 only */ #define SCTLR_FI (1U << 21) /* up to v7, v8 RES0 */ #define SCTLR_IESB (1U << 21) /* v8.2-IESB, AArch64 only */ #define SCTLR_U (1U << 22) /* up to v6, RAO in v7 */ @@ -4021,6 +4024,19 @@ static inline bool isar_feature_aa64_dit(const ARMISARegisters *id) return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, DIT) != 0; } +static inline bool isar_feature_aa64_scxtnum(const ARMISARegisters *id) +{ + int key = FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, CSV2); + if (key >= 2) { + return true; /* FEAT_CSV2_2 */ + } + if (key == 1) { + key = FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, CSV2_FRAC); + return key >= 2; /* FEAT_CSV2_1p2 */ + } + return false; +} + static inline bool isar_feature_aa64_ssbs(const ARMISARegisters *id) { return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, SSBS) != 0; diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index b62656f3c3..6ccbcb857d 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -748,7 +748,7 @@ static void aarch64_max_initfn(Object *obj) t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1); t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); /* FEAT_SEL2 */ t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); /* FEAT_DIT */ - t = FIELD_DP64(t, ID_AA64PFR0, CSV2, 1); /* FEAT_CSV2 */ + t = FIELD_DP64(t, ID_AA64PFR0, CSV2, 2); /* FEAT_CSV2_2 */ cpu->isar.id_aa64pfr0 = t; t = cpu->isar.id_aa64pfr1; @@ -760,6 +760,7 @@ static void aarch64_max_initfn(Object *obj) * we do for EL2 with the virtualization=on property. */ t = FIELD_DP64(t, ID_AA64PFR1, MTE, 3); /* FEAT_MTE3 */ + t = FIELD_DP64(t, ID_AA64PFR1, CSV2_FRAC, 0); /* FEAT_CSV2_2 */ cpu->isar.id_aa64pfr1 = t; t = cpu->isar.id_aa64mmfr0; diff --git a/target/arm/helper.c b/target/arm/helper.c index 7e4178c594..22728b9fbf 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -1771,6 +1771,9 @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) if (cpu_isar_feature(aa64_mte, cpu)) { valid_mask |= SCR_ATA; } + if (cpu_isar_feature(aa64_scxtnum, cpu)) { + valid_mask |= SCR_ENSCXT; + } } else { valid_mask &= ~(SCR_RW | SCR_ST); if (cpu_isar_feature(aa32_ras, cpu)) { @@ -5149,6 +5152,9 @@ static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask) if (cpu_isar_feature(aa64_mte, cpu)) { valid_mask |= HCR_ATA | HCR_DCT | HCR_TID5; } + if (cpu_isar_feature(aa64_scxtnum, cpu)) { + valid_mask |= HCR_ENSCXT; + } } /* Clear RES0 bits. */ @@ -5798,6 +5804,10 @@ static void define_arm_vh_e2h_redirects_aliases(ARMCPU *cpu) { K(3, 0, 5, 6, 0), K(3, 4, 5, 6, 0), K(3, 5, 5, 6, 0), "TFSR_EL1", "TFSR_EL2", "TFSR_EL12", isar_feature_aa64_mte }, + { K(3, 0, 13, 0, 7), K(3, 4, 13, 0, 7), K(3, 5, 13, 0, 7), + "SCXTNUM_EL1", "SCXTNUM_EL2", "SCXTNUM_EL12", + isar_feature_aa64_scxtnum }, + /* TODO: ARMv8.2-SPE -- PMSCR_EL2 */ /* TODO: ARMv8.4-Trace -- TRFCR_EL2 */ }; @@ -7233,7 +7243,57 @@ static const ARMCPRegInfo mte_el0_cacheop_reginfo[] = { }, }; -#endif +static CPAccessResult access_scxtnum(CPUARMState *env, const ARMCPRegInfo *ri, + bool isread) +{ + int el = arm_current_el(env); + + if (el == 0) { + uint64_t hcr = arm_hcr_el2_eff(env); + if ((hcr & (HCR_TGE | HCR_E2H)) != (HCR_TGE | HCR_E2H)) { + if (env->cp15.sctlr_el[1] & SCTLR_TSCXT) { + if (hcr & HCR_TGE) { + return CP_ACCESS_TRAP_EL2; + } + return CP_ACCESS_TRAP; + } + if (arm_is_el2_enabled(env) && !(hcr & HCR_ENSCXT)) { + return CP_ACCESS_TRAP_EL2; + } + goto no_sctlr_el2; + } + } + if (el < 2 && (env->cp15.sctlr_el[2] & SCTLR_TSCXT)) { + return CP_ACCESS_TRAP_EL2; + } + no_sctlr_el2: + if (el < 3 + && arm_feature(env, ARM_FEATURE_EL3) + && !(env->cp15.scr_el3 & SCR_ENSCXT)) { + return CP_ACCESS_TRAP_EL3; + } + return CP_ACCESS_OK; +} + +static const ARMCPRegInfo scxtnum_reginfo[] = { + { .name = "SCXTNUM_EL0", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 3, .crn = 13, .crm = 0, .opc2 = 7, + .access = PL0_RW, .accessfn = access_scxtnum, + .fieldoffset = offsetof(CPUARMState, scxtnum_el[0]) }, + { .name = "SCXTNUM_EL1", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 0, .crn = 13, .crm = 0, .opc2 = 7, + .access = PL1_RW, .accessfn = access_scxtnum, + .fieldoffset = offsetof(CPUARMState, scxtnum_el[1]) }, + { .name = "SCXTNUM_EL2", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 4, .crn = 13, .crm = 0, .opc2 = 7, + .access = PL2_RW, .accessfn = access_scxtnum, + .fieldoffset = offsetof(CPUARMState, scxtnum_el[2]) }, + { .name = "SCXTNUM_EL3", .state = ARM_CP_STATE_AA64, + .opc0 = 3, .opc1 = 6, .crn = 13, .crm = 0, .opc2 = 7, + .access = PL3_RW, + .fieldoffset = offsetof(CPUARMState, scxtnum_el[3]) }, +}; +#endif /* TARGET_AARCH64 */ static CPAccessResult access_predinv(CPUARMState *env, const ARMCPRegInfo *ri, bool isread) @@ -8372,6 +8432,10 @@ void register_cp_regs_for_features(ARMCPU *cpu) define_arm_cp_regs(cpu, mte_tco_ro_reginfo); define_arm_cp_regs(cpu, mte_el0_cacheop_reginfo); } + + if (cpu_isar_feature(aa64_scxtnum, cpu)) { + define_arm_cp_regs(cpu, scxtnum_reginfo); + } #endif if (cpu_isar_feature(any_predinv, cpu)) { From patchwork Sun Apr 17 17:44:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562866 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1876764map; Sun, 17 Apr 2022 11:41:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpYVP2l1IG0q6fxiwQWyr0NIvn5D2URqmqg2CCPVNJTBZkL1i2JsgpgN5zPvbkSea/eCUT X-Received: by 2002:ac8:5b93:0:b0:2e1:ecde:e1e2 with SMTP id a19-20020ac85b93000000b002e1ecdee1e2mr5144481qta.304.1650220891685; Sun, 17 Apr 2022 11:41:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650220891; cv=none; d=google.com; s=arc-20160816; b=lUmjHeTw5V4ZQZZWuyoSThiZkZNDxAfMQqRiKSPJfIkFUMW5CCBZ962xq7A+ga6Z0H cjG/b3hwhAVM56pQXr40KhRFCS/p4OUmHHa+8rh55CuHnp0aZ9hLFYca92aus7TGMFoB d4VO88lrYQWpGpSxQjC0ReBxJ4KqY9yKSaf6sKLxeqFKiI0K3sDSjPoYNYD0BEvTKsNN UiRsnUOjdyxh3sUkcOz1tE0UPUHwxBNgKxeqCQ6fN5AQG9Z/GKMQEGAShURTO4SbwKt0 kQRhw5qbJ8PD4YDds1yFNs4DOeETe79TBzqHqSFXbGEFLYhzGWfUwBQ9LxGCxC8DCtXR WGXw== 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=Ra+HmlDmjq5MC1Bo0b0qUr7KsvywnTjoaMfVjleqeaE=; b=mvJmvVMw7Zx3YO2v1wpCXJ0dOngMGQRaatBxPWPocx4koZhM5uALtkwQhGgo6o+oXK ch72InLuxIxL3vmMTTLvSaXlXUOl7kbpg6UD5hDyCuzoxnVkE/VCxD6r3LzbVxmXKk9k k+zgGJamp616XBCGdfbbNqymTyN7+MApUHziAGu3GZVqUJUDhuM3YU8fIILnc2+dkTyE ZSko9f5EhLilih9xcJA4GZT56l+xNAeBYEkRSRGgefGinWYBHx0ElGhBGXCBzXAcNxuq OSgsdmtV/2nOoMexKzOFcvfbj17a6UoIZdpooewd2O+kE+S1c1zH3BBnVQjFxmeH4JKs 33Sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=B5l28oZW; 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 76-20020a370b4f000000b0067eb809d426si2241055qkl.249.2022.04.17.11.41.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:41:31 -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=B5l28oZW; 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]:44738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9pz-00057x-69 for patch@linaro.org; Sun, 17 Apr 2022 14:41:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng90Y-0004m5-BB for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:22 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:45728) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng90W-00046s-KT for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:22 -0400 Received: by mail-pj1-x1032.google.com with SMTP id n33-20020a17090a5aa400b001d28f5ee3f9so736730pji.4 for ; Sun, 17 Apr 2022 10:48:20 -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=Ra+HmlDmjq5MC1Bo0b0qUr7KsvywnTjoaMfVjleqeaE=; b=B5l28oZWCEaPX16JktO6lmO5Gg+6b++FQW/pRoaRiT3pmR6WbHSzmdhBF+JcFoPxJr e4vHea6LIEz+69Sy3oc8QKdn9L7hHrFX1P/jCRd3TTgEw2bIlX1jpt0zifUSQFqFd19d bbmZMNxPF7ahYoS1D8Ddnlf/hTa9Rz6/og4nRprVGnr53qWweEymRp9CAb0ieU7oFwxh d5aYOR0j8IMm5OR+FOfWowNE52DlkiorhYmwq4RU1o9UxCl8PSERY+dPona7/mLPpFlY 4xJgt/HjTLncszBMkEVBgS4BsR100Rmn6qOyRe7SE/jdQZs/bMzjG7veCpZcqFY8sSRG T38w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ra+HmlDmjq5MC1Bo0b0qUr7KsvywnTjoaMfVjleqeaE=; b=gvN9y5M8B4ChxLS5KNS+mOGkdDNBJuFd6MELJL+xIyOyWny0YLYOmfH69ajslzl/DP WvijPzUW+hOpsJGhz6e8rGZHvGJCiJEO3N69Wwnbw3lFkvpuihxArBj4bj0f4zuI3prq MAImwFz+WLJg9bKThIgwDlrE3sADNheUAJMn5mO+6doIkKPxn5XKT+Is4F1zSReiGLSK 067UdstJqac36fuKghdSIgGlPsWJzQYsJR9w1dXs8r/yZv2EBqC1vtUoQtZL86EL7N0T ddz6q6X+nAFNPaFquwL4oMAQ/YKWtg9Nz3BqrbI1N6sIiKSYK/e8HMdJ7cMPp50Fsgdc OP1Q== X-Gm-Message-State: AOAM533qKR1oojcpuZWqhCyq8b6HzasNMy0UPFQvoZv6oseBf88WJJm9 LhvbiMTkqZASNO0HeX6/y2LN3nR27ZAcRw== X-Received: by 2002:a17:90b:390d:b0:1d2:7a7d:170e with SMTP id ob13-20020a17090b390d00b001d27a7d170emr5351329pjb.230.1650217699222; Sun, 17 Apr 2022 10:48:19 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020aa78c4e000000b00506475da4cesm9372055pfd.49.2022.04.17.10.48.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:48:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 57/60] target/arm: Enable FEAT_CSV3 for -cpu max Date: Sun, 17 Apr 2022 10:44:23 -0700 Message-Id: <20220417174426.711829-58-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This extension concerns cache speculation, which TCG does not implement. Thus we can trivially enable this feature. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- v2: Update emulation.rst --- docs/system/arm/emulation.rst | 1 + target/arm/cpu64.c | 1 + target/arm/cpu_tcg.c | 1 + 3 files changed, 3 insertions(+) diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst index aebe3be1ba..f75f0fc110 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -15,6 +15,7 @@ the following architecture extensions: - FEAT_CSV2_1p1 (Cache speculation variant 2, version 1.1) - FEAT_CSV2_1p2 (Cache speculation variant 2, version 1.2) - FEAT_CSV2_2 (Cache speculation variant 2, version 2) +- FEAT_CSV3 (Cache speculation variant 3) - FEAT_DIT (Data Independent Timing instructions) - FEAT_DPB (DC CVAP instruction) - FEAT_Debugv8p2 (Debug changes for v8.2) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 6ccbcb857d..6139f51267 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -749,6 +749,7 @@ static void aarch64_max_initfn(Object *obj) t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); /* FEAT_SEL2 */ t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); /* FEAT_DIT */ t = FIELD_DP64(t, ID_AA64PFR0, CSV2, 2); /* FEAT_CSV2_2 */ + t = FIELD_DP64(t, ID_AA64PFR0, CSV3, 1); /* FEAT_CSV3 */ cpu->isar.id_aa64pfr0 = t; t = cpu->isar.id_aa64pfr1; diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c index 762b961707..ea4eccddc3 100644 --- a/target/arm/cpu_tcg.c +++ b/target/arm/cpu_tcg.c @@ -74,6 +74,7 @@ void aa32_max_features(ARMCPU *cpu) cpu->isar.id_pfr0 = t; t = cpu->isar.id_pfr2; + t = FIELD_DP32(t, ID_PFR2, CSV3, 1); /* FEAT_CSV3 */ t = FIELD_DP32(t, ID_PFR2, SSBS, 1); /* FEAT_SSBS */ cpu->isar.id_pfr2 = t; From patchwork Sun Apr 17 17:44:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562873 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1880360map; Sun, 17 Apr 2022 11:50:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy08uVp8QaKEQQmJbYTqyt8okwD+NPMhnVs91Xd7bi1iI1hhBc99OZheeVMOQRKuMrYhwrb X-Received: by 2002:a05:620a:44cb:b0:69c:26fc:9a84 with SMTP id y11-20020a05620a44cb00b0069c26fc9a84mr4619961qkp.52.1650221420680; Sun, 17 Apr 2022 11:50:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650221420; cv=none; d=google.com; s=arc-20160816; b=GLX7GFmMuN58R4iv95Ci0ZUmrdl1E3BCeYdlTX0QXqnypXyrBJ2/Q9Vv7hYMRHqCiA 6sgGylbRQ78Nra1v2COiZscVJBhBMtWhwJLGpesc0Q43fMFFL8VT0wt3waOqmA/J3tDK hHgrOwjJVex1gy560y9NSJdsGhAw1J2QbZkc+qaAZjk1ntF3PNgLBq++9JAx1vjL6XwS QAx902++YuOfLGtG/CV63Htz37y+KxnlZM0XQX2oE0Ahp527KNERRtmXzt699YyDwyil c2E7vgQLzgF92DX/uGhSA7poXYQW/tosHabwIqHKAYk9dY1s04SkOhY2WuEus0sS32pU VDFQ== 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=7bwI399xmkYMZYOeiF66UP7rD5My88v054sfcO3BxLg=; b=Farl7Hxbj2c+8wjKxFhsL0wzA4FsCC3DewaSuqFfFdFFlmS32cvfWLy2w+IYghSJ9E ej1PXDBi2vDbyE4YX3oTlfSreObYf0XRkg1oh2K2Gk+QVhRStEEb9SGDQo0BLUJZNoR2 27cUsedfJJbSMzT+/sEJSbsTx7KQaH5JBaQNAqBpZu5MFCx0GZGyeIe8ONNMp9JNUtCM YVPUKYhSSeQyb2IQHS4+q6+1M0JfHRGlkLRSpyCN+2HNgqXymBzaRN1hq7vzQ9RnBjzT kH+386gtYVQqQqBtbI0dTgtldM9uEBVvkvE3Ivi1Eje966vSCseVUnyx5yZe5roTnLss k1mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=zzb2qRTp; 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 ke3-20020a056214300300b00443d297d9b7si2052666qvb.467.2022.04.17.11.50.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:50:20 -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=zzb2qRTp; 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]:37594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9yW-0002ZL-9q for patch@linaro.org; Sun, 17 Apr 2022 14:50:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng90a-0004nv-Ny for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:24 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:33624) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng90X-000478-4a for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:22 -0400 Received: by mail-pg1-x536.google.com with SMTP id k14so14994481pga.0 for ; Sun, 17 Apr 2022 10:48:20 -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=7bwI399xmkYMZYOeiF66UP7rD5My88v054sfcO3BxLg=; b=zzb2qRTpQv5YOaWzGfE0jQkLcnBU+zDntc/eh/oowf/cKflXehA6hIbAtaFYICsHiY jR6w3MTb8AHbOEKJ9wRx8/LNe0ZeA2+G/UtjZMtL0CBwXoqMWferVNOOWJPU9D23yt2g NyEy7E2BE8ICudIycjncU36WJF+K/sZ6dxSU/J0cdvXQIASElqfqTWf8DfCsoG0u9yUJ QsJuMu+CDpz2HokuqofJokUNwlaasnnvy8ZORdqlBo3xLhNYazh2VQda6v72JW5XRalj 9/l6sy1eD75ZFAMlL+0kE2kssvvCR9fq79qqo85hp0JB8EV8Vs5dVus672lTiFafEmii dUSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7bwI399xmkYMZYOeiF66UP7rD5My88v054sfcO3BxLg=; b=BGb+7sZ3XuQdNQ/Husr2ABXPoUlS8Gc+6YQzkBG5gytnGN8fHJL4Ap2rFzvaoYslyD 1WMJaVrpBfTi6keHuUtUaSaCXn/8vT7t0wJAi6uXSvSNPgWNWcOtC6q1Olj7YQ7k5So4 Cu0237b6rCxli1Irq2rlbA5ZY/tvJT/CwXbdlfyOxfb9vp6TWF3FV6+/cR8gq3LKh6Ix p2TqYVREvbfRWPC4j6dBHaAJECFzdrQLDpNMAc57CMXgH4W585U+w7GTW4yZswQczGRA ex40aSunByRq3MsrHJqE0cY8kGdbwUyjo3WWu0E+9RY965oFVb+mDuhdfk4DYUj7XMFT rCgQ== X-Gm-Message-State: AOAM532V9zA6a8zSgpn+xzPZyHRjhpwkGg3Hx1ggkScy/Mc1Ebvvn7zA wFAdwzxJJ4RoF0kBbooo+WbR6Tlc7NWzLg== X-Received: by 2002:aa7:8a06:0:b0:506:28c:1282 with SMTP id m6-20020aa78a06000000b00506028c1282mr8418956pfa.19.1650217699937; Sun, 17 Apr 2022 10:48:19 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020aa78c4e000000b00506475da4cesm9372055pfd.49.2022.04.17.10.48.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:48:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 58/60] target/arm: Enable FEAT_DGH for -cpu max Date: Sun, 17 Apr 2022 10:44:24 -0700 Message-Id: <20220417174426.711829-59-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This extension concerns not merging memory access, which TCG does not implement. Thus we can trivially enable this feature. Add a comment to handle_hint for the DGH instruction, but no code. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- v2: Update emulation.rst --- docs/system/arm/emulation.rst | 1 + target/arm/cpu64.c | 1 + target/arm/translate-a64.c | 1 + 3 files changed, 3 insertions(+) diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst index f75f0fc110..bc9cdda75a 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -16,6 +16,7 @@ the following architecture extensions: - FEAT_CSV2_1p2 (Cache speculation variant 2, version 1.2) - FEAT_CSV2_2 (Cache speculation variant 2, version 2) - FEAT_CSV3 (Cache speculation variant 3) +- FEAT_DGH (Data gathering hint) - FEAT_DIT (Data Independent Timing instructions) - FEAT_DPB (DC CVAP instruction) - FEAT_Debugv8p2 (Debug changes for v8.2) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 6139f51267..336a941acd 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -738,6 +738,7 @@ static void aarch64_max_initfn(Object *obj) t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1); /* FEAT_SB */ t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1); /* FEAT_SPECRES */ t = FIELD_DP64(t, ID_AA64ISAR1, BF16, 1); /* FEAT_BF16 */ + t = FIELD_DP64(t, ID_AA64ISAR1, DGH, 1); /* FEAT_DGH */ t = FIELD_DP64(t, ID_AA64ISAR1, I8MM, 1); /* FEAT_I8MM */ cpu->isar.id_aa64isar1 = t; diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index fc0b3ebf44..b44ab3ecf3 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1427,6 +1427,7 @@ static void handle_hint(DisasContext *s, uint32_t insn, break; case 0b00100: /* SEV */ case 0b00101: /* SEVL */ + case 0b00110: /* DGH */ /* we treat all as NOP at least for now */ break; case 0b00111: /* XPACLRI */ From patchwork Sun Apr 17 17:44:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562876 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1882115map; Sun, 17 Apr 2022 11:54:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKZxPLdavgU/4RHKo3qP88aWRV4SElhgKJ+fureopQ+xwvJVG3cM/gVLs7KRa7vED7FxAs X-Received: by 2002:a05:622a:5c9:b0:2f1:f20f:127a with SMTP id d9-20020a05622a05c900b002f1f20f127amr5093466qtb.13.1650221672215; Sun, 17 Apr 2022 11:54:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650221672; cv=none; d=google.com; s=arc-20160816; b=ENzKvpSKVKjVppTdswNuXo0L44rk6quiTZQQ5k0gm6G2USIrK7U2hPtGy3+tpuD+lp dmmCTPgf5tCWDfvQ/1aHqLhjGZFQZ/h6IBjW8PhQUaFDAh0eez3etFjESX9ZLoAsPGJc AXXu6yuj0Mn3kWdU238/AL3cCWeiEfG2WWQwDBZVHpYULk9ivM69Lqd/ZIUruYTlIA+u v2Qh1pNTLvR4QnFwA/DpRM7CtYo6H2SUGldICv8Pr5ahgBuy+YHvRk84eE/ZAmITFyhC DrzTp2IDvBSur2yqq4xy2TcJXXOqdnYOwtgUAP23r+9slwNaLFuC8lodMXYTyQqRp5f9 7uQQ== 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=AWChTNub/svxMafWwyMDKgs1ZSDrVWcoRccpdVr6IWk=; b=giHYNC45irCxJ31DhLVEHY6FHSS7muiPTCfyq8Cfg9laW5M1Tsj0cYpAqiG03x4gf8 j1PkDxfQ0mzd3AUG6HiuqUSsm2QmLzcKpvO6G//g8VAkJmDCwcNDM+VKG1RAnmIGK91y fLY/T4hrvGgELZ9bUQhgnb4/9lAMNVTjJPSxXSttfwRK30SXnEngZZZaHQsrigECJ6tT u3hAWEZuILx1/Gf6WVXllmtaVbiux3lJn4Uc1pTgYEq4jv66h8zw5ac7Ehn4HO4lgbAS jb6JH3TGRIs5mN8S7biIvddRn4StWAPrf1nXNNi71NFiO5j7f87p4ZRRl6/R+M2jsuKv Ujpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MNvTwov8; 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 189-20020a370bc6000000b00699ee1a095asi2285970qkl.357.2022.04.17.11.54.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:54:32 -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=MNvTwov8; 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]:49570 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngA2Z-0002Aw-Ny for patch@linaro.org; Sun, 17 Apr 2022 14:54:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49934) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng90a-0004nu-NY for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:24 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:38754) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng90Y-00047S-5e for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:23 -0400 Received: by mail-pj1-x1031.google.com with SMTP id s14-20020a17090a880e00b001caaf6d3dd1so15528820pjn.3 for ; Sun, 17 Apr 2022 10:48:21 -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=AWChTNub/svxMafWwyMDKgs1ZSDrVWcoRccpdVr6IWk=; b=MNvTwov8M7uHpW448lDUcuAo0h2kyuhJjIm5LWpKDNQdrzlCVDHGMEJeb2YnyPY3Uk m6OvjlpiU0PblON0aIFv1tf4AGB6BIKBzNatt1XFL2Myw5pTQSUlVPmpe18dS3g4MDAv 3D9eQ8iZjtBIzI9hcJkvl0SUHL96aB9qUzmifDE2BNK3rak7dspxjYTGeJAiSfS6/6w0 J5xbbhI7G9c9PMb/47rqBlEH1W7+OB3l45sjmRKGjzhaPtePEVo3a1lDpU92VF8m1Y0L BrkWbXYsNM98qpBNoDnn0N318Z0LolmEsK+Q9BectnRHZYA0Q2U7WvvTj44pfCWqfA85 4+JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AWChTNub/svxMafWwyMDKgs1ZSDrVWcoRccpdVr6IWk=; b=EnztyQsyxRoAvnljS5HUDWAVVHfaQ0Rmf3rcqt3owEhY1FzttXXDyUQLMCw2l4b7G/ L4+guERgctQnt1u/JekLOPV2DYWhVMwVm2J0Cemn23DMRv9df7fTwCVBDIJLKPWgsdaA JSe8/zghaVMqZe4zCZBf4/hcG1VYM2Pri3GquXJtz94IN9JJ0uQry6dEMjRP7I8KdPp/ p4HoOAg1DlGSZLfemZJOklC08TEn/JmjBUuUtWX5eK3BU7cXCF2h1jrBkZKzKLVl16AC Vh3LyD/7aDHRappGsPPkLwmzIP2WEPhZG+FQGrfOlEORcK+KEvBvutqaZsQS+xFX1m2R qbrg== X-Gm-Message-State: AOAM530Ov4HBfZ6T6NnpvrOZTvxrDd96WaX7M9VIGIwjWARkOlRD7MYg dmJEvPXaxq5eZPAKXDx/foiLGKIRg8ERoQ== X-Received: by 2002:a17:90a:510e:b0:1cb:b1de:27a0 with SMTP id t14-20020a17090a510e00b001cbb1de27a0mr14567096pjh.196.1650217700857; Sun, 17 Apr 2022 10:48:20 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020aa78c4e000000b00506475da4cesm9372055pfd.49.2022.04.17.10.48.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:48:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 59/60] target/arm: Define cortex-a76 Date: Sun, 17 Apr 2022 10:44:25 -0700 Message-Id: <20220417174426.711829-60-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Enable the a76 for virt and sbsa board use. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- docs/system/arm/virt.rst | 1 + hw/arm/sbsa-ref.c | 1 + hw/arm/virt.c | 1 + target/arm/cpu64.c | 66 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+) diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst index 1544632b67..e9ff81aa21 100644 --- a/docs/system/arm/virt.rst +++ b/docs/system/arm/virt.rst @@ -55,6 +55,7 @@ Supported guest CPU types: - ``cortex-a53`` (64-bit) - ``cortex-a57`` (64-bit) - ``cortex-a72`` (64-bit) +- ``cortex-a76`` (64-bit) - ``a64fx`` (64-bit) - ``host`` (with KVM only) - ``max`` (same as ``host`` for KVM; best possible emulation with TCG) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index 2387401963..2ddde88f5e 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -145,6 +145,7 @@ static const int sbsa_ref_irqmap[] = { static const char * const valid_cpus[] = { ARM_CPU_TYPE_NAME("cortex-a57"), ARM_CPU_TYPE_NAME("cortex-a72"), + ARM_CPU_TYPE_NAME("cortex-a76"), ARM_CPU_TYPE_NAME("max"), }; diff --git a/hw/arm/virt.c b/hw/arm/virt.c index d2e5ecd234..ce15c36a7f 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -202,6 +202,7 @@ static const char *valid_cpus[] = { ARM_CPU_TYPE_NAME("cortex-a53"), ARM_CPU_TYPE_NAME("cortex-a57"), ARM_CPU_TYPE_NAME("cortex-a72"), + ARM_CPU_TYPE_NAME("cortex-a76"), ARM_CPU_TYPE_NAME("a64fx"), ARM_CPU_TYPE_NAME("host"), ARM_CPU_TYPE_NAME("max"), diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 336a941acd..d046351991 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -194,6 +194,71 @@ static void aarch64_a72_initfn(Object *obj) define_cortex_a72_a57_a53_cp_reginfo(cpu); } +static void aarch64_a76_initfn(Object *obj) +{ + ARMCPU *cpu = ARM_CPU(obj); + + cpu->dtb_compatible = "arm,cortex-a76"; + set_feature(&cpu->env, ARM_FEATURE_V8); + set_feature(&cpu->env, ARM_FEATURE_NEON); + set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); + set_feature(&cpu->env, ARM_FEATURE_AARCH64); + set_feature(&cpu->env, ARM_FEATURE_CBAR_RO); + set_feature(&cpu->env, ARM_FEATURE_EL2); + set_feature(&cpu->env, ARM_FEATURE_EL3); + set_feature(&cpu->env, ARM_FEATURE_PMU); + + /* Ordered by B2.4 AArch64 registers by functional group */ + cpu->clidr = 0x82000023; + cpu->ctr = 0x8444C004; + cpu->dcz_blocksize = 4; + cpu->isar.id_aa64dfr0 = 0x0000000010305408ull; + cpu->isar.id_aa64isar0 = 0x0000100010211120ull; + cpu->isar.id_aa64isar1 = 0x0000000000100001ull; + cpu->isar.id_aa64mmfr0 = 0x0000000000101122ull; + cpu->isar.id_aa64mmfr1 = 0x0000000010212122ull; + cpu->isar.id_aa64mmfr2 = 0x0000000000001011ull; + cpu->isar.id_aa64pfr0 = 0x1100000010111112ull; /* GIC filled in later */ + cpu->isar.id_aa64pfr1 = 0x0000000000000010ull; + cpu->id_afr0 = 0x00000000; + cpu->isar.id_dfr0 = 0x04010088; + cpu->isar.id_isar0 = 0x02101110; + cpu->isar.id_isar1 = 0x13112111; + cpu->isar.id_isar2 = 0x21232042; + cpu->isar.id_isar3 = 0x01112131; + cpu->isar.id_isar4 = 0x00010142; + cpu->isar.id_isar5 = 0x01011121; + cpu->isar.id_isar6 = 0x00000010; + cpu->isar.id_mmfr0 = 0x10201105; + cpu->isar.id_mmfr1 = 0x40000000; + cpu->isar.id_mmfr2 = 0x01260000; + cpu->isar.id_mmfr3 = 0x02122211; + cpu->isar.id_mmfr4 = 0x00021110; + cpu->isar.id_pfr0 = 0x10010131; + cpu->isar.id_pfr1 = 0x00010000; /* GIC filled in later */ + cpu->isar.id_pfr2 = 0x00000011; + cpu->midr = 0x414fd0b1; /* r4p1 */ + cpu->revidr = 0; + + /* From B2.18 CCSIDR_EL1 */ + cpu->ccsidr[0] = 0x701fe01a; /* 64KB L1 dcache */ + cpu->ccsidr[1] = 0x201fe01a; /* 64KB L1 icache */ + cpu->ccsidr[2] = 0x707fe03a; /* 512KB L2 cache */ + + /* From B2.93 SCTLR_EL3 */ + cpu->reset_sctlr = 0x30c50838; + + /* From B4.23 ICH_VTR_EL2 */ + cpu->gic_num_lrs = 4; + cpu->gic_vpribits = 5; + cpu->gic_vprebits = 5; + + /* From B5.1 AdvSIMD AArch64 register summary */ + cpu->isar.mvfr0 = 0x10110222; + cpu->isar.mvfr1 = 0x13211111; + cpu->isar.mvfr2 = 0x00000043; +} + void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) { /* @@ -879,6 +944,7 @@ static const ARMCPUInfo aarch64_cpus[] = { { .name = "cortex-a57", .initfn = aarch64_a57_initfn }, { .name = "cortex-a53", .initfn = aarch64_a53_initfn }, { .name = "cortex-a72", .initfn = aarch64_a72_initfn }, + { .name = "cortex-a76", .initfn = aarch64_a76_initfn }, { .name = "a64fx", .initfn = aarch64_a64fx_initfn }, { .name = "max", .initfn = aarch64_max_initfn }, #if defined(CONFIG_KVM) || defined(CONFIG_HVF) From patchwork Sun Apr 17 17:44:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 562870 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp1878284map; Sun, 17 Apr 2022 11:45:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdfP//e1viB9M/Cj1GmqRLq0TK3Pjt2Qtz/B1yxuFUWcLaCkG8IRVWmeNdid473YbcZmB+ X-Received: by 2002:a37:6801:0:b0:69e:88f8:2ead with SMTP id d1-20020a376801000000b0069e88f82eadmr2459825qkc.39.1650221119050; Sun, 17 Apr 2022 11:45:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650221119; cv=none; d=google.com; s=arc-20160816; b=ROHLqNwxR4I098BzlfgghR8ivXtg47pyRp0REqM5d4r0TzqptyEAjnRg/zfpzzUZnT oRHPHGqW4oSalO9PPgwmSyhiqe0S3dCqXlyhx+Ct0Tet0bdrDOummjowU7dLllSZHD31 iB9WKo++4wSUNZigud3sgqhmrR9W7YlWSo54hZ34EBXHNWbK+8dAjw9Cn53qjYunHCHi SEemsPdKkMzSAlq2mhO3sqMscZSQ5h6z540twkio1+a48o6op4wUw0+Dw19GScGzoj/L m+4D45raZ8IXJmfSs12OOWRguahzOTO6G6TveIYfLGpe7AyRBlA4gZBAnSu2oPOv1XQ4 pRKw== 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=rPFD4Uf75Ys0SRC54fKBDAw6RK6wxGzSGtCN20boZmA=; b=lCjaGeoCLmJmllBvM+9BIZfihFI5DZvGEM0zXnI93iKe5FwlPDQibqFWpLKInvWZSY VwzUid3LBsLZzdul3RT1LFkLoq5vB21Jy59nZXRgnctvBbPoiO/dQCYO8NLJl1zKJ5rw SF6/2zeY5ix049hoxW8l7I8Hx4uJTW1rgPvbiDOaQaBBybEkiHltBtelER02XjumPikL ydV8ZfwGai6X+DZsZcytFsOTHwGyXaUKRYwUB3bzBks4iV+OSc301dYTdZ4m+9oGgVp1 Tap4Zp56BBSTR8c10EQh4gLhp8J/OX5DrhL8/scb8sIf47fJL36MdS8cAZHoxkLrxoWw kwrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lc4+E0VS; 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 z22-20020ac81016000000b002ed0f492e96si2247027qti.345.2022.04.17.11.45.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Apr 2022 11:45:19 -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=lc4+E0VS; 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]:53280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ng9te-0002Wi-Jy for patch@linaro.org; Sun, 17 Apr 2022 14:45:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49958) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ng90c-0004pT-EV for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:28 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]:46696) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ng90a-00047v-FC for qemu-devel@nongnu.org; Sun, 17 Apr 2022 13:48:25 -0400 Received: by mail-pg1-x533.google.com with SMTP id q12so14941980pgj.13 for ; Sun, 17 Apr 2022 10:48:22 -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=rPFD4Uf75Ys0SRC54fKBDAw6RK6wxGzSGtCN20boZmA=; b=lc4+E0VSsqAiX5c9RB/KR2vwi/A0tUaaOd7nYMHe7cc6iYUSD2Ms9LybeplVxBPBgc 4uNBfukBDr4AGchjLsN5u84npFWOij2/DLiGwyF8RQLAG7zeHkduYGmiOozKtfhYR8/H JNxDXwNAex8UIhQRqn25a+ITbJoN99NYqDeeb/NixIfqjGrTZDt8A9bSvTqejDWIHvRK rM0oZG4DHhbYYKmfi2E8BSKRSVk98CdeqOC6Wkpl4TyMy5cmJlWTg9i/bgUIyUjnFDMY a+Z8Q4CR3nLRBQWhh+VgaGnB15sdZNQslqSUJQiBCOVrkKWRVgQADGx1/i7l82VZHwei Bp8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rPFD4Uf75Ys0SRC54fKBDAw6RK6wxGzSGtCN20boZmA=; b=CJJUtDyHShGwji8EBaOjVxLLU0xueqEKe4N0DclUXg9m4SWn4QjuQtO90jin02Sben SlXE89Hk+XKyHzeMjIG0K056rga82FBZLjzAMZcqYgVkLKSKPWG6AZp4tM4dSR3nU/Qj iZsOqGjgMtSanZtDFURfMEKYJC19pGve5UDkKxxRwO2zvECzQn9XbLlc5PIUf2mqOq20 9iniiiZNFvPgsaZizamcD8VKL3ShG7rHQ3r+IATE7ydY8wGRcZpbkRtc+kOsN8aa5mK+ TtC+ra/Y5ZscZCy73venNZ6Ftffl9XB/hwslZ0Rxj26JSC5R+O/UtxL7m2M1KzqsWcKa b3Qg== X-Gm-Message-State: AOAM533b59Zrq/EWRjrTHYc27W9qKxZMa0ydytpoqn5u4s8uJaQWwtNY JVzpNrJpkBn1ZMWdjrY9TJhGfvS0zXXsAg== X-Received: by 2002:a65:68c2:0:b0:39e:18d3:fe43 with SMTP id k2-20020a6568c2000000b0039e18d3fe43mr7183281pgt.602.1650217701857; Sun, 17 Apr 2022 10:48:21 -0700 (PDT) Received: from localhost.localdomain (174-21-142-130.tukw.qwest.net. [174.21.142.130]) by smtp.gmail.com with ESMTPSA id e14-20020aa78c4e000000b00506475da4cesm9372055pfd.49.2022.04.17.10.48.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 10:48:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 60/60] target/arm: Define neoverse-n1 Date: Sun, 17 Apr 2022 10:44:26 -0700 Message-Id: <20220417174426.711829-61-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220417174426.711829-1-richard.henderson@linaro.org> References: <20220417174426.711829-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Enable the n1 for virt and sbsa board use. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- docs/system/arm/virt.rst | 1 + hw/arm/sbsa-ref.c | 1 + hw/arm/virt.c | 1 + target/arm/cpu64.c | 66 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+) diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst index e9ff81aa21..e8e851a15b 100644 --- a/docs/system/arm/virt.rst +++ b/docs/system/arm/virt.rst @@ -58,6 +58,7 @@ Supported guest CPU types: - ``cortex-a76`` (64-bit) - ``a64fx`` (64-bit) - ``host`` (with KVM only) +- ``neoverse-n1`` (64-bit) - ``max`` (same as ``host`` for KVM; best possible emulation with TCG) Note that the default is ``cortex-a15``, so for an AArch64 guest you must diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index 2ddde88f5e..dac8860f2d 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -146,6 +146,7 @@ static const char * const valid_cpus[] = { ARM_CPU_TYPE_NAME("cortex-a57"), ARM_CPU_TYPE_NAME("cortex-a72"), ARM_CPU_TYPE_NAME("cortex-a76"), + ARM_CPU_TYPE_NAME("neoverse-n1"), ARM_CPU_TYPE_NAME("max"), }; diff --git a/hw/arm/virt.c b/hw/arm/virt.c index ce15c36a7f..82dd934de6 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -204,6 +204,7 @@ static const char *valid_cpus[] = { ARM_CPU_TYPE_NAME("cortex-a72"), ARM_CPU_TYPE_NAME("cortex-a76"), ARM_CPU_TYPE_NAME("a64fx"), + ARM_CPU_TYPE_NAME("neoverse-n1"), ARM_CPU_TYPE_NAME("host"), ARM_CPU_TYPE_NAME("max"), }; diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index d046351991..da311b2eb5 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -259,6 +259,71 @@ static void aarch64_a76_initfn(Object *obj) cpu->isar.mvfr2 = 0x00000043; } +static void aarch64_neoverse_n1_initfn(Object *obj) +{ + ARMCPU *cpu = ARM_CPU(obj); + + cpu->dtb_compatible = "arm,neoverse-n1"; + set_feature(&cpu->env, ARM_FEATURE_V8); + set_feature(&cpu->env, ARM_FEATURE_NEON); + set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); + set_feature(&cpu->env, ARM_FEATURE_AARCH64); + set_feature(&cpu->env, ARM_FEATURE_CBAR_RO); + set_feature(&cpu->env, ARM_FEATURE_EL2); + set_feature(&cpu->env, ARM_FEATURE_EL3); + set_feature(&cpu->env, ARM_FEATURE_PMU); + + /* Ordered by B2.4 AArch64 registers by functional group */ + cpu->clidr = 0x82000023; + cpu->ctr = 0x8444c004; + cpu->dcz_blocksize = 4; + cpu->isar.id_aa64dfr0 = 0x0000000110305408ull; + cpu->isar.id_aa64isar0 = 0x0000100010211120ull; + cpu->isar.id_aa64isar1 = 0x0000000000100001ull; + cpu->isar.id_aa64mmfr0 = 0x0000000000101125ull; + cpu->isar.id_aa64mmfr1 = 0x0000000010212122ull; + cpu->isar.id_aa64mmfr2 = 0x0000000000001011ull; + cpu->isar.id_aa64pfr0 = 0x1100000010111112ull; /* GIC filled in later */ + cpu->isar.id_aa64pfr1 = 0x0000000000000020ull; + cpu->id_afr0 = 0x00000000; + cpu->isar.id_dfr0 = 0x04010088; + cpu->isar.id_isar0 = 0x02101110; + cpu->isar.id_isar1 = 0x13112111; + cpu->isar.id_isar2 = 0x21232042; + cpu->isar.id_isar3 = 0x01112131; + cpu->isar.id_isar4 = 0x00010142; + cpu->isar.id_isar5 = 0x01011121; + cpu->isar.id_isar6 = 0x00000010; + cpu->isar.id_mmfr0 = 0x10201105; + cpu->isar.id_mmfr1 = 0x40000000; + cpu->isar.id_mmfr2 = 0x01260000; + cpu->isar.id_mmfr3 = 0x02122211; + cpu->isar.id_mmfr4 = 0x00021110; + cpu->isar.id_pfr0 = 0x10010131; + cpu->isar.id_pfr1 = 0x00010000; /* GIC filled in later */ + cpu->isar.id_pfr2 = 0x00000011; + cpu->midr = 0x414fd0c1; /* r4p1 */ + cpu->revidr = 0; + + /* From B2.23 CCSIDR_EL1 */ + cpu->ccsidr[0] = 0x701fe01a; /* 64KB L1 dcache */ + cpu->ccsidr[1] = 0x201fe01a; /* 64KB L1 icache */ + cpu->ccsidr[2] = 0x70ffe03a; /* 1MB L2 cache */ + + /* From B2.98 SCTLR_EL3 */ + cpu->reset_sctlr = 0x30c50838; + + /* From B4.23 ICH_VTR_EL2 */ + cpu->gic_num_lrs = 4; + cpu->gic_vpribits = 5; + cpu->gic_vprebits = 5; + + /* From B5.1 AdvSIMD AArch64 register summary */ + cpu->isar.mvfr0 = 0x10110222; + cpu->isar.mvfr1 = 0x13211111; + cpu->isar.mvfr2 = 0x00000043; +} + void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) { /* @@ -946,6 +1011,7 @@ static const ARMCPUInfo aarch64_cpus[] = { { .name = "cortex-a72", .initfn = aarch64_a72_initfn }, { .name = "cortex-a76", .initfn = aarch64_a76_initfn }, { .name = "a64fx", .initfn = aarch64_a64fx_initfn }, + { .name = "neoverse-n1", .initfn = aarch64_neoverse_n1_initfn }, { .name = "max", .initfn = aarch64_max_initfn }, #if defined(CONFIG_KVM) || defined(CONFIG_HVF) { .name = "host", .initfn = aarch64_host_initfn },