mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
x86: Add sysctl for cpu online/offline
Signed-off-by: Shan Haitao <haitao.shan@intel.com>
This commit is contained in:
1 parent
8d71a294c1
commit
49571f74cb
2 files changed
+38
No files matched your search
@@ -29,6 +29,12 @@
|
||||
|
||||
#define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0)
|
||||
|
||||
static long cpu_down_helper(void *data)
|
||||
{
|
||||
int cpu = (unsigned long)data;
|
||||
return cpu_down(cpu);
|
||||
}
|
||||
|
||||
long arch_do_sysctl(
|
||||
struct xen_sysctl *sysctl, XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
|
||||
{
|
||||
@@ -92,6 +98,25 @@ long arch_do_sysctl(
|
||||
}
|
||||
break;
|
||||
|
||||
case XEN_SYSCTL_cpu_hotplug:
|
||||
{
|
||||
unsigned int cpu = sysctl->u.cpu_hotplug.cpu;
|
||||
|
||||
switch ( sysctl->u.cpu_hotplug.op )
|
||||
{
|
||||
case XEN_SYSCTL_CPU_HOTPLUG_ONLINE:
|
||||
ret = cpu_up(cpu);
|
||||
break;
|
||||
case XEN_SYSCTL_CPU_HOTPLUG_OFFLINE:
|
||||
ret = continue_hypercall_on_cpu(
|
||||
0, cpu_down_helper, (void *)(unsigned long)cpu);
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
ret = -ENOSYS;
|
||||
|
||||
@@ -262,6 +262,18 @@ struct xen_sysctl_get_pmstat {
|
||||
typedef struct xen_sysctl_get_pmstat xen_sysctl_get_pmstat_t;
|
||||
DEFINE_XEN_GUEST_HANDLE(xen_sysctl_get_pmstat_t);
|
||||
|
||||
#define XEN_SYSCTL_cpu_hotplug 11
|
||||
struct xen_sysctl_cpu_hotplug {
|
||||
/* IN variables */
|
||||
uint32_t cpu; /* Physical cpu. */
|
||||
#define XEN_SYSCTL_CPU_HOTPLUG_ONLINE 0
|
||||
#define XEN_SYSCTL_CPU_HOTPLUG_OFFLINE 1
|
||||
uint32_t op; /* hotplug opcode */
|
||||
};
|
||||
typedef struct xen_sysctl_cpu_hotplug xen_sysctl_cpu_hotplug_t;
|
||||
DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cpu_hotplug_t);
|
||||
|
||||
|
||||
struct xen_sysctl {
|
||||
uint32_t cmd;
|
||||
uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */
|
||||
@@ -276,6 +288,7 @@ struct xen_sysctl {
|
||||
struct xen_sysctl_getcpuinfo getcpuinfo;
|
||||
struct xen_sysctl_availheap availheap;
|
||||
struct xen_sysctl_get_pmstat get_pmstat;
|
||||
struct xen_sysctl_cpu_hotplug cpu_hotplug;
|
||||
uint8_t pad[128];
|
||||
} u;
|
||||
};
|
||||
|
||||