This patch change the XENPF_get_cpuinfo interface to pass only one pcpu
information each hypercall.
Also, it replace xenpf_resource_hotplug with XENPF_cpu_online/offline.
Signed-off-by: Jiang, Yunhong <yunhong.jiang@xxxxxxxxx>
diff -r 918f692f6068 xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c Tue Nov 10 13:04:45 2009 +0000
+++ b/xen/arch/x86/platform_hypercall.c Thu Nov 12 04:07:43 2009 +0800
@@ -394,91 +394,72 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
case XENPF_get_cpuinfo:
{
- int i;
- struct xenpf_pcpu_info *g_info;
- struct xen_physical_cpuinfo pcpu;
- XEN_GUEST_HANDLE(xen_physical_cpuinfo_t) g_cpus;
+ struct xenpf_pcpuinfo *g_info;
g_info = &op->u.pcpu_info;
- if (g_info->info_num <= 0 )
- {
- op->u.pcpu_info.max_present = last_cpu(cpu_present_map);
- op->u.pcpu_info.max_possible = last_cpu(cpu_possible_map);
- goto done;
- }
-
- guest_from_compat_handle(g_cpus, g_info->info);
spin_lock(&cpu_add_remove_lock);
- ret = -EFAULT;
- for (i = 0; i < g_info->info_num; i++)
- {
- if (copy_from_guest_offset(&pcpu, g_cpus, i, 1) )
- goto out;
-
- if ( (pcpu.xen_cpuid >= NR_CPUS) ||
- (pcpu.xen_cpuid < 0) ||
- !cpu_present(pcpu.xen_cpuid) )
- {
- pcpu.flags |= XEN_PCPU_FLAGS_INVALID;
- }
- else
- {
- pcpu.apic_id = x86_cpu_to_apicid[pcpu.xen_cpuid];
- pcpu.acpi_id = acpi_get_processor_id(pcpu.xen_cpuid);
- ASSERT(pcpu.apic_id != BAD_APICID);
- if (cpu_online(pcpu.xen_cpuid))
- pcpu.flags |= XEN_PCPU_FLAGS_ONLINE;
- }
-
- if ( copy_to_guest_offset(g_cpus, i, &pcpu, 1) )
- goto out;
- }
- op->u.pcpu_info.max_present = last_cpu(cpu_present_map);
- op->u.pcpu_info.max_possible = last_cpu(cpu_possible_map);
+ if ( (g_info->xen_cpuid >= NR_CPUS) ||
+ (g_info->xen_cpuid < 0) ||
+ !cpu_present(g_info->xen_cpuid) )
+ {
+ g_info->flags |= XEN_PCPU_FLAGS_INVALID;
+ }
+ else
+ {
+ g_info->apic_id = x86_cpu_to_apicid[g_info->xen_cpuid];
+ g_info->acpi_id = acpi_get_processor_id(g_info->xen_cpuid);
+ ASSERT(g_info->apic_id != BAD_APICID);
+ if (cpu_online(g_info->xen_cpuid))
+ g_info->flags |= XEN_PCPU_FLAGS_ONLINE;
+ }
+
+ g_info->max_present = last_cpu(cpu_present_map);
+
spin_unlock(&cpu_add_remove_lock);
-done:
+
ret = copy_to_guest(u_xenpf_op, op, 1) ? -EFAULT : 0;
}
break;
- case XENPF_resource_hotplug:
+ case XENPF_cpu_online:
{
int cpu;
- switch ( op->u.resource.sub_cmd)
- {
- case XEN_CPU_online:
- cpu = op->u.resource.u.cpu_ol.cpuid;
- if (!cpu_present(cpu))
- {
- ret = -EINVAL;
- break;
- }
- else if (cpu_online(cpu))
- {
- ret = 0;
- break;
- }
-
- ret = cpu_up(cpu);
- break;
- case XEN_CPU_offline:
- cpu = op->u.resource.u.cpu_ol.cpuid;
- if (!cpu_present(cpu))
- {
- ret = -EINVAL;
- break;
- } else if (!cpu_online(cpu))
- {
- ret = 0;
- break;
- }
- ret = continue_hypercall_on_cpu(
- 0, cpu_down_helper, (void *)(unsigned long)cpu);
- break;
- }
+ cpu = op->u.cpu_ol.cpuid;
+ if (!cpu_present(cpu))
+ {
+ ret = -EINVAL;
+ break;
+ }
+ else if (cpu_online(cpu))
+ {
+ ret = 0;
+ break;
+ }
+
+ ret = cpu_up(cpu);
+ break;
+ }
+
+ case XENPF_cpu_offline:
+ {
+ int cpu;
+
+ cpu = op->u.cpu_ol.cpuid;
+ if (!cpu_present(cpu))
+ {
+ ret = -EINVAL;
+ break;
+ } else if (!cpu_online(cpu))
+ {
+ ret = 0;
+ break;
+ }
+ ret = continue_hypercall_on_cpu(
+ 0, cpu_down_helper, (void *)(unsigned long)cpu);
+ break;
}
break;
diff -r 918f692f6068 xen/arch/x86/x86_64/platform_hypercall.c
--- a/xen/arch/x86/x86_64/platform_hypercall.c Tue Nov 10 13:04:45 2009 +0000
+++ b/xen/arch/x86/x86_64/platform_hypercall.c Wed Nov 11 08:37:19 2009 +0800
@@ -23,11 +23,8 @@ DEFINE_XEN_GUEST_HANDLE(compat_platform_
#define xen_processor_power_t compat_processor_power_t
#define set_cx_pminfo compat_set_cx_pminfo
-DEFINE_XEN_GUEST_HANDLE(compat_physical_cpuinfo_t);
-#define xen_physical_cpuinfo compat_physical_cpuinfo
-#define xen_physical_cpuinfo_t compat_physical_cpuinfo_t
-#define xenpf_pcpu_info compat_pf_pcpu_info
-#define xenpf_pcpu_info_t compat_pf_pcpu_info_t
+#define xenpf_pcpuinfo compat_pf_pcpuinfo
+#define xenpf_pcpuinfo_t compat_pf_pcpuinfo_t
#define xenpf_enter_acpi_sleep compat_pf_enter_acpi_sleep
diff -r 918f692f6068 xen/include/public/platform.h
--- a/xen/include/public/platform.h Tue Nov 10 13:04:45 2009 +0000
+++ b/xen/include/public/platform.h Thu Nov 12 04:07:43 2009 +0800
@@ -313,55 +313,30 @@ DEFINE_XEN_GUEST_HANDLE(xenpf_set_proces
DEFINE_XEN_GUEST_HANDLE(xenpf_set_processor_pminfo_t);
#define XENPF_get_cpuinfo 55
-struct xen_physical_cpuinfo {
+struct xenpf_pcpuinfo {
/* IN */
uint32_t xen_cpuid;
/* OUT */
- uint32_t apic_id;
- uint32_t acpi_id;
+ /* The maxium cpu_id that is present */
+ uint32_t max_present;
#define XEN_PCPU_FLAGS_ONLINE 1
/* Correponding xen_cpuid is not present*/
#define XEN_PCPU_FLAGS_INVALID 2
uint32_t flags;
- uint8_t pad[128];
-};
-typedef struct xen_physical_cpuinfo xen_physical_cpuinfo_t;
-DEFINE_XEN_GUEST_HANDLE(xen_physical_cpuinfo_t);
-
-/*
- * Fetch physical CPUs information
- */
-struct xenpf_pcpu_info
-{
- /* OUT */
- /* The maxium cpu_id that is present */
- uint32_t max_present;
- /* The maxium possible cpus */
- uint32_t max_possible;
-
- /* IN */
- uint32_t info_num;
-
- XEN_GUEST_HANDLE(xen_physical_cpuinfo_t) info;
-};
-typedef struct xenpf_pcpu_info xenpf_pcpu_info_t;
-DEFINE_XEN_GUEST_HANDLE(xenpf_pcpu_info_t);
-
+ uint32_t apic_id;
+ uint32_t acpi_id;
+};
+typedef struct xenpf_pcpuinfo xenpf_pcpuinfo_t;
+DEFINE_XEN_GUEST_HANDLE(xenpf_pcpuinfo_t);
+
+#define XENPF_cpu_online 56
+#define XENPF_cpu_offline 57
struct xenpf_cpu_ol
{
uint32_t cpuid;
};
-
-#define XENPF_resource_hotplug 56
-struct xenpf_resource_hotplug {
- uint32_t sub_cmd;
-#define XEN_CPU_online 1
-#define XEN_CPU_offline 2
- union {
- struct xenpf_cpu_ol cpu_ol;
- uint8_t pad[64];
- }u;
-};
+typedef struct xenpf_cpu_ol xenpf_cpu_ol_t;
+DEFINE_XEN_GUEST_HANDLE(xenpf_cpu_ol_t);
struct xen_platform_op {
uint32_t cmd;
@@ -378,8 +353,8 @@ struct xen_platform_op {
struct xenpf_change_freq change_freq;
struct xenpf_getidletime getidletime;
struct xenpf_set_processor_pminfo set_pminfo;
- struct xenpf_pcpu_info pcpu_info;
- struct xenpf_resource_hotplug resource;
+ struct xenpf_pcpuinfo pcpu_info;
+ struct xenpf_cpu_ol cpu_ol;
uint8_t pad[128];
} u;
};
pcpu_interface.patch
Description: pcpu_interface.patch
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|