On 2025-11-19 14:30, Grygorii Strashko wrote:
From: Grygorii Strashko <[email protected]>
Introduce is_hcall_compat() helper and use it instead of direct access to
struct vcpu->hcall_compat field in preparation for making HVM COMPAT code
optional. The vcpu->hcall_compat field is under CONFIG_COMPAT ifdefs
already.
Signed-off-by: Grygorii Strashko <[email protected]>
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 02bdc256ce37..ed6fdeeda9f9 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -311,6 +311,15 @@ struct vcpu
#endif
};
+static inline bool is_hcall_compat(void)
+{
+#ifdef CONFIG_COMPAT
+ return current->hcall_compat;
+#else
+ return false;
+#endif /* CONFIG_COMPAT */
+}
+
is_hcall_compat() matches the hcall_compat field, so I am okay with this.
Reviewed-by: Jason Andryuk <[email protected]>
However, is_compat_hcall() might be a slightly better name for the
helper. For me at least, I think of these as "compat hypercalls", so
that ordering reads a little more naturally for me. It's not a big
deal, but I figured I'd mention it in case others have an opinion.
Thanks,
Jason