2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00

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>
This commit is contained in:
Oliver Upton 2025-04-03 16:16:26 -07:00 committed by Will Deacon
parent 35382a3646
commit 17efc1acee
4 changed files with 12 additions and 6 deletions

View File

@ -485,6 +485,7 @@ What: /sys/devices/system/cpu/cpuX/regs/
/sys/devices/system/cpu/cpuX/regs/identification/ /sys/devices/system/cpu/cpuX/regs/identification/
/sys/devices/system/cpu/cpuX/regs/identification/midr_el1 /sys/devices/system/cpu/cpuX/regs/identification/midr_el1
/sys/devices/system/cpu/cpuX/regs/identification/revidr_el1 /sys/devices/system/cpu/cpuX/regs/identification/revidr_el1
/sys/devices/system/cpu/cpuX/regs/identification/aidr_el1
/sys/devices/system/cpu/cpuX/regs/identification/smidr_el1 /sys/devices/system/cpu/cpuX/regs/identification/smidr_el1
Date: June 2016 Date: June 2016
Contact: Linux ARM Kernel Mailing list <linux-arm-kernel@lists.infradead.org> Contact: Linux ARM Kernel Mailing list <linux-arm-kernel@lists.infradead.org>

View File

@ -72,14 +72,15 @@ there are some issues with their usage.
process could be migrated to another CPU by the time it uses the process could be migrated to another CPU by the time it uses the
register value, unless the CPU affinity is set. Hence, there is no register value, unless the CPU affinity is set. Hence, there is no
guarantee that the value reflects the processor that it is guarantee that the value reflects the processor that it is
currently executing on. The REVIDR is not exposed due to this currently executing on. REVIDR and AIDR are not exposed due to this
constraint, as REVIDR makes sense only in conjunction with the constraint, as these registers only make sense in conjunction with
MIDR. Alternately, MIDR_EL1 and REVIDR_EL1 are exposed via sysfs the MIDR. Alternately, MIDR_EL1, REVIDR_EL1, and AIDR_EL1 are exposed
at:: via sysfs at::
/sys/devices/system/cpu/cpu$ID/regs/identification/ /sys/devices/system/cpu/cpu$ID/regs/identification/
\- midr \- midr_el1
\- revidr \- revidr_el1
\- aidr_el1
3. Implementation 3. Implementation
-------------------- --------------------

View File

@ -44,6 +44,7 @@ struct cpuinfo_arm64 {
u64 reg_dczid; u64 reg_dczid;
u64 reg_midr; u64 reg_midr;
u64 reg_revidr; u64 reg_revidr;
u64 reg_aidr;
u64 reg_gmid; u64 reg_gmid;
u64 reg_smidr; u64 reg_smidr;
u64 reg_mpamidr; u64 reg_mpamidr;

View File

@ -328,11 +328,13 @@ static const struct kobj_type cpuregs_kobj_type = {
CPUREGS_ATTR_RO(midr_el1, midr); CPUREGS_ATTR_RO(midr_el1, midr);
CPUREGS_ATTR_RO(revidr_el1, revidr); CPUREGS_ATTR_RO(revidr_el1, revidr);
CPUREGS_ATTR_RO(aidr_el1, aidr);
CPUREGS_ATTR_RO(smidr_el1, smidr); CPUREGS_ATTR_RO(smidr_el1, smidr);
static struct attribute *cpuregs_id_attrs[] = { static struct attribute *cpuregs_id_attrs[] = {
&cpuregs_attr_midr_el1.attr, &cpuregs_attr_midr_el1.attr,
&cpuregs_attr_revidr_el1.attr, &cpuregs_attr_revidr_el1.attr,
&cpuregs_attr_aidr_el1.attr,
NULL NULL
}; };
@ -469,6 +471,7 @@ static void __cpuinfo_store_cpu(struct cpuinfo_arm64 *info)
info->reg_dczid = read_cpuid(DCZID_EL0); info->reg_dczid = read_cpuid(DCZID_EL0);
info->reg_midr = read_cpuid_id(); info->reg_midr = read_cpuid_id();
info->reg_revidr = read_cpuid(REVIDR_EL1); info->reg_revidr = read_cpuid(REVIDR_EL1);
info->reg_aidr = read_cpuid(AIDR_EL1);
info->reg_id_aa64dfr0 = read_cpuid(ID_AA64DFR0_EL1); info->reg_id_aa64dfr0 = read_cpuid(ID_AA64DFR0_EL1);
info->reg_id_aa64dfr1 = read_cpuid(ID_AA64DFR1_EL1); info->reg_id_aa64dfr1 = read_cpuid(ID_AA64DFR1_EL1);