-/* $OpenBSD: cpu.c,v 1.89 2023/04/29 08:50:53 kettenis Exp $ */
+/* $OpenBSD: cpu.c,v 1.90 2023/05/17 21:45:41 kettenis Exp $ */
/*
* Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
printf("\n%s: mismatched ID_AA64ISAR2_EL1",
ci->ci_dev->dv_xname);
}
- if (READ_SPECIALREG(id_aa64pfr0_el1) != cpu_id_aa64pfr0) {
+ id = READ_SPECIALREG(id_aa64pfr0_el1);
+ /* Allow CSV2/CVS3 to be different. */
+ id &= ~ID_AA64PFR0_CSV2_MASK;
+ id &= ~ID_AA64PFR0_CSV3_MASK;
+ /* Ignore 32-bit support in all exception levels. */
+ id &= ~ID_AA64PFR0_EL0_MASK;
+ id &= ~ID_AA64PFR0_EL1_MASK;
+ id &= ~ID_AA64PFR0_EL2_MASK;
+ id &= ~ID_AA64PFR0_EL3_MASK;
+ if (id != cpu_id_aa64pfr0) {
printf("\n%s: mismatched ID_AA64PFR0_EL1",
ci->ci_dev->dv_xname);
}
cpu_id_aa64pfr0 = READ_SPECIALREG(id_aa64pfr0_el1);
cpu_id_aa64pfr1 = READ_SPECIALREG(id_aa64pfr1_el1);
+ /*
+ * The CSV2/CSV3 "features" are handled on a
+ * per-processor basis. So it is fine if these fields
+ * differ between CPU cores. Mask off these fields to
+ * prevent exporting these to userland.
+ */
+ cpu_id_aa64pfr0 &= ~ID_AA64PFR0_CSV2_MASK;
+ cpu_id_aa64pfr0 &= ~ID_AA64PFR0_CSV3_MASK;
+
+ /*
+ * We only support 64-bit mode, so we don't care about
+ * differences in support for 32-bit mode between
+ * cores. Mask off these fields as well.
+ */
+ cpu_id_aa64pfr0 &= ~ID_AA64PFR0_EL0_MASK;
+ cpu_id_aa64pfr0 &= ~ID_AA64PFR0_EL1_MASK;
+ cpu_id_aa64pfr0 &= ~ID_AA64PFR0_EL2_MASK;
+ cpu_id_aa64pfr0 &= ~ID_AA64PFR0_EL3_MASK;
+
cpu_identify(ci);
if (OF_getproplen(ci->ci_node, "clocks") > 0) {