From patchwork Mon May 9 11:58:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570963 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3923991mal; Mon, 9 May 2022 05:01:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfKzmxDF/9ZgH6GNS5cpKG/4jSbFKJREOt/FxU3r+SW0hXv2S2efwIAN+SEbp1J3Z+r54r X-Received: by 2002:ac8:7d52:0:b0:2f3:dd27:b500 with SMTP id h18-20020ac87d52000000b002f3dd27b500mr2280321qtb.189.1652097693711; Mon, 09 May 2022 05:01:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652097693; cv=none; d=google.com; s=arc-20160816; b=dvVbEOGH68OLQFHjM3dtcmv1nttT4vEg3QckyCkzFM2xPH0IOykSB70QAZ1TFpbbcV tifPWU4Z2lm+RRXtbF7QTh9PQ9BXVaDPWHc+0z4BXX36/qWidmzLBZtHZNyA7/2UF0D1 reZ/s+Iqxu9DNIMjHNABExijxD6D50zSuD4MURlvsOlhtMxEmgq8YdsvCa3+ZC9qvank 3YgCEWc0uNCj1VqiuUu6N8Xqj9nwD41eahXfQTHnSn+1WTbzsoTyaLoJ/2DTQerR8Mjm MqWmkBhumzKmVg4zzWE9jl9DeOylnXk1nChyHOsop9w3c/kSE0h/F5O3bzf2f6vuHF2K YPug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=HECDO2g5fuR9qiRk+IIoBmUOKs2yPZa4jqvWajfBo7U=; b=VfuKo1mnKcxQRxUn+HU42iZRJNz/AkuYGy+3VX6GGStlDL+M7XnVhW+RICTrpHnlPT h/xfi6YAuXOtGirhU9eUR/zB9pKHjwToZDgp5i8JAykwNvfDfSrO6whjN49W5SOPQadf jXKfGlkzPc+vATYsEAOt5VWSegb5dYQHeZ5rY8Ncv5JCg9h1Q3mShSIMENQ1jGEiomLQ vWAEfG54BrO2Bob/9KHvywGK4GKHvKXXyDBMr81oiP3wAVFj9JpNWHBZeQcIeiJXm6pc l6lEzjEtU8n1YjAmPUZmWAxQ6vVEO3E4NseBfVU8memvqqx5aYn7KWhEMaX3+8NpUHi1 YWaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="n3/OLf9t"; 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 s18-20020a05622a1a9200b002f36e30fff1si7817334qtc.338.2022.05.09.05.01.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:01:33 -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="n3/OLf9t"; 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]:46360 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no24w-00071j-Iy for patch@linaro.org; Mon, 09 May 2022 08:01:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22Q-00070k-Jt for qemu-devel@nongnu.org; Mon, 09 May 2022 07:58:54 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:37625) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22O-0001Ga-Vc for qemu-devel@nongnu.org; Mon, 09 May 2022 07:58:54 -0400 Received: by mail-wr1-x42d.google.com with SMTP id t6so19116578wra.4 for ; Mon, 09 May 2022 04:58:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=HECDO2g5fuR9qiRk+IIoBmUOKs2yPZa4jqvWajfBo7U=; b=n3/OLf9tX4IaEs7CFqVxQk2s5TKdjTzg34rTZOGapIeW+c7e+/mJWNHgp1beHWA/Yk CcQE/PAfXr6rJeMWjBtbHjfJuV8tAc/Vj9C14btrWUBy8OrDpuWbevXSxOxDGASrlI0c DtqE6HjVs2um+exqe6PFGNTTwwJQgCX8Qfj2h2YipiLd7VoE3rwAtk4+/fmoGbuOtUIA dpnLhhOtmuuyYc5oNZN/cW6lamUPtsSxQeKSGPh4Twr2oOsRBeodpjPxIsuNsMiYMdLp hhyuzbFC1zhLU6dIfVI2eqX6XPLfb436V7ZLyz9bGJgg/7iY8ooMXsUkZ6ORkuEDbgOD cYCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HECDO2g5fuR9qiRk+IIoBmUOKs2yPZa4jqvWajfBo7U=; b=X4l4WladBHlp+qoeuZTY+Rk/AQ1ntp/Y8sBDAPfDfObgylTZtkEiA4M2qbkqmP/eDu YoZX0bjbS+Agn8fHjaH/yvCQhAQeiVd55B3KCQzCeKe4fNbk1mO4adHBZnSQOPyo7A8M CdOes5KOS9N0RuKxpsw+LTBNPYjxU3EQEdfSxkIOzZA8vNtnZrKzukQPSezW6qtM0qr5 SeiYBJdvHZ+nLw+35/X97WvmsRef52nezFbDuJ4kfutj7CP8WKsnxHN0NWkM630NJmbs vEH4fkQE13AqrBNflRRY19F9zBKwKKI9Qi/UK651AhHECEBhhETCq4+xE3SBK3Zakwqf 3V1A== X-Gm-Message-State: AOAM531FOZwGXDWERX8f/3+QOuRr7uQfI2+GosVFIDl8xWd9JNTfHR7D YZR6kEwmAeWvDNZArRdmheKS8xirKpCjdg== X-Received: by 2002:a05:6000:178d:b0:20c:b1fb:abe9 with SMTP id e13-20020a056000178d00b0020cb1fbabe9mr9440987wrg.452.1652097530837; Mon, 09 May 2022 04:58:50 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.58.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:58:50 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 01/32] MAINTAINERS/.mailmap: update email for Leif Lindholm Date: Mon, 9 May 2022 12:58:17 +0100 Message-Id: <20220509115848.3521805-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42d.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Leif Lindholm NUVIA was acquired by Qualcomm in March 2021, but kept functioning on separate infrastructure for a transitional period. We've now switched over to contributing as Qualcomm Innovation Center (quicinc), so update my email address to reflect this. Signed-off-by: Leif Lindholm Message-id: 20220505113740.75565-1-quic_llindhol@quicinc.com Cc: Leif Lindholm Cc: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé [Fixed commit message typo] Signed-off-by: Peter Maydell --- .mailmap | 3 ++- MAINTAINERS | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.mailmap b/.mailmap index 2976a675ea5..8c326709cfa 100644 --- a/.mailmap +++ b/.mailmap @@ -62,7 +62,8 @@ Greg Kurz Huacai Chen Huacai Chen James Hogan -Leif Lindholm +Leif Lindholm +Leif Lindholm Radoslaw Biernacki Paul Burton Paul Burton diff --git a/MAINTAINERS b/MAINTAINERS index 662ec472467..42f67e2b930 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -889,7 +889,7 @@ F: include/hw/ssi/imx_spi.h SBSA-REF M: Radoslaw Biernacki M: Peter Maydell -R: Leif Lindholm +R: Leif Lindholm L: qemu-arm@nongnu.org S: Maintained F: hw/arm/sbsa-ref.c From patchwork Mon May 9 11:58:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570966 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3924683mal; Mon, 9 May 2022 05:02:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVFDtX0XfBcfSVnZW6DReAg3AnXbvIDsS+vGMQlivq0ODfez46CA3jY6ObrnM0sPNnAW7d X-Received: by 2002:ac8:4e4c:0:b0:2f3:d52d:57a0 with SMTP id e12-20020ac84e4c000000b002f3d52d57a0mr6253531qtw.151.1652097732197; Mon, 09 May 2022 05:02:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652097732; cv=none; d=google.com; s=arc-20160816; b=TLoIr7x0uKKpTCLjmPWag9pvyzQ9/RcUbFwWeWnT489hczLVR9aNBoOW/e3KDYydhC lEs51Hm3dUovz7xmkvLPJftBsubeCAV4wsuFGiTagrhShNZEzvdgURKrrr4u5bpcA/hU KadPcXa9bhrWWYwQjbWa7bCHL8kucbm81kLhqUczc5hn4qmGiEzPpP5DI+hFjkyzWHUY 7lneiKQ3CqLK4z10+1UzM00KxGueqtbU3bGQhJtvG4R+0mDwMq90BL/2ky4lH7+Uw9fM 45veQhd2JKMYKQet52jCHxVgyGNKm5YdVT+IVz9Pl9eMlAhL4uCJ1iw0HUG7Q+ysAvPh mJ3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=vS3vnqyqeVbTmMwpOiEpeAFu4aTlt8ymePUVlIPTNuA=; b=x/WhN7BEk6hoiY65Q1vBsUNP07UXhvF5Cms8uP9842uzpyI54g7Eb2WVgEcjRZEXnN TFLe55+1D9YQMkvn6bPf7kg2PuUQh4ob3rRhLUYDQOVH9iu/xkewZGxoPBzeB6oNqaV2 duVID4JZ8IRikaceWTj96dzFGAF/kvGIURq4MF2RIzBL0kb8HgfGhIniU39cuZ2O1SHk TEffBpXNKuDvzT0LRB8sdz7puRcmwvGO5AHZMepinTQrfDHe/+liOU8eRPeP51lPTMDZ qV/BYob5Mc2mjS6FJ8n01l9TN47ui1DBqaWl3Z29iYB6Dog05+uARl37S/n0+mrmUJ04 rJEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PBzoCT6k; 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 h5-20020a05620a284500b0069ff5609db1si8092363qkp.481.2022.05.09.05.02.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05: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=PBzoCT6k; 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]:46650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no25b-0007Ec-Lb for patch@linaro.org; Mon, 09 May 2022 08:02:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22T-00073w-1A for qemu-devel@nongnu.org; Mon, 09 May 2022 07:58:57 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:42926) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22Q-0001Gn-D3 for qemu-devel@nongnu.org; Mon, 09 May 2022 07:58:56 -0400 Received: by mail-wr1-x436.google.com with SMTP id e24so19108668wrc.9 for ; Mon, 09 May 2022 04:58:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=vS3vnqyqeVbTmMwpOiEpeAFu4aTlt8ymePUVlIPTNuA=; b=PBzoCT6kke2+/PWr10clQtscft37He8oP/r/by+OI3W4YpHg7073bFUTvrnLFCxYuy 2X/Wr69Cg09HtgZB/nhDzhXAvBod6gxq9/WMeDNvigIMFv+Ko2mk2kAmYa0aWKUMQEiq E/IBZ4XnrrFcBEP29xVUrPogPN1Zm9AngYgb+SMviK7o9vnWqw3uziyaF3Do6n/f7gwk 0ZqCbhJYzeWHYBNuu5lKfGpfqfpWsMzgphCv2xZKBQ0kFqEHOscdAuZvz4As299MRPDw 1qAJp4rS6PsqTlKqcPg0unJpWq9ZCqqmkR6tla1jtMrfHxpjdi+FjpUKe0+dmVWpZqGP zVvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vS3vnqyqeVbTmMwpOiEpeAFu4aTlt8ymePUVlIPTNuA=; b=1BQU2C9w/84KNy/FHLo3aRcNh0RUwN7Qp+fphKU9UQathpehLyCm6bnLiTrxM3reuV cKJ5eUpiyCQjKpLB6+AvoUsj7jJGZwzhLwsUoOWHD6hF5AUsU/PRWbS1kA5yTHu6HgNI o66irAOABzSS8AJ1zPsxLYtsobtWEAYfDdfTd1XQz3jKsukOm3Q/1a9Mj1bE3LhuUf5Q QqOVd1Ahf8DH0PTuOuRyjL9gksd7H78VRcwPRH9ufFfrTOFV+4s3pgO/tui1N1/N3XAm Es7PQbcoEwZvgRtG9heN24SmwFsujHWNhHXMruNZ1T244JHA8MtFGG5CvqC3+4QfEtLY zwmw== X-Gm-Message-State: AOAM532/CkyuhJn+9D4Ey1JS8AFnQwTnIZ4FQdKhwyv+47Lmy03DxMeF QL+npPHBE6nDiLBq98OWyIEQJ7ZFPVxwKA== X-Received: by 2002:a05:6000:2a5:b0:20c:520a:a12e with SMTP id l5-20020a05600002a500b0020c520aa12emr13088129wry.629.1652097531815; Mon, 09 May 2022 04:58:51 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.58.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:58:51 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 02/32] target/arm: Handle cpreg registration for missing EL Date: Mon, 9 May 2022 12:58:18 +0100 Message-Id: <20220509115848.3521805-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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, either discard, squash to res0, const, or keep unchanged. Per rule RJFFP, mark the 4 aarch32 hypervisor access registers with ARM_CP_EL3_NO_EL2_KEEP, and mark all of the EL2 address translation and tlb invalidation "regs" ARM_CP_EL3_NO_EL2_UNDEF. Mark the 2 virtualization processor id regs ARM_CP_EL3_NO_EL2_C_NZ. This will simplify cpreg registration for conditional arm features. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220506180242.216785-2-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/cpregs.h | 11 +++ target/arm/helper.c | 178 ++++++++++++++++++++++++++++++-------------- 2 files changed, 133 insertions(+), 56 deletions(-) diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h index 73984549d25..db03d6a7e13 100644 --- a/target/arm/cpregs.h +++ b/target/arm/cpregs.h @@ -102,6 +102,17 @@ enum { ARM_CP_SVE = 1 << 14, /* Flag: Do not expose in gdb sysreg xml. */ ARM_CP_NO_GDB = 1 << 15, + /* + * Flags: If EL3 but not EL2... + * - UNDEF: discard the cpreg, + * - KEEP: retain the cpreg as is, + * - C_NZ: set const on the cpreg, but retain resetvalue, + * - else: set const on the cpreg, zero resetvalue, aka RES0. + * See rule RJFFP in section D1.1.3 of DDI0487H.a. + */ + ARM_CP_EL3_NO_EL2_UNDEF = 1 << 16, + ARM_CP_EL3_NO_EL2_KEEP = 1 << 17, + ARM_CP_EL3_NO_EL2_C_NZ = 1 << 18, }; /* diff --git a/target/arm/helper.c b/target/arm/helper.c index b4daf4f0761..9ab8b65e7bc 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -5056,16 +5056,17 @@ 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, - .access = PL2_RW, .type = ARM_CP_ALIAS | ARM_CP_FPU, + .access = PL2_RW, + .type = ARM_CP_ALIAS | ARM_CP_FPU | ARM_CP_EL3_NO_EL2_KEEP, .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, + .access = PL2_RW, .resetvalue = 0, .type = ARM_CP_EL3_NO_EL2_KEEP, .writefn = dacr_write, .raw_writefn = raw_write, .fieldoffset = offsetof(CPUARMState, cp15.dacr32_el2) }, { .name = "IFSR32_EL2", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 0, .opc2 = 1, - .access = PL2_RW, .resetvalue = 0, + .access = PL2_RW, .resetvalue = 0, .type = ARM_CP_EL3_NO_EL2_KEEP, .fieldoffset = offsetof(CPUARMState, cp15.ifsr32_el2) }, { .name = "SPSR_IRQ", .state = ARM_CP_STATE_AA64, .type = ARM_CP_ALIAS, @@ -5542,27 +5543,27 @@ static const ARMCPRegInfo el2_cp_reginfo[] = { .writefn = tlbimva_hyp_is_write }, { .name = "TLBI_ALLE2", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 7, .opc2 = 0, - .type = ARM_CP_NO_RAW, .access = PL2_W, + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, .writefn = tlbi_aa64_alle2_write }, { .name = "TLBI_VAE2", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 7, .opc2 = 1, - .type = ARM_CP_NO_RAW, .access = PL2_W, + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, .writefn = tlbi_aa64_vae2_write }, { .name = "TLBI_VALE2", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 7, .opc2 = 5, - .access = PL2_W, .type = ARM_CP_NO_RAW, + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, .writefn = tlbi_aa64_vae2_write }, { .name = "TLBI_ALLE2IS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 3, .opc2 = 0, - .access = PL2_W, .type = ARM_CP_NO_RAW, + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, .writefn = tlbi_aa64_alle2is_write }, { .name = "TLBI_VAE2IS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 3, .opc2 = 1, - .type = ARM_CP_NO_RAW, .access = PL2_W, + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, .writefn = tlbi_aa64_vae2is_write }, { .name = "TLBI_VALE2IS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 3, .opc2 = 5, - .access = PL2_W, .type = ARM_CP_NO_RAW, + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, .writefn = tlbi_aa64_vae2is_write }, #ifndef CONFIG_USER_ONLY /* Unlike the other EL2-related AT operations, these must @@ -5572,11 +5573,13 @@ static const ARMCPRegInfo el2_cp_reginfo[] = { { .name = "AT_S1E2R", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 0, .access = PL2_W, .accessfn = at_s1e2_access, - .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, .writefn = ats_write64 }, + .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC | ARM_CP_EL3_NO_EL2_UNDEF, + .writefn = ats_write64 }, { .name = "AT_S1E2W", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 1, .access = PL2_W, .accessfn = at_s1e2_access, - .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, .writefn = ats_write64 }, + .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC | ARM_CP_EL3_NO_EL2_UNDEF, + .writefn = ats_write64 }, /* The AArch32 ATS1H* operations are CONSTRAINED UNPREDICTABLE * if EL2 is not implemented; we choose to UNDEF. Behaviour at EL3 * with SCR.NS == 0 outside Monitor mode is UNPREDICTABLE; we choose @@ -6076,7 +6079,7 @@ static const ARMCPRegInfo debug_cp_reginfo[] = { { .name = "DBGVCR32_EL2", .state = ARM_CP_STATE_AA64, .opc0 = 2, .opc1 = 4, .crn = 0, .crm = 7, .opc2 = 0, .access = PL2_RW, .accessfn = access_tda, - .type = ARM_CP_NOP }, + .type = ARM_CP_NOP | ARM_CP_EL3_NO_EL2_KEEP }, /* Dummy MDCCINT_EL1, since we don't implement the Debug Communications * Channel but Linux may try to access this register. The 32-bit * alias is DBGDCCINT. @@ -6892,11 +6895,11 @@ static const ARMCPRegInfo tlbirange_reginfo[] = { .access = PL2_W, .type = ARM_CP_NOP }, { .name = "TLBI_RVAE2IS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 2, .opc2 = 1, - .access = PL2_W, .type = ARM_CP_NO_RAW, + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, .writefn = tlbi_aa64_rvae2is_write }, { .name = "TLBI_RVALE2IS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 2, .opc2 = 5, - .access = PL2_W, .type = ARM_CP_NO_RAW, + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, .writefn = tlbi_aa64_rvae2is_write }, { .name = "TLBI_RIPAS2E1", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 2, @@ -6906,19 +6909,19 @@ static const ARMCPRegInfo tlbirange_reginfo[] = { .access = PL2_W, .type = ARM_CP_NOP }, { .name = "TLBI_RVAE2OS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 5, .opc2 = 1, - .access = PL2_W, .type = ARM_CP_NO_RAW, + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, .writefn = tlbi_aa64_rvae2is_write }, { .name = "TLBI_RVALE2OS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 5, .opc2 = 5, - .access = PL2_W, .type = ARM_CP_NO_RAW, + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, .writefn = tlbi_aa64_rvae2is_write }, { .name = "TLBI_RVAE2", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 6, .opc2 = 1, - .access = PL2_W, .type = ARM_CP_NO_RAW, + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, .writefn = tlbi_aa64_rvae2_write }, { .name = "TLBI_RVALE2", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 6, .opc2 = 5, - .access = PL2_W, .type = ARM_CP_NO_RAW, + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, .writefn = tlbi_aa64_rvae2_write }, { .name = "TLBI_RVAE3IS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 6, .crn = 8, .crm = 2, .opc2 = 1, @@ -6973,11 +6976,11 @@ static const ARMCPRegInfo tlbios_reginfo[] = { .writefn = tlbi_aa64_vae1is_write }, { .name = "TLBI_ALLE2OS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 1, .opc2 = 0, - .access = PL2_W, .type = ARM_CP_NO_RAW, + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, .writefn = tlbi_aa64_alle2is_write }, { .name = "TLBI_VAE2OS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 1, .opc2 = 1, - .access = PL2_W, .type = ARM_CP_NO_RAW, + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, .writefn = tlbi_aa64_vae2is_write }, { .name = "TLBI_ALLE1OS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 1, .opc2 = 4, @@ -6985,7 +6988,7 @@ static const ARMCPRegInfo tlbios_reginfo[] = { .writefn = tlbi_aa64_alle1is_write }, { .name = "TLBI_VALE2OS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 1, .opc2 = 5, - .access = PL2_W, .type = ARM_CP_NO_RAW, + .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF, .writefn = tlbi_aa64_vae2is_write }, { .name = "TLBI_VMALLS12E1OS", .state = ARM_CP_STATE_AA64, .opc0 = 1, .opc1 = 4, .crn = 8, .crm = 1, .opc2 = 6, @@ -7905,21 +7908,24 @@ void register_cp_regs_for_features(ARMCPU *cpu) { .name = "VPIDR", .state = ARM_CP_STATE_AA32, .cp = 15, .opc1 = 4, .crn = 0, .crm = 0, .opc2 = 0, .access = PL2_RW, .accessfn = access_el3_aa32ns, - .resetvalue = cpu->midr, .type = ARM_CP_ALIAS, + .resetvalue = cpu->midr, + .type = ARM_CP_ALIAS | ARM_CP_EL3_NO_EL2_C_NZ, .fieldoffset = offsetoflow32(CPUARMState, cp15.vpidr_el2) }, { .name = "VPIDR_EL2", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 4, .crn = 0, .crm = 0, .opc2 = 0, .access = PL2_RW, .resetvalue = cpu->midr, + .type = ARM_CP_EL3_NO_EL2_C_NZ, .fieldoffset = offsetof(CPUARMState, cp15.vpidr_el2) }, { .name = "VMPIDR", .state = ARM_CP_STATE_AA32, .cp = 15, .opc1 = 4, .crn = 0, .crm = 0, .opc2 = 5, .access = PL2_RW, .accessfn = access_el3_aa32ns, - .resetvalue = vmpidr_def, .type = ARM_CP_ALIAS, + .resetvalue = vmpidr_def, + .type = ARM_CP_ALIAS | ARM_CP_EL3_NO_EL2_C_NZ, .fieldoffset = offsetoflow32(CPUARMState, cp15.vmpidr_el2) }, { .name = "VMPIDR_EL2", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 4, .crn = 0, .crm = 0, .opc2 = 5, - .access = PL2_RW, - .resetvalue = vmpidr_def, + .access = PL2_RW, .resetvalue = vmpidr_def, + .type = ARM_CP_EL3_NO_EL2_C_NZ, .fieldoffset = offsetof(CPUARMState, cp15.vmpidr_el2) }, }; define_arm_cp_regs(cpu, vpidr_regs); @@ -8506,13 +8512,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: @@ -8547,6 +8554,32 @@ 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. + */ + make_const = false; + if (arm_feature(env, ARM_FEATURE_EL3)) { + /* + * An EL2 register without EL2 but with EL3 is (usually) RES0. + * See rule RJFFP in section D1.1.3 of DDI0487H.a. + */ + int min_el = ctz32(r->access) / 2; + if (min_el == 2 && !arm_feature(env, ARM_FEATURE_EL2)) { + if (r->type & ARM_CP_EL3_NO_EL2_UNDEF) { + return; + } + make_const = !(r->type & ARM_CP_EL3_NO_EL2_KEEP); + } + } else { + CPAccessRights max_el = (arm_feature(env, ARM_FEATURE_EL2) + ? PL2_RW : PL1_RW); + if ((r->access & max_el) == 0) { + return; + } + } + /* Combine cpreg and name into one allocation. */ name_len = strlen(name) + 1; r2 = g_malloc(sizeof(*r2) + name_len); @@ -8567,44 +8600,77 @@ 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_NOP); /* - * 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 other 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]; - } + r2->type = (r2->type & ~ARM_CP_SPECIAL_MASK) | 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. + */ + if (!(r->type & ARM_CP_EL3_NO_EL2_C_NZ)) { + r2->resetvalue = 0; + } + /* + * ARM_CP_CONST has precedence, so removing the callbacks and + * offsets are not strictly necessary, but it 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 (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. + * 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 (HOST_BIG_ENDIAN && - r->state == ARM_CP_STATE_BOTH && r2->fieldoffset) { - r2->fieldoffset += sizeof(uint32_t); + if (HOST_BIG_ENDIAN && + r->state == ARM_CP_STATE_BOTH && r2->fieldoffset) { + r2->fieldoffset += sizeof(uint32_t); + } } } @@ -8615,7 +8681,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 Mon May 9 11:58:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570968 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3928314mal; Mon, 9 May 2022 05:05:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzq7lXLDWgPYmFdVaM+BgTR7t23AbA8f3U82jly2rSTN5BUWfqCovtsjdZ0QBaVRAtxfaNK X-Received: by 2002:a05:620a:25d2:b0:699:bd31:aafb with SMTP id y18-20020a05620a25d200b00699bd31aafbmr11215142qko.531.1652097957050; Mon, 09 May 2022 05:05:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652097957; cv=none; d=google.com; s=arc-20160816; b=EwzuXq0tmWM0PNcaYtBYJPSwsg9rSLHjfLB8FxWD2af/6zRquY27awHAoSrkjBDepr uUcqn4f7RpFMw/g5gj1Zcjsc3h5jH2M4P9G+320P8NGLhTYpA4bfJQK5Z1mlCmqyOWxZ Qss4vL1xJT+tIROKjBkjcdrFb3ZKv/8moRwlpqVR4jE7eLyQLCK+YLJ/TsIbYP9Vp/O8 Vku6lPwFNdQRAwSXQutsqV/6C7s032MNA7urIwyojeVtW0Jku/KWGBSBsXFThfCu9UiR I7K1mYe6lcSzfV9NYy3t1B4yyet18c8G42shSqr7ScIUV7sKSk15vdFOAMAWoZLLpzZX sGRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=AMHYpqYyVexl/KQxM32vgi111AbDDgBeiFSwyB6v1qY=; b=PG5ieh27OCLcApFEnLe6ZEhRPTuXWgKh54ikr6SSTb8cXwKw9L0r4zQogxTSNrJRLr yp0pOFOCvk02Hr5EUw0XowXEzLp0qswHzwbl7G3PJeRMolrmQuvTPXBSEXp38abhzPGa m375yAyjB0RVfuUSLAQzey/QC241XvQC3UYCe4azHQBaAlke+480M37YQy0c9nijkjp5 lmGKvnstI49Z+lE0W3azgYwn3lPFUi04oc8vmaidy3KowTFYvstVNS0VwOxypiBa2tW5 IO1uX4P31PEUT095nBYm7zU523jUdFJteH1QmUDy0o8Q7oeakLI3ZzIUst/6qdz1PUvX 5K7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=z2c3usWg; 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 f18-20020a05620a409200b0069fc79d86b8si8412961qko.46.2022.05.09.05.05.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:05:57 -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=z2c3usWg; 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]:54920 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no29E-0004jQ-KV for patch@linaro.org; Mon, 09 May 2022 08:05:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49654) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22S-00071t-Cj for qemu-devel@nongnu.org; Mon, 09 May 2022 07:58:56 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:35697) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22Q-0001Gm-Ak for qemu-devel@nongnu.org; Mon, 09 May 2022 07:58:56 -0400 Received: by mail-wr1-x42d.google.com with SMTP id j15so19134476wrb.2 for ; Mon, 09 May 2022 04:58:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=AMHYpqYyVexl/KQxM32vgi111AbDDgBeiFSwyB6v1qY=; b=z2c3usWgNkj0IeuV9S3gCwit8cc13I3mZ6oaR8q4zBGP1Fiy0AEpL97X9a6gPlLACc qTdLg3FoLaPVLcTPDbRCKebFbFUN98CaxMEBSgniqYjOK+fUk888HkPMU09eFlDpjCpc c8Kyeo6X0noZYTDC+EwBoVqOhITg8MugspwiNZS25jGj9YJl2u4pdGTVEGKtMpsKu6Mb wqw/l3JI1xMz+GugZZ2GUAk5DAOWD7MYymSdBAJ/sDOm6Q34suCkECr5iNsXoohatq8w L3JBGfFdF4E1n3/jgVMGcBD482b9Yijjm63TXrkxWrEfV/AtbFHnfFzJFTGtP7ImZcZ4 S3bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AMHYpqYyVexl/KQxM32vgi111AbDDgBeiFSwyB6v1qY=; b=IDWZWqcvzi3/I9mRE6pxBRqRo9XA6T1B4Zwp4ET2Qm87EIOync764Bja7MfQKAxdqh K2+7Ztg6G8Kla6aOYYv1fUb4tdTPQUaf/tXKeXtnS74YYCWiwH0y1HxNK8RmUMHrKyBG 6BsMpfYYT7gGygDO2XxfBNJAGbAZig+1JOAj9h1CwO1qCh9X7aQGl4nzKmG7zB2LTP2L 0z1WxwS0pyEdIQBo7T3qFuK8xdE4XRCMyyp+QU4WTOdGN0bsnL5TfK/YMh2aCOatk/fK FfK/wCGDw5riOliJyw6o7TsZ3iIa7Dhq69AvweOec+fdIwB2BhcowXnrCS+9fKbBYmT1 amTg== X-Gm-Message-State: AOAM53304TYNXh1wO8PXZua7qAnovY0GnHTGaeePSw5OF/VCjHfJWKKO tP2ia3UBvA67r06lgY5LZxyvEi/XAHhv4A== X-Received: by 2002:adf:f748:0:b0:20c:86d5:c343 with SMTP id z8-20020adff748000000b0020c86d5c343mr13628104wrp.477.1652097532797; Mon, 09 May 2022 04:58:52 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.58.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:58:52 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 03/32] target/arm: Drop EL3 no EL2 fallbacks Date: Mon, 9 May 2022 12:58:19 +0100 Message-Id: <20220509115848.3521805-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42d.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Drop el3_no_el2_cp_reginfo, el3_no_el2_v8_cp_reginfo, and the local vpidr_regs definition, and rely on the squashing to ARM_CP_CONST while registering for v8. This is a behavior change for v7 cpus with Security Extensions and without Virtualization Extensions, in that the virtualization cpregs are now correctly not present. This would be a migration compatibility break, except that we have an existing bug in which migration of 32-bit cpus with Security Extensions enabled does not work. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220506180242.216785-3-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 9ab8b65e7bc..ea2788b3d53 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); @@ -7902,7 +7784,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, @@ -7946,33 +7838,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 Mon May 9 11:58:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570971 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3931007mal; Mon, 9 May 2022 05:08:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwi+gLK20KPDCab4S/ejroNVkIE5vsMGKtPsVIraI2YHp1HPYrf3UW/nFaZWvr0TiMlKS6w X-Received: by 2002:a05:6214:5097:b0:45a:cadc:af88 with SMTP id kk23-20020a056214509700b0045acadcaf88mr12878670qvb.129.1652098136623; Mon, 09 May 2022 05:08:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652098136; cv=none; d=google.com; s=arc-20160816; b=nIX6i1nX+XdYPw2GSLgmURTbBSj1GE93YqAbqLAXvWsIovrwZQ0PWD/ORt6RyhiNH9 ao3ymb1uJ89HToae8cCpP8qVZ2VJP2yTBB0+Hv2K5j4dmUaNjLz85xUW75rCDlka0X8Z 2Ns0iov9ndZh48OHacGkjhnuMbfWsHs0AhYRNlN3dbYisepDREUkJ+GQitEBz1w3zWKF 5z5gptqLbamk1mEe8nlrpZDrLRG3Anf4fzLtuwqz4VQDP6UJz+tKIsKnZ5OqrWsA5IJZ hSLxHvuH0DsCtvH3QWA8QX0JlCMJlA6uNHIsd5DsbZ9eyHY72wg3LGTOCciW7NymLcpH 0upg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=td1xtIAYO/HO2sfcsrTqOil4G/8JSLwPxSu0vY6fM+Q=; b=gpk8YEUnMwseVVEeTBXPJHJt46mluboyMSiR/aTtS4Ps/89hhXnF+gchocCsg1ZHwh 4yLRbJvvJNYdBLqdIESRn18GHZCVd3JPWyd2iprck42xKX2B2L9fmvwYNiSlpCyMqqqu Fu3k5EdKyFcxULh0xIKlvl0U14mVlASDCjYLuifGnaKTPXnS9felu4mdqsxbuJIhJhN8 g/JKDeugIhVwt9M50fixTb1NwJbEBiw5z7UvJCEXTMqrm73PwrX4VZo9StO9fyVATTcn R6KqkMv64z1ndFklWce2ZNtQziYT+VE5ySCTSyzhkjUeim19Plz//3vBkRWsbJgPDzLr N5wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="KQ5YJNr/"; 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 w187-20020a3762c4000000b0069a127363afsi7054700qkb.554.2022.05.09.05.08.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:08: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="KQ5YJNr/"; 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]:35208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2C8-00029W-4m for patch@linaro.org; Mon, 09 May 2022 08:08:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22S-00072V-JN for qemu-devel@nongnu.org; Mon, 09 May 2022 07:58:56 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:40783) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22Q-0001Gs-T9 for qemu-devel@nongnu.org; Mon, 09 May 2022 07:58:56 -0400 Received: by mail-wr1-x432.google.com with SMTP id e2so19095769wrh.7 for ; Mon, 09 May 2022 04:58:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=td1xtIAYO/HO2sfcsrTqOil4G/8JSLwPxSu0vY6fM+Q=; b=KQ5YJNr/ENfUtj1+7cHtGFS3se8DsQ0iM25ElXXWhkX7SF3ulWtYbya4NJKb+RHytc mgEqlT7d+FYQPH8zXVont2mCRaDAT1mj4xt6fqPJuGQYC0mmno7QXZQVN2UWhwQC9mg6 Og/KSo1XdmWmDfCwB/JVVhin7g6DYZi1Sdcxgwo/7eQ0klnOzjb2DEi4BZWPSShBMS6B LqO31X+ASd5qTBVOWWhFKF1y6I2Qv+e+vGH46Wko//nXHAWTnsPio/9+ds4ynDs5bfqW 7WKxhSKkheZf6Id26kpgtp63kKij42/UJ/AYuC8KQbnDbYOttf2QCWHvcV3hjKZF/FR7 C3cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=td1xtIAYO/HO2sfcsrTqOil4G/8JSLwPxSu0vY6fM+Q=; b=NwaA8nF2QRklpjXTf4eFivD8mUKWkufhaWpJv1Q0kcBZBxsAYWW9ebUTDVVhol3ESN 0U2NnLQkiNMluXA1j0/80InjskzhfHA4U8g3qxlsjtnesVfM3kdPDpRU5u8n7P3AhccK avYw6ssWpnZYgdOxPVWd1Hlhm2PO/oijYHYVxf03SgWfyFgtRLICrC4I1o7etlNzmKgX ImbolRBBN+tzzyuCSCLaU8nqSYZx4bX22cO85mKpYJ4+Y58wyoQ/46Zc/A6pAvg4WYdq /mPzSuR3q4CFreIYEOh7MlKgBmcnyOi+ivOvluRDQA2wDuS8GYtM1XlduY2uQGijuvSC XQjg== X-Gm-Message-State: AOAM533u+3GyXuPcgGLXqIyJ7unPlVuWm5TUVz/IQ796ADT3CwctR7Tl dC57PXch671HybEgqbs63R3tlx6PeTlr7g== X-Received: by 2002:a5d:5085:0:b0:20a:e090:85ad with SMTP id a5-20020a5d5085000000b0020ae09085admr13387896wrt.235.1652097533587; Mon, 09 May 2022 04:58:53 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.58.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:58:53 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 04/32] target/arm: Merge zcr reginfo Date: Mon, 9 May 2022 12:58:20 +0100 Message-Id: <20220509115848.3521805-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220506180242.216785-4-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 ea2788b3d53..72d05070f02 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6122,35 +6122,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) @@ -8233,15 +8220,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 Mon May 9 11:58:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570967 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3928284mal; Mon, 9 May 2022 05:05:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFURbkOKgLfpgRpdJF6mBWpTPnLKnmojCuvRYjBVMS0BjK04LLJTz0YxQJZBCVGqow+VF4 X-Received: by 2002:a05:620a:12e8:b0:69f:9645:420c with SMTP id f8-20020a05620a12e800b0069f9645420cmr10990894qkl.731.1652097955139; Mon, 09 May 2022 05:05:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652097955; cv=none; d=google.com; s=arc-20160816; b=k03nPvWh0OQkI5b1RVBXbWbX2LJbED0+8V7fcFP9d6yYXRnbkTzSyHc5/ZuIcgfCvU Trc0jsm0b+BV2shtLUtoEw+0TkWT2D++0JnJyYSM/kjTppL8MBqecxEFQK4QkEo8sLOo J6M09pB/VM9+eMUDklTpctNX1/XdRrij2nU/35MqqSTcaMEyLaCbEV5HB7By3ncMp2ca UQ9j5ueOHfl+2QmNU0MM3nd/YidIfB30Aztma6RDKN4nPQ2ltIpsUmDV486Vj4YTRKu9 YkGLcBO9nAd8YVJeEyU2C0cFOnPPBKjRfnFgnRWkXa7iOPa/jWGtPlEKmxWGroiXDvQk gLZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=ppR8M7ixk9OKU1weHfQnjLWTVAHBFdys9ITuaO8WXIs=; b=KgFFRd+8wLdoUpISt4x3YmtiCzZEIKRRJ5tL3skwlfqr2W6m9ymimhD/lGJvahayC0 768pkIj95P7S8x2Wdb0JUd3kztWGkSjvl0pgE88tUgnYbxqXUUJeBvbJgyRaUIzWsdgJ VZCBI1vj7RP9ZicZU4fC8SzbnASXm4ahI6z1SDdeyP/6AwhUlIbIf1BVAiHlIVjBp9Us gmsySYsNhmMChA/JdUAMnOOyamiNOwJHReTX2f4WYajlGkJEx+fwrjiUk4/j7TYWo+iu /4dc0s+gxxuUZuPvoi+s+VqcwVRxL+bh9xlULUmfCEFrN5q342KmKq4rYGH7PEFL0F2N GmnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pdwa+SCC; 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 bj21-20020a05620a191500b0069f9e03107bsi7653941qkb.386.2022.05.09.05.05.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:05:55 -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=pdwa+SCC; 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]:54840 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no29C-0004fn-MF for patch@linaro.org; Mon, 09 May 2022 08:05:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49672) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22T-00074F-Ak for qemu-devel@nongnu.org; Mon, 09 May 2022 07:58:57 -0400 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:51108) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22R-0001HE-Nn for qemu-devel@nongnu.org; Mon, 09 May 2022 07:58:57 -0400 Received: by mail-wm1-x330.google.com with SMTP id 129so8240189wmz.0 for ; Mon, 09 May 2022 04:58:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ppR8M7ixk9OKU1weHfQnjLWTVAHBFdys9ITuaO8WXIs=; b=pdwa+SCC74XdaKZKT+1bADvrYieb+dWKs/IQ19Er+CcgcDC6Q+J47SPw2nuzys0khf ubZCLZvVLmiJyPa7W2EiULvtWAHv+pK0VFvuuZgPnDE4vVwUflF2tH3qXk1VzN+A6qSt UBbMuVQ9UvTbre53aPUmGQVuu3qB8cQZn3ND1yPTbq2nDkes7n0efYdItRkDIZKH9zi1 dY5dC1vnTyH+MA9dQWeyQqgtZDVY9YqHmgMJ5+HCeCtExHx1Iqrdz082mGaNtdLg0xuu AceFKCUomY159mZMDkyTWuzbfIX/T98UD4XsvcH1f95WU/H1Zhe9zKa5WGMzOwhsVBJW +4FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ppR8M7ixk9OKU1weHfQnjLWTVAHBFdys9ITuaO8WXIs=; b=ZTksA59LpiH/zsNgajRXEDc2zwjhqFIoxrZ81QChfScRqkY2acstte08287UFe+PE7 Dr2+4EHbqY59tyRFE5K3gwgwBB9AdZGdCm0ZSsrXv/iXjt1ToGpTDAQO7S5gc+xiVXTJ Nq/wl05whnXLkvceE9mQ2Y2qCwvp7S+jNssgztzoVoE9Y+6YOD4jdv+xpeJLTBAxVSyx NQ7Ew9py6QeXdoABLdJ6EdaCJaqnYk2Nz7weTSO0f12UiFIoEj3NY7kzz2NIqtrBIosB lzBGr4G/uKBwoe2CASzvFRXhrUgTBa+Guam9jPAm8Xm3Owl1UOF8IDe5UQqekBP1oK7D y8Vw== X-Gm-Message-State: AOAM53240ZURZNObQo8NiHqOYH1G7X+AAzyRW+6Y2AbW8TZc5IULxHZr rbMrvpCAj0bKdz4WNyxdFT/jjrwkynfwFg== X-Received: by 2002:a7b:c4d9:0:b0:394:41a:d36f with SMTP id g25-20020a7bc4d9000000b00394041ad36fmr15651014wmk.152.1652097534305; Mon, 09 May 2022 04:58:54 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.58.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:58:53 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 05/32] target/arm: Adjust definition of CONTEXTIDR_EL2 Date: Mon, 9 May 2022 12:58:21 +0100 Message-Id: <20220509115848.3521805-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson This register is present for either VHE or Debugv8p2. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220506180242.216785-5-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 72d05070f02..7b31c719806 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -7246,11 +7246,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, @@ -8215,6 +8218,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 Mon May 9 11:58:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570965 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3924645mal; Mon, 9 May 2022 05:02:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAuR2fgiCQ9ehDHBUSk4uwtmFqEjarYB6t+VtahTNwNIjdC5+YXwHTQflqBQsj/bTlCj/z X-Received: by 2002:a05:622a:284:b0:2f3:c6aa:6c96 with SMTP id z4-20020a05622a028400b002f3c6aa6c96mr14090880qtw.512.1652097729928; Mon, 09 May 2022 05:02:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652097729; cv=none; d=google.com; s=arc-20160816; b=lHkNM7fxvIydUYr/VpJgiUHNWq5OhcrOwbH+yQTXPv6RePuX1yglZVJP62Wk6VVolV rJNEzORSb6wq5t49SoQ8hMGsscQ0fzW1U8JdwW3iZHMIsTsuo0vjFy0z1fY16TZ99gAN y/hQHCXk3gz2JGDRK273FC2Hcn+C6CvtbGdGTtiac1y1cYP6Kp0rWbNEgXYwf+7L2EmR 2J4lb/4ICO2wywoiJkn5SFqpJNRG+X5mX3RbKmgPv5TvR6HLsGsx4fi2bcGOKV8EtPeg E9phe3f14gRDLr1SnV+LktXm2+qN3s/2QH+so7o8qTNyPRXDVb0EtOFQGNGz9j4Q5Yt/ GdkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=LY5sAZbP9l4aivrMm1pJ8nSFUjBRbRAVppWVZ7qEALg=; b=K4o0ACLvKiYsq9dGpR/yT6QK2RyWrAkREGcYpJ2r38bs7kafAyVqaJx7yyo6UmtNYh PFZtOTtQ7pw86IKIUuiZ5AjazvlsEwykBiqLzYnWvTpVMYppKtGwC5z7Qzr5GMllooKp Gu8M0Ylag9pzJZAwBr4BdMqbK44FrjIXV9X5zr15/xzuIUhd0z4bXHRPZl9Yg7zVS394 mz8bea3Pn+xF8gPhcRMh68kpxvjFjGV7WmkC4OOPFEf4SIpUNGY7kyybERVghJVil+fU zB9xyQGjKWu4g9NXM0C3R6oYH4jVkrUrxOyuHONtG2dcFXyiuOJmiGT+CUpTJG/8AhDA wC8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zobKmjVi; 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 k8-20020a05620a414800b0069ff12ac4fdsi9472989qko.467.2022.05.09.05.02.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:02: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=zobKmjVi; 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]:46618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no25Z-0007DH-E6 for patch@linaro.org; Mon, 09 May 2022 08:02:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49694) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22U-00077x-Ho for qemu-devel@nongnu.org; Mon, 09 May 2022 07:58:58 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:53958) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22S-0001HQ-Ii for qemu-devel@nongnu.org; Mon, 09 May 2022 07:58:58 -0400 Received: by mail-wm1-x333.google.com with SMTP id p189so8230788wmp.3 for ; Mon, 09 May 2022 04:58:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=LY5sAZbP9l4aivrMm1pJ8nSFUjBRbRAVppWVZ7qEALg=; b=zobKmjVie7A/HsvDzpHJ5zvXYJ2RvxBxwxnOmeDfXoulseASR8suIav66VHRsoYM6J f70r/kAxepge4buikzR0TX6cKUdG75Tw/ETpMSvQMgmWdDJW+Q0ftEN3O/mvwNkR9dif KDqGpEGWMHiDtNnYj08UFizGDTT6gZF5B8O0Ara1v5dmKxHzcF8W9q8ozygr2rY5lys5 Xo6EeEDduNmNNVdy8T2Yty1EfrnpqfonXOJEgndSOk/ighyZFS9JCNKXUlgtFvVYsxjn V9UiwOrz269fSxoaSYM+WtCCAJyEQJpLWBXCEzg3LDwFKyKFRhanOx5aVY9D1DyN78Gt JnQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LY5sAZbP9l4aivrMm1pJ8nSFUjBRbRAVppWVZ7qEALg=; b=rtePg/xFR0o2iJ1DGgQs2A+Fg9cOTdqCyYzd/jpuXPsSLO2W4VExToEIrFJx8f8Q8Z kL2etU55g62cqiHFGB22mHX0+iDrA7zmj3tBXu/T9LU4N7Ky8btV1d1YfF1qKc+b4YXL N+LKXOZk6xUe8LZIxw9A6vFROIRqkChn+wf4h/ghzXilHYcc41OGp0cERqmM1KkQCW2e exdN4Z4raCLcMYkoTRcepllbxjQxCplWIvubhWDuIqkeoH2sHqBPN0T2pNb0BAv86mwf 71sMKyo5hvpi3ClTGeM2oxsCkTMlA8Fu7cPVzTarbv/T751oQjvewtGa4KWoATuFXCJS 51FQ== X-Gm-Message-State: AOAM530VIFsHuSyP7euGXchH85bg031c+7prbiYEvzwWa59GIjYeiwys bibOA7zEYnJgXoO01RgTnObdQwBQM2kqwQ== X-Received: by 2002:a05:600c:3503:b0:394:8382:9fda with SMTP id h3-20020a05600c350300b0039483829fdamr10189511wmq.0.1652097535186; Mon, 09 May 2022 04:58:55 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.58.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:58:54 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 06/32] target/arm: Move cortex impdef sysregs to cpu_tcg.c Date: Mon, 9 May 2022 12:58:22 +0100 Message-Id: <20220509115848.3521805-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220506180242.216785-6-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 255833479d4..343b465d516 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1307,4 +1307,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 c841d55d0e9..33a0a719003 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 9338088b226..d078f06931c 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 Mon May 9 11:58:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570969 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3928671mal; Mon, 9 May 2022 05:06:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkU4aVz5A4u8ORJcdBuYzlY9o4Ws3Khz9RmEzwA9vYEF6R6qLdR/7nUgkCNc5W65j8a6Hq X-Received: by 2002:a05:620a:c43:b0:67d:f048:f5e9 with SMTP id u3-20020a05620a0c4300b0067df048f5e9mr11257675qki.281.1652097981144; Mon, 09 May 2022 05:06:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652097981; cv=none; d=google.com; s=arc-20160816; b=So9VwWmhF2MhG0ZI3pzhHj4kksY3Nv1sEi5Atwy4vIPTB0zXcvfqGSoK7oHXKqlJ18 2I7pIRv6tT/7NDaGBD2tICyxyX7V9geu6Z4J3pSBw/ou+iBLi557PJZc4UgavkzRTydr Sxud4H6yHK43vGVINTGGrpQog2e5B2SdASBWuqawa/ZiDBrrESXmcqZHi9kLenFq65+O 8FcmfjdWi2waMKHW5wUt7r67vRGf35NzqYpP943pIxGnxjhiC7dHhByTX7ab3TfVZ1mx FLkBFjv290L+/fTvanjYU12DcAh9XAXIEsemlgQmGv4bffoDEKv/zIp4tX4JDKqTt/Ej ZsOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=NTlGCwPOD+kUxmNLauVtxFXKm1Wxpl+T/qfsIS4Q+pg=; b=SlGVfs5KMFpC0bWrQU9NYhZlhTMj4SMX/EQA9hS2yJfvH0k/2twu5udxZmSb0dabWk xGAxi+JziFXVB/lbJEfjSXi3w6jxFT8N0vEnNQs/OqCNwlytc7j7YUjFseyTrSX89UJQ 17Vb5DFP1enHH6mHzlT5Mwqt9V7Ja4ETO0SLfdOTV7z6xUiWO2GPkd6yJyNYdd1RAz9c LZwVVwXCATKxfmZ1Be5OMKoca/isPDc4XGozXXH0QhpHqkHVi2ClIvc/RiiRXmTuL3Qy 0mK8gf5ids3Al3VlYYaTe1yJlbChiVqn3Ez9eBJ2ComZcMcofQlDqnPKCrhZlz5NgOTE CGTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ONB7tcZw; 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 n15-20020a05622a040f00b002f3ae9852aasi8400043qtx.286.2022.05.09.05.06.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:06:21 -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=ONB7tcZw; 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]:55536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no29c-000587-Mi for patch@linaro.org; Mon, 09 May 2022 08:06:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49714) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22V-00079U-9N for qemu-devel@nongnu.org; Mon, 09 May 2022 07:58:59 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:53079) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22T-0001Hl-Cb for qemu-devel@nongnu.org; Mon, 09 May 2022 07:58:59 -0400 Received: by mail-wm1-x32c.google.com with SMTP id k126so8239444wme.2 for ; Mon, 09 May 2022 04:58:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=NTlGCwPOD+kUxmNLauVtxFXKm1Wxpl+T/qfsIS4Q+pg=; b=ONB7tcZwaI4hgq6dY1sBEOEReFZEBy8BK8o4WP6tv2IU1IWhpcfoxLDKCCLi/hmeyw bPu9Q5ZDLKCzX9FD3Cyee+mOvoAznoe3cJSJ1HygItRc5EMjm8Ly5NQESOJ5Rf+xZLHs ZZhcYHQnC8W8Y9mSOgqbwO3X7j3YA42d8fXX2kFgw9YtmmUxqULcP51b10D7MrBgoF9Z jZyznHNuawB8En5LsVHS3gi2w165XOMpG++XVAv3lDS3MPpXfGwRMEitOBxDf6OpuOOC mcM9Va4EncujNImyRUH8r63Ap74w7XwJjfnpT26Uc4MAXV1kE7DhOJYdXMdCXk+H87c+ 5LCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NTlGCwPOD+kUxmNLauVtxFXKm1Wxpl+T/qfsIS4Q+pg=; b=RClksMzbexCE3JBQURSadlQXaIcG+KcONTScDijDi2909cM7kFY6VhuS+Kaxfsgzh7 6aBukBOboDA88kU+7B07evR8ypNAPsk0clF34yQQ8FMaRubP5yvzyqQcPfVzXGLcjuLs 5b6uQHALu4O+n1qRjiSEaNCjNernNYWz7BfFCX9DKoDxAM96H5VbfqEodx59dhzgOcQp hmNY0lIkRjAgEbrR+QWpEaQ1eh+lEk6U8LdrQfd4q9LYeTpAqwWYsVQeJJqAeYOJc+mT b+MxFLWJN3OOiuowagLoJA2P8oXhYjjmpYJJJzi6F46p9CB93ndefuOm1WqI/5i42Ovt o56A== X-Gm-Message-State: AOAM5330kOkHp9t+K0xuAjs4X4uWDkuSQ77bM5wkDlBfb4fNpNwOCqgJ bjGjL9MZFTfGj4fUfAzqzNLP/kNMsiPnxA== X-Received: by 2002:a1c:7414:0:b0:394:1d5d:27f2 with SMTP id p20-20020a1c7414000000b003941d5d27f2mr15811751wmc.37.1652097536026; Mon, 09 May 2022 04:58:56 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.58.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:58:55 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 07/32] target/arm: Update qemu-system-arm -cpu max to cortex-a57 Date: Mon, 9 May 2022 12:58:23 +0100 Message-Id: <20220509115848.3521805-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220506180242.216785-7-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 d078f06931c..f9094c17525 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 Mon May 9 11:58:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570973 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3931585mal; Mon, 9 May 2022 05:09:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/Mq/66kLXj4p6HslL5CTjKFEBMBbo6Z8yVKYerdGHmFOXojbyjZkl9hvKtI7FdpJNVAc9 X-Received: by 2002:ac8:7d86:0:b0:2f3:c523:19a2 with SMTP id c6-20020ac87d86000000b002f3c52319a2mr14359831qtd.566.1652098176177; Mon, 09 May 2022 05:09:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652098176; cv=none; d=google.com; s=arc-20160816; b=aDZV+a1XtEViX0Sh0W+yHje7hv+bn2Hf09tYsOc0+FjEHcwvt2M1gYDKfIVQaNnc9d c5YbcCwvd/0SzRcR2zb7RiKFEiA7tFxeZiF9VVBingEEgIIpQt+W+Hfk3ds3k0DxMnr+ UGRMza73HU0xvyHTPCGiNeXmmmeCVWzZaZHQgLLOHvcpzKtvUhZMdOdtrnHVIOLsgbGC ky21EKdvyFGjzdB0j2sbpYvs0T1hJNExE0RhbcCCsrBDDy0VQvdamCytfAFAevJMgrzH i95z8vsmqj4fqIa+1/4J+IeKoO8tFn4IAy4L3OVRfGenmZe1cslgMQb6ZXEYiK2loNhE 4A8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=utw3LcG1dMmm1L7xgVlIZJE0fwXZzx5RP9DT2it4qMY=; b=i/23FCbFs2HalaUY3QwLi4n1Sd05kh/AxElWgSX9ALgJslPf0RwlW7IULNg8s9AlQy XaBRMyxFScsDgFogE0ecRfYbQCPPL8Ne6pjXZfwWMSq6+8MVhiG6qfEtraar45mRWDdv qrRnD299t+DRnffoDhpImxux9t+sUlmjgL9sl58cgGpMyokmJ+eP7B3PAd4WTJ792MJi WvCLnhQBdEXpo9b9wYaiwBo7xQyZSIohUfhXx05aEdrBsQAww0UVYOBj9BA77U/n6iGy /CiBgDl8RunHcChKpal+esn8kTl/zC92n90Y5LNltW0adkWJNqh2FB8iMiLXS3ydC7zd prag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I8LFVy4U; 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 u19-20020a05620a0c5300b0069a0ddf2192si8513575qki.658.2022.05.09.05.09.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:09: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=pass header.i=@linaro.org header.s=google header.b=I8LFVy4U; 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]:36020 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2Cl-0002hh-Ou for patch@linaro.org; Mon, 09 May 2022 08:09:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49736) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22W-0007Bg-9M for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:00 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:47027) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22U-0001I7-NI for qemu-devel@nongnu.org; Mon, 09 May 2022 07:58:59 -0400 Received: by mail-wr1-x429.google.com with SMTP id i5so19083154wrc.13 for ; Mon, 09 May 2022 04:58:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=utw3LcG1dMmm1L7xgVlIZJE0fwXZzx5RP9DT2it4qMY=; b=I8LFVy4UBf/5CFt85x/PlfGgFsQDAgSkpjJYzu5aCnA5ngi7bRI+QXAOM8LKDTwiRG fDcdhZnbyGPZz6rBxGPy0+uONdeTkTVJkBsRB5rIjR7GXoEbCrSK4iuXAyKvk/DR7h9m ggbCA4RbeUsf1f9t+kWCK+rak1mBn5bTH7UJGRa0Hrg3INKkQ+AXlFKtCxzaVoykdXyr Poutc8I1YMEjL9C0XPkkrq56dGvL3shY0EIdj4pGPA6e3vMhg9cwln5mp5lkgm8kfiwu pxIq2SgVvblo6mSJ5yQFnUapHtfDKWMVhYo7XPdFV0sw0mHWDHRxnFSCp77kAQ4ivW8C BOJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=utw3LcG1dMmm1L7xgVlIZJE0fwXZzx5RP9DT2it4qMY=; b=bqCbKZF1dX/2H78HOYLTw8wbV0FREG1X6a0FamwN0VvQflccT/tI36AwQzgo2nXNSt 92XSc0jxfMf5XjkgVgRGPcpw6Den9qSTEATMPUYffgciJ7QpUFstg/64QcU6ILHWjf8Q zvsygXHFKyGtFQW09pAMy3+lwkkxl1tAnUzu4afvHgdO9Jr7QriAAkk6+3P+Yw48ytSN GX79i8vVS0XFweyxnh06raCdSU2uvXGBVPol0dpaEUecGJRu2xeMDAElpPbd6FueKm0u VljpUhtVZ44pJXFxlyEe0/2AWluUka6M08M6BQjLPvTbhhXup8aw2zhwwc3lTm3A2W+J loGA== X-Gm-Message-State: AOAM5300FfdDDl/6EUsEWHfbbDHLC4r2KKb5HzDEbvm6A6y13iCztTZr udjjJ36ZIa+4OsxYbVIwiRCiXHR1bR8VNQ== X-Received: by 2002:a5d:598e:0:b0:20c:57ef:6083 with SMTP id n14-20020a5d598e000000b0020c57ef6083mr13535445wri.457.1652097536728; Mon, 09 May 2022 04:58:56 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.58.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:58:56 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 08/32] target/arm: Set ID_DFR0.PerfMon for qemu-system-arm -cpu max Date: Mon, 9 May 2022 12:58:24 +0100 Message-Id: <20220509115848.3521805-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Message-id: 20220506180242.216785-8-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 f9094c17525..9aa2f737c1e 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 Mon May 9 11:58:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570977 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3935596mal; Mon, 9 May 2022 05:14:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdn7YmRm9cvphcT2pCYXMJW4Erc9dLoaJEjS/y71B6dPhy2jYwe5T41twsdeE4AM7X+K1o X-Received: by 2002:ac8:5dc9:0:b0:2f3:c1de:c0da with SMTP id e9-20020ac85dc9000000b002f3c1dec0damr14272175qtx.313.1652098473717; Mon, 09 May 2022 05:14:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652098473; cv=none; d=google.com; s=arc-20160816; b=wVSxPipjSrMtUWku9EODNWFRU241j+DjR0nDM/C2013K6rvyQcVp+v6fum934lwzYS hGVX+Tre7iIWjgrC/beBP/I14H5RwP6SKk+2vqwRjOEHUoGLcT+SYXfmwgN0XW5s45qP aU8vwNCMYgdNhzu7nK1BChiRHGJHqNG+/w026jERaIHegJ/NPfjBl9n0gG3HD98dzR74 ZLqH5Wkq4mUhAnd3yjFIoCqinlwQD6B5Zbn7S7wA5n47DkS12awjqBu5LgtGuDRtuFMm C/pzb9Myct2DDLBCYS5npq1GzmJwpMyxU7thdigByVBm6baLAWCeThN0XqUSSFogA0/E nPRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=+LCYa4SACHz39b/N8QB7n8zUhxKTI4/N9Nw1WrChTbA=; b=B6enQbPEBd/Cd1zS1b+FJi7vh9laLRvxIQYsF7fv2iS5nq4FY67uRS/to4upkwtuD4 HF0Vnjyq1j8Fj4aytIWf99+UeUhbAcz1V2m4Xw9yMugEIGpA4nKKFNzQVq3lDxVy93HN 8RaPdBfvl+GYYgysn9gKBp9ABW6rjyZb6QPi2GaLmcBapnZAZzjJMpIHtdvYX/+l4Yb+ GlxUxu5jNB1Yf+2nXaPDCgNTssKMgkkLVqlUqDsa5NY6yjaA1NiyW7wldr8lNxvTZZLT z+N5Ogj6QXdubb/Elun4xfIgdYOFk5EwjzXlJ9PFQ9mWzdAqxSVVzug4X6qI7RI/aRZC wndA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EmXl+onM; 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 k14-20020a05620a414e00b0069f74c9d6a5si6469966qko.679.2022.05.09.05.14.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:14:33 -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=EmXl+onM; 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]:44556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2HZ-00004z-9F for patch@linaro.org; Mon, 09 May 2022 08:14:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22X-0007Dv-6D for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:01 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:53084) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22V-0001IB-3f for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:00 -0400 Received: by mail-wm1-x331.google.com with SMTP id k126so8239512wme.2 for ; Mon, 09 May 2022 04:58:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=+LCYa4SACHz39b/N8QB7n8zUhxKTI4/N9Nw1WrChTbA=; b=EmXl+onMX5B4JnHTlHew38l4WLwLQFQ7VgB+ttMudctyRIWblTzODdj1ykvyq6S8sD 7nGR0ZZptOSqbzlIVF4QKLQXc9e3M9eAcNl44G1NyynIFGa0ftzery3wAZxwIpq3QCOE 8ucqiLc3O7inJE1Me9PO4zqsXICN0wKyd3Hv90Pa39P/ItQummhBPF9omrv72JC/whY3 FV18iB/rPIj9a1Z2d7hX6DkWiwyKnXYa7eG+lFfCW+9G7Stc4T+I6BeKe/kJ76P4s3C8 OH6FuRWoOavorhpSAE9MUWX4KnS53k8o8gHLH+ZA64Wl9x0Ui61clBgrr+s7KgWUXStN Mjqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+LCYa4SACHz39b/N8QB7n8zUhxKTI4/N9Nw1WrChTbA=; b=23HVPgtfDdrOBp3Q1nZvDuUbJoBtrPnhJIZKo32StNNnk9QpLagxsM6EXxDNWKfVjD IltJYwpwLJWSswYMTN/GiWDmN2H2cPR/FzLN8/5+vfEmbZWsg3b32pJiY93hNPhPzYLJ GdmIvUvyEBsbxr+MWH6OWetyP6elP/EHGERoqcLVRD5gl4NhYuM2JILiCeO6K1Eb9h2J k5JYucGYxurUuAFVw+2eK/ayq38DQ1Abin4N3Cbx0qAZo5y/OIcZRFFzpSAP47kU5m6l UpUWbWKqVU5/8iLm/EvdslSRmmTPNke3JL8AftgUC5xdY5dktDjRP8eADnj75rfOEVxQ XXCQ== X-Gm-Message-State: AOAM533DnnjnCmh+Mo7FglghbqTx97DlFOCpiJ9PJoognHo9PyWl/r6C DNvAQ0WgkVsR+VimxPR5QhhewcrwLgOLxg== X-Received: by 2002:a05:600c:3caa:b0:394:8fb8:716 with SMTP id bg42-20020a05600c3caa00b003948fb80716mr4970063wmb.105.1652097537613; Mon, 09 May 2022 04:58:57 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.58.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:58:57 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 09/32] target/arm: Split out aa32_max_features Date: Mon, 9 May 2022 12:58:25 +0100 Message-Id: <20220509115848.3521805-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Share the code to set AArch32 max features so that we no longer have code drift between qemu{-system,}-{arm,aarch64}. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220506180242.216785-9-richard.henderson@linaro.org Signed-off-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 343b465d516..c563b3735f2 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1313,4 +1313,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 33a0a719003..6da42af56eb 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' */ @@ -799,57 +798,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 9aa2f737c1e..b0dbf2c991b 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 Mon May 9 11:58:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570980 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3937817mal; Mon, 9 May 2022 05:17:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwktgfoRdESkXKGOvAs/nk/4/k+wbbtfcUlSJAxOJl9/52kKVHtGe0dq+34O1axlFNwFZb X-Received: by 2002:ac8:1191:0:b0:2ed:bb6:ab07 with SMTP id d17-20020ac81191000000b002ed0bb6ab07mr14710215qtj.418.1652098637482; Mon, 09 May 2022 05:17:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652098637; cv=none; d=google.com; s=arc-20160816; b=w9hdfpccxYOT/BfdLXdx7Izo+ZRWR2gD8gg1/yaz76mo2JaQHUlVl/T9qtodwnykkH Sp++uvfkFJSSdVOp0GsX3/N5kbwphnPw3CmPcDZsD7qbLWV30dxMm61SrMptktfIAth4 2OsdvyW7xmt4Xmz7RF7LQvCWp2l9/TefViy1g/SSc/hZabpMah3r5/7+v/TcKm3hqu6S XGdDVp9tN9NBJKov5f868jOHqsDCF8Z8f8KLTY7pb24TfZhYBB/RWsU3GiO7Jww47zXD iZ2GMVgsdf43fVAwvkNTcrd0OzlkXAepughUkP+apNlFXY3x5SfE/APysJEFU0W3H7Ux 1URw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=vceOIhx7TgPek853xQx9nRZrn5XzWmRekZy6kMIQLHM=; b=0ViPYiXU79i0rXF9umj70PPxTCHE77vSAA6kBQly8y7ssT4IbVNM4XaCgcoDnJgekn yJGW6lQKayEcMvtwbSliznOFBgRGqI9igHa5LOfPqDSSVWNNfY6VUwk+ceILpuCsgDuQ U99CoqicGOcQ/Btz6V/C1hMFW6/j2gZwuHi2liDEU8XevG6wZE+R5kZRYATEjPc9i5RC /+dm9terIE5TNTNH8faJOeDRjH6jz+RbIJsoatXfewkt6DreBzltcGzWXEcenRksyOz9 V6DO/FMv2OfEbyGUuci4aF7g0kfM4c7T/J0Kg4qR7aJlT08zo30C9XGDX1e96IPzC7RM UsoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jDD6IlsQ; 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 s4-20020a0ce304000000b004564f6bf721si7600160qvl.186.2022.05.09.05.17.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:17:17 -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=jDD6IlsQ; 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]:53146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2KD-0005pF-0A for patch@linaro.org; Mon, 09 May 2022 08:17:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22X-0007EE-9I for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:01 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:42926) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22V-0001Gn-9j for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:00 -0400 Received: by mail-wr1-x436.google.com with SMTP id e24so19108668wrc.9 for ; Mon, 09 May 2022 04:58:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=vceOIhx7TgPek853xQx9nRZrn5XzWmRekZy6kMIQLHM=; b=jDD6IlsQ9JjrxAmW8owpTZQ6OTI54wUiYtmu9oNICosINeB+VD1KlTxzrjxGY2rGIl Pa9fE+/Lwr/+jO3+4yu9YHZLPXA1+kmJCuda4Sy+yOb5wZcVixQx0c/tDzT3gojeyPu1 zjoalsaeBqnb38Mi0R2Uhw4oK8F49qg6dRnn5pcbYkx9ysD08nW9Jf6s9WC2PL0lRWXT xTw+vEgxgzujSGzelYqMx2AYz+b+oK48WNXhhk5Vv3H2nusZmNQ+FOXKt80VBrfDptyN IVEas9gTMx3SMcMQ7gn3/q9iaYrl9AK1SGG55k2EdZH7dOwMgVZIqq/Mq9OO7JL3GZ4F OgQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vceOIhx7TgPek853xQx9nRZrn5XzWmRekZy6kMIQLHM=; b=6A8lUY7QvFH6ZtmaKfygCdqKX6k5LRnTPTw2ExBp8sVSaxTXK7JEuNcEAoU5xrPscl h1KuD2LXtajrN4tjt/HjYGHrMrv3pULwjNCPTS8SekBp3+IaFKHOm8N+muPRzQHU4FNT przHvGQfam+pxAMsfrwf+AOKfe0uuVHiguvGfTD6cpDpRgVMjWYLU7nOONUmjAqD3JLP d0XPtTsGEh9d4VHy2t5au0ROijdtsH6X9ibuk++/I4cIihjU2NgovKmjbas4Wj/QRGjJ J6JCgQF//brRvfrX9Rq7GGXD6hWekJTZvylV/0b76p6PSD5uBqwIMO7kqOXxn1qVHGun gc4g== X-Gm-Message-State: AOAM532OvIveI4TcZOQgo/4q9el2U9hneQINX9NTo2lZ67dNQTl2DeIZ 5tZJvP+uNblk4YqR3wfZiLQrCl96JzhSpQ== X-Received: by 2002:adf:fa42:0:b0:20a:e8d6:58b8 with SMTP id y2-20020adffa42000000b0020ae8d658b8mr13912991wrr.64.1652097538460; Mon, 09 May 2022 04:58:58 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.58.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:58:58 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 10/32] target/arm: Annotate arm_max_initfn with FEAT identifiers Date: Mon, 9 May 2022 12:58:26 +0100 Message-Id: <20220509115848.3521805-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Message-id: 20220506180242.216785-10-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/cpu64.c | 100 +++++++++++++++++++++---------------------- target/arm/cpu_tcg.c | 48 ++++++++++----------- 2 files changed, 74 insertions(+), 74 deletions(-) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 6da42af56eb..5fce40a6bc0 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,37 +769,37 @@ 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, TTL, 1); /* FEAT_TTL */ - t = FIELD_DP64(t, ID_AA64MMFR2, BBM, 2); /* FEAT_BBM at level 2 */ + 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 */ + t = FIELD_DP64(t, ID_AA64MMFR2, TTL, 1); /* FEAT_TTL */ + t = FIELD_DP64(t, ID_AA64MMFR2, BBM, 2); /* FEAT_BBM at level 2 */ 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 b0dbf2c991b..bc8f9d0edf5 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 Mon May 9 11:58:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570970 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3929140mal; Mon, 9 May 2022 05:06:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztmpxDZ7GJmO8pZf0a+xNT86KPJrq6928614lxiQJvNfS5Pj+6dsn+lHGjASS8pcgWIOQr X-Received: by 2002:a05:622a:15c5:b0:2f3:c195:8d5 with SMTP id d5-20020a05622a15c500b002f3c19508d5mr14667037qty.369.1652098013351; Mon, 09 May 2022 05:06:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652098013; cv=none; d=google.com; s=arc-20160816; b=nmmn+q1Vn/dXVnoPbEwMHJlR+t/E1PLnVHDa8kh3CnZCgEBdGhpQTv0zFbUeXjrfC+ soVpcnO6lVsNxVXkkFAv+QvG7r+h5mwLSWLJXtrgmAm3Goka/GuKaP4u5sVpu+E7EbRf /+AOZOGiGpzuLeygUS69Ai+b+lRzrELXjFsKlcCCESqi39l5wetbKwG385w0mxHZZOPF TnttOnlIMeQje8aE0lQVoYWzwGoNj5SqV8V9itNdyZrdNLveIgwUPpzipjUqeSFjHG4A u6zTWZNbOmCnJt9ysm1kWO46wJbE1m4TySaSOxCJroe2iE/S/7uhoKTJG+Ry/Z1rJl+i 7ZSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=qa9bXLZrtUjkR08O1nmZU1gZrJzLSKj+bcC5vCf6akQ=; b=wrcD4DbhD8Stj3Q2J2ucQWt6QXRy+wlYSiJyqOtIl3bvIhIziFuSA6Cz05rStr0Su1 r+cxlGMf99TFf5eg4WxEoW2dLfeMAVwzHwReZJGutk2IKGM+aGszfNMwqVWD2FcU68rW DOhT5V8XxmYKQeZxT+tWarvSXhrXhoWbspBBXgfKI3X1Amh9d2zFTJDRWISKWBF0Hbyp PB1M/a9gFylGkSrUmagJcESkwXWKCmostEDoYU9fXczo6jbTPXzuY7p3kTgFArJp+Ouq tmFXMUZBcEBcCBR99V/K8GqRXwW6DLd9TfLhqi2TGKBQHwEIgjnmCpgjPvVhuby4aHh2 l4hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lBg71FUe; 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 s31-20020a05622a1a9f00b002f12dadaa45si7719591qtc.612.2022.05.09.05.06.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:06: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=lBg71FUe; 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]:58316 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2A8-00074g-UZ for patch@linaro.org; Mon, 09 May 2022 08:06:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49796) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22Y-0007GU-Dx for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:02 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:45640) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22W-0001IW-L9 for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:02 -0400 Received: by mail-wr1-x42a.google.com with SMTP id w4so19070775wrg.12 for ; Mon, 09 May 2022 04:59:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=qa9bXLZrtUjkR08O1nmZU1gZrJzLSKj+bcC5vCf6akQ=; b=lBg71FUejsMOGgDjkg2a3q3HoFPcoiTPkAk35Re3AJwRs0yh+f/bK5BJdJjBXlC8hs OosnlXDx+F65FS74EZDPU15JKWM6kBHI5LMcvUoRnUlJay8BC68KNDSkpZu0iKhMg46G QPA8NDchVgqlkltUAz76bGCJ9ABiFZXg7A4XrWsO2ljNNBncz901Rr12lYntwSI+qVx8 V/mdTqt0SFA7xCnBUsk1AV0z9AvDa+EqFchN1s3utb5XqjKwLg80DAHrul19XvhAE7Gb p1eD9/KwQ+neTnAGQQKindJ/XkXgBEAgXAVD22liBy9X3gSSSX0r5fSB0OiD8R+Cc4RG 5uUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qa9bXLZrtUjkR08O1nmZU1gZrJzLSKj+bcC5vCf6akQ=; b=imhEB6L4dBCIaUqU7/GUp8xo4tVKWP2EZNzngb4JfM5/ds8m41wuA94GEZO5fK6qQO 3lxZoA42aTt5Qxr/dK6Db5EuVp49RgTJzZFy9eU+9yURTAe2TUlVY6WnVx0IcsdNWRI6 +Xwemqi7G7kyJNzszVtVgxWvsBrwQ/I3qouFmILbuzOnFB/Qeiz4jJehlp6YP46Ut89m d43iyAQF+9qgisZ0JSGe0UWtpW76x/4mmQ1PQGom4kfq4OLn/ohB6ryTDOjcUPMN4JGU nNUth/aHPv/Mfo0j1fmasKcoArgavPWD6bw4El5SA4LlciY2b/iJXNJWfJguhiqqBELU oWmg== X-Gm-Message-State: AOAM530cl0lU5ZZ6ZVRS59NleRDQPjwJisK7AJucDQ0TcEO2VHd7T05q ZrzVj+OFTKwYOVUvTtBgU9aVfS11KkLtuQ== X-Received: by 2002:a05:6000:2a5:b0:20c:520a:a12e with SMTP id l5-20020a05600002a500b0020c520aa12emr13088558wry.629.1652097539234; Mon, 09 May 2022 04:58:59 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.58.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:58:58 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/32] target/arm: Use field names for manipulating EL2 and EL3 modes Date: Mon, 9 May 2022 12:58:27 +0100 Message-Id: <20220509115848.3521805-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Message-id: 20220506180242.216785-11-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 01176b2569f..7995ff27126 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1801,11 +1801,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) { @@ -1836,12 +1838,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 Mon May 9 11:58:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570972 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3931018mal; Mon, 9 May 2022 05:08:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOBB7dclPwtPnLfx6NRITbnSK/mmf6UE90AIw8y11V9KGVZUr67rr+tD5uD+K9FVtdFcRO X-Received: by 2002:a37:34d:0:b0:69f:8951:a89f with SMTP id 74-20020a37034d000000b0069f8951a89fmr11490718qkd.550.1652098137482; Mon, 09 May 2022 05:08:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652098137; cv=none; d=google.com; s=arc-20160816; b=oq85l/zvQiuEvC8PPITEfWMcjmvYCFJtvJxcBERAGdm8IszR65ZcETRNuaqlIgd+qe FdfxlIT0LD7CvqATgTC19MGZpXWMqX0v5cpPiepdjg0jssk0WBkqR+/944ESz67mung9 vxOqx1MDgJrGuwGWp94RRpyu5ySB7YkhKzJBRhzf8UOt9GZA8NAPaJZIYAvDYVGrMQ3Y uiov8NLxGWnulYSchg40lbAUYg90tyGSzBUcBXWqRSW3S2atWez13gb08LTaEls2hkBs 5unrSeSoDn3FHYVLeukVtCJl/+SnTI8pI4gENpPWen0Dc7GMyzjGKNGLJgG1mUSP4jm4 CylQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=SNNEXS1ZgRVkdqjO580Cr2E6Kdi1t7aqdV46MS2BNEw=; b=EjZCLPHaKpdEO2nnFgUBqpUC14z0VkhQTduQ4dPRRrj7ikIEuRqYeTIAnCGsMCwryO 3ZL+dMXQSMY8DnQH223cqQ2kbTYYWLCNeedlhFoUAbDb1znVREZDWBXdY73AVw10exQT d3fu2PDECKdi9Qu3VKRuaQFKowK7ZEshxiCFkCvUziBE/Dd6QgmaDEds2nefMwoTHy4g aM30IF14xufEDttXyG9U/pqtuKlbj5Af9f8c+9odfltiq7g5KnHUq4cxXoOxe/XrKWqv vfGzRK1Vu1cHhKASUs0gcRaJwnf7RP2EFQD6wBFJUK/P45IKt/UI0ZyJ0LQ4Oe5Sps+z uPQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yqzZWaK3; 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 ey2-20020a0562140b6200b004466a5ce9f8si11052276qvb.560.2022.05.09.05.08.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:08:57 -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=yqzZWaK3; 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]:35112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2C9-00025k-2l for patch@linaro.org; Mon, 09 May 2022 08:08:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49798) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22Y-0007H4-Jv for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:02 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:47027) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22W-0001I7-TN for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:02 -0400 Received: by mail-wr1-x429.google.com with SMTP id i5so19083154wrc.13 for ; Mon, 09 May 2022 04:59:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=SNNEXS1ZgRVkdqjO580Cr2E6Kdi1t7aqdV46MS2BNEw=; b=yqzZWaK3b3AL9Hh6QRmWSVZRLVT/aMXPv8KvS7PfUbtEzDhZJtWqizDOrFhO5o0GmR +UgCHdwTYnEUALB+6eJJtVYnFziM2LORdrGg6XXA198QpjIGjLjUKCdc3EA5t/KojgSD KycfwuLTJE/0kUAnCOESaCSBt4ICku85LPg3Kfcw8cu9Xi11r1GXc+YunKudR0cYPUwu 2Ceof9XGMyFjVTQlHfqZ6QF+5vErB30yHYi51V8GOMIA4kj7D374tRKqYGG3VdBsf4sR 4L6w+cdd1cmCgTrrzUFambGzJch2vPMpYIq8UOIfMjbDoWpwKdpfqh/r/LBqQ2xNpUnX Jwng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SNNEXS1ZgRVkdqjO580Cr2E6Kdi1t7aqdV46MS2BNEw=; b=I4kT6vd2WkjNoU0O6DUVmaZ3Vib4RjFVgSJCOj7AtilPhiQHVe6KDFBvduj2Xf0KvB yeeTrrcSmOweGB7y5nOL2CUCsB9N8LhE9557rbRaLG2XC6jkD3eXTRBg6216u0D+UdJV tB94NaBpfdj2pudhbL++HIhwfpDCvVK/Jds3mSoHdhScslWyVnEp6iDzz0uVEK2iq0fo wyx14W2vuE3KehyT9d2zOJygp9Rqr9jDnI/yYPs5+hFdZfPMu+5htGPsZOL5hxDJ23kn cz9Xinckt/uLHtB/7wFPUB+ZPZQUPQFp/rtVEt9d4F2wOM7lhjsZBOYCNp0R2/4xGSH+ eH8w== X-Gm-Message-State: AOAM533FLUDSuunSNRiHnBXYg8BJD7jz3/xrP9sd3wwX3vjoa2NVgu35 fJBlE3GGk+oPsJxiClGEesc9PfkqT70J7g== X-Received: by 2002:adf:f748:0:b0:20c:86d5:c343 with SMTP id z8-20020adff748000000b0020c86d5c343mr13628538wrp.477.1652097539979; Mon, 09 May 2022 04:58:59 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.58.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:58:59 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 12/32] target/arm: Enable FEAT_Debugv8p2 for -cpu max Date: Mon, 9 May 2022 12:58:28 +0100 Message-Id: <20220509115848.3521805-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Message-id: 20220506180242.216785-12-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 c3bd0676a87..965f35d8c9a 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -14,6 +14,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 7995ff27126..2667aaf28bf 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1806,6 +1806,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 5fce40a6bc0..202fd5c46e4 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -799,6 +799,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 bc8f9d0edf5..b6fc3752f2c 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 Mon May 9 11:58:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570975 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3935239mal; Mon, 9 May 2022 05:14:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy13lpVP1sv8kGdRi0gVa7RSIKkIN0lt0Kp+MDomp57lrgvgGkYKsjQ5pUz/KjbcpSC+6WU X-Received: by 2002:ac8:7dc1:0:b0:2f3:c70a:df9e with SMTP id c1-20020ac87dc1000000b002f3c70adf9emr13805113qte.307.1652098448551; Mon, 09 May 2022 05:14:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652098448; cv=none; d=google.com; s=arc-20160816; b=PP3nDsznlSu0K0ti1d/IBouwtHLBXQWYukTDYb3ZnL4mL9DETGSChTfEJ11NUz4lxE dN2+wyQqRlVTRz+9VyITzqOZK+2CvSDI4ZPyIZyy9JY/2DT3HXQGFwWsejqk1xghFgsM wJ5yyEiJbM6tTt8d6EdDsXQ7/eqZ0Zfz66zxK99cYE+y+dCmy+o1I9lBWnGC20+5M+aU ZsVfxq+sVmMRNT14cm5jyoIMfd7VIJCa3gZLMY7K5JAIxq8gPY0MAaP158TCog53TQpG y5UPvoQ5M6wSmHbqmXV4aOv37/ebNq3R8/pfsfd2/0+qp2fwz0frmTSRLTMa861lnYg4 i35w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=Xq4iM0BZvoq8/HgoELbIYA7Nz6YX3WBJKHh4C9qCekk=; b=ixO2WOfkh83CpJ+IXosu7Gd0Efw3oYs/YHl54t6YvnE+Esy+JMUWl6KHfgQHESfkDT S1bglMghRlL79s4OaiIntxS4WkeMPNHfuIu+J0KxPc8Sm4YX/j2zkKAQEIfWjhjB4DTa KXy14hSQ9E2G2UdA0cENv1AZuCo+VavvplY109b+XlhAQ9z9qUBCYmP05krdTk6RM7m7 p8/JbXdb2R8ICnoTgDqKrle1Yv9T7u92yOx/nOfVpPk5DqG6x4KngAYo+BMaOwiFheL5 2cOglyg87+1PlEb1UEWZvtE6S5FyQZ0LHD/YHkJuUVbVT829MqLMcDT4c8jK3biidmY3 vz0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YnZ+dLdF; 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 p3-20020a05622a00c300b002f3ae700255si7999263qtw.64.2022.05.09.05.14.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:14:08 -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=YnZ+dLdF; 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]:43678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2HA-0007vr-49 for patch@linaro.org; Mon, 09 May 2022 08:14:08 -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 1no22Z-0007Kw-QC for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:03 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:38580) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22Y-0001Iy-4l for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:03 -0400 Received: by mail-wr1-x435.google.com with SMTP id k2so19091116wrd.5 for ; Mon, 09 May 2022 04:59:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Xq4iM0BZvoq8/HgoELbIYA7Nz6YX3WBJKHh4C9qCekk=; b=YnZ+dLdFO1w6+l3YjhRNd5NQJqdvO2432QMMUh1CDRc9RTx56xWW+6RtxvaAJAP5OY tbze/z+u2CM5ZvwkFGSvbMx6WTyfGIISc7+xF7kEUr82fEs1b72JUj9XwBad1YhH/66b shmgD73107weCRObpB0sowHZ0eALafMRDwXelIQJX8OO12jN83bdG1LyZtQU3CnKnmGD OlASbUmg5YP2ng3pyVwqKJ78XhZ446fQszYhBYEwLX/YnempiknJNEuZdGNlGmXVYTqZ eBBrqWPlgp547ZGwwyIOJolb/nhwu6xIXJifxwQF8eHcruC8fDdeIEl2Zyr6vKXrr45t AG/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Xq4iM0BZvoq8/HgoELbIYA7Nz6YX3WBJKHh4C9qCekk=; b=ZJ9Gz4dtoOxhpvIAPMVm87kXN/Z3zMrQ98OhCzdbnTsUOlm4Bsr2k4EYTy7VyTwwGi uEDgHIG7kI3bGjA5+R/C2MXWtIX0cEArmjtVBvLexh7ZRF9Or8gPW7YKKkCc8wN9xKsu 0M4jE4XMl4FcDBy4VRGrLFvznd/VgW85Alc8Leeg3eZj91s5fKfZud2nVXzPFavksz2j emxDrEUnbFC8QQbITaRT3O25l6pymHFWc/d12AAbQ9QaADXhl0A9+mEuYlEE/cVcTmrS L5PCkryTNgwkglhDfGkfZ/KfAIJ9Gd412D+6+5tj9F5dv5G/SC8PmEaS75f4QA+glj+w LRCQ== X-Gm-Message-State: AOAM530q511aYPHaAHuj4tiZnRxvPN2iUwLpSrSU4uog6xndtioLVRNx zlPs+syDAN+WUMy0NdjE6OwB+rSmalCijw== X-Received: by 2002:a5d:5085:0:b0:20a:e090:85ad with SMTP id a5-20020a5d5085000000b0020ae09085admr13388304wrt.235.1652097540757; Mon, 09 May 2022 04:59:00 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.59.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:59:00 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 13/32] target/arm: Enable FEAT_Debugv8p4 for -cpu max Date: Mon, 9 May 2022 12:58:29 +0100 Message-Id: <20220509115848.3521805-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x435.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Message-id: 20220506180242.216785-13-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 965f35d8c9a..0acac6347c5 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -15,6 +15,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 202fd5c46e4..88d3cef93e8 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -799,7 +799,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 b6fc3752f2c..337598e9490 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 Mon May 9 11:58:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570976 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3935489mal; Mon, 9 May 2022 05:14:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcEIQzbzkLepMpNdeVvkgOrd9S/SJW2wQLtMTQ0Mdb/u+ZBOB4569V3PYqTfsboWULSrlg X-Received: by 2002:ae9:e917:0:b0:6a0:162e:992b with SMTP id x23-20020ae9e917000000b006a0162e992bmr11399576qkf.694.1652098466279; Mon, 09 May 2022 05:14:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652098466; cv=none; d=google.com; s=arc-20160816; b=ILunUFg5wky/8+jx+yIrdtyb274VQaQMUC+uAXGD588upPJolfLd7tpCbABZqTGS+P OsPxxAcbFWVBtS8RfmvspBgvBawOHB+5R37jFmCWG62XAkiYdm5tqLN+ppshSUYAvdEL 9XtD4gBB+09QUhE8QT78Py/zBpkO1jOy5kcgeDceHvA8dYynBIXA+yb3zSXFs580A3CD NqcAmETdhvVQwA5xygJnF4JrT27GVxoLwIzztQFN/vywzt+6lwgghdJHKLZpIV1gGve6 WT80CaoKwlN/eir012l1Vg7E6fQKQQRfc76v78JFM8/K/lwKc1VzEJ3mKmHPZ/xI1D5h 5FUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=QFEFHrp8GnfgbZp41x52WMf8dTsWr28zOIoNVlzdXik=; b=yyqaKcI664kXH90yEFGAzqSldRjW7moaHGpDgCkvc8BCRg7jEHizXFQGxNPO8ZrGOa TVkpipF3Ja7EflHBvIlIBvah2EinEOKvr2AMxkXOKJCr2gslb7BYrCib5MW2w1/3fgyp B1iX6hsyXHjYTUOh2aOdZ6TxpTizlhYoXmlMgaxBIl2sSgjMHbgvpNQT0orzBSeP/kBh I4l/1kxG8ibb6YInSZHQd48AUXYpx6p894sl4EX0WuSxGZ8nI0CZThAT1n0HWsRuiepn 5OdXXHKIvHS37eoyu5pl8Q18cpcpyk7cjHs5knX/HjwBhmQseBZs2DxCXi9L9kF5V/aG noTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nrADNp01; 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 m6-20020a05622a054600b002f3d85c4cb9si2461067qtx.251.2022.05.09.05.14.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:14: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=nrADNp01; 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]:43938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2HR-00088E-Rb for patch@linaro.org; Mon, 09 May 2022 08:14:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49852) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22a-0007Ng-FH for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:04 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:43791) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22Y-0001GV-Hg for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:04 -0400 Received: by mail-wr1-x431.google.com with SMTP id v12so19069501wrv.10 for ; Mon, 09 May 2022 04:59:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=QFEFHrp8GnfgbZp41x52WMf8dTsWr28zOIoNVlzdXik=; b=nrADNp01sOuN1uEPaP6mfcXcHIQhZF4ZHH7O6iVuwNea0zRThtjthiH5f7jRbQDiuW Q6m3q6rrOl2IrU2LtKLJx9hBfVAdiYEaTPbY6lFp2aT+JQVDBACdt31VizL6NsjpFITk xLQ56oEyfg1Z2ty4X0OPiSdpPlR66kx/N7U+jJOl0Efr+m+P19baHddpIiDMT6i61usV iqSJyWNauqpFxQ0/C/6lqUUTpOOW8OudkW2t0MdjJLv3I4uZyWsR4DTAlYtKxzWkCOkL HqhEMFPes2lF60zEz+FaBYCxp/JNPpRZ3pgzFF+RpO7wBzqLQSn95nQRPyY4uOXjDXKk UcEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QFEFHrp8GnfgbZp41x52WMf8dTsWr28zOIoNVlzdXik=; b=LUQUWbR1DxWD7/+Z0nql2R9Y9YnCKGVgM3cGZx+o5Qw97CoCYTHhSFWUJpDUABnUNZ e1sQQt4jxR7LC5w32OdLu7AyrQYDmlAs19ChMa8WXAaR99mQsZwpfrsgzav+N/7gA2Vc JbtjUaKh88qbrq9HIi7zxqiqkmwATejDMczK2pk9fLieBXhYukq1jDEolV9/PKAKY2rC bmXWqDajvnQAXfHEz8Zdte53IZxBXevf+PP+2NQ5xnJYcYvacU3hMVLyGbkWvoDkEdvl sq8FQ05q8hXNcCcuV3If6LdrSfUMr+WqD8ofrqXeAYtXZNRTiCF3AMam+iEZlb2ZOmLm 5EbA== X-Gm-Message-State: AOAM531nZ9MFry/EJdqI9Lku5Lp2Rgg18Vh/8BlK2tz4uRQ8IIIWX1YX udrQ9zWYxiA0eD6okMCf0jDKz5IUDTa6vg== X-Received: by 2002:a05:6000:1f91:b0:20c:d301:2a57 with SMTP id bw17-20020a0560001f9100b0020cd3012a57mr228677wrb.400.1652097541638; Mon, 09 May 2022 04:59:01 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.59.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:59:01 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 14/32] target/arm: Add minimal RAS registers Date: Mon, 9 May 2022 12:58:30 +0100 Message-Id: <20220509115848.3521805-15-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Add only the system registers required to implement zero error records. This means that all values for ERRSELR are out of range, which means that it and all of the indexed error record registers need not be implemented. Add the EL2 registers required for injecting virtual SError. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220506180242.216785-14-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 ca01f909a86..a55980d66da 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -525,6 +525,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 7b31c719806..37c5e42bc08 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -5980,6 +5980,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 @@ -8217,6 +8298,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 Mon May 9 11:58:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570978 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3937677mal; Mon, 9 May 2022 05:17:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQy5uOy8NQImhFgjIJogWqlPwzekRYaOvobpYihaaWeg74juOGeMxDv7NNI/7KK5S4hTHL X-Received: by 2002:a05:620a:cd7:b0:69f:b1a7:d1eb with SMTP id b23-20020a05620a0cd700b0069fb1a7d1ebmr11164496qkj.5.1652098626517; Mon, 09 May 2022 05:17:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652098626; cv=none; d=google.com; s=arc-20160816; b=WgjfJulI+g7mWnA3SXFR6lWk3dClg+jRL4U90BUZJP4IZ9tQp81/VB5qeP9mSV1so+ Ebin2OxpiRGrsIrVmEY9U8w4F6VWmxrbGm7dHdC/IhrcP3fEIYM6i/v0V/lppYy7hyqm Hd1VFmf9V8MtKN6xKcfowTTDrRGsaRn1neX1MRSC++cbYFoMxC3dWoyhjBJEYc4U7ST4 zlJGvBNDm9z/WzxlTlmextRpCx79sRd0R1w8+O7ZSyzePOksCcR0t6PHc0hPlikvZ+Pd Vgfd708rjR/uTm+8vIOJh4YsMS+4NIpSWCVCndUrBSyrbszLmYDxn2XUoZxya/IOkJmk 5Usg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=7pySLzbCv+tkaUGvN3VNAC3sQSHs+Dm5J6SjR0nFzKc=; b=C3LwXV8vd41/1XbVw24dUFrJ031d5tRTdmowDtCj6OohJf2SkhUZipTW1tIfPLp09d ucbbU+Ynm3y+fMeaRAM70TI5Lx4dkKmtaWGwre/9aAejQmNPVJmIfj5czY+giFVfJkf4 VxVtiv7Tgqhj/upflrJ8gR9Z60mLVWW2WSVpqXfqGKggRh9UrkLufjEL6KBk/IpI27Ob Pfnbj32Ygetp64Evq4zGeLgl/E8FH2h3fgl37fKewOJdWXBCfb1H/yWwZCix9FpuUN/B xddQ029PuNWudO8ovU4locGdrWriW47fTV5R1+B5pI57X0YsiqHaQ9gQYVJD14eqYwn/ E5zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s80sxpH9; 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 131-20020a370489000000b0069f341ea43dsi6635976qke.138.2022.05.09.05.17.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:17: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=s80sxpH9; 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]:52218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2K2-0005Dv-4C for patch@linaro.org; Mon, 09 May 2022 08:17:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22b-0007Rv-FA for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:05 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:45750) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22Z-0001JH-Mu for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:05 -0400 Received: by mail-wm1-x335.google.com with SMTP id m2-20020a1ca302000000b003943bc63f98so8121477wme.4 for ; Mon, 09 May 2022 04:59:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=7pySLzbCv+tkaUGvN3VNAC3sQSHs+Dm5J6SjR0nFzKc=; b=s80sxpH91V2tjpTaxW7zK5aY/KJHza9mQ1FiaVeT9qCwfLi6mZ5oglve8Ep3aynca3 p1+MnmAhDtcmKJtkE3IeUeB8PoQD9ttItzlUWiCYrZ5fsQSK/c7SvDfgX7ZUiOB7DBeR dzklElN8uZ1xD/M5yo33KxfWX/hQ2lWjmIlQgoG1OrBUkZkwQKhbUxK/7YIXIjCDGYw/ 0k2ndYxnnLXAbEXUuF7l/qRui5w2D9Dv82faX5S0PMyhAH9lgdcvnJzeHO5RC+cJ/t+K NIvsHm2qcoKvmLcnE2jOrE2H0MHwcwaeIqYAdQFPTk1bqdBT3qXsefBpCiNIMV2iSS7n a2Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7pySLzbCv+tkaUGvN3VNAC3sQSHs+Dm5J6SjR0nFzKc=; b=nHi+2Gtq/dirKtEUcCWKXsgt4UkaOI9PBjgfpDhJIQK+eYer6LGj/vncSvKfZbHYIw c53EbC4os/woKb1hl59feO4b8vj0T0ayhlXwlXLwITGbP8wNV+sQhe6LSciwvftRX4hM rcv/YHJbt3eInf4HWoVgxbvZ/DsxirauSwWqVW//yuZfHQLIfnL9nH+Kw/ZHOnZ4NYMs MA/TZfJ8wQEUac6dke831yZZ2um6AOGr+HbUG4EeMCZeR0ETBQ2IhUnLyCIudXTGO0vs be/PkEgH8OCC3bjeW4urOW0pe3OH+CPRkRDbZtjdOqyi2Z9tOz+34iu+ipNtD2xS89mZ dJhQ== X-Gm-Message-State: AOAM531LrijgMagIYwiL4fnjRn/i3iIc+w4ThNB9N0EPEW+OyIlSgRXZ 4YB3ojC3kKpLx6UsyCX6AVgOYoi7zyt4Ow== X-Received: by 2002:a1c:f30b:0:b0:37b:b5de:c804 with SMTP id q11-20020a1cf30b000000b0037bb5dec804mr21958884wmq.166.1652097542369; Mon, 09 May 2022 04:59:02 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.59.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:59:02 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/32] target/arm: Enable SCR and HCR bits for RAS Date: Mon, 9 May 2022 12:58:31 +0100 Message-Id: <20220509115848.3521805-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Message-id: 20220506180242.216785-15-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/helper.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/target/arm/helper.c b/target/arm/helper.c index 37c5e42bc08..b6faebf4a75 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -1755,6 +1755,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; } @@ -1769,6 +1772,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 Mon May 9 11:58:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570979 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3937730mal; Mon, 9 May 2022 05:17:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrIh+b5J6FyZM9KZbi+SmQNeNgUoJtY3acX7I313AYDS9GalcbQsw6s5npUxAEaiJnfjNl X-Received: by 2002:a05:6214:f65:b0:45a:7efc:7857 with SMTP id iy5-20020a0562140f6500b0045a7efc7857mr13057453qvb.17.1652098630624; Mon, 09 May 2022 05:17:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652098630; cv=none; d=google.com; s=arc-20160816; b=VhZ6IyqsfPLHbXQ+gY1OaRHeQoKwpMiMMuI8EcnJ9h6KhN+PZHESSblGEr2JENh7ia hnLpN59hKOntCEMUZtmmpULH38AvtLQhH8d/lspIDNXBdQXAeccP4z3ydPVpbY040Svi Yh9y4M1coH8ybu/9Ig/PoKfKVZBqazxtBmzwRAmdP9JgDkY5yUdZHq96QeYYSzRXlYoj CkvIbCUqvVVlPO4t93mMUHTy35KoJQC0DyaZJlem3yO5hlQm3NhzKzdZvhMl/0Sqs4Yg YcsNuSl4SqZMYmMDqXHjaG6jAzq7V9jMUsFk3DIU2PGruh9oYnKwHw9CgFA9c7sL2o+Q U+kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=h2fvx2tQiDpuY8jz1XT17Zp34OPniFEINsNj/DI0Pqc=; b=XHiAVQQCL3k6updSCeGhktuxnF7hZBp1d6eL7MZvKQeUXocExNkS2FT5hQsyN+3Qsm uRmNcOtLLN92WZam9WDKo6VsU2YG1D/CIjBCXoiS3lhdGsUZ97NB6MWe5fB2n6Izca19 eeymfJLBbh9dlRp0hiOzDJpGyWoY/GRwB6RiJxCeo1PgR5IeSzP9P2fHmuSCniG9ssVS iY7DP9NliywyGWXcSCN0LUbsSAHZA1dN2UaSpymkSPpfRb/3jh/c1MZEW7s1cOvgaVPI NZxWcFWvDan+Y3N/J9lk2QXES1BCvrcqUrU2gKB8cbfxo0vBYYgUexoSmCBJwtOfq7/V 5FKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S5WsTObh; 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 bq16-20020a05620a469000b006a02d2c20e9si8618443qkb.27.2022.05.09.05.17.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:17:10 -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=S5WsTObh; 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]:52522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2K6-0005Py-3Q for patch@linaro.org; Mon, 09 May 2022 08:17:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49904) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22c-0007VR-Ka for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:06 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:45739) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22a-0001JR-Le for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:06 -0400 Received: by mail-wm1-x329.google.com with SMTP id m2-20020a1ca302000000b003943bc63f98so8121506wme.4 for ; Mon, 09 May 2022 04:59:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=h2fvx2tQiDpuY8jz1XT17Zp34OPniFEINsNj/DI0Pqc=; b=S5WsTObh8gIUMIGjrBSg5/qN3xTcHAoUYuWnNiFBEcvGyDxPSn2EY5dJKoP8vZCGVp fp0TtNa07/kiYEiyZxdtlGTsM3oSus5GCOed6axJmlVu688lsh0JIz0+63BToBbCNYjc B9DT1uxNZSveASiNuf1B6T9hjjwRpeS0c0XirK2cQzklztm8pYBa0U/gtKpeol7f+g2m DbiBrlaLg0K0Q0JJtB+f2hoeZybmS/rT5d3VQtJcqQMkK8DD4eq5uU9mCWGP3/xt3apF 7vPxVYnFfZ/+MNz8baau/iiDRQiNP1rpmSqcuizt7x586NHHNEmMaLpNtQvvNsuMlG33 zeKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=h2fvx2tQiDpuY8jz1XT17Zp34OPniFEINsNj/DI0Pqc=; b=4JNSrIi3hXk+UX4c+8eFM58rQ9OcqxYv/HwAISJQOkB8wRjuu8uYErLIxT7jeyYJsC gsVAiaYYCy6CMFj5LniTk9FVX0NTeAu5cnKe5MJTwFhE8QluzmIBV8ZncQYsDMegMD+k 0Ap8sC5moGMJtE28FLemyYawdSu+lxGpFX6cwqi9WchhXI80LkMOu7ge0WlYCmNobpoX qf7w6B2cUD87UQld5N57j+OcWvxmW8UfMGlbDIX4APl+SBFagy4B61UiXgOukJ4EOgZQ LePAIFRBe/KS9euIeAykIzKOef76AxYZwSps0QoQbnXlawSIa5+DjdepAsTjYck0RYK0 dE8g== X-Gm-Message-State: AOAM5328W4jeDKsh9/yigOmPXz+ZLKBX7VmeghpyQfXdptpSICEojGcz MF8S48lh2rRRVoYfcWWb1hxkO/MXlEf5Tw== X-Received: by 2002:a05:600c:35cc:b0:394:7b56:ef38 with SMTP id r12-20020a05600c35cc00b003947b56ef38mr15199685wmq.34.1652097543234; Mon, 09 May 2022 04:59:03 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.59.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:59:02 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/32] target/arm: Implement virtual SError exceptions Date: Mon, 9 May 2022 12:58:32 +0100 Message-Id: <20220509115848.3521805-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Virtual SError exceptions are raised by setting HCR_EL2.VSE, and are routed to EL1 just like other virtual exceptions. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220506180242.216785-16-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 a55980d66da..aade9237bde 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -56,6 +56,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 @@ -89,6 +90,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 c563b3735f2..6ca0e957468 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -947,6 +947,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 8cde8e7243a..0cb26dde7d8 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 2667aaf28bf..652a84cf849 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); } @@ -511,6 +511,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(); } @@ -632,6 +638,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: @@ -684,6 +701,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 b6faebf4a75..4857d2dbb80 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -1863,7 +1863,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) @@ -9331,6 +9337,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)) { @@ -9843,6 +9850,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; @@ -10063,6 +10095,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 Mon May 9 11:58:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570981 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3939766mal; Mon, 9 May 2022 05:20:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7paOIrr2qM+ZUgWLPZsivOBPP2BhJ5QD3j7ekm7lkWaxtEeNWtmkUzIxAF0VjfUugn1k5 X-Received: by 2002:a05:620a:1a14:b0:69e:9090:a7ba with SMTP id bk20-20020a05620a1a1400b0069e9090a7bamr11371404qkb.582.1652098799968; Mon, 09 May 2022 05:19:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652098799; cv=none; d=google.com; s=arc-20160816; b=CIlClvoZ9lDGmIUFM/AGSOY+GQ86djaOYjjGKRqNzAMlBsd2yd4tWKQETJc5UEF30M bS9ap7Kq3c2EIE7hxg9YWCZJ5iCh3Jo5DtdO+rT2HmYtFLf5Mf1o9O4pdE7wfnF4NVdi yhaUYOAtlWZs/9DBbPPRmtOXCSbOMwJ4NH6nxHytClt0o8OnHmHM8lWRJ+R2oHLlGYed SIXTo0rn7gVQPx3J6CtXLJTzHF5dnZBCLolr7cwZ4zxBd7MlD5OVg4TDcX68ubnRw+2b MupvRB+Epr8N93hHjhRbpHf4EopIxa5XmvUcGpxzGM8t84B3BVoqKr6qkwGldVop3a/L PWfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=1JiIEt3yGg5HPcE3kQ4SQjm2oZBNqFx24lYyJ3rca6I=; b=ZR9u3gElMl7xxBMd9aCB4AzfJQprTG0Fo6qS/EUn6nz9Y/ELjjyzmWZmx37Kt5Oj3D xNKuRNvkzdNTqUFBTtFe684Tw8wGd4Z1FvSeDefNUwpPkeTv7Nz9ttQzttirtf4buMOj 3XZX1NjeLKM8eo0/NWwemXZdeswI9jxB1Yc3Kpge6VbivTRvNvp+ZdDQ0uShAt6TQOPS we4cpqyY5k8uqQOYkPph7dEzRktCvFvB9y86XDlCaiXr0Oa9N4XPeoOoJkyfJK4LAQEt f/vDoNt5nGqYzx2cBMT173GIU1To64VDQYitmzeQighCEWP7SDjrn9DVEHyg72F4mxvo LVYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k6a6Fnzj; 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 cw11-20020ad44dcb000000b0045aa9c2d0a2si7179033qvb.161.2022.05.09.05.19.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:19: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=k6a6Fnzj; 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]:60552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2Mp-0002OI-Dp for patch@linaro.org; Mon, 09 May 2022 08:19:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49906) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22c-0007WQ-TX for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:06 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:45640) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22a-0001IW-UC for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:06 -0400 Received: by mail-wr1-x42a.google.com with SMTP id w4so19070775wrg.12 for ; Mon, 09 May 2022 04:59:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=1JiIEt3yGg5HPcE3kQ4SQjm2oZBNqFx24lYyJ3rca6I=; b=k6a6FnzjtuLxRa5xTeEomWQuTq6DPNw8ibtIjtsBC9NZ21odfRDf81YqddlqA5y/xX I8UcBLLPPWON0VfPeNj8QlqiG2sBRjvNhmSOuIsq06f7c7XXj5Dya63DEo9n/jAtB8Ek FLkMEAmw2ub9UNELvGb/P6sSwtiJW03qfxWTY/Bm5VeL5zgMzxiEqX6MNUiHk5ifLhI6 aXgkdvneKrel8+ooN9IfKl0SkKTbXcMbUiFPm8+OstpIhUNPdV6g0V39PxYLGvQJ//C+ vz5Hq0YbzJMccixSZxwUt+KzG7/Ppy5dfjOA0dBpGcdMT5aBIwJC+MxgHco43aSLEzyD 2OUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1JiIEt3yGg5HPcE3kQ4SQjm2oZBNqFx24lYyJ3rca6I=; b=MQ5Kj3oFOnZIEH4a7L2MOKTxf7lcJpbRLLE4hL4T2bd/6nxC4TxyBAxUYH07t5Kl/9 SSAWEPAAqXy83TEdLbngfIFduewe1IlUjR+i2LQySqv147AIMhMJYodlGyQTNaAz8OgN WpwvJXTRBFbAVlsSYe+DgGzQcsGjWO1zZVmxa6mlVXpGcNtxTd+fbz/pis7RzgRqfWeD CmPhlNMQdTak3YovBt5Pxqch8HG/hhoBfOrp0BSjNWpUfYJ+smi2J3PADix7YU7IN+ZI 9S+lU1LCv+nii2F0l0rHjdYrbj1E7OAkR/on+FtqtYiAX4FAj2NNNXzyHWmI4JEisU3J sQbg== X-Gm-Message-State: AOAM530mBWMu3WTytfYvkEh7FAnRHCMeWG/ASWsdhhH2QfqJB0+jpF2y 43DF3F53chQYhklSAMhBFomoTF6z4T1YpA== X-Received: by 2002:a5d:598e:0:b0:20c:57ef:6083 with SMTP id n14-20020a5d598e000000b0020c57ef6083mr13535905wri.457.1652097544166; Mon, 09 May 2022 04:59:04 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.59.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:59:03 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 17/32] target/arm: Implement ESB instruction Date: Mon, 9 May 2022 12:58:33 +0100 Message-Id: <20220509115848.3521805-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Check for and defer any pending virtual SError. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220506180242.216785-17-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 b463d9343bc..b1334e0c42e 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 fcd8cd4f7d9..f2ca4809495 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 78fadef9d62..f21ad0167ab 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 76499ffa149..390b6578a89 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 b80313670f9..5a02e076b7f 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 4e19191ed5c..87a899d6380 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -6239,6 +6239,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 Mon May 9 11:58:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570982 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3939953mal; Mon, 9 May 2022 05:20:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1dM+6npzPjXr01lRJjSI9J9h/j9h13sEO4HlgGpis5Vgsj3vvGL+CwuxAN4Dmr3Q8+kJk X-Received: by 2002:ad4:5be1:0:b0:430:c99:8a87 with SMTP id k1-20020ad45be1000000b004300c998a87mr12993017qvc.82.1652098817084; Mon, 09 May 2022 05:20:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652098817; cv=none; d=google.com; s=arc-20160816; b=aGM/XBWJe6JqxIxS8SYP210vmHlugbTRemQHEQRzr+r3XwebfjCdwnIYnsV5Q2hBID Vuwh9lkGcMmgWw4VQyyHf3EdbRKkonWlj0wvBRk6OQREcM4L3EBra2OUtDUknVlCjJne lPZJmOMu+4FCElCRzJdfjdfoB+X4FErRCWMSaLYs4OF/2B91HpsZp/ert2Li/adfP9lz 1Whwl/Npu93TO3POMVCueGTl0NdnG66By+48DhCzMZWfdsRw/Tlk7hJo6/pIhpoS4lfI kHb5Ff0n9THxR3RGiqjTzUo48LnYUB4RLDCLoakI9l/VEdFoqKelZcmb0RBZLxT3hzsr tpTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=BIbbh4ECZCDM5wPUP3NeE8Zmw3wBRxjd4KnilvrbrYc=; b=jdcy0ClbkXR3ZoizsA7/nF/w4ZBKP+gfqRyHyS9grDGTP7m4PQxe00q1FhgzAc8T4P KWpOHKhjc2xfd/7Ux1BXNYROHmcQjh7paMVjfGmJQBcUv1pMB/l53pHAnG85JHX/cezX OcvuEmAhhmAbcMSHuoWse37bzH2uoLCiyaWJOB3bMhprnsRtrhfWF+85sj/8gaEkDkqA eWbTpm+cz4nu8o590LSIoaJTAcHBsFEiambTOEQd1cVc/q2QWz1fvdrudHr72x/oD4CU YaD3OaSAXqGepiKk9wh7pw1vF1j6SaqLlB1yq62xNhQM2VxUROvQzqrktLKK2ktxB2SD XJJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OmaCwLWE; 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 c8-20020ac87d88000000b002f3b8bfe203si7961176qtd.150.2022.05.09.05.20.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:20:17 -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=OmaCwLWE; 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]:60804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2N6-0002bG-Mm for patch@linaro.org; Mon, 09 May 2022 08:20:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22e-0007YQ-6L for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:08 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:39677) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22c-0001K6-By for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:07 -0400 Received: by mail-wr1-x434.google.com with SMTP id d5so19112727wrb.6 for ; Mon, 09 May 2022 04:59:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=BIbbh4ECZCDM5wPUP3NeE8Zmw3wBRxjd4KnilvrbrYc=; b=OmaCwLWEqQ+U8KN6P9vWnPRQwLuN/khdFN6anC4BYUI9w4U1PSQqNyYKtaTR8nDBBQ Q//Kw4L6085U/EQfb84cUhWIO/sJTUNQ8QUgjf3Se6UXSlVMeksX61TjNWfJpdEBIua8 92i67BUHkpob3rEMs2DBcrrUihCfz5/o04uH9Yb7Gacm0ekydKzO03kcgSfrNYH5xWJE JfYeOywi/4HfR/jXm3hxeEp8HxpCnftPr6af2yMPivqNnumKuRGLa/JGT7s9VQAKLazA u7Gjxtbbx5e7Bz0MpLXjMu2hbEeij73E8vRlKJNdb73AHE8LFRvRv5sc9qAEpe+jK+Dv ISfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BIbbh4ECZCDM5wPUP3NeE8Zmw3wBRxjd4KnilvrbrYc=; b=nbGO2BLRPTMukdlYaJJRVVXHA0bQ2XdaamMz/oxtOe06IKxhMKr9Ws7IJJ7jJNQtIT AUVtkvu2VqdK2GpkeqhEHA2ngCTB0bGXxboSKgjaM4VtsJS1hh+/lL/m/NFoSj1iBdmR CvKdzZ4e2p2m83pnPBlOFzAykfyYI+BXROa+9e0icD8Usbhl0JK8C8Ui8yMNGYuuJ/EP NjofsN7PmTp7duDKei+iTrx4RDsB85Gwun4FzNhd1HzRS+r0KggZQOd1LlFgidKDFEv4 yV1ZuiQvfVyhoSITyQNmA3uAPI70n/IFeJ+edsub3KqYRPf/TyA2T6wIbnAQrwMgi9RY 3TWA== X-Gm-Message-State: AOAM531/CRRCip+yVYUVhbvqoDoe03Lk6tiWVWEK8zMNlv0+vKpXf5J/ DCBx+X2O8s9WL7a24ko/w+vtDCeupnJDUg== X-Received: by 2002:adf:d0d0:0:b0:20a:d93f:e252 with SMTP id z16-20020adfd0d0000000b0020ad93fe252mr13546232wrh.78.1652097544917; Mon, 09 May 2022 04:59:04 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.59.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:59:04 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 18/32] target/arm: Enable FEAT_RAS for -cpu max Date: Mon, 9 May 2022 12:58:34 +0100 Message-Id: <20220509115848.3521805-19-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220506180242.216785-18-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 0acac6347c5..81104080003 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -42,6 +42,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 88d3cef93e8..35881c74b20 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 337598e9490..c5cf7efe95c 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 Mon May 9 11:58:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570984 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3942595mal; Mon, 9 May 2022 05:23:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTQmfXDNtVWA1gA3jcJfx99PViIJ3tPzy35+LtNnUMdv1RHWDlJvgT6JFm4x4ofkAdjeKc X-Received: by 2002:a05:620a:2018:b0:69f:9981:d00c with SMTP id c24-20020a05620a201800b0069f9981d00cmr11282205qka.419.1652099036178; Mon, 09 May 2022 05:23:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652099036; cv=none; d=google.com; s=arc-20160816; b=ZjxHwWefPx2B37JC+Qj3l/QTYNHjluHxL4mR5vQUxjQur0gm4Qm8BXAFihbqruy75p 9CD99DFtBJqgKYwubu06AVxWva7NNMSLl3w3wdjpWiPhdInA4qSMU5dNGQl0Qaq2lA9n xJFEZpQZQrUW8HQwA0bB/4pEamTvAIJ0UykPxcN+CukDp+y/NtNvO0owRgaSnWE+KiKj tNqlt1tLgQIuKm3cog1Z36tuDOsEdNA01MPtOec+bgjj14q10bIU+UnSvMVcqtFPZvQP Xc2ArDzaxxuJw9L6fK77V8c5gKRvNyFHj/kZM2dHqQXZ/Do0RvZxg60nW5gflYMKfGRs yVUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=OhRdJfnini9q7/jjQO5HIr9d+z6cd7iuez+VhkZ7LaE=; b=LZx8qBdz7/uzZG4jck+FrgO3TaFAY7NY/antdFL1/1dWZi53XR+jNBMdPiULv0vwwO RgjphqtVTbRxl8Za/RQKsT2wzSHeA7e+vCL6b99oyOXPGVGhnTBA9IYfSXUFNMEzBwb9 NYTq4jrJI4XS36v0MWQ5YL0BYqx0+gzKnH7ML3fb/YHQtti0ejCPcU07AV+5vaWlzVZw 3SwsXnu+/14nTVelLgmxsYrmePl5SeN6v9L9y8s79ZiWzfEUZSA8KN67K7lh3o1DwY3F O1CwA634z1Zfy5mHIVSdr4mIOuhMDKMA5W6WZ5EmKzgCQWbYtDSiw0VWQHU+LxfQ476t FoQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kEmkA9vK; 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 135-20020a37068d000000b0069f6ce80c0dsi7004101qkg.573.2022.05.09.05.23.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:23: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=kEmkA9vK; 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]:38950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2Qd-00072k-Op for patch@linaro.org; Mon, 09 May 2022 08:23:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22e-0007Zw-Q5 for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:08 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:41880) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22d-0001KE-4k for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:08 -0400 Received: by mail-wr1-x42f.google.com with SMTP id c11so19084579wrn.8 for ; Mon, 09 May 2022 04:59:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=OhRdJfnini9q7/jjQO5HIr9d+z6cd7iuez+VhkZ7LaE=; b=kEmkA9vK4xkoYPXwWkGpx3j3OSYeHGJbvjI2STEhovWpPHgkZXe+yOVysKeT34kFDW pz2MoLeyNIowaTDYaX6gSxmHLPJJIHziDADiiO/nmFakOFyT6RDHpEftT6Tyw+LQvz9A leKlpQhczJkkzv50xroaPz7cECzFBkyF+Du5Au+Vtb6H5REPl20L08yNrl++K4tiqT0Z k5WtCQwOfwrr2zevmsTBaa12COxaESnE2aIrY0l35R2cgcSgWQOhaeHtWJGOsuuM8ZWo fM8KAwF3+8Fis/A/fCcPhADQj6tQZqhFFJPu3IDnFrFf4PV5s+3a1hnrIqEHDFAmq6qd JnDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OhRdJfnini9q7/jjQO5HIr9d+z6cd7iuez+VhkZ7LaE=; b=axuyVYSIU9tyqKJwDgGtLp0KRiuIBGbE/Y2z0oxoYN/MfMO1gn5KAtEsaDg6GDMtor zpohSI4k8yFtFv5WOS9myxQT2yzCbZyIfSGAR1hUz5gYoz5cxX98npgDju7scj0ABRyh xpRwbv5nBImhBS2peCxANKowZ93NifK0CC2ALb+qiDUq1EieINEnM93mjjvamV3ACeE/ lttk74TPgYUjDc4SSV0sS5o6kTK2fIh31LabXQVoiSpb9voUcP2BDgqH8fET/326VT0J F+ULP53yRIFZyEJG1ktGH+0+YPsAzPvYGEZ0zZcIBk1VH1yxwk1jm0WgF7wnzrAnlIe6 VuPA== X-Gm-Message-State: AOAM532nS6C9Yo3hc3awA2EtitGck4ufF9U0JYvNNn6OJic2sREzaKTh 66vpDwCrBkpuDHJEwg+WDkbUXwjYTwC9eQ== X-Received: by 2002:adf:f40c:0:b0:20c:c5e3:7e12 with SMTP id g12-20020adff40c000000b0020cc5e37e12mr4992467wro.1.1652097545762; Mon, 09 May 2022 04:59:05 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.59.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:59:05 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/32] target/arm: Enable FEAT_IESB for -cpu max Date: Mon, 9 May 2022 12:58:35 +0100 Message-Id: <20220509115848.3521805-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Message-id: 20220506180242.216785-19-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 81104080003..b200012d89b 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -25,6 +25,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 35881c74b20..10410619f90 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 */ t = FIELD_DP64(t, ID_AA64MMFR2, TTL, 1); /* FEAT_TTL */ From patchwork Mon May 9 11:58:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570974 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3932859mal; Mon, 9 May 2022 05:11:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYGleD0jDwMKTpnfnG7DlH1tqd1Lj3yDVfUa+eY2gjaf+rZWWnFfCmgmuvQPXE4720OuA9 X-Received: by 2002:ac8:5c4d:0:b0:2e0:71b7:2829 with SMTP id j13-20020ac85c4d000000b002e071b72829mr13988606qtj.323.1652098273416; Mon, 09 May 2022 05:11:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652098273; cv=none; d=google.com; s=arc-20160816; b=qvVYXfLGE4TC3qkZptObEfVRl/uKjdFxWhC7ADJoAPVOuddJmVCFfFrK/SydTaNIS9 I4ZrsPbS87fpLxa7x9PVWDKeuLRV8WBjRTHhklF9xodDzYA/ebZRHBA5gXu2dD88f+5f bNqXCwagXa0a6FmIkB6WeLwklikarrbalw67poLylmL4kxFn9nWwAuE6B4vR3WYNVI1D wc8W9R85MANHqBo6vHd4kOeToH9OEwAGtLTmKLQpAyINP6RIsIk0dDuAJronJ8FSFFkS ePS673KXbt1qjCzvdR4LCzZroxnois07ySnaQ4dg/H6A/lz7hrNphdVIo3wUnCKesC9s gLTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=almVrNVpuLpoIepWO4cILFV+4VahPiB3xxYGOPFdNE8=; b=cfNNAhQKVBuzqxJzXU9YwbVg5yDPkDoMjZexAlMHYq1KY9z7J0AX+8paAZtdIJSEVI r9LWlsxKj6lWYkaYMEOZF8Xy+sbPdego3aZegu/W9Df6bttuxltWsm29OUUPZDbzpFge 5tikXRR/IZ5p043ck1DaUn0By4rSA2I8EWkOufrvcN3zv/V+/BEPxhhVTtlcfR0ePJ/G uhlimUczf5TDABYrag3rcDKxsmG8kOq19Z4w6U0h7TB+jZXtbC+7+lj3yO98Fi8nEbzz ICObs3nseUaGbGS09Q+XsSQuW7s3EHfMxfjG8OF2AlnPV5gtKc7EOrxbXo3arHxEdqb5 f1lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NjffDT3i; 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 g10-20020ac87d0a000000b002f37e72791asi7834510qtb.347.2022.05.09.05.11.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:11:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NjffDT3i; 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]:38796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2EK-0004bB-0C for patch@linaro.org; Mon, 09 May 2022 08:11:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49956) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22e-0007a4-QV for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:08 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:37625) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22d-0001Ga-5Y for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:08 -0400 Received: by mail-wr1-x42d.google.com with SMTP id t6so19116578wra.4 for ; Mon, 09 May 2022 04:59:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=almVrNVpuLpoIepWO4cILFV+4VahPiB3xxYGOPFdNE8=; b=NjffDT3iobI943d2HUI4yACEbIYkLq7x/n5WyxYoWnYJVao3PWpnxQXy0Pj4FZKv6e PmORjCjNvZt+icfquGi+tzSJFg1AHDhxig36AF8VbB1sTkfMATVQW1o2VxU5ETcJQnL9 L0pyhPt/RJ7c7sQ3Ll58V0IF+npwaXurC69tBWBALuJ26nvuraMCg6i3H7XzdUbzXQTJ vKuPyINM8OjPTqLhByAfcx34R3foN9hw0dKta0msnOdY/PJWDvYltXgelRAvQoo+TFTc wDxdvn2fprivszOTVL7Gm2fyOXCeaYJ4tTIUHDBJ0UqODn0sovh7q1poDtKAaLymJ71Y ugKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=almVrNVpuLpoIepWO4cILFV+4VahPiB3xxYGOPFdNE8=; b=CBuLuB4NFjl1CL/Fai2iQ4JdbYFRBi3i5z4XXnu5CNZPioAG+L6k+ofAaDs5AuQxM0 tIwAcvSZnn+FSAM8xGQfwgO877YFmiU47HF6GLQLjZzCxKYuoEj1Q/ZjXbkpxrv+OvS0 JfV23a1iQrTjP5QDHljQpJO68bKecSmTjSKq7LDoHEYKfrHY3xpXz6/lGNKG/v4X4KUR ML6UmmIkJi6Yu9HNg5br3WpiuHVRwmAnK5LmzjWI6oYx2DIj34l6sFL8VTM0cGWgIrue 2z6obZbUYmP5m+iYjL9PTjVsZwWgpofVvJ0bgJJ/vyQVWI5g0nWZDNRyDifS07GxGBs5 BPow== X-Gm-Message-State: AOAM531XMJcPjvQJPaIXdk/qHvVt8fHHYU2aAPxLrcUe6bf/F0msVIn7 qCwNrGTF6bfMLTdmXh2DWSS6xKrxj6PA7w== X-Received: by 2002:a05:6000:1810:b0:20a:d512:96b9 with SMTP id m16-20020a056000181000b0020ad51296b9mr13450377wrh.611.1652097546525; Mon, 09 May 2022 04:59:06 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.59.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:59:06 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 20/32] target/arm: Enable FEAT_CSV2 for -cpu max Date: Mon, 9 May 2022 12:58:36 +0100 Message-Id: <20220509115848.3521805-21-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42d.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Message-id: 20220506180242.216785-20-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 b200012d89b..b2a3e2a4373 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -12,6 +12,7 @@ the following architecture extensions: - FEAT_BBM at level 2 (Translation table break-before-make levels) - 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 10410619f90..25fe74f928b 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 c5cf7efe95c..762b9617073 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 Mon May 9 11:58:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570987 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3945128mal; Mon, 9 May 2022 05:27:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsKES4q63lNOvKCA7YMcc+7DGsX1DTySHKXgDzlrkwpD2W3h9EXtt2NE6tfGqcU5Yp7cFM X-Received: by 2002:a05:622a:250:b0:2f3:cfd5:45aa with SMTP id c16-20020a05622a025000b002f3cfd545aamr9084373qtx.676.1652099256201; Mon, 09 May 2022 05:27:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652099256; cv=none; d=google.com; s=arc-20160816; b=yF1ufnVGFeFAONOCpSVHcGpii9jO5kWcJDUwYLCqamJixLr1dovm/oSf2+vruMyjQ7 UZJlidnH0wAAzOipoPZjxpdx+LDV0TW++YlWE2dsa3RwdEgTtFoQEosyRRflfCjMsAxw 6dL+FiMw3yRU5G1QSv7PJOknYA9nuYdf5o4WMw/rOXCp+oKmJkr7Ihsp8VdWiZz7UZrp hy+mD2C/o0znF+EXOfoDHRgOHLtEs0iK8JAwwztVVs3+K+Zu+LaAg3+rFW0ZJAwvX+JN BwtynskaCZld6CE7TpSDlEJGKvopdvSSnTYIlMvQTs8NAIfTI57+uTkVNxY+ybCtPVgf c++w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=/KwXv4BlDQuOReLyYKnpu/uH4XylEzL/YqcY+RA23x8=; b=SdZ3Lb4bD5617j3W1LrcNePyMvyeEtWPNUUBDd3w7a9wCmMdc6++M6rYZGxaXZlEw1 3VtGpec6f5HYLmyUuchO8ekjJQYfshw94zrZQITvjAVoCN7y9GHfnNTw4DSKML8yc2KM DFZlNSfl6amR+rYTjS/GG8sJ815T7FpLQcnfgfB3rSNg23OAYvhAnd0+CKf2e1/fivMX 0e9E61NeZGYohE/CQyQrLPZ7i2pE8d08NuK3fCBE0HmFbPRwOA6cvauiC0wgf/WkwAFK VNVE9RXeAu+SAZMfQYEapp9xukXU284zP96MLv7/JE3Xa3AZ0OliAcMuuhoTHeRR+TWk Yjwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ETsqwWfY; 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 bk31-20020a05620a1a1f00b0069f0c98d582si7563641qkb.466.2022.05.09.05.27.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:27: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=pass header.i=@linaro.org header.s=google header.b=ETsqwWfY; 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]:46756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2UB-0003xX-Or for patch@linaro.org; Mon, 09 May 2022 08:27:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49978) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22g-0007eW-2J for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:10 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:38580) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22e-0001Iy-5G for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:09 -0400 Received: by mail-wr1-x435.google.com with SMTP id k2so19091116wrd.5 for ; Mon, 09 May 2022 04:59:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=/KwXv4BlDQuOReLyYKnpu/uH4XylEzL/YqcY+RA23x8=; b=ETsqwWfYKvWmDa5OL3G8up9XfzlBpw+oToiaPw4dc4y52V/GFuukZpheq3XgDNUxmn DiaSw4fVg3SBJDypqxr6FktDPxupl0BexD5uKw3YO5CF++5Ejqr1QtYGR1bdRJOnECi2 GnMDy4cZQ9SJz83VDXqYx0PM1dj3nxKNlG49JXqCq26VmU0ZQfuIho+zHJwR632b274u 0c3uhLM5TaCqm/HY9tNGDKiBQ2F1zrbvrBzsqub3deR6JMRS82WQwboAJ0znLQ+30M1c TNBjrylh7cvFaBLN6Z2Aj0aDrxAxZ8rXAGUEoukMoLfg/TtW36jQoAlOzlpyppsQ2NWv SGCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/KwXv4BlDQuOReLyYKnpu/uH4XylEzL/YqcY+RA23x8=; b=pqMq9dFKhV4IkNapyyiAnYx/b4xvGM7covwlpJGUkgViZ8l7UIf1dAdkRUHh1ggDgs VOt5zwgJbd71pYXREo6xU0R0Vwy9tK5NukIogtqd/igU53KoM+taggD5LqjLwMNI2cbo DUQKduQ2PeLnGWUi2aubKGZhB7n0MZbPAloHXHOH7O8RvgZGj26bgBqTg+poQC4Ap/qc tT7PV7IDnb68rZl7179XADLJXnibVwEHFKSnm6WZw3rWzmSAAOkqkYa4gD0VSjrq4KlT 7JYbBHsi/4hUnURAZh7O/HqDaeAOg9bPbUmnWoeQ2wYEr5EfjXtlEdyVl4zrK0FSgFBd /bDg== X-Gm-Message-State: AOAM532fErkVubxGubHstscAmvQi57TbADRKa7qLOeZ0reCvtODfSC// x7Cr6qVNSpIwqLXEuSAtqYCONXwlzIn/8A== X-Received: by 2002:a5d:6d0b:0:b0:20c:4ecb:1113 with SMTP id e11-20020a5d6d0b000000b0020c4ecb1113mr13323857wrq.203.1652097547421; Mon, 09 May 2022 04:59:07 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.59.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:59:07 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 21/32] target/arm: Enable FEAT_CSV2_2 for -cpu max Date: Mon, 9 May 2022 12:58:37 +0100 Message-Id: <20220509115848.3521805-22-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x435.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220506180242.216785-21-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- docs/system/arm/emulation.rst | 3 ++ target/arm/cpu.h | 16 +++++++++ target/arm/cpu.c | 5 +++ target/arm/cpu64.c | 3 +- target/arm/helper.c | 61 ++++++++++++++++++++++++++++++++++- 5 files changed, 86 insertions(+), 2 deletions(-) diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst index b2a3e2a4373..9765ee3eaf6 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -13,6 +13,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 aade9237bde..18ca61e8e25 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -688,6 +688,8 @@ typedef struct CPUArchState { ARMPACKey apdb; ARMPACKey apga; } keys; + + uint64_t scxtnum_el[4]; #endif #if defined(CONFIG_USER_ONLY) @@ -1211,6 +1213,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 */ @@ -4022,6 +4025,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/cpu.c b/target/arm/cpu.c index 652a84cf849..59df597e052 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -230,6 +230,11 @@ static void arm_cpu_reset(DeviceState *dev) */ env->cp15.gcr_el1 = 0x1ffff; } + /* + * Disable access to SCXTNUM_EL0 from CSV2_1p2. + * This is not yet exposed from the Linux kernel in any way. + */ + env->cp15.sctlr_el[1] |= SCTLR_TSCXT; #else /* Reset into the highest available EL */ if (arm_feature(env, ARM_FEATURE_EL3)) { diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 25fe74f928b..07b44a62bef 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 4857d2dbb80..432bd819195 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -1770,6 +1770,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. */ @@ -5800,6 +5806,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 */ }; @@ -7223,7 +7233,52 @@ static const ARMCPRegInfo mte_el0_cacheop_reginfo[] = { }, }; -#endif +static CPAccessResult access_scxtnum(CPUARMState *env, const ARMCPRegInfo *ri, + bool isread) +{ + uint64_t hcr = arm_hcr_el2_eff(env); + int el = arm_current_el(env); + + if (el == 0 && !((hcr & HCR_E2H) && (hcr & HCR_TGE))) { + if (env->cp15.sctlr_el[1] & SCTLR_TSCXT) { + if (hcr & HCR_TGE) { + return CP_ACCESS_TRAP_EL2; + } + return CP_ACCESS_TRAP; + } + } else if (el < 2 && (env->cp15.sctlr_el[2] & SCTLR_TSCXT)) { + return CP_ACCESS_TRAP_EL2; + } + if (el < 2 && arm_is_el2_enabled(env) && !(hcr & HCR_ENSCXT)) { + return CP_ACCESS_TRAP_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) @@ -8365,6 +8420,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 Mon May 9 11:58:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570990 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3948427mal; Mon, 9 May 2022 05:32:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiPjWckIK1TRwUcG6dL0JrfiwNPYGYl1nMV62IrIVnrpgkhgHgA9YNxeML0AiOaBScRK9a X-Received: by 2002:ac8:5895:0:b0:2e1:c997:a629 with SMTP id t21-20020ac85895000000b002e1c997a629mr14274742qta.124.1652099537587; Mon, 09 May 2022 05:32:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652099537; cv=none; d=google.com; s=arc-20160816; b=ZFyrN3iJevE0metthig8sowCQdz/9YiSaAzc6N0qjMoMYIQf3hLtIfMd8xc3mEC/xT v5wbDLbaiQEiudtcC/C4G/dwAXv4BhCgWBvQFkGMqAO+dMM1WvcGR8rh5wlto3sJOo+c lD1WgzB58HJ3LMoXBB3diTMW4xB7p/WNb+QmE0WT+O/oEwc++gstNgq3td8+QJ6z4Z17 2PiyIglbs8eWlx+QaNw9wazqvOQuun3MNK6EuQ6I98aDA3Vy29DEHPRnNjjB/RPzj7Uj qpAl+lpF0vbDQrt5C2IHDq3tVAQW6izclKO0ydcfhcO3Yez+yjK8+BWcl88BKvUyivLI usHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=XpvaNYf3N2LXESEBCGwFXMc1KzcepH0wfVYS4gErJ5s=; b=aiaqTsZdaUteq3lYblJoWv0U7CAPRJL2WIhNbduSZT3yC5ZXguPze8fcn1+MSSf+e/ jX7vTF9PXXf59vJ+HTzHPlJNBzZRcHYCfCQIYQlScyl1EQMpAU5QaKdbcMOp61Jvfay0 l16dXXfXzJpVDcepPPQ5h+mNbHPwwWY2x91UwkxKc5IDce+29eUuIG2YK3ZyKdHTjngs AHUTRtzLforSjG5Xf9ULjMGMzWClx5057OpSGRqDylt8U5nM1wyuT62sOgoa4ZfHcLVW 7juGvI2S9BMoohyh3A+jHP+VbahQRXj3gm8bwF5K1knf8gzMnLgyir260NNpiqpRdWyu rKAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QGVeTiZ2; 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 133-20020a370a8b000000b0069f8dc8f8e2si6975233qkk.534.2022.05.09.05.32.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:32:17 -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=QGVeTiZ2; 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]:56992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2Yd-0002TZ-Md for patch@linaro.org; Mon, 09 May 2022 08:32:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50006) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22h-0007i3-20 for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:11 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:44800) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22f-0001Kn-D6 for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:10 -0400 Received: by mail-wr1-x432.google.com with SMTP id b19so19092384wrh.11 for ; Mon, 09 May 2022 04:59:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=XpvaNYf3N2LXESEBCGwFXMc1KzcepH0wfVYS4gErJ5s=; b=QGVeTiZ2s5Pokafrg3gkaW2/8XM8++JXnXbbVh2kEoXRv09KoV0pR4M/ei1pipang+ nLdEPMv14Ud13sed276zQfP38qDisMH/wFOV5nJSrOsoXpE8VfJtrODMn3CXPxlMyaGC q/3XygSUlMCuiQLqARgSMgsIbUXcxtIgiDX9RKHV93HWGyESyO2UTNIkGUyuC35NG9Rc jUuOBEf1p31VdZt2q6qH8eL9aBvB3npYHV6bEp97xBjHW7ju0XqiD9bzyAtLaPirmVM9 KwCCYXAuxb7IK592w1hmATvuFg3FofsUagqU/DMVDhQIuDM34G/Ml02NBcBjUpy5dqzy UUJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XpvaNYf3N2LXESEBCGwFXMc1KzcepH0wfVYS4gErJ5s=; b=vkvyBVKsiu1TVCSngh3Hd/zjYaR5AheB/12CQ7zlYhB6ecnv+TLU/B3v6Eg9ztgxHg PJJxQhQDFPuV3vIq39CSpg1M5fS+O5wNlB2S2+TSAB3+o/izNUa1HGXROfkgEr5OAtri 6upiWul2Iz0MsMmS3n0lhwFCvYZMNkFQeQNZa7E78e4IVAvTqW8C8E9FSuk+SocnFtDC NrgQkqYYdQ+mTPC+SrL5p75evgt1X/rFLj7oMLtEZx1Q0M5c2vpoXDolZhiVXm+3FzG/ ceDO7UPqQheVzFxU3dOOensU0DUN3OkEt6NOD8AYjo+R5fLf+nQbg9qeesSGHHlcPWe9 +uIg== X-Gm-Message-State: AOAM533TCGiSTIkOzrtNBDI3jjKYxckxKfKPmDyw8nRziJsweQPi/HPB 1WQ32eyUzXulZLjIXhxXowWZg7584AClRw== X-Received: by 2002:a5d:45d0:0:b0:20a:d002:b80e with SMTP id b16-20020a5d45d0000000b0020ad002b80emr13475809wrs.447.1652097548178; Mon, 09 May 2022 04:59:08 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.59.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:59:07 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 22/32] target/arm: Enable FEAT_CSV3 for -cpu max Date: Mon, 9 May 2022 12:58:38 +0100 Message-Id: <20220509115848.3521805-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Message-id: 20220506180242.216785-22-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 9765ee3eaf6..48522b8e1cd 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -16,6 +16,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 07b44a62bef..40f77defb51 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 762b9617073..ea4eccddc35 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 Mon May 9 11:58:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570985 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3942631mal; Mon, 9 May 2022 05:23:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxX9BBV0/C0EskCRb59mOA77zoGOzi+xI1chykwJm4wNj5u2NNyc/AaEjBQM9TyO5fsODau X-Received: by 2002:ac8:580b:0:b0:2f3:a523:98fa with SMTP id g11-20020ac8580b000000b002f3a52398famr14501516qtg.338.1652099039316; Mon, 09 May 2022 05:23:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652099039; cv=none; d=google.com; s=arc-20160816; b=KpzCgQmHV7s8cdlf0nvhhWplV7b2KxwQuIsskiZPzTBc1JVcHCY0IgLkO89PIuq2dS qiopynAYa1/KF1WyCDDyR63qYdlFUlbbNIIl3wWS0/lbxqijt8LpCeOIHZE7rmh/nli7 TZh9BoyGdWwB/xF0304D8g3Xs/aJVZ6+zxKuyDipmoqPPFBorZVC10Lhu3JjRQFeO6n9 u7vWbwUrhWCHQxHMiqkaAAfqVTHoVcRW7Y2YccU//V0O3rJLMChWgKClpyQqVaQIa7qJ kXDEWJLarRnDhZ4hfN3HWBqAucvnwVOPGFR3jj8h/DtvZ0kEoeUeOqg0mxF/IPAoisOp VnGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=+3olo7e85VH/YZ4COonx8SmNnB4UzXRKEotRzbQ80o4=; b=eNbxK0cltYxQ4FwCErA1Y+IFmJe7SoiosIlgkFFoM3HSdnKFeLr1lOp7bSYqKDKJsY v6LVuxLEty+gaGmfQ4zbbQszWBDWNrwo00ZtPkiOll6bCAn6SC9KbJPSGqk/roZxBLRm AXHlYChqfdBGkkm7H1Rdr9zCLRh+DmCO8aaQ65dU7Rvv+THZaUZpOtEUuRBUp8IkXAiT eESOZ5UVRLGvYyCql98jS1dTfgCqzaimyt/c5kI7+wD/57GuEIK0gxGWAf30r9ZKTzKP zK5Q6BT2e3qiC+2MWOoHD/ASjgS4j8vcXLpDF6VBdAReGKnSIeSZKyynEKtZy0Papt4E Q2gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=u5Vj86WS; 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 f11-20020a05622a1a0b00b002f3b5418c93si8026994qtb.208.2022.05.09.05.23.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:23: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=u5Vj86WS; 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]:39074 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2Qg-00077t-To for patch@linaro.org; Mon, 09 May 2022 08:23:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50022) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22i-0007l9-2o for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:12 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:35741) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22g-0001L4-Df for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:11 -0400 Received: by mail-wm1-x336.google.com with SMTP id c190-20020a1c35c7000000b0038e37907b5bso10651126wma.0 for ; Mon, 09 May 2022 04:59:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=+3olo7e85VH/YZ4COonx8SmNnB4UzXRKEotRzbQ80o4=; b=u5Vj86WSM2ffMzDw5tMtLV3nUvfOVVSQzfOE10UVk+jUMtv6oxRPkjkffdPp/rBSKo /gBFbmtUvz+xum5zvwNLny66nLOFytvSb+JqBgDKxrd3Jxz2jp0FH8ul55kQJpbA05+0 BKdlbVPeQsnVmADlvxySPYa7Noh/VKxgdcCvEwOZhTfTqcwHpk43xtsLcGIYDWsyBFv3 H05ZjTiTE+HjVTLMSHc7MmFeOmeAHWtcn/A3FUyBGz0A4NZvK+MaTMFId7/EpUpaPWzx R2Gh81sQ2YmDs+sgt1EyawqWxhUkLvHksdYxtpTvoE8oMFWOK54cojY+RvY0THNYj4ze diYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+3olo7e85VH/YZ4COonx8SmNnB4UzXRKEotRzbQ80o4=; b=6zEWJIzH48lMVhUGGHzrim62ZUS0iPHXI6IeIQr7AkorVEXgE6CAv/b9kvE8h3NaOQ Ea+rGIHdjG+cQcckPZatU1BI6EOiMcYh01O64aC6hRRiNPz+seR2qyE7NlheggbXPBrp Q3uO/bHEuxjqQwjPAkAPyLht1Ir9vro9BzRv3dWEh41XCXvvn5ySINF5HeanYk1AMs8Y 1p53t//CQXiYvpghe4AcEjlOr9LZlGnO0yX7qyNvMU9fV6eL8D2dx8BVtybHKRnv2d0S NX6X9pRDjnvfJDXChX4zixVn/cgn5TyG1NOd+UF7349g63ousTnpC7/mepDjp4buZegw V/pQ== X-Gm-Message-State: AOAM530PlZY01qIInQKa9PAg//4zqqV8ZJK83hfE9YS3vz+gkdNfLdqB 0XfpkawKQbNHHTU0K+DvKQ3SbuWQWmTSgQ== X-Received: by 2002:a1c:7414:0:b0:394:1d5d:27f2 with SMTP id p20-20020a1c7414000000b003941d5d27f2mr15812603wmc.37.1652097549047; Mon, 09 May 2022 04:59:09 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.59.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:59:08 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 23/32] target/arm: Enable FEAT_DGH for -cpu max Date: Mon, 9 May 2022 12:58:39 +0100 Message-Id: <20220509115848.3521805-24-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x336.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Message-id: 20220506180242.216785-23-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 48522b8e1cd..8ed466bf68e 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -17,6 +17,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 40f77defb51..f55121060dc 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 5a02e076b7f..6a27234a5c4 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 Mon May 9 11:58:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570988 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3945153mal; Mon, 9 May 2022 05:27:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyocKDZUXUlpWLYiALxRqTNCOW8KSYFcoDZCp4zyrvWF8SRHjbA/5qDjQG1rhnKmXCuyN2h X-Received: by 2002:a37:b5c5:0:b0:69f:bbe0:b23f with SMTP id e188-20020a37b5c5000000b0069fbbe0b23fmr11378555qkf.346.1652099259009; Mon, 09 May 2022 05:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652099259; cv=none; d=google.com; s=arc-20160816; b=Uhd2yjQykcnZBrpUKvNvUvxgnxyFR5ZP6txlP/+E7gJzKYeFyE/bowXgVbcQwFe/1l uGMDQx+n+oZjws31uK3E10e4m1gt+WagYAkSF5YWVwruHiwKHCx+m0GZyof2E6K6hohr X3StZg+hjyy7i4hE0xRrTzhhDdKgZFd6ot4546EjOMecQT9kPwCAPAxaObhvB0labxU2 IRcGvDHNq3/x5RSvKOtvPgGAdyUm26/ovnMVGmtksB+sAC45zZ/9O6grv1YaZA4jPdV2 nlhMiqgnSG9eBliGqSHTi5xVD5ckTnqydS/IJJt+XG/0pBxNyB+LieoO5AWlV9C9zsem mlDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=/lpv2cPi1QsrCoVR7BqND3LjQ1uLgD1c9+4prWrFMIY=; b=pbAklSiqse3V9F07Uef+nXRsDGy0oi7BF2gIIGdnwno2uYMM13Rna253G40fsdluS8 jc603wYBdb1Gkc0AQ35so/+OtQ6VOIwx3dQHxpr382y3PE1anybDohKSY+vPha2b/QNr tD2Hh1d87BQ/L6MwW4hSAWjtPoBAtTHuXQzpYQAifx8RxGk5QMp2zekkOrxdH4UUv4H9 SklMrNG+KW7wvR6jQv6Oxa+VZepc2BY++Whx4cMzlGJfBxK0D1vNJP48lsz5N+gkYbQm UO+bFnJbmrkwRiqmyERW3LDxVfGn1T2YXEWAd4R0Rsvu0tJ5rQcRKo2/vmiVc4Yfieha AYIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pwhPb6q+; 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 y11-20020ad445ab000000b0045b02b4deddsi2650753qvu.251.2022.05.09.05.27.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:27: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=pwhPb6q+; 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]:46956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2UE-00045J-Hp for patch@linaro.org; Mon, 09 May 2022 08:27:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22i-0007nA-Hq for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:12 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:41880) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22g-0001KE-Kp for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:12 -0400 Received: by mail-wr1-x42f.google.com with SMTP id c11so19084579wrn.8 for ; Mon, 09 May 2022 04:59:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=/lpv2cPi1QsrCoVR7BqND3LjQ1uLgD1c9+4prWrFMIY=; b=pwhPb6q+USsUPLF2lWcOj4E9qkuvs8jSSp1Oantv9cKQZuyYnO9O+j63T99SbUIzZa NHA6NULtqPcxQ8rEeeDLM80nyMOZME5fbNx6K8gnjb1jP3dMb+q41ZP3/Jvrz0a9ITr4 wpHDdyCxnsoGnu1iog32icBgVwO+A61Ij1dSx0+liDA9+3EV3xigibmJi++ia9k8my50 rtfChfdiKVFNisaryl4U/IaXlYqwwbU/oyo6WzRCpIdTrjESsQ7LQe3RI8KcocX/tKqj zkZasA76CLJ6xWub3yKPQxAvl4/9tC4J5PujCxX/AlxHTUWvp1WRQsf3sKqrdhJE1ejR tb3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/lpv2cPi1QsrCoVR7BqND3LjQ1uLgD1c9+4prWrFMIY=; b=OC8tUWvHsntcNAy7STpnwiCkr+Iio2HiYvaXr25FTKl6eS22RMyCyB1ZZEuIiZ4h5g HkuEICTMKvlOi1s4Ro/hC0IUEQ+Fq/vmXXv43lDKvlycP/uxxDIKQgINSpOzhzSFrsBk Tz3JOuVlhZu5Pn1SEjv9fz2n9jx6YbdK1qxEptEP7mLHUD5asFWzyVhZIHF7AHoXr6x1 GhdcxGnk6ts9v/+OvVBFI9z1vF+PW159d4m4jiCxXkiYXb0yc7oHkmfbIS07+1sSyfkV Ux57rxQXCOHeDr/GYn8OtEXMC/M2jIgABQcJubvR6hXUkfk5l148OhXq57HpHTR6G9Hr aM9w== X-Gm-Message-State: AOAM530DHgunWA+7XL8JhRMOS9zLJf5l7VST/ImAoCzZnJyQ4t2dwzta vmP/uqNv0GxOf0CpS/jCFmXC0wwJh8ejJw== X-Received: by 2002:adf:f6d1:0:b0:20a:d5ca:6dc0 with SMTP id y17-20020adff6d1000000b0020ad5ca6dc0mr13811285wrp.292.1652097549900; Mon, 09 May 2022 04:59:09 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.59.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:59:09 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 24/32] target/arm: Define cortex-a76 Date: Mon, 9 May 2022 12:58:40 +0100 Message-Id: <20220509115848.3521805-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Enable the a76 for virt and sbsa board use. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220506180242.216785-24-richard.henderson@linaro.org Signed-off-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 5fe045cbf06..3e264d85af8 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 23874019639..2ddde88f5eb 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 f94278935f5..12bc2318ecb 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 f55121060dc..adfe6b26be7 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) { /* @@ -881,6 +946,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 Mon May 9 11:58:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570983 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3940295mal; Mon, 9 May 2022 05:20:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2Ndb44euwnbHE8rQEo7qMH5wQ9ho1Qdx0Q4x/kzwKxmJ98A+nQBs7JoFrHQqgNpIc2IL/ X-Received: by 2002:ac8:4e51:0:b0:2f3:d85c:4c8e with SMTP id e17-20020ac84e51000000b002f3d85c4c8emr5020112qtw.423.1652098843999; Mon, 09 May 2022 05:20:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652098843; cv=none; d=google.com; s=arc-20160816; b=g2IsBHlWRRk3ZYQjUNIwvWekUxp32BvkDXe3x6I5OXQthpB4E/QA7MN5EdjWZzSQqy k1VyxmqdvYAFUlZ/zJ6Jmwn5Yh9M3AJ9CWpIQz8H8rhuWSTCgm2pZ968N1qWLVOtZEGX grMoz6jzWHzaUdF3fPk2/4Cdy71qRXLzWH7YDXzmdvN0DGPtMkHkaYbPVA4B+II0k9Iw PPt50B40VXiN7o2Ia1v0sEmKuCHrGB16WoA5jx3HmhYKQtMxAQ9T4mZnRu5RUR4xSVv2 ASOMAB7mSzmknFPMPuqs+w8GGbyCDwE1j5Y+QuMozzgusER83f/Q8QnidaHcy4cLGaoU aOog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=gvIVM7y/OILbDxrcgpLmhBrY6fNb+2S83OGiai4zK8Y=; b=oMSI++X9pqUt7XeCFUgYi5/g6Q76uy7LnzMWrgJh+rYx9BEth65mZHBZ1BU7lRshDU nRlmYvyr+kBEY+r2xqbT+c1Caai5hnUKIWviP1fbbSOS/Ldipdg2xCUJJb8OjTF3sy1/ JdtuigryR54hao3Ufia/deCcj6iZn1b5v2mEdEaUuNqpQQgJCq0oDKXv9OwIWt0TBxP7 H+tD88MmZn3YD6JjS6tTOXYN7PCItHGGdfWdhLA2Dbmn6ZxKPZVzIHVWQmJym1VVx4x3 U1j6AbcDx7ftTOcRC/ldxkp8SD7GQymrJ6rwrJIkaLgRrilOEC8E/yPMf6Z6a4Dz8ZLg n7jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cQxqmszr; 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 ay42-20020a05620a17aa00b0069f7c7d651esi8370277qkb.678.2022.05.09.05.20.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:20:43 -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=cQxqmszr; 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]:33162 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2NX-0002yg-GH for patch@linaro.org; Mon, 09 May 2022 08:20:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50068) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22k-0007s3-0H for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:14 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:35730) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22i-0001LM-6z for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:13 -0400 Received: by mail-wm1-x32a.google.com with SMTP id c190-20020a1c35c7000000b0038e37907b5bso10651166wma.0 for ; Mon, 09 May 2022 04:59:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=gvIVM7y/OILbDxrcgpLmhBrY6fNb+2S83OGiai4zK8Y=; b=cQxqmszrPWVCDJHnwbatVfI0y2Qmm/lUY58pI6TPOGFe/PY6d3MM8uQD6snuorfyzk r1eQJHYblAIKi/wgStgRzkHmqpiFl4QZeQ7WcXLs/HLX3mO1PUlbkuctZIT6W9gqJN+D Pi8eZvCG0gxQc/d6qrF9YKw0B9cAMKnNtSfBFaaFvYLoYhgJdqaFEvurXqKWZpyd4/HT WVNMXOs3HhWvasYNNO3tlKvi5S2FuERzsrb+mAh5AJMbzzr9G6Swrv2RDT/3U5jeJHOT RqMDM9v9SzRc5qTYhz2kC+tcHaA+cn3+zjVZujTgeIKOHqVKSCF7ZKzeV8gMI4PiqUsl fKMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gvIVM7y/OILbDxrcgpLmhBrY6fNb+2S83OGiai4zK8Y=; b=OiyqMhgX4JV5TRJkKuzRnIgL3LLptsqIZ+971TCHjXp8Pm/ufUjolNzuzvirtvWJWc TiykXChEwQIG41PW7ravlUWMLMEfC6EqIicDi0qAXrzuczsnOEou4rjtN0QMfAfrbWdO WF4xVSPxzNkHp/9hGsehjzBIqUv5e9gCTGt+foQXPJ6tYeraN8gIVehundvsW1YHjS2o VXsp8nNMD2Y2GL9mDXi0klJMn6ZLy8omzuRzrGyHMxypQJoAOeCua2aKHmtVgR4ZjBEb PfeLa3o3qbiTdCk7np+/OJPt7Bt02Tf5m5mV5aE14fgnjp4wcVjp7YyWepc5neYkPweR 39cw== X-Gm-Message-State: AOAM530D8qs+dx/qA21tv+GS5P96Qc+HvMNNWYCI71Aaf8gsL2IQQnJn NG7RIcF+VMr+gj09GoPvUGkOPVwgdZm+AA== X-Received: by 2002:a05:600c:5105:b0:394:7d22:aa93 with SMTP id o5-20020a05600c510500b003947d22aa93mr14277202wms.107.1652097550670; Mon, 09 May 2022 04:59:10 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.59.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:59:10 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 25/32] target/arm: Define neoverse-n1 Date: Mon, 9 May 2022 12:58:41 +0100 Message-Id: <20220509115848.3521805-26-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32a.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Enable the n1 for virt and sbsa board use. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220506180242.216785-25-richard.henderson@linaro.org Signed-off-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 3e264d85af8..3d1058a80c0 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 2ddde88f5eb..dac8860f2d0 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 12bc2318ecb..da7e3ede563 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 adfe6b26be7..04427e073f1 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) { /* @@ -948,6 +1013,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 }, From patchwork Mon May 9 11:58:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570989 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3947203mal; Mon, 9 May 2022 05:30:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFyhr+qPHb7AAVWdtf90zBN0PX5gPtwEOYqRN0CWpxWAUC7W1YwBB2fkUfZXAenw1q357z X-Received: by 2002:a05:620a:666:b0:69f:bbd4:b9af with SMTP id a6-20020a05620a066600b0069fbbd4b9afmr11161511qkh.11.1652099444213; Mon, 09 May 2022 05:30:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652099444; cv=none; d=google.com; s=arc-20160816; b=WS1EjdvQ3RRhtGI4l77zOlE0DhI2TWEz7aR2gnD2CJqkDenkLRxKol8L4vZayRWg0f j1qfa9IXaIpjUMiWc77JvHpJB940tLgZSHXaFIqiRf910NK46YwNjIK4316lLCzKfVrR LoUs+CMWOouS5fyknsMzgbroiFHAoflqZyueENMs/mK768/7TO8OJvY2VbxUgiRE0clq 9oBggtKgbXufFMUQQBhiWrmTVSAQyqQg0VvF1CgEIpocL0TFtZraqdosNwtNp4b36u/a xIvrVwVZCYSq+Rk1LpvnpbvRQNLL25Q3norLq8vzxSvj8Bd/9ZXjy+psra7fDJz+y4lb 8sMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=CHxjayFyhr5I4QGmzb4c6k5c4ekfbOJ2eilTAyumfL8=; b=BDkydmz8cwAHGX5r1eh1bVO+vhiG3c/Ky41HCxJ0TsQiE7PW1xsJDc5JVMRvRxTgfO VTSU6sGM0ulZyewDPv5p/S7Z0oBK4sWc1YY/X1xrDa6KyLiW/cgv+DY7xvHyFjupxo+i 3MSV7NfWAkPJRrZVI8tu2e0UwknY/AcrI6dM+c46wF7h/sD0wjnbqT/FbW700YImmSsy ywJQYEv4zQn4d6DZflvNlF/sydDVD/Lmt4BW1YJzxm/ZkCy1LIs97u+amPx1rWsdxYAM v8s8g69slJNBtsYQVH0yfLEyxpEaMrODTz3urCv8GQfyqLXRy8Q+QkfP9Uw7dMtlJ1W3 d+pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Yi1lT6Ka; 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 v2-20020a05622a144200b002f35aeef1f3si8098346qtx.397.2022.05.09.05.30.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:30: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=Yi1lT6Ka; 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]:54712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2XD-0000xD-Qe for patch@linaro.org; Mon, 09 May 2022 08:30:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50078) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22k-0007tu-EH for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:14 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:38682) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22i-0001LV-Or for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:14 -0400 Received: by mail-wm1-x335.google.com with SMTP id 1-20020a05600c248100b00393fbf11a05so10617420wms.3 for ; Mon, 09 May 2022 04:59:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=CHxjayFyhr5I4QGmzb4c6k5c4ekfbOJ2eilTAyumfL8=; b=Yi1lT6KanPpBoe+NsJfg70qRGUAcu0QBBSI1m4uXpJUX0f6qsCaNB4P0lKf/Ou8QCP yTf0a5qUPuZapQEIG2SGgNacAqIzV0w6GyttKxFYsdS8P9P2zWWLpehYAqUJvDvvj15H cSxDEFVBPmM0zyioddmjxE9S+cQpU3P8Ck1UywjpqQ2Yfe79GAkHquHLnGd0zp4iB5nD 0WlLU6N31lK9vuoq7NDjQIm3cpKM2ZtmPPQfbLkiAUenFxcjZTg+cL9gA5MwEmI/qbll KXcHi/9AWbOhg8E+KfBrf10Gwxvuf5ek8ULUQsQXr2aaSi+Bl1rwSMlUahBnv3qRIJ75 cArw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CHxjayFyhr5I4QGmzb4c6k5c4ekfbOJ2eilTAyumfL8=; b=540PjjfgpErE66kXBajHeRaSqVE2w+/5f/0rGsbv19qQB/seCy+iu0Oev1YmcOSpqc I4drnaCEYhzhOcBifYCwsnQ8ykSmPC/JL8KDFZakOL0zD24K6Mt50JF6HcvyjavDzvDq BEFzHbWhQDJ/1wF+C2kV33Roq76yW8cqRr1NSE+1x1/wCoU2pmV1DLRStXTH92Eo3ndi Vb5V254Ltwl68OTGxzJGFI690cryVntrEWqAB5Rr9tuztkR1xOuhKMPQYixjgLEdXNZO ISKU2jVH5fBouuv6C3KZftnw6g3w07q824KLoVKTm/if8DvwYlR2Zf+eTKU5lsndgCuu o67w== X-Gm-Message-State: AOAM532zH8Ts2cPOcLGtaQgS9VTYeOZXNIw34IjyQUNhIpunHnhlawcJ 1M8XJp/XMOB3SzhQNpPMXUTsf5xvUcewYQ== X-Received: by 2002:a05:600c:6005:b0:394:7ba4:5e62 with SMTP id az5-20020a05600c600500b003947ba45e62mr14997828wmb.25.1652097551512; Mon, 09 May 2022 04:59:11 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.59.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:59:11 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 26/32] hw/arm: add versioning to sbsa-ref machine DT Date: Mon, 9 May 2022 12:58:42 +0100 Message-Id: <20220509115848.3521805-27-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Leif Lindholm The sbsa-ref machine is continuously evolving. Some of the changes we want to make in the near future, to align with real components (e.g. the GIC-700), will break compatibility for existing firmware. Introduce two new properties to the DT generated on machine generation: - machine-version-major To be incremented when a platform change makes the machine incompatible with existing firmware. - machine-version-minor To be incremented when functionality is added to the machine without causing incompatibility with existing firmware. to be reset to 0 when machine-version-major is incremented. This versioning scheme is *neither*: - A QEMU versioned machine type; a given version of QEMU will emulate a given version of the platform. - A reflection of level of SBSA (now SystemReady SR) support provided. The version will increment on guest-visible functional changes only, akin to a revision ID register found on a physical platform. These properties are both introduced with the value 0. (Hence, a machine where the DT is lacking these nodes is equivalent to version 0.0.) Signed-off-by: Leif Lindholm Message-id: 20220505113947.75714-1-quic_llindhol@quicinc.com Cc: Peter Maydell Cc: Radoslaw Biernacki Cc: Cédric Le Goater Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/arm/sbsa-ref.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index dac8860f2d0..4bb444684f4 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -192,6 +192,20 @@ static void create_fdt(SBSAMachineState *sms) qemu_fdt_setprop_cell(fdt, "/", "#address-cells", 0x2); qemu_fdt_setprop_cell(fdt, "/", "#size-cells", 0x2); + /* + * This versioning scheme is for informing platform fw only. It is neither: + * - A QEMU versioned machine type; a given version of QEMU will emulate + * a given version of the platform. + * - A reflection of level of SBSA (now SystemReady SR) support provided. + * + * machine-version-major: updated when changes breaking fw compatibility + * are introduced. + * machine-version-minor: updated when features are added that don't break + * fw compatibility. + */ + qemu_fdt_setprop_cell(fdt, "/", "machine-version-major", 0); + qemu_fdt_setprop_cell(fdt, "/", "machine-version-minor", 0); + if (ms->numa_state->have_numa_distance) { int size = nb_numa_nodes * nb_numa_nodes * 3 * sizeof(uint32_t); uint32_t *matrix = g_malloc0(size); From patchwork Mon May 9 11:58:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570992 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3950607mal; Mon, 9 May 2022 05:35:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypwQSFdygy5efdzBrQex7ZNUFVTHpgqoOJqkX6BhmdPHVPTDpleNqGBOHSji5sF2Cyh6Mn X-Received: by 2002:a37:c11:0:b0:69f:c4cb:f9f with SMTP id 17-20020a370c11000000b0069fc4cb0f9fmr11437730qkm.216.1652099731860; Mon, 09 May 2022 05:35:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652099731; cv=none; d=google.com; s=arc-20160816; b=dMbOHTZLfYfzaVHn1SuN+lmxMp/VwM1yXwzYZKeKF90L6QejX/v1SgfFu+M6emOkvG uhzvPf80VOCz0qqLJtzwNL2T4H+nzCqKQIyU1tC0H5iEHrhqSp6hkhPa69E8CkXu7bSZ WVisCGz1WFss+LNzT3AtMJbg/sb1bLIIv+0B0GCau/BjQFY1ztjslSpRg5odxfIl/Hrr A+/KM2DeNbCL8uy7Of0ygeuJ8ocdAEcy1FgXR3SzHeo3WhP4soXtSbyzMgUt0UP5UOPN sJDxtx+31ULJuI9q7Gpq1FWTOAN4CDGMo6Vd6P/lWcs8lsrJyZzjdLs4BzN7C/o5zN92 kXlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=YLPDbkbC5BUT53wo2jLeCb34qH34ZBTypIl7O2mGU7o=; b=0R33Xr9GzFCv2y5y5eJm3I3x1PrZ8dGTwFU+4I6qfoEC14iE2iefZMlrzdP1QOs3Kh Tj+81Er8MGG9mK8L8D0nE7trKd3tgi9oG0Z1DnRbJcHvsvhLq2lIZMTTLQ/udhKsJMVq hCveFO0PEttcEGYv3EawqZmgoZxJtMnMgHq3mkIxxYbSWzSdQ3lm5p28IbwlcllPIrki XEk7Zn8ACFYjPHr+klr8+uaeXBPo+X4g9uXkhO1EtVPiKPHgIX//jhIIhHFcQWk6r9rN iUXQg9DOpAky/BDLXjWugnXgQdBrGqbdTZkzIWj0pljez52+Mr0IrMSc+qu0zcyP54aP v8BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jKEKt9mS; 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 x16-20020a0ceb90000000b00440f6b905a0si6863469qvo.109.2022.05.09.05.35.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:35: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=pass header.i=@linaro.org header.s=google header.b=jKEKt9mS; 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]:35328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2br-000709-Ee for patch@linaro.org; Mon, 09 May 2022 08:35:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50082) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22k-0007uS-PP for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:14 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:45640) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22j-0001IW-55 for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:14 -0400 Received: by mail-wr1-x42a.google.com with SMTP id w4so19070775wrg.12 for ; Mon, 09 May 2022 04:59:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=YLPDbkbC5BUT53wo2jLeCb34qH34ZBTypIl7O2mGU7o=; b=jKEKt9mSyDPu2mqArGI5a1O2mZydnsLJEfX7bkpeUBS1gqAnBzymOSwfjlGk+wOIZa kbDa32xe2je0ZCN9VfZF+ppMvtrQmEkvWAHLwk26BFkL4a03GP3YB/qmS2WRw/Bie3y7 bRlia1h6VQYcCjYOXAWdeuqPhh1bfgSn6AhkClYazqcqOTadthW//1aZCMPajEhr5DvW PDRjLOjLBY6isEAzqX79ocly52lJ0zxclTVOquO7DNCPsttHQY0ht5d9YV+IbQMkg2h3 6J4LmfqQgQjpuM5NC/Sb5Hgc8VreGU7/4If86TVvt4s6NgKAUQ2nIhcSmoPigTrekp1t 85vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YLPDbkbC5BUT53wo2jLeCb34qH34ZBTypIl7O2mGU7o=; b=Y9Q71GDK/pwn5jDg7XJPTjXq7YOup2CeFC9feedA5q4HtlS6l8IJwWObfIA3sLPU1j TW/3adOAKXWjp816utoLQOYaMvPOlCBaQVtfW5UHBuWT75g1mHF+0NXUjUu5WxAJwRwy 4AsFcqYqm9jV6YFUq3QNCLTqqXScwfhmfKncvjJYW8a+veApF0H91kB7Q589t4DJpPNV O8Ooeq1PWwQP9PHjeKhJdbpkNzctZkNwTEP6MuAG/Y4/G7aaKMFhbq19D/3Z7apqtFNr +P+scRtYYvQ6eZFibXb7u8aqgUXPVv/s1xTnzZpa5+glPgKUexPenuqvOLD+r2FwFMwz g3Vw== X-Gm-Message-State: AOAM531KUp7Lr2dwETH+rwHzI3f8b3TIMFzm/y60/qVzqqS+2ET8/zRi 4yGS+iyam7aOL4XUvLUeY3qARp2uznwJMw== X-Received: by 2002:a05:6000:178d:b0:20c:b1fb:abe9 with SMTP id e13-20020a056000178d00b0020cb1fbabe9mr9442318wrg.452.1652097552362; Mon, 09 May 2022 04:59:12 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.59.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:59:11 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 27/32] qapi/machine.json: Add cluster-id Date: Mon, 9 May 2022 12:58:43 +0100 Message-Id: <20220509115848.3521805-28-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Gavin Shan This adds cluster-id in CPU instance properties, which will be used by arm/virt machine. Besides, the cluster-id is also verified or dumped in various spots: * hw/core/machine.c::machine_set_cpu_numa_node() to associate CPU with its NUMA node. * hw/core/machine.c::machine_numa_finish_cpu_init() to record CPU slots with no NUMA mapping set. * hw/core/machine-hmp-cmds.c::hmp_hotpluggable_cpus() to dump cluster-id. Signed-off-by: Gavin Shan Reviewed-by: Yanan Wang Acked-by: Igor Mammedov Message-id: 20220503140304.855514-2-gshan@redhat.com Signed-off-by: Peter Maydell --- qapi/machine.json | 6 ++++-- hw/core/machine-hmp-cmds.c | 4 ++++ hw/core/machine.c | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/qapi/machine.json b/qapi/machine.json index d25a481ce40..4c417e32a5d 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -868,10 +868,11 @@ # @node-id: NUMA node ID the CPU belongs to # @socket-id: socket number within node/board the CPU belongs to # @die-id: die number within socket the CPU belongs to (since 4.1) -# @core-id: core number within die the CPU belongs to +# @cluster-id: cluster number within die the CPU belongs to (since 7.1) +# @core-id: core number within cluster the CPU belongs to # @thread-id: thread number within core the CPU belongs to # -# Note: currently there are 5 properties that could be present +# Note: currently there are 6 properties that could be present # but management should be prepared to pass through other # properties with device_add command to allow for future # interface extension. This also requires the filed names to be kept in @@ -883,6 +884,7 @@ 'data': { '*node-id': 'int', '*socket-id': 'int', '*die-id': 'int', + '*cluster-id': 'int', '*core-id': 'int', '*thread-id': 'int' } diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c index 4e2f319aebd..5cb5eecbfc9 100644 --- a/hw/core/machine-hmp-cmds.c +++ b/hw/core/machine-hmp-cmds.c @@ -77,6 +77,10 @@ void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict) if (c->has_die_id) { monitor_printf(mon, " die-id: \"%" PRIu64 "\"\n", c->die_id); } + if (c->has_cluster_id) { + monitor_printf(mon, " cluster-id: \"%" PRIu64 "\"\n", + c->cluster_id); + } if (c->has_core_id) { monitor_printf(mon, " core-id: \"%" PRIu64 "\"\n", c->core_id); } diff --git a/hw/core/machine.c b/hw/core/machine.c index cb9bbc844d2..700c1e76b88 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -682,6 +682,11 @@ void machine_set_cpu_numa_node(MachineState *machine, return; } + if (props->has_cluster_id && !slot->props.has_cluster_id) { + error_setg(errp, "cluster-id is not supported"); + return; + } + if (props->has_socket_id && !slot->props.has_socket_id) { error_setg(errp, "socket-id is not supported"); return; @@ -701,6 +706,11 @@ void machine_set_cpu_numa_node(MachineState *machine, continue; } + if (props->has_cluster_id && + props->cluster_id != slot->props.cluster_id) { + continue; + } + if (props->has_die_id && props->die_id != slot->props.die_id) { continue; } @@ -995,6 +1005,12 @@ static char *cpu_slot_to_string(const CPUArchId *cpu) } g_string_append_printf(s, "die-id: %"PRId64, cpu->props.die_id); } + if (cpu->props.has_cluster_id) { + if (s->len) { + g_string_append_printf(s, ", "); + } + g_string_append_printf(s, "cluster-id: %"PRId64, cpu->props.cluster_id); + } if (cpu->props.has_core_id) { if (s->len) { g_string_append_printf(s, ", "); From patchwork Mon May 9 11:58:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570991 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3949930mal; Mon, 9 May 2022 05:34:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpztgzcg6SmPxQcj75/tBvI2P16Q6LXwkkVgFQVbVDuKPy/VxfJ2YMjTqBie+qPBtdo2HU X-Received: by 2002:a05:622a:507:b0:2f3:cde7:bb3a with SMTP id l7-20020a05622a050700b002f3cde7bb3amr10579764qtx.107.1652099671875; Mon, 09 May 2022 05:34:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652099671; cv=none; d=google.com; s=arc-20160816; b=qDjLnOBFW7T69gEvruTLJvBOfgn2OfgZhtz5CJoVZ2G2WS0qCT8Zcg3AxZVMbClTu3 qOC+7XGof1C/L/pr2j/fKhNh8aZ1X5KEEGxbakocgxcQrubgoS4bjcknfEO0cMfP/oXm nXs0bOMmOu2f1wXVBE3SH2HZp7XbEY1eaGKtIn+3CK47pe/sITBsY6z8Ko0jUadKoEeK LMgRXVKFxx/cP2gMcf/TWhMsYFpdVILE9nXdEgd1udIeGkSXABcXHrzn9FHJjaTT3xTB dzOO+FNh5Knic49B7sDxneuGSpBXAiR8yFgdQzkrlcmDRM2Z4cuiGWcgsh7Hkb0QTK9G Mjpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=/2ZMkN9Xsn+WNKUQIXzmZMqbQpeIw+bxxGpIjA8E3Ao=; b=RrKDDMJBAyY96BWNl86ZnbAJjVHd0NDhywEVPkLNwcLwHqnbDo6poLH+8/6FMKqMbH Thc+oGcvyrdycgtQw6rGCamFmew9eqyynaTzQ6BEO4rgCSYawwZzOCTzZeYcRlIyuAmU 3pN1TLnOml4TdFzRjHWymWOcdWofpTdovnUUflYSrdYYxirJW8J0iR7KWaqn7x6XO9zW B1YJ5/mvhZSuNbqk3iXVVLZqh/eIgNVKfZDXZbuKjNCbmGwBHaUR9YdhpBhpQu5Wuymn TUHDZ4zz7IrQmhTaMn1tVGDFgrpUg5+/GQG44yg862DQtFLnKnLEH/+CmYVw+cOAVsQ9 Ddhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l4ZNMlir; 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 x16-20020a05620a259000b0069fbe5d4116si9391858qko.660.2022.05.09.05.34.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:34: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=pass header.i=@linaro.org header.s=google header.b=l4ZNMlir; 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]:33042 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2at-0005Su-C9 for patch@linaro.org; Mon, 09 May 2022 08:34:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50102) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22l-0007xx-RK for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:15 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:43791) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22k-0001GV-2x for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:15 -0400 Received: by mail-wr1-x431.google.com with SMTP id v12so19069501wrv.10 for ; Mon, 09 May 2022 04:59:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=/2ZMkN9Xsn+WNKUQIXzmZMqbQpeIw+bxxGpIjA8E3Ao=; b=l4ZNMlirTm4jFEKyH1tpc0j3xlzehgGzioDJWL05w9XOgLsaJIeq6w5tszXyD543nZ t7jajeAuCPan9Di0Q2t7NbGHQRxi4Led7im8J2Hjc8tg/DzkzuWLdex8kJyL/+KbEE9z n9Q1DnUkvSv0U0poBmNY7fGVYkwgvoTgjsmZk8VgwdJQCwaSF8LCLKaTA0sg80WHJaQ4 pdcsCfjZPwHveFc9c4DCQLEgAKp04P2Nb/+ILeTyYQtWH01wVC0Q9R1bR3fH2Cg0iUuR ej6x9JtB5uz529eUQob89StfF5Rj4Rk1FEfS+cOnyraA4c7edmaibPZ9lrWOgpJHXCKu sCMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/2ZMkN9Xsn+WNKUQIXzmZMqbQpeIw+bxxGpIjA8E3Ao=; b=auVq7LqxBcujvIN4aQ+LqvkNwiEdhWmYr/Euhyh5tXeETUOSU7IQ5j4DZdMrGJBnSX Lf+x909VcfqTLaoGEGydpXwuM46bq+ehzBZvx591cAZtgNE42GxUJnk55oor+GA+qnkL fRVxA1nHOcdsVock55IAP1JkOYNTKMLywbOzzI/vMP53YFLuUFOuujWyLO2oLhvSXXF1 94obOxsMu5IeHTV5dBk/lCCXi2BEJezeqKh6tsMsLmaQ6UQRn8hMiqXJCc/fi9BwlzbY raVKRA5Bc6d6T5bkzlUNSMs5h8T/jAgsD9b0tMFt/uHYkXMzLEcASF3VVXnTLTFGLkKg e3KA== X-Gm-Message-State: AOAM533bRnkmuUoGgkY5g3QrqpP0lilen1/1+3NiubwVIrY9bZCEexpQ lWclcNdtugEJqD6x3+7234M7qr2dL/8rFg== X-Received: by 2002:a5d:6d0b:0:b0:20c:4ecb:1113 with SMTP id e11-20020a5d6d0b000000b0020c4ecb1113mr13324221wrq.203.1652097553312; Mon, 09 May 2022 04:59:13 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.59.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:59:12 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 28/32] qtest/numa-test: Specify CPU topology in aarch64_numa_cpu() Date: Mon, 9 May 2022 12:58:44 +0100 Message-Id: <20220509115848.3521805-29-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Gavin Shan The CPU topology isn't enabled on arm/virt machine yet, but we're going to do it in next patch. After the CPU topology is enabled by next patch, "thread-id=1" becomes invalid because the CPU core is preferred on arm/virt machine. It means these two CPUs have 0/1 as their core IDs, but their thread IDs are all 0. It will trigger test failure as the following message indicates: [14/21 qemu:qtest+qtest-aarch64 / qtest-aarch64/numa-test ERROR 1.48s killed by signal 6 SIGABRT >>> G_TEST_DBUS_DAEMON=/home/gavin/sandbox/qemu.main/tests/dbus-vmstate-daemon.sh \ QTEST_QEMU_STORAGE_DAEMON_BINARY=./storage-daemon/qemu-storage-daemon \ QTEST_QEMU_BINARY=./qemu-system-aarch64 \ QTEST_QEMU_IMG=./qemu-img MALLOC_PERTURB_=83 \ /home/gavin/sandbox/qemu.main/build/tests/qtest/numa-test --tap -k ―――――――――――――――――――――――――――――――――――――――――――――― stderr: qemu-system-aarch64: -numa cpu,node-id=0,thread-id=1: no match found This fixes the issue by providing comprehensive SMP configurations in aarch64_numa_cpu(). The SMP configurations aren't used before the CPU topology is enabled in next patch. Signed-off-by: Gavin Shan Reviewed-by: Yanan Wang Message-id: 20220503140304.855514-3-gshan@redhat.com Signed-off-by: Peter Maydell --- tests/qtest/numa-test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/qtest/numa-test.c b/tests/qtest/numa-test.c index 749429dd27e..976526e5275 100644 --- a/tests/qtest/numa-test.c +++ b/tests/qtest/numa-test.c @@ -223,7 +223,8 @@ static void aarch64_numa_cpu(const void *data) QTestState *qts; g_autofree char *cli = NULL; - cli = make_cli(data, "-machine smp.cpus=2 " + cli = make_cli(data, "-machine " + "smp.cpus=2,smp.sockets=1,smp.clusters=1,smp.cores=1,smp.threads=2 " "-numa node,nodeid=0,memdev=ram -numa node,nodeid=1 " "-numa cpu,node-id=1,thread-id=0 " "-numa cpu,node-id=0,thread-id=1"); From patchwork Mon May 9 11:58:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570993 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3953931mal; Mon, 9 May 2022 05:40:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6qqcD8c8cndYtlC6lACtPgohQ912Ivhuc0/XjGkDRwPZcz4wxaUTqI4+/RKIbiBLn+SA6 X-Received: by 2002:a05:622a:610e:b0:2f1:eaaf:4a76 with SMTP id hg14-20020a05622a610e00b002f1eaaf4a76mr14028018qtb.1.1652100039796; Mon, 09 May 2022 05:40:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652100039; cv=none; d=google.com; s=arc-20160816; b=WK5wcw++8MXLPoiQn8HOOIBKhaIw2SaAJWydpv4894BlNqgmB3HvY4iy8Ljzalf/VZ GCntyKJQPJ7Gz+vqDvZZC23tJaFPEOaWFGU36XnF3J8jI5DMjQ2n9bsehQoM40T2rlXa j5CXvN+wHgac/BpBkqfE5kWBJpHnfKznqokVnEImHeuUa+flIraKTAB+9dDCbPMic/Zh iYaUjZKxWzA78OkkhrFBTepwLGk2oJJ8GUBnQXBXOHmK2SdjxkjNRhHMbQQFYGWm15oz AXrv6r88GZgHD0wWXoYUqKzwVX5TtD09Rc1aTbvd3zKuYKQCDaAdNpK5CQbuOnGVuWmC kRfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=6W3Bgjhq7uaaxAYbIx+7B2aztwb5IVXKMxHtE0WnVww=; b=xeEufnYGlrvS6vXexsuyfZDYfZhngIbMd2U7+AYvpOApu0cNNdzyDvgl1BgXmRYVUf JJAMPwsvOXB4gY04E0EXMcJkWFVyaBGtl4AgzU0+PNnYOyOuLRZbfNU+wFq71TLkNRyK fkVsoYT3eKWSO8kGtPE3agHx6XPNdAKVC90ys2na0uT3KFmOUwmcxXLMlCixrEZfLZZC C6dUBxvq7nOHEwFkYaCxcEfxJFaLCJRqSjBZlrr/oUUdxHOcRKgnJcXQX4DZ7db1PcUw iRVerF5PbBq5m7KiIE6wDAaO+AihI9TVXEOHUaVQTVAlceKykY4QqUTlRqK6ZD8ICpUC fdgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="CPn8Bn/v"; 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 b3-20020ae9eb03000000b0069f9086a1b9si6981108qkg.144.2022.05.09.05.40.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:40: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="CPn8Bn/v"; 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]:39558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2gm-0001ov-NR for patch@linaro.org; Mon, 09 May 2022 08:40:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50114) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22m-00080v-HL for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:16 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:42926) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22k-0001Gn-SY for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:16 -0400 Received: by mail-wr1-x436.google.com with SMTP id e24so19108668wrc.9 for ; Mon, 09 May 2022 04:59:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=6W3Bgjhq7uaaxAYbIx+7B2aztwb5IVXKMxHtE0WnVww=; b=CPn8Bn/vAYWKn46fra/DRUcRidfnJryBmxNl0fvRCsXtffs50QG+/N0qbv3ncn7d1O jnjvuaD8ouB6A8jyBx08uvlZ4lfPEWfauxhJ7HOMQVFeYWB/R84XOw1rwWdmCxD8EkgM kQ3fsO8JDHWQxOiunUE55uJGoKfQt22o1X99bfyoClewSaABTgh+5+rq4v1/CJ6ESguy DBeJma18ICQ3f2Gui+wrepq3sE8iQok63takUTdqQPywp5KSDJ4mTo6NN2oDdGg3UkXA N3DwVNyCjOgbcBpAuBuedhNIDK8YRzZoDj06kV62M5rTSn7Fcq7Oe3psX5WZbjExjKtf gSpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6W3Bgjhq7uaaxAYbIx+7B2aztwb5IVXKMxHtE0WnVww=; b=dlGc4onaubhUi1k93ogPupjhjBpG1eTmyqocPR30ForiMAx93KPwNup96MEZ5cYR/S NNrkvzLg+kVrRKIkPtwd7TAu1k1yF7UYPUKm+vF+yabikMojhUT6hi5uN/E4kwo8wY9c xdadRqz4d6iZInaMLks+DLCsoq9ZZj4yXvTVgAaz+GdSnV7KXvblc+KDSqLFdO3cDSme lzp1khG/ZV8RCWeKU73pJUJzskvwKANWoFORSuaVTkW/ADGQw0i7qhAIVMjcrKOJ7XhM dHwLyljO7uSZaJ+mkeo2lUZHW8CYUOp5Z8WPMVJ9nWCkBvHbsWv970tIgwB5/5xwaIkS 3NvA== X-Gm-Message-State: AOAM531Yn/pA0pemELecIbClI63KrEb7cC422GAVBsGfhwFbMzGdh/bF YrKry+fN15X2+1ixDQHlemzdwUWqOxfI2Q== X-Received: by 2002:a05:6000:1f91:b0:20c:d301:2a57 with SMTP id bw17-20020a0560001f9100b0020cd3012a57mr229462wrb.400.1652097554161; Mon, 09 May 2022 04:59:14 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.59.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:59:13 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 29/32] hw/arm/virt: Consider SMP configuration in CPU topology Date: Mon, 9 May 2022 12:58:45 +0100 Message-Id: <20220509115848.3521805-30-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Gavin Shan Currently, the SMP configuration isn't considered when the CPU topology is populated. In this case, it's impossible to provide the default CPU-to-NUMA mapping or association based on the socket ID of the given CPU. This takes account of SMP configuration when the CPU topology is populated. The die ID for the given CPU isn't assigned since it's not supported on arm/virt machine. Besides, the used SMP configuration in qtest/numa-test/aarch64_numa_cpu() is corrcted to avoid testing failure Signed-off-by: Gavin Shan Reviewed-by: Yanan Wang Acked-by: Igor Mammedov Message-id: 20220503140304.855514-4-gshan@redhat.com Signed-off-by: Peter Maydell --- hw/arm/virt.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index da7e3ede563..c25023a083a 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2562,6 +2562,7 @@ static const CPUArchIdList *virt_possible_cpu_arch_ids(MachineState *ms) int n; unsigned int max_cpus = ms->smp.max_cpus; VirtMachineState *vms = VIRT_MACHINE(ms); + MachineClass *mc = MACHINE_GET_CLASS(vms); if (ms->possible_cpus) { assert(ms->possible_cpus->len == max_cpus); @@ -2575,8 +2576,20 @@ static const CPUArchIdList *virt_possible_cpu_arch_ids(MachineState *ms) ms->possible_cpus->cpus[n].type = ms->cpu_type; ms->possible_cpus->cpus[n].arch_id = virt_cpu_mp_affinity(vms, n); + + assert(!mc->smp_props.dies_supported); + ms->possible_cpus->cpus[n].props.has_socket_id = true; + ms->possible_cpus->cpus[n].props.socket_id = + n / (ms->smp.clusters * ms->smp.cores * ms->smp.threads); + ms->possible_cpus->cpus[n].props.has_cluster_id = true; + ms->possible_cpus->cpus[n].props.cluster_id = + (n / (ms->smp.cores * ms->smp.threads)) % ms->smp.clusters; + ms->possible_cpus->cpus[n].props.has_core_id = true; + ms->possible_cpus->cpus[n].props.core_id = + (n / ms->smp.threads) % ms->smp.cores; ms->possible_cpus->cpus[n].props.has_thread_id = true; - ms->possible_cpus->cpus[n].props.thread_id = n; + ms->possible_cpus->cpus[n].props.thread_id = + n % ms->smp.threads; } return ms->possible_cpus; } From patchwork Mon May 9 11:58:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570994 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3954783mal; Mon, 9 May 2022 05:41:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxStstUra7J3+bJPqMNa4W5YgrXbR+vsHot0bAX8+auWt7Kz+IV/YtbfhoKOwyVEvPmn+Ci X-Received: by 2002:a05:622a:610e:b0:2f1:eaaf:4a76 with SMTP id hg14-20020a05622a610e00b002f1eaaf4a76mr14032090qtb.1.1652100104324; Mon, 09 May 2022 05:41:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652100104; cv=none; d=google.com; s=arc-20160816; b=mHyrlZSSuKGZAxifGnKQtHG9GIPX/5xkdf9YQ/ggpYiO61M1/Bs6wwH+1xdHVlE6Fd lq9DS9AJkiv1sdIA6TyIAIzGcBt7Dc4JEAicquuMXgLCusc2hVljMGppn6F3SH65R5sQ 8bJuHg009TuupE6EK1ooUoWS+wMafqai6azPLl+YO3/u7uAKedgJUibHO5BL6N7npG3e /NFGQ0lfX4HZ72dp5Pb4mbnFLYfC0c7/N2fKDIY7DMNex5H28GJvkj7rIwNn7+L8r7X5 /MPPU8au+a67x5aiQ6SQ5tM7+mw7tGNkT0Tg8Sbf9Pkq57E2dQQpYY3xW8CGJrmrUNFB VN8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=egnDhnogUFgFI8NqjtDufQtOvQlPRiqNP9maTORnA4Y=; b=JiP9P1IPvXB1sCFCfbqPxaJ9MMencY2828TsxXA9NCW/vMX6HzUJ7Ox/eUTLVNM5LZ it3vwsZyeo0e3T0/NLbe+zeJ7Sa4fhBJjgfD7chbZm+DcJLVlC4FPulJSCT7WQsCv0NN UFWb582wsVf4iTbBNNsxsEDznuFzvsjkAbrxj3FtVVVu52hbywKVdYLNG3gTwESwxSly 8TvNjdqxvRk6dkhlfLhvsDtT9nJUP0byQ4y8iOo3QL9UquypoYs3mZfZd5V27MZvoTlR a1UnoekxkjkD6feZjCe3hRMxeAKHxgXIxKPbTxhZQjevBFhfdsmcVRrCgAn5pOnRppRH gVrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xARfycHH; 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 o22-20020ac86996000000b002f1d3ebacb5si6247513qtq.703.2022.05.09.05.41.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:41: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=xARfycHH; 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]:42068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2hr-0003a2-FJ for patch@linaro.org; Mon, 09 May 2022 08:41:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22n-00084Q-L6 for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:18 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:35697) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22l-0001Gm-TB for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:17 -0400 Received: by mail-wr1-x42d.google.com with SMTP id j15so19134476wrb.2 for ; Mon, 09 May 2022 04:59:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=egnDhnogUFgFI8NqjtDufQtOvQlPRiqNP9maTORnA4Y=; b=xARfycHHZW+7WWW36+c73ICNdjD0DN00UKN9s+aaJfKMEmkXmMvdPYKrRPIiL1svKs 0k0qNgaw7N4XM4yyEhnNgV1FF7J74WN/eaIyGM5Hq511Fmj+/mKBMYzZnjd73xw7vA+L w3CUHNaGdHJKVXW+HV2l+jR1hoxqjAq1oFBIGXOikFFked0x3Ru2/vyPWL2GMrU3JlAl kJthWaZcpNISn9vlR3qfDQGck0ZDRGu0shuwFJb5+cSnqA2Tzo1ZImg6F6JNlIDDpGXh /vo/RYpF1fF59CL/F1lLJKBY0Kd8llJstW72+dbXkqKuqNu3JloADEwpFDlr1m7tMOFd YE1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=egnDhnogUFgFI8NqjtDufQtOvQlPRiqNP9maTORnA4Y=; b=hxVgyIIes7lhZ+BlX996RPr/a6FaftoEdbEAu3f38slW9+Tw1I3fueoQSt2uXaFmTL 8wsw42WK2oGJc9bz5kX8Qm4/9T/Kju1Xeb0fCelct7TD2XE2DKGRXbe+pUOJMtknKc/P kAz6dGHYpz2f7XK3WLCGZmcQdkFwrQt6NyIsWEqf7UgiIAiXkuO1u+ukeVd+/92IvQsx Ixl6hQBe2RaviPrQRBZi+f+QmLlS99qX/Xv42962oUde30dqbbBeGYTOlx5G5kMlXFHN UFp1zJpd0amAQ6zYpQSkv3uVV/VxMsylMgr3vL3h5yO4ctRac8+DwOgrcqZcqsfaASMJ WPfQ== X-Gm-Message-State: AOAM5326vdwwsy7tZ8lbXzRghLH/WjaLPi6hZCXb5bl9CF6et0sRQ8XL 21Uj+KHpqTOIFjJrJpYUnM0chkLyHcUO1g== X-Received: by 2002:a05:6000:2ae:b0:20c:57b6:32e1 with SMTP id l14-20020a05600002ae00b0020c57b632e1mr13351598wry.285.1652097555057; Mon, 09 May 2022 04:59:15 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.59.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:59:14 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 30/32] qtest/numa-test: Correct CPU and NUMA association in aarch64_numa_cpu() Date: Mon, 9 May 2022 12:58:46 +0100 Message-Id: <20220509115848.3521805-31-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42d.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Gavin Shan In aarch64_numa_cpu(), the CPU and NUMA association is something like below. Two threads in the same core/cluster/socket are associated with two individual NUMA nodes, which is unreal as Igor Mammedov mentioned. We don't expect the association to break NUMA-to-socket boundary, which matches with the real world. NUMA-node socket cluster core thread ------------------------------------------ 0 0 0 0 0 1 0 0 0 1 This corrects the topology for CPUs and their association with NUMA nodes. After this patch is applied, the CPU and NUMA association becomes something like below, which looks real. Besides, socket/cluster/core/thread IDs are all checked when the NUMA node IDs are verified. It helps to check if the CPU topology is properly populated or not. NUMA-node socket cluster core thread ------------------------------------------ 0 1 0 0 0 1 0 0 0 0 Suggested-by: Igor Mammedov Signed-off-by: Gavin Shan Acked-by: Igor Mammedov Message-id: 20220503140304.855514-5-gshan@redhat.com Signed-off-by: Peter Maydell --- tests/qtest/numa-test.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/qtest/numa-test.c b/tests/qtest/numa-test.c index 976526e5275..c5eb13f349f 100644 --- a/tests/qtest/numa-test.c +++ b/tests/qtest/numa-test.c @@ -224,17 +224,17 @@ static void aarch64_numa_cpu(const void *data) g_autofree char *cli = NULL; cli = make_cli(data, "-machine " - "smp.cpus=2,smp.sockets=1,smp.clusters=1,smp.cores=1,smp.threads=2 " + "smp.cpus=2,smp.sockets=2,smp.clusters=1,smp.cores=1,smp.threads=1 " "-numa node,nodeid=0,memdev=ram -numa node,nodeid=1 " - "-numa cpu,node-id=1,thread-id=0 " - "-numa cpu,node-id=0,thread-id=1"); + "-numa cpu,node-id=0,socket-id=1,cluster-id=0,core-id=0,thread-id=0 " + "-numa cpu,node-id=1,socket-id=0,cluster-id=0,core-id=0,thread-id=0"); qts = qtest_init(cli); cpus = get_cpus(qts, &resp); g_assert(cpus); while ((e = qlist_pop(cpus))) { QDict *cpu, *props; - int64_t thread, node; + int64_t socket, cluster, core, thread, node; cpu = qobject_to(QDict, e); g_assert(qdict_haskey(cpu, "props")); @@ -242,12 +242,18 @@ static void aarch64_numa_cpu(const void *data) g_assert(qdict_haskey(props, "node-id")); node = qdict_get_int(props, "node-id"); + g_assert(qdict_haskey(props, "socket-id")); + socket = qdict_get_int(props, "socket-id"); + g_assert(qdict_haskey(props, "cluster-id")); + cluster = qdict_get_int(props, "cluster-id"); + g_assert(qdict_haskey(props, "core-id")); + core = qdict_get_int(props, "core-id"); g_assert(qdict_haskey(props, "thread-id")); thread = qdict_get_int(props, "thread-id"); - if (thread == 0) { + if (socket == 0 && cluster == 0 && core == 0 && thread == 0) { g_assert_cmpint(node, ==, 1); - } else if (thread == 1) { + } else if (socket == 1 && cluster == 0 && core == 0 && thread == 0) { g_assert_cmpint(node, ==, 0); } else { g_assert(false); From patchwork Mon May 9 11:58:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570986 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3943028mal; Mon, 9 May 2022 05:24:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxE+ocJSvMdxVVB7OtBqTpy4xWXe2g432RHfyA6yX+KGyvX8nCWZQcaTpD3gfHXKbzNfsnJ X-Received: by 2002:a05:620a:2590:b0:680:f8c3:582 with SMTP id x16-20020a05620a259000b00680f8c30582mr10998400qko.723.1652099070490; Mon, 09 May 2022 05:24:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652099070; cv=none; d=google.com; s=arc-20160816; b=ZPy2GdnH8w0/J7A40D08ohbBqrSH2zwaKbfu+uONyKFpyuaX6Fb2a+up5vE3/P8ZUI P4J5XHoO6N2rCJC6DG74BNB2c9AW5A5KgYNi0N31WMZcpJ7LzjlYBtHd1r9wmk3M6QX5 Rh5QIzuk72DTRy28TeFIV9VStrYmRScPI7O2MgQ/8w1LGqNzQhtj5Sgg5sqbq30p+wmR aXT/85aDAtnVYlraWA8Bl2OHUWGk3Rc0dmfhip+zyImwiYlP7/rlgWjVRD05NeyoMTV9 VxE+NKocA81oY3ItMhCMXotm0txOyR6WRtTviHy6vGv+rqlDjB+5UsfzKjbb53EZo/Xh 6Fzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=GAKojUArTipjlz2CUBGk94csiNAnp/cdOHeIZmJ/G7k=; b=nLp7jWYIuJHsirEqonWDc5jBQ5lNKRX4xCu6N1aKl3uEVfpbxlUOXP8Iw0L63aunPM +DgvCY2V+x75NuCVhnjZ2mq3CLUS/JVvuNR+HCJ+pwN5x86bIMbYOsiPzcu0OzYxKCsH 3RL+DKcpokRV5TfHVmpdDgzj5TDIV8fK6+ICvLJcQrN8HpIM3HS9LbkjBBuHDpSSUxA8 cMo10J1OokiElH/CJOO9ZkWrCUZ/DQlLFKS7089T1uSBKuovpXYRHgxdsILeD28AmOQa 0mVFOye0y/DNxOWgUf8WCJlEcm+R1luSQNHT1zbnZWBQ/uX+yvPJtNjNiUmW09Dq3n5w RPQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a6suQOZd; 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 w7-20020a05622a134700b002f3d5a78975si2517044qtk.724.2022.05.09.05.24.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:24:30 -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=a6suQOZd; 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]:39746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2RC-0007Yn-16 for patch@linaro.org; Mon, 09 May 2022 08:24:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50158) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22o-00086r-U2 for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:18 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:39715) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22n-0001MO-C1 for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:18 -0400 Received: by mail-wm1-x332.google.com with SMTP id 125-20020a1c0283000000b003946c466c17so47404wmc.4 for ; Mon, 09 May 2022 04:59:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=GAKojUArTipjlz2CUBGk94csiNAnp/cdOHeIZmJ/G7k=; b=a6suQOZdhGln2FMk/CT5buKH0UElF3/j1XNo9et4bw33WoQtHs4W0LXGF2Nxbi38Nv QerNQEpYthuSNLAfG33r2xsoUC9758SOHyGsAwgDGkypkmkq2DBN+iTmH5tgKzIqro+A epWR1XBsRnX7cf5rHiwEWDnzjx2wo96AVSS4FjWJPfyfLEohlzdljuFp0qcovJeWUs4j /XlxKatr/9HIgPLH2md2hYz+NbPcWy6DJG/s12nCCZCKed+D2N1mJwtP2U81wo/2JsyK +9au6IS+aoQLua9+xgTApDvN7QojDaN6vu2hV8fZWE0LrPxNzvEKvKrrIsibFbFXX4Ep 60Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GAKojUArTipjlz2CUBGk94csiNAnp/cdOHeIZmJ/G7k=; b=3OHzU8sEUsLhuK9TqGByiuLXNrrN+GQkv4IEslA6fsBfLgLTxjm+NpTmnqKiOFGNHB +zLaHhXhqDw8l525HxrX3fYNtk4jdzSfplSb1fyL1YKPTQGbe0wBp39aqZe19uqxaAXc m0GR5q9f1Yze00btmwEiOJcDJwndIL2HYauAKUYeUShg8PoQ2/uWcc61TPiopT/FdrGH crC7EqqEUr+CkMwGeRttLMuyOhvfC1Ah/yGb/gx+JUhYlFrRMZM5kFnHAD/D32tpt98L HDgJOItX8SndP4mUQNOVjCtD+z0hD0N0sUMwPtNRM5L0wtH0i6/RqNaIMhTqRonZSEKr Gm9A== X-Gm-Message-State: AOAM5333ThC4wrKKWfYAUkDM30Rrfv8kCUKyCpnNY1QGlI+eRWhyzyeW kp4w7kPz8YxrXO/Bv4CzZH/3HjtM/5sF8g== X-Received: by 2002:a1c:4b12:0:b0:394:3558:a95e with SMTP id y18-20020a1c4b12000000b003943558a95emr15556137wma.147.1652097556035; Mon, 09 May 2022 04:59:16 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.59.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:59:15 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 31/32] hw/arm/virt: Fix CPU's default NUMA node ID Date: Mon, 9 May 2022 12:58:47 +0100 Message-Id: <20220509115848.3521805-32-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Gavin Shan When CPU-to-NUMA association isn't explicitly provided by users, the default one is given by mc->get_default_cpu_node_id(). However, the CPU topology isn't fully considered in the default association and this causes CPU topology broken warnings on booting Linux guest. For example, the following warning messages are observed when the Linux guest is booted with the following command lines. /home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \ -accel kvm -machine virt,gic-version=host \ -cpu host \ -smp 6,sockets=2,cores=3,threads=1 \ -m 1024M,slots=16,maxmem=64G \ -object memory-backend-ram,id=mem0,size=128M \ -object memory-backend-ram,id=mem1,size=128M \ -object memory-backend-ram,id=mem2,size=128M \ -object memory-backend-ram,id=mem3,size=128M \ -object memory-backend-ram,id=mem4,size=128M \ -object memory-backend-ram,id=mem4,size=384M \ -numa node,nodeid=0,memdev=mem0 \ -numa node,nodeid=1,memdev=mem1 \ -numa node,nodeid=2,memdev=mem2 \ -numa node,nodeid=3,memdev=mem3 \ -numa node,nodeid=4,memdev=mem4 \ -numa node,nodeid=5,memdev=mem5 : alternatives: patching kernel code BUG: arch topology borken the CLS domain not a subset of the MC domain BUG: arch topology borken the DIE domain not a subset of the NODE domain With current implementation of mc->get_default_cpu_node_id(), CPU#0 to CPU#5 are associated with NODE#0 to NODE#5 separately. That's incorrect because CPU#0/1/2 should be associated with same NUMA node because they're seated in same socket. This fixes the issue by considering the socket ID when the default CPU-to-NUMA association is provided in virt_possible_cpu_arch_ids(). With this applied, no more CPU topology broken warnings are seen from the Linux guest. The 6 CPUs are associated with NODE#0/1, but there are no CPUs associated with NODE#2/3/4/5. Signed-off-by: Gavin Shan Reviewed-by: Igor Mammedov Reviewed-by: Yanan Wang Message-id: 20220503140304.855514-6-gshan@redhat.com Signed-off-by: Peter Maydell --- hw/arm/virt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index c25023a083a..1a45f44435e 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2554,7 +2554,9 @@ virt_cpu_index_to_props(MachineState *ms, unsigned cpu_index) static int64_t virt_get_default_cpu_node_id(const MachineState *ms, int idx) { - return idx % ms->numa_state->num_nodes; + int64_t socket_id = ms->possible_cpus->cpus[idx].props.socket_id; + + return socket_id % ms->numa_state->num_nodes; } static const CPUArchIdList *virt_possible_cpu_arch_ids(MachineState *ms) From patchwork Mon May 9 11:58:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 570995 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:66c4:0:0:0:0 with SMTP id x4csp3957338mal; Mon, 9 May 2022 05:45:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXx4y77eyBII9o/mZZi7oBVl/pMjn5xjZh1dzvW/QdU00pjWdzaXhOLUPDQQgZK9OKbj/Y X-Received: by 2002:a05:620a:2804:b0:67d:1e7b:b528 with SMTP id f4-20020a05620a280400b0067d1e7bb528mr11504089qkp.193.1652100314803; Mon, 09 May 2022 05:45:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652100314; cv=none; d=google.com; s=arc-20160816; b=NF5dTzM3bFiVsoRo7wxRR6cDzO/TQc7D0PAWdk1YuMbgDvEjFc0w0ZVWRMeEiuWukX M9WrRcVlYhSYsnbnz9UfgXv2OT52NmuCma0eYpCMwPKqB9mmUmRLewFuBtp8esTzC3YQ cziT/E4NWNEO6vAgqnO4FyrbDNZUIneWkud2coVlD6X3+rhLvud7pxvkb58Zoqwcq41n ALETn8mJ55LBY85a6Wc2wBmGXCiz3dDdhl7oZ658PXICaMuJDM7mJel3HXm/by4pPeZM ibV1A9NnV3+e31lfR4YAjHCUMI9eQSzRxFKjVDm+I7Zx8mc115hu4G1wGAG4US7AbU7p ZzZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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=aYXIZAfUyumvHztGuBmfJ493wl1SWQhTJkN41sNVXpo=; b=Uj+MzkyLkgIcQTbye0aazTghJhiubqKwdPPKiVzynIu1lKAwVD2azD46jWGd12caKf Ro/r7p36WWHJ1SDRiZ5rKNQJY1GOiFugqv1wXMeM/uGB3Ow8luP0xDutB8YZnau3mJxt RuxklxH5NAUE8AAELvu6cvGyl150uPBxxv/arB3g3wDDANWclbYrGZuIgLcbLFCN3xYi cyzyOjuAiNwwTb7DSe9WIhneGe7dDU5tkbB+g7iBFNlXl6L6fUMBCc2fQvplqru5CbUh PMW6CYTmuwoyRgxBj7ayCs5hS/ScxwTcf63LhSORFDGvxnRCQ39Z44H1ed4DMmYABvK+ Ti5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=daBMO3S3; 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 bq19-20020a05620a469300b0069fbb393062si8272731qkb.654.2022.05.09.05.45.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 May 2022 05:45:14 -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=daBMO3S3; 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]:50632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1no2lG-0001fn-Cr for patch@linaro.org; Mon, 09 May 2022 08:45:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50166) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1no22p-00088B-GK for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:19 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:42926) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1no22n-0001Gn-Jv for qemu-devel@nongnu.org; Mon, 09 May 2022 07:59:19 -0400 Received: by mail-wr1-x436.google.com with SMTP id e24so19108668wrc.9 for ; Mon, 09 May 2022 04:59:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=aYXIZAfUyumvHztGuBmfJ493wl1SWQhTJkN41sNVXpo=; b=daBMO3S3dZ0hlNjXy6GD80QDKPKSa9jz99hOUzLdyJdahyZqnsoiAi1OE+TCP5++HM L3a6jGkhKL8duPBZj1l+42jLbtgADJol6Kh/EqfPjeMKyjdcwnqtFIssCHLDClnCEJnT gUwLmbiUdQ/GIS46z+aBaCWqL/UsEwyGxeF3+XDIWvDH7cn3RsPqg53Eso5RNAY6tcI2 PjWIGwUHueFRoGIjHxFxlT4oaHsYgeojg3XcEzf1hhFDa6fF9ESJ63/4Y3xPdYw2BNZh uPnk62ojcTs5S5FFlZTV48wWrqPo1NNQf0HN8/LcU78vCvw5wdaH9IoyS7E5Y56/z7DG snhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aYXIZAfUyumvHztGuBmfJ493wl1SWQhTJkN41sNVXpo=; b=jSXbEjhuo5aq6DbJjNnVH//ZXyOBRjufnrJuUWUGvKkkgSOaBm8I2i5n+DoOsA+piF FS5ae9nW+XioXZ+JKhT11Xa6viI8zUnYvPUz4PFa12Si8i18/X/L+q+9xjWRqX/Od+A4 NYDvDrLcSdihrgHH7X/79QBJ3obeqTShoA9VgvrjCzsFvDAsvpy45G/XOwMyj96MibM1 ngps5SAVz3zhVfaq8TJQk6ZmHseKQboqI/0UE8N7RO0REIDYox8yHKaZqt21KhodR2TJ 57H1LEoj4unRwAghUDPTLClwtp4kwNQRyjd03WvIB7T2b/OU5TQjjkS7M0oxhDr5bbZN t5dg== X-Gm-Message-State: AOAM530bcWtK4z8CxO8e7bVuAUXLTKiULRW4cLVRpCgag1NABZM0XgTb 5vGqfkRUo7gMOr+zA15HAaAQYe3pVVWRUQ== X-Received: by 2002:a5d:4052:0:b0:20a:d8b9:9d4b with SMTP id w18-20020a5d4052000000b0020ad8b99d4bmr13201130wrp.612.1652097556877; Mon, 09 May 2022 04:59:16 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id bs6-20020a056000070600b0020c5253d8bdsm12199928wrb.9.2022.05.09.04.59.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:59:16 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 32/32] hw/acpi/aml-build: Use existing CPU topology to build PPTT table Date: Mon, 9 May 2022 12:58:48 +0100 Message-Id: <20220509115848.3521805-33-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220509115848.3521805-1-peter.maydell@linaro.org> References: <20220509115848.3521805-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x436.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Gavin Shan When the PPTT table is built, the CPU topology is re-calculated, but it's unecessary because the CPU topology has been populated in virt_possible_cpu_arch_ids() on arm/virt machine. This reworks build_pptt() to avoid by reusing the existing IDs in ms->possible_cpus. Currently, the only user of build_pptt() is arm/virt machine. Signed-off-by: Gavin Shan Tested-by: Yanan Wang Reviewed-by: Yanan Wang Acked-by: Igor Mammedov Acked-by: Michael S. Tsirkin Message-id: 20220503140304.855514-7-gshan@redhat.com Signed-off-by: Peter Maydell --- hw/acpi/aml-build.c | 111 +++++++++++++++++++------------------------- 1 file changed, 48 insertions(+), 63 deletions(-) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 4086879ebff..e6bfac95c7a 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -2002,86 +2002,71 @@ void build_pptt(GArray *table_data, BIOSLinker *linker, MachineState *ms, const char *oem_id, const char *oem_table_id) { MachineClass *mc = MACHINE_GET_CLASS(ms); - GQueue *list = g_queue_new(); - guint pptt_start = table_data->len; - guint parent_offset; - guint length, i; - int uid = 0; - int socket; + CPUArchIdList *cpus = ms->possible_cpus; + int64_t socket_id = -1, cluster_id = -1, core_id = -1; + uint32_t socket_offset = 0, cluster_offset = 0, core_offset = 0; + uint32_t pptt_start = table_data->len; + int n; AcpiTable table = { .sig = "PPTT", .rev = 2, .oem_id = oem_id, .oem_table_id = oem_table_id }; acpi_table_begin(&table, table_data); - for (socket = 0; socket < ms->smp.sockets; socket++) { - g_queue_push_tail(list, - GUINT_TO_POINTER(table_data->len - pptt_start)); - build_processor_hierarchy_node( - table_data, - /* - * Physical package - represents the boundary - * of a physical package - */ - (1 << 0), - 0, socket, NULL, 0); - } - - if (mc->smp_props.clusters_supported) { - length = g_queue_get_length(list); - for (i = 0; i < length; i++) { - int cluster; - - parent_offset = GPOINTER_TO_UINT(g_queue_pop_head(list)); - for (cluster = 0; cluster < ms->smp.clusters; cluster++) { - g_queue_push_tail(list, - GUINT_TO_POINTER(table_data->len - pptt_start)); - build_processor_hierarchy_node( - table_data, - (0 << 0), /* not a physical package */ - parent_offset, cluster, NULL, 0); - } + /* + * This works with the assumption that cpus[n].props.*_id has been + * sorted from top to down levels in mc->possible_cpu_arch_ids(). + * Otherwise, the unexpected and duplicated containers will be + * created. + */ + for (n = 0; n < cpus->len; n++) { + if (cpus->cpus[n].props.socket_id != socket_id) { + assert(cpus->cpus[n].props.socket_id > socket_id); + socket_id = cpus->cpus[n].props.socket_id; + cluster_id = -1; + core_id = -1; + socket_offset = table_data->len - pptt_start; + build_processor_hierarchy_node(table_data, + (1 << 0), /* Physical package */ + 0, socket_id, NULL, 0); } - } - length = g_queue_get_length(list); - for (i = 0; i < length; i++) { - int core; - - parent_offset = GPOINTER_TO_UINT(g_queue_pop_head(list)); - for (core = 0; core < ms->smp.cores; core++) { - if (ms->smp.threads > 1) { - g_queue_push_tail(list, - GUINT_TO_POINTER(table_data->len - pptt_start)); - build_processor_hierarchy_node( - table_data, - (0 << 0), /* not a physical package */ - parent_offset, core, NULL, 0); - } else { - build_processor_hierarchy_node( - table_data, - (1 << 1) | /* ACPI Processor ID valid */ - (1 << 3), /* Node is a Leaf */ - parent_offset, uid++, NULL, 0); + if (mc->smp_props.clusters_supported) { + if (cpus->cpus[n].props.cluster_id != cluster_id) { + assert(cpus->cpus[n].props.cluster_id > cluster_id); + cluster_id = cpus->cpus[n].props.cluster_id; + core_id = -1; + cluster_offset = table_data->len - pptt_start; + build_processor_hierarchy_node(table_data, + (0 << 0), /* Not a physical package */ + socket_offset, cluster_id, NULL, 0); } + } else { + cluster_offset = socket_offset; } - } - length = g_queue_get_length(list); - for (i = 0; i < length; i++) { - int thread; + if (ms->smp.threads == 1) { + build_processor_hierarchy_node(table_data, + (1 << 1) | /* ACPI Processor ID valid */ + (1 << 3), /* Node is a Leaf */ + cluster_offset, n, NULL, 0); + } else { + if (cpus->cpus[n].props.core_id != core_id) { + assert(cpus->cpus[n].props.core_id > core_id); + core_id = cpus->cpus[n].props.core_id; + core_offset = table_data->len - pptt_start; + build_processor_hierarchy_node(table_data, + (0 << 0), /* Not a physical package */ + cluster_offset, core_id, NULL, 0); + } - parent_offset = GPOINTER_TO_UINT(g_queue_pop_head(list)); - for (thread = 0; thread < ms->smp.threads; thread++) { - build_processor_hierarchy_node( - table_data, + build_processor_hierarchy_node(table_data, (1 << 1) | /* ACPI Processor ID valid */ (1 << 2) | /* Processor is a Thread */ (1 << 3), /* Node is a Leaf */ - parent_offset, uid++, NULL, 0); + core_offset, n, NULL, 0); } } - g_queue_free(list); acpi_table_end(linker, &table); }