ia64/xen-unstable

changeset 18796:d44ad6db638c

x86, hvm: Provide access to limited VCPUOP_ hypercalls.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Nov 13 14:19:56 2008 +0000 (2008-11-13)
parents 48879ca58848
children a0910b1b5ec0
files xen/arch/x86/hvm/hvm.c xen/include/xen/hypercall.h
line diff
     1.1 --- a/xen/arch/x86/hvm/hvm.c	Thu Nov 13 13:03:16 2008 +0000
     1.2 +++ b/xen/arch/x86/hvm/hvm.c	Thu Nov 13 14:19:56 2008 +0000
     1.3 @@ -1884,6 +1884,25 @@ static long hvm_memory_op(int cmd, XEN_G
     1.4      return rc;
     1.5  }
     1.6  
     1.7 +static long hvm_vcpu_op(
     1.8 +    int cmd, int vcpuid, XEN_GUEST_HANDLE(void) arg)
     1.9 +{
    1.10 +    long rc;
    1.11 +
    1.12 +    switch ( cmd )
    1.13 +    {
    1.14 +    case VCPUOP_register_runstate_memory_area:
    1.15 +    case VCPUOP_get_runstate_info:
    1.16 +        rc = do_vcpu_op(cmd, vcpuid, arg);
    1.17 +        break;
    1.18 +    default:
    1.19 +        rc = -ENOSYS;
    1.20 +        break;
    1.21 +    }
    1.22 +
    1.23 +    return rc;
    1.24 +}
    1.25 +
    1.26  typedef unsigned long hvm_hypercall_t(
    1.27      unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
    1.28  
    1.29 @@ -1895,6 +1914,7 @@ typedef unsigned long hvm_hypercall_t(
    1.30  static hvm_hypercall_t *hvm_hypercall32_table[NR_hypercalls] = {
    1.31      [ __HYPERVISOR_memory_op ] = (hvm_hypercall_t *)hvm_memory_op,
    1.32      [ __HYPERVISOR_grant_table_op ] = (hvm_hypercall_t *)hvm_grant_table_op,
    1.33 +    [ __HYPERVISOR_vcpu_op ] = (hvm_hypercall_t *)hvm_vcpu_op,
    1.34      HYPERCALL(xen_version),
    1.35      HYPERCALL(event_channel_op),
    1.36      HYPERCALL(sched_op),
    1.37 @@ -1911,9 +1931,29 @@ static long hvm_memory_op_compat32(int c
    1.38      return rc;
    1.39  }
    1.40  
    1.41 +static long hvm_vcpu_op_compat32(
    1.42 +    int cmd, int vcpuid, XEN_GUEST_HANDLE(void) arg)
    1.43 +{
    1.44 +    long rc;
    1.45 +
    1.46 +    switch ( cmd )
    1.47 +    {
    1.48 +    case VCPUOP_register_runstate_memory_area:
    1.49 +    case VCPUOP_get_runstate_info:
    1.50 +        rc = compat_vcpu_op(cmd, vcpuid, arg);
    1.51 +        break;
    1.52 +    default:
    1.53 +        rc = -ENOSYS;
    1.54 +        break;
    1.55 +    }
    1.56 +
    1.57 +    return rc;
    1.58 +}
    1.59 +
    1.60  static hvm_hypercall_t *hvm_hypercall64_table[NR_hypercalls] = {
    1.61      [ __HYPERVISOR_memory_op ] = (hvm_hypercall_t *)hvm_memory_op,
    1.62      [ __HYPERVISOR_grant_table_op ] = (hvm_hypercall_t *)hvm_grant_table_op,
    1.63 +    [ __HYPERVISOR_vcpu_op ] = (hvm_hypercall_t *)hvm_vcpu_op,
    1.64      HYPERCALL(xen_version),
    1.65      HYPERCALL(event_channel_op),
    1.66      HYPERCALL(sched_op),
    1.67 @@ -1923,6 +1963,7 @@ static hvm_hypercall_t *hvm_hypercall64_
    1.68  static hvm_hypercall_t *hvm_hypercall32_table[NR_hypercalls] = {
    1.69      [ __HYPERVISOR_memory_op ] = (hvm_hypercall_t *)hvm_memory_op_compat32,
    1.70      [ __HYPERVISOR_grant_table_op ] = (hvm_hypercall_t *)hvm_grant_table_op,
    1.71 +    [ __HYPERVISOR_vcpu_op ] = (hvm_hypercall_t *)hvm_vcpu_op_compat32,
    1.72      HYPERCALL(xen_version),
    1.73      HYPERCALL(event_channel_op),
    1.74      HYPERCALL(sched_op),
     2.1 --- a/xen/include/xen/hypercall.h	Thu Nov 13 13:03:16 2008 +0000
     2.2 +++ b/xen/include/xen/hypercall.h	Thu Nov 13 14:19:56 2008 +0000
     2.3 @@ -124,6 +124,12 @@ compat_memory_op(
     2.4      unsigned int cmd,
     2.5      XEN_GUEST_HANDLE(void) arg);
     2.6  
     2.7 +extern int
     2.8 +compat_vcpu_op(
     2.9 +    int cmd,
    2.10 +    int vcpuid,
    2.11 +    XEN_GUEST_HANDLE(void) arg);
    2.12 +
    2.13  #endif
    2.14  
    2.15  #endif /* __XEN_HYPERCALL_H__ */