[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 02/11] xen/xsm: Wrap around xsm_platform_op with CONFIG_PLATFORM_OP


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jiqian Chen <Jiqian.Chen@xxxxxxx>
  • Date: Fri, 25 Jul 2025 14:15:21 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2UtHWQF39zvxE0GFBiHiKFyLZ0dmoJQ/vSoS2CPhbI4=; b=V3bQiJAICKzRwntK1cqKb1JcJNc148ZEq1LDUzFiGeWaw/qwjBQiHXVXzpLA5FLFFij6MEvrooO45g+GibpAFl/WZRUH/+HlWKRsCiKpsIiLUpeLQySTuU9WDBobzGcM9rSDTLk7HZ8V1g5OPolWqcWkmBHYqawletGUTvEeX5pZM9aT8AcRwKTIFk7DyQGQqRPkCseNQZWM3y1bGYHzDyqNEAdt7oIjp4bAn2DfppRCo0xHKGiqFee97/XwTj4enMMj265sMjL29H5aEBs5cT3gieeo81oz8BbdHOPs9g9oP9VeVr/HvA2V5b0YFyllse3rHc3MkwWZI1jaX9SOjw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FCvtGBiPMOMqh0yXdhsb6wsi9gr2a7wm67w7HerLaHAaev/iflCKUzJ1Xyun2wqbax3/x3hMdqyIc1izjccJiiqHFFKUfM2QBhRE598FGIuMEHpW9I65wITzdJQtCK3U65vBwFNpyBZuHIAODxa5cZFdl16KQHwKQFOiMQykX/+LW+sMXf1z9nTSZXhZBPGBcPrG1t67CjYs+uOfS75xevH3zv9F+U26YyzH+2ElY0eeuCm3gx7ahynKC+codvJDubdwi9YJdNzPCmIMuqhiuNyMwQa7LoMlFKeWtMqmENgMyPxWw18UVALHYfohjUfZZWA9AhF0oQV467qCoYFlMg==
  • Cc: Huang Rui <ray.huang@xxxxxxx>, Jiqian Chen <Jiqian.Chen@xxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 25 Jul 2025 06:16:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxx>
---
cc: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
---
 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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.