On 12/8/25 02:44, Richard Henderson wrote:
On 8/12/25 03:06, Philippe Mathieu-Daudé wrote:
+bool host_cpu_feature_supported(enum arm_features feat, bool
can_emulate)
+{
+#if defined(CONFIG_KVM) || defined(CONFIG_HVF)
+ static enum { F_UNKN, F_SUPP, F_UNSUPP } supported[64] = { };
+
+ assert(feat < ARRAY_SIZE(supported));
+ if (supported[feat] == F_UNKN) {
+ supported[feat] = arm_hw_accel_cpu_feature_supported(feat,
can_emulate);
+ }
+ return supported[feat] == F_SUPP;
+#elif defined(CONFIG_TCG)
+ return can_emulate;
+#else
+#error
+#endif
+}
How much startup time is saved by this cache?
This feels like premature optimization.
It is called for each PSCI call here:
https://lore.kernel.org/qemu-devel/20250808070137.48716-6-moha...@unpredictable.fr/
+static int hvf_psci_get_target_el(void)
+{
+ if (hvf_arm_el2_enabled()) {
+ return 2;
+ }
+ return 1;
+}
But as you mentioned in patch #9 "by the time we get [here] we have
already detected the host cpu features and have updated env to match",
so checking with:
arm_feature(env, ARM_FEATURE_EL2)
should be sufficient.