The CPU capabilities will be set depending on the value found in the CPU
registers. This patch provides a generic to go through a set of capabilities
and find which one should be enabled.
The parameter "info" is used to display the kind of capability updated (e.g
workaround, feature...).
Signed-off-by: Julien Grall <julien.grall@arm.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
DECLARE_BITMAP(cpu_hwcaps, ARM_NCAPS);
+void update_cpu_capabilities(const struct arm_cpu_capabilities *caps,
+ const char *info)
+{
+ int i;
+
+ for ( i = 0; caps[i].matches; i++ )
+ {
+ if ( !caps[i].matches(&caps[i]) )
+ continue;
+
+ if ( !cpus_have_cap(caps[i].capability) && caps[i].desc )
+ printk(XENLOG_INFO "%s: %s\n", info, caps[i].desc);
+ cpus_set_cap(caps[i].capability);
+ }
+}
+
/*
* Local variables:
* mode: C
__set_bit(num, cpu_hwcaps);
}
+struct arm_cpu_capabilities {
+ const char *desc;
+ u16 capability;
+ bool_t (*matches)(const struct arm_cpu_capabilities *);
+};
+
+void update_cpu_capabilities(const struct arm_cpu_capabilities *caps,
+ const char *info);
+
#endif /* __ASSEMBLY__ */
#endif