* [PATCH v3 0/7] arm64: Support for systems without AArch32 state
@ 2016-03-31 17:27 Suzuki K Poulose
2016-03-31 17:27 ` [PATCH v3 1/7] arm64: hwcaps: Cleanup naming Suzuki K Poulose
` (6 more replies)
0 siblings, 7 replies; 15+ messages in thread
From: Suzuki K Poulose @ 2016-03-31 17:27 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-kernel, will.deacon, mark.rutland, marc.zyngier, ynorov,
Suzuki K Poulose
This series add checks to make sure that the AArch32 state is
supported before we process the 32bit ID registers. Also
checks the same for COMPAT binary execution.
Applies on top of 4.6-rc1. The series remains unchanged from V3, except
for :
Changes since V2:
- Rebased to 4.6-rc1
- Drop redundant KVM check introduced in V1.
Changes since V1:
- Prevent changing the personality to PER_LINUX32 by adding
wrapper for personality() syscall.
- Add the check to KVM before initialising a AArch32 vcpu
- Tested on hardware.
Btw, linux32 doesn't complain when the personality() syscall fails to change
to PER_LINUX32. You can verify the personality by running
$ cat /proc/cpuinfo
which would still list the 64bit features for the CPUs.
Suzuki K Poulose (6):
arm64: hwcaps: Cleanup naming
arm64: HWCAP: Split COMPAT HWCAP table entries
arm64: Add helpers for detecting AArch32 support at EL0
arm64: cpufeature: Check availability of AArch32
arm64: cpufeature: Track 32bit EL0 support
arm64: Add a wrapper for personality() syscall
Yury Norov (1):
arm64: compat: Check for AArch32 state
arch/arm64/include/asm/cpufeature.h | 15 ++-
arch/arm64/include/asm/elf.h | 3 +-
arch/arm64/include/asm/sysreg.h | 1 +
arch/arm64/kernel/cpufeature.c | 208 ++++++++++++++++++++---------------
arch/arm64/kernel/cpuinfo.c | 37 ++++---
arch/arm64/kernel/sys.c | 10 ++
6 files changed, 165 insertions(+), 109 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 1/7] arm64: hwcaps: Cleanup naming
2016-03-31 17:27 [PATCH v3 0/7] arm64: Support for systems without AArch32 state Suzuki K Poulose
@ 2016-03-31 17:27 ` Suzuki K Poulose
2016-03-31 17:27 ` [PATCH v3 2/7] arm64: HWCAP: Split COMPAT HWCAP table entries Suzuki K Poulose
` (5 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: Suzuki K Poulose @ 2016-03-31 17:27 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-kernel, will.deacon, mark.rutland, marc.zyngier, ynorov,
Suzuki K Poulose
We use hwcaps for referring to ELF hwcaps capability information.
However this can be confusing with 'cpu_hwcaps' which stands for the
CPU capability bit field. This patch cleans up the names to make it
a bit more readable.
Tested-by: Yury Norov <ynorov@caviumnetworks.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
arch/arm64/kernel/cpufeature.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index 943f514..23b0f15 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -740,7 +740,7 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
.hwcap = cap, \
}
-static const struct arm64_cpu_capabilities arm64_hwcaps[] = {
+static const struct arm64_cpu_capabilities arm64_elf_hwcaps[] = {
HWCAP_CAP(SYS_ID_AA64ISAR0_EL1, ID_AA64ISAR0_AES_SHIFT, FTR_UNSIGNED, 2, CAP_HWCAP, HWCAP_PMULL),
HWCAP_CAP(SYS_ID_AA64ISAR0_EL1, ID_AA64ISAR0_AES_SHIFT, FTR_UNSIGNED, 1, CAP_HWCAP, HWCAP_AES),
HWCAP_CAP(SYS_ID_AA64ISAR0_EL1, ID_AA64ISAR0_SHA1_SHIFT, FTR_UNSIGNED, 1, CAP_HWCAP, HWCAP_SHA1),
@@ -761,7 +761,7 @@ static const struct arm64_cpu_capabilities arm64_hwcaps[] = {
{},
};
-static void __init cap_set_hwcap(const struct arm64_cpu_capabilities *cap)
+static void __init cap_set_elf_hwcap(const struct arm64_cpu_capabilities *cap)
{
switch (cap->hwcap_type) {
case CAP_HWCAP:
@@ -782,7 +782,7 @@ static void __init cap_set_hwcap(const struct arm64_cpu_capabilities *cap)
}
/* Check if we have a particular HWCAP enabled */
-static bool __maybe_unused cpus_have_hwcap(const struct arm64_cpu_capabilities *cap)
+static bool cpus_have_elf_hwcap(const struct arm64_cpu_capabilities *cap)
{
bool rc;
@@ -806,14 +806,14 @@ static bool __maybe_unused cpus_have_hwcap(const struct arm64_cpu_capabilities *
return rc;
}
-static void __init setup_cpu_hwcaps(void)
+static void __init setup_elf_hwcaps(void)
{
int i;
- const struct arm64_cpu_capabilities *hwcaps = arm64_hwcaps;
+ const struct arm64_cpu_capabilities *hwcaps = arm64_elf_hwcaps;
for (i = 0; hwcaps[i].matches; i++)
if (hwcaps[i].matches(&hwcaps[i]))
- cap_set_hwcap(&hwcaps[i]);
+ cap_set_elf_hwcap(&hwcaps[i]);
}
void update_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
@@ -950,8 +950,8 @@ void verify_local_cpu_capabilities(void)
caps[i].enable(NULL);
}
- for (i = 0, caps = arm64_hwcaps; caps[i].matches; i++) {
- if (!cpus_have_hwcap(&caps[i]))
+ for (i = 0, caps = arm64_elf_hwcaps; caps[i].matches; i++) {
+ if (!cpus_have_elf_hwcap(&caps[i]))
continue;
if (!feature_matches(__raw_read_system_reg(caps[i].sys_reg), &caps[i])) {
pr_crit("CPU%d: missing HWCAP: %s\n",
@@ -974,7 +974,7 @@ void __init setup_cpu_features(void)
/* Set the CPU feature capabilies */
setup_feature_capabilities();
- setup_cpu_hwcaps();
+ setup_elf_hwcaps();
/* Advertise that we have computed the system capabilities */
set_sys_caps_initialised();
--
1.7.9.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 2/7] arm64: HWCAP: Split COMPAT HWCAP table entries
2016-03-31 17:27 [PATCH v3 0/7] arm64: Support for systems without AArch32 state Suzuki K Poulose
2016-03-31 17:27 ` [PATCH v3 1/7] arm64: hwcaps: Cleanup naming Suzuki K Poulose
@ 2016-03-31 17:27 ` Suzuki K Poulose
2016-03-31 17:27 ` [PATCH v3 3/7] arm64: Add helpers for detecting AArch32 support at EL0 Suzuki K Poulose
` (4 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: Suzuki K Poulose @ 2016-03-31 17:27 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-kernel, will.deacon, mark.rutland, marc.zyngier, ynorov,
Suzuki K Poulose
In order to handle systems which do not support 32bit at EL0,
split the COMPAT HWCAP entries into a separate table which can
be processed, only if the support is available.
Tested-by: Yury Norov <ynorov@caviumnetworks.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
arch/arm64/kernel/cpufeature.c | 104 +++++++++++++++++++++-------------------
1 file changed, 56 insertions(+), 48 deletions(-)
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index 23b0f15..a067c31 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -751,6 +751,10 @@ static const struct arm64_cpu_capabilities arm64_elf_hwcaps[] = {
HWCAP_CAP(SYS_ID_AA64PFR0_EL1, ID_AA64PFR0_FP_SHIFT, FTR_SIGNED, 1, CAP_HWCAP, HWCAP_FPHP),
HWCAP_CAP(SYS_ID_AA64PFR0_EL1, ID_AA64PFR0_ASIMD_SHIFT, FTR_SIGNED, 0, CAP_HWCAP, HWCAP_ASIMD),
HWCAP_CAP(SYS_ID_AA64PFR0_EL1, ID_AA64PFR0_ASIMD_SHIFT, FTR_SIGNED, 1, CAP_HWCAP, HWCAP_ASIMDHP),
+ {},
+};
+
+static const struct arm64_cpu_capabilities compat_elf_hwcaps[] = {
#ifdef CONFIG_COMPAT
HWCAP_CAP(SYS_ID_ISAR5_EL1, ID_ISAR5_AES_SHIFT, FTR_UNSIGNED, 2, CAP_COMPAT_HWCAP2, COMPAT_HWCAP2_PMULL),
HWCAP_CAP(SYS_ID_ISAR5_EL1, ID_ISAR5_AES_SHIFT, FTR_UNSIGNED, 1, CAP_COMPAT_HWCAP2, COMPAT_HWCAP2_AES),
@@ -806,28 +810,23 @@ static bool cpus_have_elf_hwcap(const struct arm64_cpu_capabilities *cap)
return rc;
}
-static void __init setup_elf_hwcaps(void)
+static void __init setup_elf_hwcaps(const struct arm64_cpu_capabilities *hwcaps)
{
- int i;
- const struct arm64_cpu_capabilities *hwcaps = arm64_elf_hwcaps;
-
- for (i = 0; hwcaps[i].matches; i++)
- if (hwcaps[i].matches(&hwcaps[i]))
- cap_set_elf_hwcap(&hwcaps[i]);
+ for (; hwcaps->matches; hwcaps++)
+ if (hwcaps->matches(hwcaps))
+ cap_set_elf_hwcap(hwcaps);
}
void update_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
const char *info)
{
- int i;
-
- for (i = 0; caps[i].matches; i++) {
- if (!caps[i].matches(&caps[i]))
+ for (; caps->matches; caps++) {
+ if (!caps->matches(caps))
continue;
- if (!cpus_have_cap(caps[i].capability) && caps[i].desc)
- pr_info("%s %s\n", info, caps[i].desc);
- cpus_set_cap(caps[i].capability);
+ if (!cpus_have_cap(caps->capability) && caps->desc)
+ pr_info("%s %s\n", info, caps->desc);
+ cpus_set_cap(caps->capability);
}
}
@@ -838,11 +837,9 @@ void update_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
static void __init
enable_cpu_capabilities(const struct arm64_cpu_capabilities *caps)
{
- int i;
-
- for (i = 0; caps[i].matches; i++)
- if (caps[i].enable && cpus_have_cap(caps[i].capability))
- on_each_cpu(caps[i].enable, NULL, true);
+ for (; caps->matches; caps++)
+ if (caps->enable && cpus_have_cap(caps->capability))
+ on_each_cpu(caps->enable, NULL, true);
}
/*
@@ -911,6 +908,41 @@ static void check_early_cpu_features(void)
verify_cpu_asid_bits();
}
+static void
+verify_local_elf_hwcaps(const struct arm64_cpu_capabilities *caps)
+{
+
+ for (; caps->matches; caps++) {
+ if (!cpus_have_elf_hwcap(caps))
+ continue;
+ if (!feature_matches(__raw_read_system_reg(caps->sys_reg), caps)) {
+ pr_crit("CPU%d: missing HWCAP: %s\n",
+ smp_processor_id(), caps->desc);
+ cpu_die_early();
+ }
+ }
+}
+
+static void
+verify_local_cpu_features(const struct arm64_cpu_capabilities *caps)
+{
+ for (; caps->matches; caps++) {
+ if (!cpus_have_cap(caps->capability) || !caps->sys_reg)
+ continue;
+ /*
+ * If the new CPU misses an advertised feature, we cannot proceed
+ * further, park the cpu.
+ */
+ if (!feature_matches(__raw_read_system_reg(caps->sys_reg), caps)) {
+ pr_crit("CPU%d: missing feature: %s\n",
+ smp_processor_id(), caps->desc);
+ cpu_die_early();
+ }
+ if (caps->enable)
+ caps->enable(NULL);
+ }
+}
+
/*
* Run through the enabled system capabilities and enable() it on this CPU.
* The capabilities were decided based on the available CPUs at the boot time.
@@ -921,8 +953,6 @@ static void check_early_cpu_features(void)
*/
void verify_local_cpu_capabilities(void)
{
- int i;
- const struct arm64_cpu_capabilities *caps;
check_early_cpu_features();
@@ -933,32 +963,9 @@ void verify_local_cpu_capabilities(void)
if (!sys_caps_initialised)
return;
- caps = arm64_features;
- for (i = 0; caps[i].matches; i++) {
- if (!cpus_have_cap(caps[i].capability) || !caps[i].sys_reg)
- continue;
- /*
- * If the new CPU misses an advertised feature, we cannot proceed
- * further, park the cpu.
- */
- if (!feature_matches(__raw_read_system_reg(caps[i].sys_reg), &caps[i])) {
- pr_crit("CPU%d: missing feature: %s\n",
- smp_processor_id(), caps[i].desc);
- cpu_die_early();
- }
- if (caps[i].enable)
- caps[i].enable(NULL);
- }
-
- for (i = 0, caps = arm64_elf_hwcaps; caps[i].matches; i++) {
- if (!cpus_have_elf_hwcap(&caps[i]))
- continue;
- if (!feature_matches(__raw_read_system_reg(caps[i].sys_reg), &caps[i])) {
- pr_crit("CPU%d: missing HWCAP: %s\n",
- smp_processor_id(), caps[i].desc);
- cpu_die_early();
- }
- }
+ verify_local_cpu_features(arm64_features);
+ verify_local_elf_hwcaps(arm64_elf_hwcaps);
+ verify_local_elf_hwcaps(compat_elf_hwcaps);
}
static void __init setup_feature_capabilities(void)
@@ -974,7 +981,8 @@ void __init setup_cpu_features(void)
/* Set the CPU feature capabilies */
setup_feature_capabilities();
- setup_elf_hwcaps();
+ setup_elf_hwcaps(arm64_elf_hwcaps);
+ setup_elf_hwcaps(compat_elf_hwcaps);
/* Advertise that we have computed the system capabilities */
set_sys_caps_initialised();
--
1.7.9.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 3/7] arm64: Add helpers for detecting AArch32 support at EL0
2016-03-31 17:27 [PATCH v3 0/7] arm64: Support for systems without AArch32 state Suzuki K Poulose
2016-03-31 17:27 ` [PATCH v3 1/7] arm64: hwcaps: Cleanup naming Suzuki K Poulose
2016-03-31 17:27 ` [PATCH v3 2/7] arm64: HWCAP: Split COMPAT HWCAP table entries Suzuki K Poulose
@ 2016-03-31 17:27 ` Suzuki K Poulose
2016-04-14 16:39 ` Will Deacon
2016-03-31 17:27 ` [PATCH v3 4/7] arm64: cpufeature: Check availability of AArch32 Suzuki K Poulose
` (3 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Suzuki K Poulose @ 2016-03-31 17:27 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-kernel, will.deacon, mark.rutland, marc.zyngier, ynorov,
Suzuki K Poulose
Adds a helper to extract the support for AArch32 at EL0
Tested-by: Yury Norov <ynorov@caviumnetworks.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
arch/arm64/include/asm/cpufeature.h | 7 +++++++
arch/arm64/include/asm/sysreg.h | 1 +
2 files changed, 8 insertions(+)
diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
index b9b6494..7f64285 100644
--- a/arch/arm64/include/asm/cpufeature.h
+++ b/arch/arm64/include/asm/cpufeature.h
@@ -170,6 +170,13 @@ static inline bool id_aa64mmfr0_mixed_endian_el0(u64 mmfr0)
cpuid_feature_extract_unsigned_field(mmfr0, ID_AA64MMFR0_BIGENDEL0_SHIFT) == 0x1;
}
+static inline bool id_aa64pfr0_32bit_el0(u64 pfr0)
+{
+ u32 val = cpuid_feature_extract_unsigned_field(pfr0, ID_AA64PFR0_EL0_SHIFT);
+
+ return val == ID_AA64PFR0_EL0_32BIT_64BIT;
+}
+
void __init setup_cpu_features(void);
void update_cpu_capabilities(const struct arm64_cpu_capabilities *caps,
diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h
index 1287416..1a5f602 100644
--- a/arch/arm64/include/asm/sysreg.h
+++ b/arch/arm64/include/asm/sysreg.h
@@ -115,6 +115,7 @@
#define ID_AA64PFR0_ASIMD_SUPPORTED 0x0
#define ID_AA64PFR0_EL1_64BIT_ONLY 0x1
#define ID_AA64PFR0_EL0_64BIT_ONLY 0x1
+#define ID_AA64PFR0_EL0_32BIT_64BIT 0x2
/* id_aa64mmfr0 */
#define ID_AA64MMFR0_TGRAN4_SHIFT 28
--
1.7.9.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 4/7] arm64: cpufeature: Check availability of AArch32
2016-03-31 17:27 [PATCH v3 0/7] arm64: Support for systems without AArch32 state Suzuki K Poulose
` (2 preceding siblings ...)
2016-03-31 17:27 ` [PATCH v3 3/7] arm64: Add helpers for detecting AArch32 support at EL0 Suzuki K Poulose
@ 2016-03-31 17:27 ` Suzuki K Poulose
2016-03-31 17:27 ` [PATCH v3 5/7] arm64: cpufeature: Track 32bit EL0 support Suzuki K Poulose
` (2 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: Suzuki K Poulose @ 2016-03-31 17:27 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-kernel, will.deacon, mark.rutland, marc.zyngier, ynorov,
Suzuki K Poulose
On ARMv8 support for AArch32 state is optional. Hence it is
not safe to check the AArch32 ID registers for sanity, which
could lead to false warnings. This patch makes sure that the
AArch32 state is implemented before we keep track of the 32bit
ID registers.
As per ARM ARM (D.1.21.2 - Support for Exception Levels and
Execution States, DDI0487A.h), checking the support for AArch32
at EL0 is good enough to check the support for AArch32 (i.e,
AArch32 at EL1 => AArch32 at EL0, but not vice versa).
Tested-by: Yury Norov <ynorov@caviumnetworks.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
arch/arm64/kernel/cpufeature.c | 86 ++++++++++++++++++++++------------------
arch/arm64/kernel/cpuinfo.c | 37 +++++++++--------
2 files changed, 67 insertions(+), 56 deletions(-)
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index a067c31..cfc0cfd 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -435,22 +435,26 @@ void __init init_cpu_features(struct cpuinfo_arm64 *info)
init_cpu_ftr_reg(SYS_ID_AA64MMFR2_EL1, info->reg_id_aa64mmfr2);
init_cpu_ftr_reg(SYS_ID_AA64PFR0_EL1, info->reg_id_aa64pfr0);
init_cpu_ftr_reg(SYS_ID_AA64PFR1_EL1, info->reg_id_aa64pfr1);
- init_cpu_ftr_reg(SYS_ID_DFR0_EL1, info->reg_id_dfr0);
- init_cpu_ftr_reg(SYS_ID_ISAR0_EL1, info->reg_id_isar0);
- init_cpu_ftr_reg(SYS_ID_ISAR1_EL1, info->reg_id_isar1);
- init_cpu_ftr_reg(SYS_ID_ISAR2_EL1, info->reg_id_isar2);
- init_cpu_ftr_reg(SYS_ID_ISAR3_EL1, info->reg_id_isar3);
- init_cpu_ftr_reg(SYS_ID_ISAR4_EL1, info->reg_id_isar4);
- init_cpu_ftr_reg(SYS_ID_ISAR5_EL1, info->reg_id_isar5);
- init_cpu_ftr_reg(SYS_ID_MMFR0_EL1, info->reg_id_mmfr0);
- init_cpu_ftr_reg(SYS_ID_MMFR1_EL1, info->reg_id_mmfr1);
- init_cpu_ftr_reg(SYS_ID_MMFR2_EL1, info->reg_id_mmfr2);
- init_cpu_ftr_reg(SYS_ID_MMFR3_EL1, info->reg_id_mmfr3);
- init_cpu_ftr_reg(SYS_ID_PFR0_EL1, info->reg_id_pfr0);
- init_cpu_ftr_reg(SYS_ID_PFR1_EL1, info->reg_id_pfr1);
- init_cpu_ftr_reg(SYS_MVFR0_EL1, info->reg_mvfr0);
- init_cpu_ftr_reg(SYS_MVFR1_EL1, info->reg_mvfr1);
- init_cpu_ftr_reg(SYS_MVFR2_EL1, info->reg_mvfr2);
+
+ if (id_aa64pfr0_32bit_el0(info->reg_id_aa64pfr0)) {
+ init_cpu_ftr_reg(SYS_ID_DFR0_EL1, info->reg_id_dfr0);
+ init_cpu_ftr_reg(SYS_ID_ISAR0_EL1, info->reg_id_isar0);
+ init_cpu_ftr_reg(SYS_ID_ISAR1_EL1, info->reg_id_isar1);
+ init_cpu_ftr_reg(SYS_ID_ISAR2_EL1, info->reg_id_isar2);
+ init_cpu_ftr_reg(SYS_ID_ISAR3_EL1, info->reg_id_isar3);
+ init_cpu_ftr_reg(SYS_ID_ISAR4_EL1, info->reg_id_isar4);
+ init_cpu_ftr_reg(SYS_ID_ISAR5_EL1, info->reg_id_isar5);
+ init_cpu_ftr_reg(SYS_ID_MMFR0_EL1, info->reg_id_mmfr0);
+ init_cpu_ftr_reg(SYS_ID_MMFR1_EL1, info->reg_id_mmfr1);
+ init_cpu_ftr_reg(SYS_ID_MMFR2_EL1, info->reg_id_mmfr2);
+ init_cpu_ftr_reg(SYS_ID_MMFR3_EL1, info->reg_id_mmfr3);
+ init_cpu_ftr_reg(SYS_ID_PFR0_EL1, info->reg_id_pfr0);
+ init_cpu_ftr_reg(SYS_ID_PFR1_EL1, info->reg_id_pfr1);
+ init_cpu_ftr_reg(SYS_MVFR0_EL1, info->reg_mvfr0);
+ init_cpu_ftr_reg(SYS_MVFR1_EL1, info->reg_mvfr1);
+ init_cpu_ftr_reg(SYS_MVFR2_EL1, info->reg_mvfr2);
+ }
+
}
static void update_cpu_ftr_reg(struct arm64_ftr_reg *reg, u64 new)
@@ -555,47 +559,51 @@ void update_cpu_features(int cpu,
info->reg_id_aa64pfr1, boot->reg_id_aa64pfr1);
/*
- * If we have AArch32, we care about 32-bit features for compat. These
- * registers should be RES0 otherwise.
+ * If we have AArch32, we care about 32-bit features for compat.
+ * If the system doesn't support AArch32, don't update them.
*/
- taint |= check_update_ftr_reg(SYS_ID_DFR0_EL1, cpu,
+ if (id_aa64pfr0_32bit_el0(read_system_reg(SYS_ID_AA64PFR0_EL1)) &&
+ id_aa64pfr0_32bit_el0(info->reg_id_aa64pfr0)) {
+
+ taint |= check_update_ftr_reg(SYS_ID_DFR0_EL1, cpu,
info->reg_id_dfr0, boot->reg_id_dfr0);
- taint |= check_update_ftr_reg(SYS_ID_ISAR0_EL1, cpu,
+ taint |= check_update_ftr_reg(SYS_ID_ISAR0_EL1, cpu,
info->reg_id_isar0, boot->reg_id_isar0);
- taint |= check_update_ftr_reg(SYS_ID_ISAR1_EL1, cpu,
+ taint |= check_update_ftr_reg(SYS_ID_ISAR1_EL1, cpu,
info->reg_id_isar1, boot->reg_id_isar1);
- taint |= check_update_ftr_reg(SYS_ID_ISAR2_EL1, cpu,
+ taint |= check_update_ftr_reg(SYS_ID_ISAR2_EL1, cpu,
info->reg_id_isar2, boot->reg_id_isar2);
- taint |= check_update_ftr_reg(SYS_ID_ISAR3_EL1, cpu,
+ taint |= check_update_ftr_reg(SYS_ID_ISAR3_EL1, cpu,
info->reg_id_isar3, boot->reg_id_isar3);
- taint |= check_update_ftr_reg(SYS_ID_ISAR4_EL1, cpu,
+ taint |= check_update_ftr_reg(SYS_ID_ISAR4_EL1, cpu,
info->reg_id_isar4, boot->reg_id_isar4);
- taint |= check_update_ftr_reg(SYS_ID_ISAR5_EL1, cpu,
+ taint |= check_update_ftr_reg(SYS_ID_ISAR5_EL1, cpu,
info->reg_id_isar5, boot->reg_id_isar5);
- /*
- * Regardless of the value of the AuxReg field, the AIFSR, ADFSR, and
- * ACTLR formats could differ across CPUs and therefore would have to
- * be trapped for virtualization anyway.
- */
- taint |= check_update_ftr_reg(SYS_ID_MMFR0_EL1, cpu,
+ /*
+ * Regardless of the value of the AuxReg field, the AIFSR, ADFSR, and
+ * ACTLR formats could differ across CPUs and therefore would have to
+ * be trapped for virtualization anyway.
+ */
+ taint |= check_update_ftr_reg(SYS_ID_MMFR0_EL1, cpu,
info->reg_id_mmfr0, boot->reg_id_mmfr0);
- taint |= check_update_ftr_reg(SYS_ID_MMFR1_EL1, cpu,
+ taint |= check_update_ftr_reg(SYS_ID_MMFR1_EL1, cpu,
info->reg_id_mmfr1, boot->reg_id_mmfr1);
- taint |= check_update_ftr_reg(SYS_ID_MMFR2_EL1, cpu,
+ taint |= check_update_ftr_reg(SYS_ID_MMFR2_EL1, cpu,
info->reg_id_mmfr2, boot->reg_id_mmfr2);
- taint |= check_update_ftr_reg(SYS_ID_MMFR3_EL1, cpu,
+ taint |= check_update_ftr_reg(SYS_ID_MMFR3_EL1, cpu,
info->reg_id_mmfr3, boot->reg_id_mmfr3);
- taint |= check_update_ftr_reg(SYS_ID_PFR0_EL1, cpu,
+ taint |= check_update_ftr_reg(SYS_ID_PFR0_EL1, cpu,
info->reg_id_pfr0, boot->reg_id_pfr0);
- taint |= check_update_ftr_reg(SYS_ID_PFR1_EL1, cpu,
+ taint |= check_update_ftr_reg(SYS_ID_PFR1_EL1, cpu,
info->reg_id_pfr1, boot->reg_id_pfr1);
- taint |= check_update_ftr_reg(SYS_MVFR0_EL1, cpu,
+ taint |= check_update_ftr_reg(SYS_MVFR0_EL1, cpu,
info->reg_mvfr0, boot->reg_mvfr0);
- taint |= check_update_ftr_reg(SYS_MVFR1_EL1, cpu,
+ taint |= check_update_ftr_reg(SYS_MVFR1_EL1, cpu,
info->reg_mvfr1, boot->reg_mvfr1);
- taint |= check_update_ftr_reg(SYS_MVFR2_EL1, cpu,
+ taint |= check_update_ftr_reg(SYS_MVFR2_EL1, cpu,
info->reg_mvfr2, boot->reg_mvfr2);
+ }
/*
* Mismatched CPU features are a recipe for disaster. Don't even
diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
index 84c8684..92189e2 100644
--- a/arch/arm64/kernel/cpuinfo.c
+++ b/arch/arm64/kernel/cpuinfo.c
@@ -216,23 +216,26 @@ static void __cpuinfo_store_cpu(struct cpuinfo_arm64 *info)
info->reg_id_aa64pfr0 = read_cpuid(ID_AA64PFR0_EL1);
info->reg_id_aa64pfr1 = read_cpuid(ID_AA64PFR1_EL1);
- info->reg_id_dfr0 = read_cpuid(ID_DFR0_EL1);
- info->reg_id_isar0 = read_cpuid(ID_ISAR0_EL1);
- info->reg_id_isar1 = read_cpuid(ID_ISAR1_EL1);
- info->reg_id_isar2 = read_cpuid(ID_ISAR2_EL1);
- info->reg_id_isar3 = read_cpuid(ID_ISAR3_EL1);
- info->reg_id_isar4 = read_cpuid(ID_ISAR4_EL1);
- info->reg_id_isar5 = read_cpuid(ID_ISAR5_EL1);
- info->reg_id_mmfr0 = read_cpuid(ID_MMFR0_EL1);
- info->reg_id_mmfr1 = read_cpuid(ID_MMFR1_EL1);
- info->reg_id_mmfr2 = read_cpuid(ID_MMFR2_EL1);
- info->reg_id_mmfr3 = read_cpuid(ID_MMFR3_EL1);
- info->reg_id_pfr0 = read_cpuid(ID_PFR0_EL1);
- info->reg_id_pfr1 = read_cpuid(ID_PFR1_EL1);
-
- info->reg_mvfr0 = read_cpuid(MVFR0_EL1);
- info->reg_mvfr1 = read_cpuid(MVFR1_EL1);
- info->reg_mvfr2 = read_cpuid(MVFR2_EL1);
+ /* Update the 32bit ID registers only if AArch32 is implemented */
+ if (id_aa64pfr0_32bit_el0(info->reg_id_aa64pfr0)) {
+ info->reg_id_dfr0 = read_cpuid(ID_DFR0_EL1);
+ info->reg_id_isar0 = read_cpuid(ID_ISAR0_EL1);
+ info->reg_id_isar1 = read_cpuid(ID_ISAR1_EL1);
+ info->reg_id_isar2 = read_cpuid(ID_ISAR2_EL1);
+ info->reg_id_isar3 = read_cpuid(ID_ISAR3_EL1);
+ info->reg_id_isar4 = read_cpuid(ID_ISAR4_EL1);
+ info->reg_id_isar5 = read_cpuid(ID_ISAR5_EL1);
+ info->reg_id_mmfr0 = read_cpuid(ID_MMFR0_EL1);
+ info->reg_id_mmfr1 = read_cpuid(ID_MMFR1_EL1);
+ info->reg_id_mmfr2 = read_cpuid(ID_MMFR2_EL1);
+ info->reg_id_mmfr3 = read_cpuid(ID_MMFR3_EL1);
+ info->reg_id_pfr0 = read_cpuid(ID_PFR0_EL1);
+ info->reg_id_pfr1 = read_cpuid(ID_PFR1_EL1);
+
+ info->reg_mvfr0 = read_cpuid(MVFR0_EL1);
+ info->reg_mvfr1 = read_cpuid(MVFR1_EL1);
+ info->reg_mvfr2 = read_cpuid(MVFR2_EL1);
+ }
cpuinfo_detect_icache_policy(info);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 5/7] arm64: cpufeature: Track 32bit EL0 support
2016-03-31 17:27 [PATCH v3 0/7] arm64: Support for systems without AArch32 state Suzuki K Poulose
` (3 preceding siblings ...)
2016-03-31 17:27 ` [PATCH v3 4/7] arm64: cpufeature: Check availability of AArch32 Suzuki K Poulose
@ 2016-03-31 17:27 ` Suzuki K Poulose
2016-04-14 16:43 ` Will Deacon
2016-03-31 17:27 ` [PATCH v3 6/7] arm64: Add a wrapper for personality() syscall Suzuki K Poulose
2016-03-31 17:27 ` [PATCH v3 7/7] arm64: compat: Check for AArch32 state Suzuki K Poulose
6 siblings, 1 reply; 15+ messages in thread
From: Suzuki K Poulose @ 2016-03-31 17:27 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-kernel, will.deacon, mark.rutland, marc.zyngier, ynorov,
Suzuki K Poulose
Add cpu_hwcap bit for keeping track of the support for 32bit EL0.
Tested-by: Yury Norov <ynorov@caviumnetworks.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
arch/arm64/include/asm/cpufeature.h | 8 +++++++-
arch/arm64/kernel/cpufeature.c | 9 +++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
index 7f64285..ca8fb4b 100644
--- a/arch/arm64/include/asm/cpufeature.h
+++ b/arch/arm64/include/asm/cpufeature.h
@@ -35,8 +35,9 @@
#define ARM64_ALT_PAN_NOT_UAO 10
#define ARM64_HAS_VIRT_HOST_EXTN 11
#define ARM64_WORKAROUND_CAVIUM_27456 12
+#define ARM64_HAS_32BIT_EL0 13
-#define ARM64_NCAPS 13
+#define ARM64_NCAPS 14
#ifndef __ASSEMBLY__
@@ -192,6 +193,11 @@ static inline bool cpu_supports_mixed_endian_el0(void)
return id_aa64mmfr0_mixed_endian_el0(read_cpuid(ID_AA64MMFR0_EL1));
}
+static inline bool system_supports_32bit_el0(void)
+{
+ return cpus_have_cap(ARM64_HAS_32BIT_EL0);
+}
+
static inline bool system_supports_mixed_endian_el0(void)
{
return id_aa64mmfr0_mixed_endian_el0(read_system_reg(SYS_ID_AA64MMFR0_EL1));
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index cfc0cfd..739314b 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -733,6 +733,15 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
.capability = ARM64_HAS_VIRT_HOST_EXTN,
.matches = runs_at_el2,
},
+ {
+ .desc = "32bit EL0 Support",
+ .capability = ARM64_HAS_32BIT_EL0,
+ .matches = has_cpuid_feature,
+ .sys_reg = SYS_ID_AA64PFR0_EL1,
+ .sign = FTR_UNSIGNED,
+ .field_pos = ID_AA64PFR0_EL0_SHIFT,
+ .min_field_value = ID_AA64PFR0_EL0_32BIT_64BIT,
+ },
{},
};
--
1.7.9.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 6/7] arm64: Add a wrapper for personality() syscall
2016-03-31 17:27 [PATCH v3 0/7] arm64: Support for systems without AArch32 state Suzuki K Poulose
` (4 preceding siblings ...)
2016-03-31 17:27 ` [PATCH v3 5/7] arm64: cpufeature: Track 32bit EL0 support Suzuki K Poulose
@ 2016-03-31 17:27 ` Suzuki K Poulose
2016-04-14 16:44 ` Will Deacon
2016-03-31 17:27 ` [PATCH v3 7/7] arm64: compat: Check for AArch32 state Suzuki K Poulose
6 siblings, 1 reply; 15+ messages in thread
From: Suzuki K Poulose @ 2016-03-31 17:27 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-kernel, will.deacon, mark.rutland, marc.zyngier, ynorov,
Suzuki K Poulose
In order to prevent setting PER_LINUX32 on systems without
32bit EL0 support, add a wrapper for personality() syscall.
Tested-by: Yury Norov <ynorov@caviumnetworks.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
arch/arm64/kernel/sys.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm64/kernel/sys.c b/arch/arm64/kernel/sys.c
index 75151aa..817d860 100644
--- a/arch/arm64/kernel/sys.c
+++ b/arch/arm64/kernel/sys.c
@@ -36,11 +36,17 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
return sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
}
+SYSCALL_DEFINE1(arm64_personality, unsigned int, personality)
+{
+ return sys_personality(personality);
+}
+
/*
* Wrappers to pass the pt_regs argument.
*/
asmlinkage long sys_rt_sigreturn_wrapper(void);
#define sys_rt_sigreturn sys_rt_sigreturn_wrapper
+#define sys_personality sys_arm64_personality
#undef __SYSCALL
#define __SYSCALL(nr, sym) [nr] = sym,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 7/7] arm64: compat: Check for AArch32 state
2016-03-31 17:27 [PATCH v3 0/7] arm64: Support for systems without AArch32 state Suzuki K Poulose
` (5 preceding siblings ...)
2016-03-31 17:27 ` [PATCH v3 6/7] arm64: Add a wrapper for personality() syscall Suzuki K Poulose
@ 2016-03-31 17:27 ` Suzuki K Poulose
6 siblings, 0 replies; 15+ messages in thread
From: Suzuki K Poulose @ 2016-03-31 17:27 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-kernel, will.deacon, mark.rutland, marc.zyngier, ynorov,
Suzuki K Poulose
From: Yury Norov <ynorov@caviumnetworks.com>
Make sure we have AArch32 state available for running COMPAT
binaries and also for switching the personality to PER_LINUX32.
Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
[ Added cap bit, checks for HWCAP, personality ]
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Tested-by: Yury Norov <ynorov@caviumnetworks.com>
---
arch/arm64/include/asm/elf.h | 3 ++-
arch/arm64/kernel/cpufeature.c | 7 +++++--
arch/arm64/kernel/sys.c | 4 ++++
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h
index 24ed037..7a09c48 100644
--- a/arch/arm64/include/asm/elf.h
+++ b/arch/arm64/include/asm/elf.h
@@ -177,7 +177,8 @@ typedef compat_elf_greg_t compat_elf_gregset_t[COMPAT_ELF_NGREG];
/* AArch32 EABI. */
#define EF_ARM_EABI_MASK 0xff000000
-#define compat_elf_check_arch(x) (((x)->e_machine == EM_ARM) && \
+#define compat_elf_check_arch(x) (system_supports_32bit_el0() && \
+ ((x)->e_machine == EM_ARM) && \
((x)->e_flags & EF_ARM_EABI_MASK))
#define compat_start_thread compat_start_thread
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index 739314b..c31be96 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -982,7 +982,8 @@ void verify_local_cpu_capabilities(void)
verify_local_cpu_features(arm64_features);
verify_local_elf_hwcaps(arm64_elf_hwcaps);
- verify_local_elf_hwcaps(compat_elf_hwcaps);
+ if (system_supports_32bit_el0())
+ verify_local_elf_hwcaps(compat_elf_hwcaps);
}
static void __init setup_feature_capabilities(void)
@@ -999,7 +1000,9 @@ void __init setup_cpu_features(void)
/* Set the CPU feature capabilies */
setup_feature_capabilities();
setup_elf_hwcaps(arm64_elf_hwcaps);
- setup_elf_hwcaps(compat_elf_hwcaps);
+
+ if (system_supports_32bit_el0())
+ setup_elf_hwcaps(compat_elf_hwcaps);
/* Advertise that we have computed the system capabilities */
set_sys_caps_initialised();
diff --git a/arch/arm64/kernel/sys.c b/arch/arm64/kernel/sys.c
index 817d860..26fe8ea 100644
--- a/arch/arm64/kernel/sys.c
+++ b/arch/arm64/kernel/sys.c
@@ -25,6 +25,7 @@
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/syscalls.h>
+#include <asm/cpufeature.h>
asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags,
@@ -38,6 +39,9 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
SYSCALL_DEFINE1(arm64_personality, unsigned int, personality)
{
+ if (personality(personality) == PER_LINUX32 &&
+ !system_supports_32bit_el0())
+ return -EINVAL;
return sys_personality(personality);
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v3 3/7] arm64: Add helpers for detecting AArch32 support at EL0
2016-03-31 17:27 ` [PATCH v3 3/7] arm64: Add helpers for detecting AArch32 support at EL0 Suzuki K Poulose
@ 2016-04-14 16:39 ` Will Deacon
2016-04-14 16:46 ` Suzuki K Poulose
0 siblings, 1 reply; 15+ messages in thread
From: Will Deacon @ 2016-04-14 16:39 UTC (permalink / raw)
To: Suzuki K Poulose
Cc: linux-arm-kernel, linux-kernel, mark.rutland, marc.zyngier,
ynorov
On Thu, Mar 31, 2016 at 06:27:31PM +0100, Suzuki K Poulose wrote:
> Adds a helper to extract the support for AArch32 at EL0
>
> Tested-by: Yury Norov <ynorov@caviumnetworks.com>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
> arch/arm64/include/asm/cpufeature.h | 7 +++++++
> arch/arm64/include/asm/sysreg.h | 1 +
> 2 files changed, 8 insertions(+)
>
> diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
> index b9b6494..7f64285 100644
> --- a/arch/arm64/include/asm/cpufeature.h
> +++ b/arch/arm64/include/asm/cpufeature.h
> @@ -170,6 +170,13 @@ static inline bool id_aa64mmfr0_mixed_endian_el0(u64 mmfr0)
> cpuid_feature_extract_unsigned_field(mmfr0, ID_AA64MMFR0_BIGENDEL0_SHIFT) == 0x1;
> }
>
> +static inline bool id_aa64pfr0_32bit_el0(u64 pfr0)
> +{
> + u32 val = cpuid_feature_extract_unsigned_field(pfr0, ID_AA64PFR0_EL0_SHIFT);
> +
> + return val == ID_AA64PFR0_EL0_32BIT_64BIT;
Should this be >=? What are the rules for this register?
Will
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 5/7] arm64: cpufeature: Track 32bit EL0 support
2016-03-31 17:27 ` [PATCH v3 5/7] arm64: cpufeature: Track 32bit EL0 support Suzuki K Poulose
@ 2016-04-14 16:43 ` Will Deacon
2016-04-14 16:50 ` Suzuki K Poulose
0 siblings, 1 reply; 15+ messages in thread
From: Will Deacon @ 2016-04-14 16:43 UTC (permalink / raw)
To: Suzuki K Poulose
Cc: linux-arm-kernel, linux-kernel, mark.rutland, marc.zyngier,
ynorov
On Thu, Mar 31, 2016 at 06:27:33PM +0100, Suzuki K Poulose wrote:
> Add cpu_hwcap bit for keeping track of the support for 32bit EL0.
>
> Tested-by: Yury Norov <ynorov@caviumnetworks.com>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
> arch/arm64/include/asm/cpufeature.h | 8 +++++++-
> arch/arm64/kernel/cpufeature.c | 9 +++++++++
> 2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
> index 7f64285..ca8fb4b 100644
> --- a/arch/arm64/include/asm/cpufeature.h
> +++ b/arch/arm64/include/asm/cpufeature.h
> @@ -35,8 +35,9 @@
> #define ARM64_ALT_PAN_NOT_UAO 10
> #define ARM64_HAS_VIRT_HOST_EXTN 11
> #define ARM64_WORKAROUND_CAVIUM_27456 12
> +#define ARM64_HAS_32BIT_EL0 13
>
> -#define ARM64_NCAPS 13
> +#define ARM64_NCAPS 14
>
> #ifndef __ASSEMBLY__
>
> @@ -192,6 +193,11 @@ static inline bool cpu_supports_mixed_endian_el0(void)
> return id_aa64mmfr0_mixed_endian_el0(read_cpuid(ID_AA64MMFR0_EL1));
> }
>
> +static inline bool system_supports_32bit_el0(void)
> +{
> + return cpus_have_cap(ARM64_HAS_32BIT_EL0);
> +}
> +
> static inline bool system_supports_mixed_endian_el0(void)
> {
> return id_aa64mmfr0_mixed_endian_el0(read_system_reg(SYS_ID_AA64MMFR0_EL1));
> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index cfc0cfd..739314b 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -733,6 +733,15 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
> .capability = ARM64_HAS_VIRT_HOST_EXTN,
> .matches = runs_at_el2,
> },
> + {
> + .desc = "32bit EL0 Support",
Nit: missing hyphen (32-bit).
Will
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 6/7] arm64: Add a wrapper for personality() syscall
2016-03-31 17:27 ` [PATCH v3 6/7] arm64: Add a wrapper for personality() syscall Suzuki K Poulose
@ 2016-04-14 16:44 ` Will Deacon
2016-04-14 16:47 ` Suzuki K Poulose
0 siblings, 1 reply; 15+ messages in thread
From: Will Deacon @ 2016-04-14 16:44 UTC (permalink / raw)
To: Suzuki K Poulose
Cc: linux-arm-kernel, linux-kernel, mark.rutland, marc.zyngier,
ynorov
On Thu, Mar 31, 2016 at 06:27:34PM +0100, Suzuki K Poulose wrote:
> In order to prevent setting PER_LINUX32 on systems without
> 32bit EL0 support, add a wrapper for personality() syscall.
>
> Tested-by: Yury Norov <ynorov@caviumnetworks.com>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> ---
> arch/arm64/kernel/sys.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/arch/arm64/kernel/sys.c b/arch/arm64/kernel/sys.c
> index 75151aa..817d860 100644
> --- a/arch/arm64/kernel/sys.c
> +++ b/arch/arm64/kernel/sys.c
> @@ -36,11 +36,17 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
> return sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
> }
>
> +SYSCALL_DEFINE1(arm64_personality, unsigned int, personality)
> +{
> + return sys_personality(personality);
> +}
> +
> /*
> * Wrappers to pass the pt_regs argument.
> */
> asmlinkage long sys_rt_sigreturn_wrapper(void);
> #define sys_rt_sigreturn sys_rt_sigreturn_wrapper
> +#define sys_personality sys_arm64_personality
You can merge this in with the subsequent patch, since it doesn't do
anything on its own.
Will
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 3/7] arm64: Add helpers for detecting AArch32 support at EL0
2016-04-14 16:39 ` Will Deacon
@ 2016-04-14 16:46 ` Suzuki K Poulose
2016-04-14 16:47 ` Will Deacon
0 siblings, 1 reply; 15+ messages in thread
From: Suzuki K Poulose @ 2016-04-14 16:46 UTC (permalink / raw)
To: Will Deacon
Cc: linux-arm-kernel, linux-kernel, mark.rutland, marc.zyngier,
ynorov
On 14/04/16 17:39, Will Deacon wrote:
> On Thu, Mar 31, 2016 at 06:27:31PM +0100, Suzuki K Poulose wrote:
>> Adds a helper to extract the support for AArch32 at EL0
>>
>> Tested-by: Yury Norov <ynorov@caviumnetworks.com>
>> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
>> +static inline bool id_aa64pfr0_32bit_el0(u64 pfr0)
>> +{
>> + u32 val = cpuid_feature_extract_unsigned_field(pfr0, ID_AA64PFR0_EL0_SHIFT);
>> +
>> + return val == ID_AA64PFR0_EL0_32BIT_64BIT;
>
> Should this be >=? What are the rules for this register?
This feature value is kind of "FTR_EXACT" where, we don't know what the relationship
of the values are. Here is the list of possible values :
0001 EL0 can be executed in AArch64 state only.
0010 EL0 can be executed in either AArch64 or AArch32 state.
All the other values are reserved. So I believe "==" is better check.
Suzuki
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 3/7] arm64: Add helpers for detecting AArch32 support at EL0
2016-04-14 16:46 ` Suzuki K Poulose
@ 2016-04-14 16:47 ` Will Deacon
0 siblings, 0 replies; 15+ messages in thread
From: Will Deacon @ 2016-04-14 16:47 UTC (permalink / raw)
To: Suzuki K Poulose
Cc: linux-arm-kernel, linux-kernel, mark.rutland, marc.zyngier,
ynorov
On Thu, Apr 14, 2016 at 05:46:08PM +0100, Suzuki K Poulose wrote:
> On 14/04/16 17:39, Will Deacon wrote:
> >On Thu, Mar 31, 2016 at 06:27:31PM +0100, Suzuki K Poulose wrote:
> >>Adds a helper to extract the support for AArch32 at EL0
> >>
> >>Tested-by: Yury Norov <ynorov@caviumnetworks.com>
> >>Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
>
> >>+static inline bool id_aa64pfr0_32bit_el0(u64 pfr0)
> >>+{
> >>+ u32 val = cpuid_feature_extract_unsigned_field(pfr0, ID_AA64PFR0_EL0_SHIFT);
> >>+
> >>+ return val == ID_AA64PFR0_EL0_32BIT_64BIT;
> >
> >Should this be >=? What are the rules for this register?
>
> This feature value is kind of "FTR_EXACT" where, we don't know what the relationship
> of the values are. Here is the list of possible values :
>
> 0001 EL0 can be executed in AArch64 state only.
> 0010 EL0 can be executed in either AArch64 or AArch32 state.
>
> All the other values are reserved. So I believe "==" is better check.
Yeah, and thinking about it some more, that makes sense. Thanks.
Will
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 6/7] arm64: Add a wrapper for personality() syscall
2016-04-14 16:44 ` Will Deacon
@ 2016-04-14 16:47 ` Suzuki K Poulose
0 siblings, 0 replies; 15+ messages in thread
From: Suzuki K Poulose @ 2016-04-14 16:47 UTC (permalink / raw)
To: Will Deacon
Cc: linux-arm-kernel, linux-kernel, mark.rutland, marc.zyngier,
ynorov
On 14/04/16 17:44, Will Deacon wrote:
> On Thu, Mar 31, 2016 at 06:27:34PM +0100, Suzuki K Poulose wrote:
>> In order to prevent setting PER_LINUX32 on systems without
>> 32bit EL0 support, add a wrapper for personality() syscall.
>>
>> /*
>> * Wrappers to pass the pt_regs argument.
>> */
>> asmlinkage long sys_rt_sigreturn_wrapper(void);
>> #define sys_rt_sigreturn sys_rt_sigreturn_wrapper
>> +#define sys_personality sys_arm64_personality
>
> You can merge this in with the subsequent patch, since it doesn't do
> anything on its own.
>
OK, I kept it separate because we were in effect modifying the syscall table
contents. I can merge it.
Suzuki
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 5/7] arm64: cpufeature: Track 32bit EL0 support
2016-04-14 16:43 ` Will Deacon
@ 2016-04-14 16:50 ` Suzuki K Poulose
0 siblings, 0 replies; 15+ messages in thread
From: Suzuki K Poulose @ 2016-04-14 16:50 UTC (permalink / raw)
To: Will Deacon
Cc: linux-arm-kernel, linux-kernel, mark.rutland, marc.zyngier,
ynorov
On 14/04/16 17:43, Will Deacon wrote:
> On Thu, Mar 31, 2016 at 06:27:33PM +0100, Suzuki K Poulose wrote:
>> Add cpu_hwcap bit for keeping track of the support for 32bit EL0.
>>
>> return id_aa64mmfr0_mixed_endian_el0(read_system_reg(SYS_ID_AA64MMFR0_EL1));
>> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
>> index cfc0cfd..739314b 100644
>> --- a/arch/arm64/kernel/cpufeature.c
>> +++ b/arch/arm64/kernel/cpufeature.c
>> @@ -733,6 +733,15 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
>> .capability = ARM64_HAS_VIRT_HOST_EXTN,
>> .matches = runs_at_el2,
>> },
>> + {
>> + .desc = "32bit EL0 Support",
>
> Nit: missing hyphen (32-bit).
OK, can change it.
Suzuki
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2016-04-14 16:50 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-31 17:27 [PATCH v3 0/7] arm64: Support for systems without AArch32 state Suzuki K Poulose
2016-03-31 17:27 ` [PATCH v3 1/7] arm64: hwcaps: Cleanup naming Suzuki K Poulose
2016-03-31 17:27 ` [PATCH v3 2/7] arm64: HWCAP: Split COMPAT HWCAP table entries Suzuki K Poulose
2016-03-31 17:27 ` [PATCH v3 3/7] arm64: Add helpers for detecting AArch32 support at EL0 Suzuki K Poulose
2016-04-14 16:39 ` Will Deacon
2016-04-14 16:46 ` Suzuki K Poulose
2016-04-14 16:47 ` Will Deacon
2016-03-31 17:27 ` [PATCH v3 4/7] arm64: cpufeature: Check availability of AArch32 Suzuki K Poulose
2016-03-31 17:27 ` [PATCH v3 5/7] arm64: cpufeature: Track 32bit EL0 support Suzuki K Poulose
2016-04-14 16:43 ` Will Deacon
2016-04-14 16:50 ` Suzuki K Poulose
2016-03-31 17:27 ` [PATCH v3 6/7] arm64: Add a wrapper for personality() syscall Suzuki K Poulose
2016-04-14 16:44 ` Will Deacon
2016-04-14 16:47 ` Suzuki K Poulose
2016-03-31 17:27 ` [PATCH v3 7/7] arm64: compat: Check for AArch32 state Suzuki K Poulose
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox