aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/platform_hypercall.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2011-11-24 17:56:26 +0100
committerJan Beulich <jbeulich@suse.com>2011-11-24 17:56:26 +0100
commit0244dc67686f8b683bc4998b90009c4747ba7955 (patch)
tree00588ff13eab9d597e6a46b53e6eb565a4ba0897 /xen/arch/x86/platform_hypercall.c
parent41f1a2fac48465b0b3863f1f9eec0a1a72101e46 (diff)
downloadxen-0244dc67686f8b683bc4998b90009c4747ba7955.tar.gz
xen-0244dc67686f8b683bc4998b90009c4747ba7955.tar.bz2
xen-0244dc67686f8b683bc4998b90009c4747ba7955.zip
x86: small fixes to pcpu platform op handling
XENPF_get_cpuinfo should init the flags output field rather than only modify it. XENPF_cpu_online must check for the input CPU number to be in range. XENPF_cpu_offline must also do that, and should also reject attempts to offline CPU 0 (this fails in cpu_down() too, but preventing this here appears more correct given that the code here calls continue_hypercall_on_cpu(0, ...), which would be flawed if cpu_down() would ever allow bringing down CPU 0 (and a distinct error code is easier to deal with when debugging issues). Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/arch/x86/platform_hypercall.c')
-rw-r--r--xen/arch/x86/platform_hypercall.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c
index 79b5ec2ccc..1cb8ff39db 100644
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -449,13 +449,14 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op)
if ( (g_info->xen_cpuid >= nr_cpu_ids) ||
!cpu_present(g_info->xen_cpuid) )
{
- g_info->flags |= XEN_PCPU_FLAGS_INVALID;
+ 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);
+ g_info->flags = 0;
if (cpu_online(g_info->xen_cpuid))
g_info->flags |= XEN_PCPU_FLAGS_ONLINE;
}
@@ -472,7 +473,7 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op)
{
int cpu = op->u.cpu_ol.cpuid;
- if ( !cpu_present(cpu) )
+ if ( cpu >= nr_cpu_ids || !cpu_present(cpu) )
{
ret = -EINVAL;
break;
@@ -493,7 +494,13 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op)
{
int cpu = op->u.cpu_ol.cpuid;
- if ( !cpu_present(cpu) )
+ if ( cpu == 0 )
+ {
+ ret = -EOPNOTSUPP;
+ break;
+ }
+
+ if ( cpu >= nr_cpu_ids || !cpu_present(cpu) )
{
ret = -EINVAL;
break;