Skip to content

Commit 17efc1a

Browse files
ouptonwilldeacon
authored andcommitted
arm64: Expose AIDR_EL1 via sysfs
The KVM PV ABI recently added a feature that allows the VM to discover the set of physical CPU implementations, identified by a tuple of {MIDR_EL1, REVIDR_EL1, AIDR_EL1}. Unlike other KVM PV features, the expectation is that the VMM implements the hypercall instead of KVM as it has the authoritative view of where the VM gets scheduled. To do this the VMM needs to know the values of these registers on any CPU in the system. While MIDR_EL1 and REVIDR_EL1 are already exposed, AIDR_EL1 is not. Provide it in sysfs along with the other identification registers. Signed-off-by: Oliver Upton <oliver.upton@linux.dev> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com> Link: https://lore.kernel.org/r/20250403231626.3181116-1-oliver.upton@linux.dev Signed-off-by: Will Deacon <will@kernel.org>
1 parent 35382a3 commit 17efc1a

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

Documentation/ABI/testing/sysfs-devices-system-cpu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ What: /sys/devices/system/cpu/cpuX/regs/
485485
/sys/devices/system/cpu/cpuX/regs/identification/
486486
/sys/devices/system/cpu/cpuX/regs/identification/midr_el1
487487
/sys/devices/system/cpu/cpuX/regs/identification/revidr_el1
488+
/sys/devices/system/cpu/cpuX/regs/identification/aidr_el1
488489
/sys/devices/system/cpu/cpuX/regs/identification/smidr_el1
489490
Date: June 2016
490491
Contact: Linux ARM Kernel Mailing list <linux-arm-kernel@lists.infradead.org>

Documentation/arch/arm64/cpu-feature-registers.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,15 @@ there are some issues with their usage.
7272
process could be migrated to another CPU by the time it uses the
7373
register value, unless the CPU affinity is set. Hence, there is no
7474
guarantee that the value reflects the processor that it is
75-
currently executing on. The REVIDR is not exposed due to this
76-
constraint, as REVIDR makes sense only in conjunction with the
77-
MIDR. Alternately, MIDR_EL1 and REVIDR_EL1 are exposed via sysfs
78-
at::
75+
currently executing on. REVIDR and AIDR are not exposed due to this
76+
constraint, as these registers only make sense in conjunction with
77+
the MIDR. Alternately, MIDR_EL1, REVIDR_EL1, and AIDR_EL1 are exposed
78+
via sysfs at::
7979

8080
/sys/devices/system/cpu/cpu$ID/regs/identification/
81-
\- midr
82-
\- revidr
81+
\- midr_el1
82+
\- revidr_el1
83+
\- aidr_el1
8384

8485
3. Implementation
8586
--------------------

arch/arm64/include/asm/cpu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ struct cpuinfo_arm64 {
4444
u64 reg_dczid;
4545
u64 reg_midr;
4646
u64 reg_revidr;
47+
u64 reg_aidr;
4748
u64 reg_gmid;
4849
u64 reg_smidr;
4950
u64 reg_mpamidr;

arch/arm64/kernel/cpuinfo.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,11 +328,13 @@ static const struct kobj_type cpuregs_kobj_type = {
328328

329329
CPUREGS_ATTR_RO(midr_el1, midr);
330330
CPUREGS_ATTR_RO(revidr_el1, revidr);
331+
CPUREGS_ATTR_RO(aidr_el1, aidr);
331332
CPUREGS_ATTR_RO(smidr_el1, smidr);
332333

333334
static struct attribute *cpuregs_id_attrs[] = {
334335
&cpuregs_attr_midr_el1.attr,
335336
&cpuregs_attr_revidr_el1.attr,
337+
&cpuregs_attr_aidr_el1.attr,
336338
NULL
337339
};
338340

@@ -469,6 +471,7 @@ static void __cpuinfo_store_cpu(struct cpuinfo_arm64 *info)
469471
info->reg_dczid = read_cpuid(DCZID_EL0);
470472
info->reg_midr = read_cpuid_id();
471473
info->reg_revidr = read_cpuid(REVIDR_EL1);
474+
info->reg_aidr = read_cpuid(AIDR_EL1);
472475

473476
info->reg_id_aa64dfr0 = read_cpuid(ID_AA64DFR0_EL1);
474477
info->reg_id_aa64dfr1 = read_cpuid(ID_AA64DFR1_EL1);

0 commit comments

Comments
 (0)