Skip to content

Commit c8c3798

Browse files
Suzuki K Poulosectmarinas
authored andcommitted
arm64: v8.3: Support for Javascript conversion instruction
ARMv8.3 adds support for a new instruction to perform conversion from double precision floating point to integer to match the architected behaviour of the equivalent Javascript conversion. Expose the availability via HWCAP and MRS emulation. Signed-off-by: Suzuki K Poulose <[email protected]> Signed-off-by: Catalin Marinas <[email protected]>
1 parent 87da236 commit c8c3798

File tree

5 files changed

+20
-1
lines changed

5 files changed

+20
-1
lines changed

Documentation/arm64/cpu-feature-registers.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,14 @@ infrastructure:
169169
as available on the CPU where it is fetched and is not a system
170170
wide safe value.
171171

172+
4) ID_AA64ISAR1_EL1 - Instruction set attribute register 1
173+
174+
x--------------------------------------------------x
175+
| Name | bits | visible |
176+
|--------------------------------------------------|
177+
| JSCVT | [15-12] | y |
178+
x--------------------------------------------------x
179+
172180
Appendix I: Example
173181
---------------------------
174182

arch/arm64/include/asm/sysreg.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@
156156
#define ID_AA64ISAR0_SHA1_SHIFT 8
157157
#define ID_AA64ISAR0_AES_SHIFT 4
158158

159+
/* id_aa64isar1 */
160+
#define ID_AA64ISAR1_JSCVT_SHIFT 12
161+
159162
/* id_aa64pfr0 */
160163
#define ID_AA64PFR0_GIC_SHIFT 24
161164
#define ID_AA64PFR0_ASIMD_SHIFT 20

arch/arm64/include/uapi/asm/hwcap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@
3232
#define HWCAP_ASIMDHP (1 << 10)
3333
#define HWCAP_CPUID (1 << 11)
3434
#define HWCAP_ASIMDRDM (1 << 12)
35+
#define HWCAP_JSCVT (1 << 13)
3536

3637
#endif /* _UAPI__ASM_HWCAP_H */

arch/arm64/kernel/cpufeature.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ static const struct arm64_ftr_bits ftr_id_aa64isar0[] = {
9797
ARM64_FTR_END,
9898
};
9999

100+
static const struct arm64_ftr_bits ftr_id_aa64isar1[] = {
101+
ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_EXACT, ID_AA64ISAR1_JSCVT_SHIFT, 4, 0),
102+
ARM64_FTR_END,
103+
};
104+
100105
static const struct arm64_ftr_bits ftr_id_aa64pfr0[] = {
101106
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_EXACT, ID_AA64PFR0_GIC_SHIFT, 4, 0),
102107
S_ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64PFR0_ASIMD_SHIFT, 4, ID_AA64PFR0_ASIMD_NI),
@@ -314,7 +319,7 @@ static const struct __ftr_reg_entry {
314319

315320
/* Op1 = 0, CRn = 0, CRm = 6 */
316321
ARM64_FTR_REG(SYS_ID_AA64ISAR0_EL1, ftr_id_aa64isar0),
317-
ARM64_FTR_REG(SYS_ID_AA64ISAR1_EL1, ftr_raz),
322+
ARM64_FTR_REG(SYS_ID_AA64ISAR1_EL1, ftr_id_aa64isar1),
318323

319324
/* Op1 = 0, CRn = 0, CRm = 7 */
320325
ARM64_FTR_REG(SYS_ID_AA64MMFR0_EL1, ftr_id_aa64mmfr0),
@@ -888,6 +893,7 @@ static const struct arm64_cpu_capabilities arm64_elf_hwcaps[] = {
888893
HWCAP_CAP(SYS_ID_AA64PFR0_EL1, ID_AA64PFR0_FP_SHIFT, FTR_SIGNED, 1, CAP_HWCAP, HWCAP_FPHP),
889894
HWCAP_CAP(SYS_ID_AA64PFR0_EL1, ID_AA64PFR0_ASIMD_SHIFT, FTR_SIGNED, 0, CAP_HWCAP, HWCAP_ASIMD),
890895
HWCAP_CAP(SYS_ID_AA64PFR0_EL1, ID_AA64PFR0_ASIMD_SHIFT, FTR_SIGNED, 1, CAP_HWCAP, HWCAP_ASIMDHP),
896+
HWCAP_CAP(SYS_ID_AA64ISAR1_EL1, ID_AA64ISAR1_JSCVT_SHIFT, FTR_UNSIGNED, 1, CAP_HWCAP, HWCAP_JSCVT),
891897
{},
892898
};
893899

arch/arm64/kernel/cpuinfo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ static const char *const hwcap_str[] = {
6565
"asimdhp",
6666
"cpuid",
6767
"asimdrdm",
68+
"jscvt",
6869
NULL
6970
};
7071

0 commit comments

Comments
 (0)