|
@@ -121,15 +121,15 @@ static inline void cpus_set_cap(unsigned int num)
|
|
|
}
|
|
|
|
|
|
static inline int __attribute_const__
|
|
|
-cpuid_feature_extract_field_width(u64 features, int field, int width)
|
|
|
+cpuid_feature_extract_signed_field_width(u64 features, int field, int width)
|
|
|
{
|
|
|
return (s64)(features << (64 - width - field)) >> (64 - width);
|
|
|
}
|
|
|
|
|
|
static inline int __attribute_const__
|
|
|
-cpuid_feature_extract_field(u64 features, int field)
|
|
|
+cpuid_feature_extract_signed_field(u64 features, int field)
|
|
|
{
|
|
|
- return cpuid_feature_extract_field_width(features, field, 4);
|
|
|
+ return cpuid_feature_extract_signed_field_width(features, field, 4);
|
|
|
}
|
|
|
|
|
|
static inline unsigned int __attribute_const__
|
|
@@ -149,17 +149,23 @@ static inline u64 arm64_ftr_mask(struct arm64_ftr_bits *ftrp)
|
|
|
return (u64)GENMASK(ftrp->shift + ftrp->width - 1, ftrp->shift);
|
|
|
}
|
|
|
|
|
|
+static inline int __attribute_const__
|
|
|
+cpuid_feature_extract_field(u64 features, int field, bool sign)
|
|
|
+{
|
|
|
+ return (sign) ?
|
|
|
+ cpuid_feature_extract_signed_field(features, field) :
|
|
|
+ cpuid_feature_extract_unsigned_field(features, field);
|
|
|
+}
|
|
|
+
|
|
|
static inline s64 arm64_ftr_value(struct arm64_ftr_bits *ftrp, u64 val)
|
|
|
{
|
|
|
- return ftrp->sign ?
|
|
|
- cpuid_feature_extract_field_width(val, ftrp->shift, ftrp->width) :
|
|
|
- cpuid_feature_extract_unsigned_field_width(val, ftrp->shift, ftrp->width);
|
|
|
+ return (s64)cpuid_feature_extract_field(val, ftrp->shift, ftrp->sign);
|
|
|
}
|
|
|
|
|
|
static inline bool id_aa64mmfr0_mixed_endian_el0(u64 mmfr0)
|
|
|
{
|
|
|
- return cpuid_feature_extract_field(mmfr0, ID_AA64MMFR0_BIGENDEL_SHIFT) == 0x1 ||
|
|
|
- cpuid_feature_extract_field(mmfr0, ID_AA64MMFR0_BIGENDEL0_SHIFT) == 0x1;
|
|
|
+ return cpuid_feature_extract_unsigned_field(mmfr0, ID_AA64MMFR0_BIGENDEL_SHIFT) == 0x1 ||
|
|
|
+ cpuid_feature_extract_unsigned_field(mmfr0, ID_AA64MMFR0_BIGENDEL0_SHIFT) == 0x1;
|
|
|
}
|
|
|
|
|
|
void __init setup_cpu_features(void);
|