As function xsm_platform_op() is solely invoked in platform_hypercall.c,
it needs to be wrapped around with CONFIG_PLATFORM_OP.
Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
---
cc: "Daniel P. Smith" <dpsmith@apertussolutions.com>
---
xen/include/xsm/xsm.h | 4 ++++
xen/xsm/dummy.c | 3 +++
xen/xsm/flask/hooks.c | 5 +++++
3 files changed, 12 insertions(+)
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 9a23d2827cc0..bc0a0776c895 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -678,7 +678,11 @@ static inline int xsm_mem_sharing(xsm_default_t def, struct domain *d)
static inline int xsm_platform_op(xsm_default_t def, uint32_t op)
{
+#ifdef CONFIG_PLATFORM_OP
return alternative_call(xsm_ops.platform_op, op);
+#else
+ return -EOPNOTSUPP;
+#endif
}
#ifdef CONFIG_X86
diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c
index 8b7e01b50690..d9f4d3ee12b1 100644
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -129,7 +129,10 @@ static const struct xsm_ops __initconst_cf_clobber dummy_ops = {
.mem_sharing = xsm_mem_sharing,
#endif
+#ifdef CONFIG_PLATFORM_OP
.platform_op = xsm_platform_op,
+#endif
+
#ifdef CONFIG_X86
.do_mca = xsm_do_mca,
.shadow_control = xsm_shadow_control,
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index b0308e1b26e0..a56a6d07475c 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -1527,6 +1527,7 @@ static int cf_check flask_deassign_dtdevice(
}
#endif /* HAS_PASSTHROUGH && HAS_DEVICE_TREE_DISCOVERY */
+#ifdef CONFIG_PLATFORM_OP
static int cf_check flask_platform_op(uint32_t op)
{
switch ( op )
@@ -1598,6 +1599,7 @@ static int cf_check flask_platform_op(uint32_t op)
return avc_unknown_permission("platform_op", op);
}
}
+#endif /* CONFIG_PLATFORM_OP */
#ifdef CONFIG_X86
static int cf_check flask_do_mca(void)
@@ -2000,7 +2002,10 @@ static const struct xsm_ops __initconst_cf_clobber flask_ops = {
.deassign_dtdevice = flask_deassign_dtdevice,
#endif
+#ifdef CONFIG_PLATFORM_OP
.platform_op = flask_platform_op,
+#endif
+
#ifdef CONFIG_X86
.do_mca = flask_do_mca,
.shadow_control = flask_shadow_control,
--
2.34.1