ia64/xen-unstable

changeset 15249:4c2b8ca4842c

hvm: Allow GNTTABOP_query_size.
Signed-off-by: Takanori Kasai <kasai.takanori@jp.fujitsu.com>
Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@jp.fujitsu.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Thu May 31 10:53:11 2007 +0100 (2007-05-31)
parents d1d5ceb3c3ff
children e2ba95ed2b09
files xen/arch/x86/hvm/hvm.c
line diff
     1.1 --- a/xen/arch/x86/hvm/hvm.c	Thu May 31 10:42:34 2007 +0100
     1.2 +++ b/xen/arch/x86/hvm/hvm.c	Thu May 31 10:53:11 2007 +0100
     1.3 @@ -662,20 +662,28 @@ void hvm_cpuid(unsigned int input, unsig
     1.4      }
     1.5  }
     1.6  
     1.7 +static long hvm_grant_table_op(
     1.8 +    unsigned int cmd, XEN_GUEST_HANDLE(void) uop, unsigned int count)
     1.9 +{
    1.10 +    if ( cmd != GNTTABOP_query_size )
    1.11 +        return -ENOSYS; /* all other commands need auditing */
    1.12 +    return do_grant_table_op(cmd, uop, count);
    1.13 +}
    1.14 +
    1.15  typedef unsigned long hvm_hypercall_t(
    1.16      unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
    1.17  
    1.18  #define HYPERCALL(x)                                        \
    1.19      [ __HYPERVISOR_ ## x ] = (hvm_hypercall_t *) do_ ## x
    1.20 -#define HYPERCALL_COMPAT32(x)                               \
    1.21 -    [ __HYPERVISOR_ ## x ] = (hvm_hypercall_t *) do_ ## x ## _compat32
    1.22  
    1.23  #if defined(__i386__)
    1.24  
    1.25  static hvm_hypercall_t *hvm_hypercall32_table[NR_hypercalls] = {
    1.26      HYPERCALL(memory_op),
    1.27 +    [ __HYPERVISOR_grant_table_op ] = (hvm_hypercall_t *)hvm_grant_table_op,
    1.28      HYPERCALL(multicall),
    1.29      HYPERCALL(xen_version),
    1.30 +    HYPERCALL(grant_table_op),
    1.31      HYPERCALL(event_channel_op),
    1.32      HYPERCALL(sched_op),
    1.33      HYPERCALL(hvm_op)
    1.34 @@ -726,15 +734,19 @@ static long do_memory_op_compat32(int cm
    1.35  
    1.36  static hvm_hypercall_t *hvm_hypercall64_table[NR_hypercalls] = {
    1.37      HYPERCALL(memory_op),
    1.38 +    [ __HYPERVISOR_grant_table_op ] = (hvm_hypercall_t *)hvm_grant_table_op,
    1.39      HYPERCALL(xen_version),
    1.40 +    HYPERCALL(grant_table_op),
    1.41      HYPERCALL(event_channel_op),
    1.42      HYPERCALL(sched_op),
    1.43      HYPERCALL(hvm_op)
    1.44  };
    1.45  
    1.46  static hvm_hypercall_t *hvm_hypercall32_table[NR_hypercalls] = {
    1.47 -    HYPERCALL_COMPAT32(memory_op),
    1.48 +    [ __HYPERVISOR_memory_op ] = (hvm_hypercall_t *)do_memory_op_compat32,
    1.49 +    [ __HYPERVISOR_grant_table_op ] = (hvm_hypercall_t *)hvm_grant_table_op,
    1.50      HYPERCALL(xen_version),
    1.51 +    HYPERCALL(grant_table_op),
    1.52      HYPERCALL(event_channel_op),
    1.53      HYPERCALL(sched_op),
    1.54      HYPERCALL(hvm_op)
    1.55 @@ -767,9 +779,6 @@ int hvm_do_hypercall(struct cpu_user_reg
    1.56  
    1.57      if ( (eax >= NR_hypercalls) || !hvm_hypercall32_table[eax] )
    1.58      {
    1.59 -        if ( eax != __HYPERVISOR_grant_table_op )
    1.60 -            gdprintk(XENLOG_WARNING, "HVM vcpu %d:%d bad hypercall %u.\n",
    1.61 -                     current->domain->domain_id, current->vcpu_id, eax);
    1.62          regs->eax = -ENOSYS;
    1.63          return HVM_HCALL_completed;
    1.64      }
    1.65 @@ -779,7 +788,8 @@ int hvm_do_hypercall(struct cpu_user_reg
    1.66       * For now we also need to flush when pages are added, as qemu-dm is not
    1.67       * yet capable of faulting pages into an existing valid mapcache bucket.
    1.68       */
    1.69 -    flush = (eax == __HYPERVISOR_memory_op);
    1.70 +    flush = ((eax == __HYPERVISOR_memory_op) ||
    1.71 +             (eax == __HYPERVISOR_grant_table_op)); /* needed ? */
    1.72      this_cpu(hc_preempted) = 0;
    1.73  
    1.74  #ifdef __x86_64__
    1.75 @@ -809,7 +819,8 @@ int hvm_do_hypercall(struct cpu_user_reg
    1.76                                                 (uint32_t)regs->edi);
    1.77      }
    1.78  
    1.79 -    HVM_DBG_LOG(DBG_LEVEL_HCALL, "hcall%u -> %lx", eax, (unsigned long)regs->eax);
    1.80 +    HVM_DBG_LOG(DBG_LEVEL_HCALL, "hcall%u -> %lx",
    1.81 +                eax, (unsigned long)regs->eax);
    1.82  
    1.83      return (this_cpu(hc_preempted) ? HVM_HCALL_preempted :
    1.84              flush ? HVM_HCALL_invalidate : HVM_HCALL_completed);