[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2 3/4] arm/sysctl: Implement cpu hotplug ops
Implement XEN_SYSCTL_CPU_HOTPLUG_{ONLINE,OFFLINE} calls to allow for enabling/disabling CPU cores in runtime. Signed-off-by: Mykyta Poturai <mykyta_poturai@xxxxxxxx> v1->v2: * remove SMT ops * remove cpu == 0 checks * add XSM hooks * only implement for 64bit Arm --- xen/arch/arm/sysctl.c | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/xen/arch/arm/sysctl.c b/xen/arch/arm/sysctl.c index 32cab4feff..fecd649db1 100644 --- a/xen/arch/arm/sysctl.c +++ b/xen/arch/arm/sysctl.c @@ -12,6 +12,8 @@ #include <xen/dt-overlay.h> #include <xen/errno.h> #include <xen/hypercall.h> +#include <xen/cpu.h> +#include <xsm/xsm.h> #include <asm/arm64/sve.h> #include <public/sysctl.h> @@ -23,6 +25,42 @@ void arch_do_physinfo(struct xen_sysctl_physinfo *pi) XEN_SYSCTL_PHYSCAP_ARM_SVE_MASK); } +#ifdef CONFIG_ARM_64 +static long cpu_up_helper(void *data) +{ + unsigned long cpu = (unsigned long) data; + return cpu_up(cpu); +} + +static long cpu_down_helper(void *data) +{ + unsigned long cpu = (unsigned long) data; + return cpu_down(cpu); +} + +static long cpu_hotplug_sysctl(struct xen_sysctl_cpu_hotplug *hotplug) +{ + int ret; + + switch (hotplug->op) { + case XEN_SYSCTL_CPU_HOTPLUG_ONLINE: + ret = xsm_resource_plug_core(XSM_HOOK); + if ( ret ) + return ret; + return continue_hypercall_on_cpu(0, cpu_up_helper, _p(hotplug->cpu)); + + case XEN_SYSCTL_CPU_HOTPLUG_OFFLINE: + ret = xsm_resource_unplug_core(XSM_HOOK); + if ( ret ) + return ret; + return continue_hypercall_on_cpu(0, cpu_down_helper, _p(hotplug->cpu)); + + default: + return -EOPNOTSUPP; + } +} +#endif + long arch_do_sysctl(struct xen_sysctl *sysctl, XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) { @@ -34,6 +72,13 @@ long arch_do_sysctl(struct xen_sysctl *sysctl, ret = dt_overlay_sysctl(&sysctl->u.dt_overlay); break; +/* CPU Hotplug only implemented for 64-bit Arm */ +#ifdef CONFIG_ARM_64 + case XEN_SYSCTL_cpu_hotplug: + ret = cpu_hotplug_sysctl(&sysctl->u.cpu_hotplug); + break; +#endif + default: ret = -ENOSYS; break; -- 2.34.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |