/* * In case the boot CPU is hotpluggable, we record its initial state and * current state separately. Certain system registers may contain different * values depending on configuration at or after reset.
*/
DEFINE_PER_CPU(struct cpuinfo_arm64, cpu_data); staticstruct cpuinfo_arm64 boot_cpu_data;
staticinlineconstchar *icache_policy_str(int l1ip)
{ switch (l1ip) { case CTR_EL0_L1Ip_VIPT: return"VIPT"; case CTR_EL0_L1Ip_PIPT: return"PIPT"; default: return"RESERVED/UNKNOWN";
}
}
staticint c_show(struct seq_file *m, void *v)
{ int j; int cpu = m->index; bool compat = personality(current->personality) == PER_LINUX32; struct cpuinfo_arm64 *cpuinfo = v;
u32 midr = cpuinfo->reg_midr;
/* * glibc reads /proc/cpuinfo to determine the number of * online processors, looking for lines beginning with * "processor". Give glibc what it expects.
*/
seq_printf(m, "processor\t: %d\n", cpu); if (compat)
seq_printf(m, "model name\t: ARMv8 Processor rev %d (%s)\n",
MIDR_REVISION(midr), COMPAT_ELF_PLATFORM);
/* * Dump out the common processor features in a single line. * Userspace should read the hwcaps with getauxval(AT_HWCAP) * rather than attempting to parse this, but there's a body of * software which does already (at least for 32-bit).
*/
seq_puts(m, "Features\t:"); if (compat) { #ifdef CONFIG_COMPAT for (j = 0; j < ARRAY_SIZE(compat_hwcap_str); j++) { if (compat_elf_hwcap & (1 << j)) { /* * Warn once if any feature should not * have been present on arm64 platform.
*/ if (WARN_ON_ONCE(!compat_hwcap_str[j])) continue;
/* * The ARM ARM uses the phrase "32-bit register" to describe a register * whose upper 32 bits are RES0 (per C5.1.1, ARM DDI 0487A.i), however * no statement is made as to whether the upper 32 bits will or will not * be made use of in future, and between ARM DDI 0487A.c and ARM DDI * 0487A.d CLIDR_EL1 was expanded from 32-bit to 64-bit. * * Thus, while both MIDR_EL1 and REVIDR_EL1 are described as 32-bit * registers, we expose them both as 64 bit values to cater for possible * future expansion without an ABI break.
*/ #define kobj_to_cpuinfo(kobj) container_of(kobj, struct cpuinfo_arm64, kobj) #define CPUREGS_ATTR_RO(_name, _field) \ static ssize_t _name##_show(struct kobject *kobj, \ struct kobj_attribute *attr, char *buf) \
{ \ struct cpuinfo_arm64 *info = kobj_to_cpuinfo(kobj); \
\ if (info->reg_midr) \ return sprintf(buf, "0x%016llx\n", info->reg_##_field); \ else \ return 0; \
} \ staticstruct kobj_attribute cpuregs_attr_##_name = __ATTR_RO(_name)
dev = get_cpu_device(cpu); if (!dev) return -ENODEV; if (info->kobj.parent) {
sysfs_remove_group(&info->kobj, &cpuregs_attr_group);
kobject_del(&info->kobj);
}
return 0;
}
staticint __init cpuinfo_regs_init(void)
{ int cpu, ret;
staticvoid __cpuinfo_store_cpu(struct cpuinfo_arm64 *info)
{
info->reg_cntfrq = arch_timer_get_cntfrq(); /* * Use the effective value of the CTR_EL0 than the raw value * exposed by the CPU. CTR_EL0.IDC field value must be interpreted * with the CLIDR_EL1 fields to avoid triggering false warnings * when there is a mismatch across the CPUs. Keep track of the * effective value of the CTR_EL0 in our internal records for * accurate sanity check and feature enablement.
*/
info->reg_ctr = read_cpuid_effective_cachetype();
info->reg_dczid = read_cpuid(DCZID_EL0);
info->reg_midr = read_cpuid_id();
info->reg_revidr = read_cpuid(REVIDR_EL1);
info->reg_aidr = read_cpuid(AIDR_EL1);
if (id_aa64pfr1_mte(info->reg_id_aa64pfr1))
info->reg_gmid = read_cpuid(GMID_EL1);
if (id_aa64pfr0_32bit_el0(info->reg_id_aa64pfr0))
__cpuinfo_store_cpu_32bit(&info->aarch32);
/* * info->reg_mpamidr deferred to {init,update}_cpu_features because we * don't want to read it (and trigger a trap on buggy firmware) if * using an aa64pfr0_el1 override to unconditionally disable MPAM.
*/
if (IS_ENABLED(CONFIG_ARM64_SME) &&
id_aa64pfr1_sme(info->reg_id_aa64pfr1)) { /* * We mask out SMPS since even if the hardware * supports priorities the kernel does not at present * and we block access to them.
*/
info->reg_smidr = read_cpuid(SMIDR_EL1) & ~SMIDR_EL1_SMPS;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.