Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFE3D40963B for ; Tue, 19 May 2026 13:29:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779197392; cv=none; b=VFhgUPKDf3cXg3nGPPbumaNeBwxZifdJPnRAabe0yMEnKPegTETL9laTmWkA+yjuVcgIKkcfQB1EPa48wAwfXtWxq/uS1sYTx4bbsJJKE5hDnPP8F6KC1zB28/P5VBPvozgf1QbyiJaY4s3iGrwU4Jvl7hD5gz6wkiTt3f+/Vbw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779197392; c=relaxed/simple; bh=0NvCrThsEgEVeYguQf2g4ajfirzZ9cANbgObXYmWwK8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=p2UeiJAA05wKSbBdMg/sf8TpUbx3FaqRmUsfIt3YQLaYSySja9bVzIQCTtO0BiG9xiZnl1VoVKdYHSxVLbYTSC6bBrm7WlOS+5bkBCqi8ejWj9MeKr/sRF3zp4tL0zlaXytz4lJFRjqrGave0V60zav4QyK7A2LC2Rjx1189Oj8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=avPZPjPv; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="avPZPjPv" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779197390; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dwyuT711ANFwkmoW9hE10UVAWRLP0/b2kn74eIoXpnw=; b=avPZPjPvrzAdC+fF9hbgXqOWzIVVwBnR+50IulmNkw+2k1wDfy+869x953pRzCLeDz3Fa6 PgUTBAORKbxnZ6HbC5562e+DdjrFy3Xmui05zVUrX/46PDJIWENGKCbpuyMVbBqV3se8Eg qgRmxt0HzSSavZCr53g/nvIBSyFlypw= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-362-MebOFveqPQa4iCYe-hCsEw-1; Tue, 19 May 2026 09:29:46 -0400 X-MC-Unique: MebOFveqPQa4iCYe-hCsEw-1 X-Mimecast-MFC-AGG-ID: MebOFveqPQa4iCYe-hCsEw_1779197383 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8732519560B7; Tue, 19 May 2026 13:29:43 +0000 (UTC) Received: from laptop.redhat.com (unknown [10.44.49.207]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B112E180034E; Tue, 19 May 2026 13:29:37 +0000 (UTC) From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, kvmarm@lists.linux.dev, peter.maydell@linaro.org, shaju.abraham@nutanix.com, khushit.shah@nutanix.com, yangjinqian1@huawei.com, cohuck@redhat.com, richard.henderson@linaro.org, sebott@redhat.com, skolothumtho@nvidia.com, philmd@linaro.org Cc: maz@kernel.org, oliver.upton@linux.dev, pbonzini@redhat.com, armbru@redhat.com, berrange@redhat.com, abologna@redhat.com, jdenemar@redhat.com Subject: [PATCH v5 04/18] arm/cpu: Add infra to handle generated ID register definitions Date: Tue, 19 May 2026 15:27:18 +0200 Message-ID: <20260519132905.145643-5-eric.auger@redhat.com> In-Reply-To: <20260519132905.145643-1-eric.auger@redhat.com> References: <20260519132905.145643-1-eric.auger@redhat.com> Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-MFC-PROC-ID: n-AoPglMt0lm23LuaZiDPCVPM73O1QLi-byMQOczD5o_1779197383 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true The known ID regs are populated in a new initialization function named initialize_cpu_sysreg_properties(). That code will be automatically generated from AARCHMRS Registers.json. For the time being let's just describe a single id reg, CTR_EL0. In this description we only care about non RES/RAZ fields, ie. named fields. The registers are populated in an array indexed by ARMIDRegisterIdx and their fields are added in a sorted list. Signed-off-by: Eric Auger Signed-off-by: Cornelia Huck --- v4 -> v5 - ifdef TARGET_ARM_CPU_IDREGS_H - s/g_list_append/g_list_prepend - void arm64_sysreg_add_field() --- target/arm/cpu-idregs.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 target/arm/cpu-idregs.h diff --git a/target/arm/cpu-idregs.h b/target/arm/cpu-idregs.h new file mode 100644 index 0000000000..664e2d6ddd --- /dev/null +++ b/target/arm/cpu-idregs.h @@ -0,0 +1,33 @@ +/* + * handle ID registers and their fields + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#ifndef TARGET_ARM_CPU_IDREGS_H +#define TARGET_ARM_CPU_IDREGS_H + +#include "qemu/osdep.h" +#include "qemu/error-report.h" +#include "cpu.h" +#include "cpu-sysregs.h" + +typedef struct ARM64SysRegField { + const char *name; /* name of the field, for instance CTR_EL0_IDC */ + ARMIDRegisterIdx index; /* parent register, e.g. CTR_EL0_IDX */ + int shift; /* lsb of the field in the register */ + int length; /* highest bit number */ +} ARM64SysRegField; + +typedef struct ARM64SysReg { + const char *name; /* name of the sysreg, for instance CTR_EL0 */ + ARMIDRegisterIdx index; /* register index, e.g. CTR_EL0_IDX */ + struct ARM64SysRegField *fields; + uint32_t fields_count; +} ARM64SysReg; + +/* + * List of exposed ID regs (automatically populated from AARCHMRS Registers.json) + */ +extern ARM64SysReg arm64_id_regs[NUM_ID_IDX]; + +#endif -- 2.53.0