From nobody Sun Feb 8 20:28:27 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1644318154258813.6674516312021; Tue, 8 Feb 2022 03:02:34 -0800 (PST) Received: from localhost ([::1]:56140 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nHOGW-0006VL-Oa for importer@patchew.org; Tue, 08 Feb 2022 06:02:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nHNif-0007nU-G8; Tue, 08 Feb 2022 05:27:35 -0500 Received: from mail.csgraf.de ([85.25.223.15]:34486 helo=zulu616.server4you.de) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nHNib-0005tS-PK; Tue, 08 Feb 2022 05:27:31 -0500 Received: from localhost.localdomain (dynamic-077-002-106-089.77.2.pool.telefonica.de [77.2.106.89]) by csgraf.de (Postfix) with ESMTPSA id C97E1608091C; Tue, 8 Feb 2022 11:27:25 +0100 (CET) From: Alexander Graf To: Peter Maydell Subject: [PATCH v2] hvf: arm: Handle unknown ID registers as RES0 Date: Tue, 8 Feb 2022 11:27:24 +0100 Message-Id: <20220208102724.34451-1-agraf@csgraf.de> X-Mailer: git-send-email 2.32.0 (Apple Git-132) MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=85.25.223.15; envelope-from=agraf@csgraf.de; helo=zulu616.server4you.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-stable@nongnu.org, Cameron Esfahani , qemu-devel@nongnu.org, Roman Bolshakov , qemu-arm@nongnu.org, Ivan Babrou Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1644318156058100001 Content-Type: text/plain; charset="utf-8" Recent Linux versions added support to read ID_AA64ISAR2_EL1. On M1, those reads trap into QEMU which handles them as faults. However, AArch64 ID registers should always read as RES0. Let's handle them accordingly. This fixes booting Linux 5.17 guests. Cc: qemu-stable@nongnu.org Reported-by: Ivan Babrou Signed-off-by: Alexander Graf --- target/arm/hvf/hvf.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 92ad0d29c4..39c3e0d85f 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -729,6 +729,17 @@ static bool hvf_handle_psci_call(CPUState *cpu) return true; } =20 +static bool is_id_sysreg(uint32_t reg) +{ + uint32_t op0 =3D (reg >> 20) & 0x3; + uint32_t op1 =3D (reg >> 14) & 0x7; + uint32_t crn =3D (reg >> 10) & 0xf; + uint32_t crm =3D (reg >> 1) & 0xf; + uint32_t op2 =3D (reg >> 7) & 0x7; + + return op0 =3D=3D 3 && op1 =3D=3D 0 && crn =3D=3D 0 && crm >=3D 1 && c= rm < 8 && op2 < 8; +} + static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, uint32_t rt) { ARMCPU *arm_cpu =3D ARM_CPU(cpu); @@ -781,6 +792,11 @@ static int hvf_sysreg_read(CPUState *cpu, uint32_t reg= , uint32_t rt) /* Dummy register */ break; default: + if (is_id_sysreg(reg)) { + /* ID system registers read as RES0 */ + val =3D 0; + break; + } cpu_synchronize_state(cpu); trace_hvf_unhandled_sysreg_read(env->pc, reg, (reg >> 20) & 0x3, --=20 2.32.0 (Apple Git-132)