diff mbox series

[v2,19/19] xen/sysctl: wrap around sysctl hypercall

Message ID 20250326055053.3313146-20-Penny.Zheng@amd.com (mailing list archive)
State New
Headers show
Series xen: introduce CONFIG_SYSCTL | expand

Commit Message

Penny, Zheng March 26, 2025, 5:50 a.m. UTC
From: Stefano Stabellini <stefano.stabellini@amd.com>

We intend to wrap around sysctl hypercall, and also correct the order
alphabetically
We also need to removes all transient "#ifdef CONFIG_SYSCTL"-s in sysctl.c.

Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
---
v1 -> v2:
- remove all transient "#ifdef CONFIG_SYSCTL"-s in sysctl.c
---
 xen/common/Makefile          |  2 +-
 xen/common/sysctl.c          | 10 ----------
 xen/include/hypercall-defs.c |  8 ++++++--
 3 files changed, 7 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/xen/common/Makefile b/xen/common/Makefile
index ac23120d7d..d45dfeb5b6 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -69,7 +69,7 @@  obj-$(CONFIG_COMPAT) += $(addprefix compat/,domain.o memory.o multicall.o xlat.o
 ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
 obj-y += domctl.o
 obj-$(CONFIG_VM_EVENT) += monitor.o
-obj-y += sysctl.o
+obj-$(CONFIG_SYSCTL) += sysctl.o
 endif
 
 extra-y := symbols-dummy.o
diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c
index b0e2e43c7e..ba8c5e2266 100644
--- a/xen/common/sysctl.c
+++ b/xen/common/sysctl.c
@@ -58,7 +58,6 @@  long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
 
     switch ( op->cmd )
     {
-#ifdef CONFIG_SYSCTL
     case XEN_SYSCTL_readconsole:
         ret = xsm_readconsole(XSM_HOOK, op->u.readconsole.clear);
         if ( ret )
@@ -67,17 +66,14 @@  long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
         ret = read_console_ring(&op->u.readconsole);
         break;
 
-#endif /* CONFIG_SYSCTL */
     case XEN_SYSCTL_tbuf_op:
         ret = tb_control(&op->u.tbuf_op);
         break;
 
-#ifdef CONFIG_SYSCTL
     case XEN_SYSCTL_sched_id:
         op->u.sched_id.sched_id = scheduler_id();
         break;
 
-#endif /* CONFIG_SYSCTL */
     case XEN_SYSCTL_getdomaininfolist:
     { 
         struct domain *d;
@@ -117,7 +113,6 @@  long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
     }
     break;
 
-#ifdef CONFIG_SYSCTL
 #ifdef CONFIG_PERF_COUNTERS
     case XEN_SYSCTL_perfc_op:
         ret = perfc_control(&op->u.perfc_op);
@@ -129,7 +124,6 @@  long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
         ret = spinlock_profile_control(&op->u.lockprof_op);
         break;
 #endif
-#endif /* CONFIG_SYSCTL */
     case XEN_SYSCTL_debug_keys:
     {
         char c;
@@ -188,7 +182,6 @@  long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
         break;
 #endif /* CONFIG_PM_STATS */
 
-#ifdef CONFIG_SYSCTL
     case XEN_SYSCTL_page_offline_op:
     {
         uint32_t *status, *ptr;
@@ -300,7 +293,6 @@  long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
     }
     break;
 
-#endif /* CONFIG_SYSCTL */
     case XEN_SYSCTL_numainfo:
     {
         unsigned int i, j, num_nodes;
@@ -490,10 +482,8 @@  long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
         break;
 
     default:
-#ifdef CONFIG_SYSCTL
         ret = arch_do_sysctl(op, u_sysctl);
         copyback = 0;
-#endif
         break;
     }
 
diff --git a/xen/include/hypercall-defs.c b/xen/include/hypercall-defs.c
index 7720a29ade..322aa6eb09 100644
--- a/xen/include/hypercall-defs.c
+++ b/xen/include/hypercall-defs.c
@@ -195,10 +195,12 @@  kexec_op(unsigned long op, void *uarg)
 dm_op(domid_t domid, unsigned int nr_bufs, xen_dm_op_buf_t *bufs)
 #endif
 #ifndef CONFIG_PV_SHIM_EXCLUSIVE
-sysctl(xen_sysctl_t *u_sysctl)
 domctl(xen_domctl_t *u_domctl)
 paging_domctl_cont(xen_domctl_t *u_domctl)
 platform_op(xen_platform_op_t *u_xenpf_op)
+#ifdef CONFIG_SYSCTL
+sysctl(xen_sysctl_t *u_sysctl)
+#endif
 #endif
 #ifdef CONFIG_HVM
 hvm_op(unsigned long op, void *arg)
@@ -274,8 +276,10 @@  physdev_op                         compat   do       hvm      hvm      do_arm
 hvm_op                             do       do       do       do       do
 #endif
 #ifndef CONFIG_PV_SHIM_EXCLUSIVE
-sysctl                             do       do       do       do       do
 domctl                             do       do       do       do       do
+#ifdef CONFIG_SYSCTL
+sysctl                             do       do       do       do       do
+#endif
 #endif
 #ifdef CONFIG_KEXEC
 kexec_op                           compat   do       -        -        -