ia64/xen-unstable

changeset 18853:cb526325927c

physdev: make PHYSDEVOP_pirq_eoi_mfn use of gmfn instead of mfn.

To pass a page from a guest to hypervisor, gmfn should be used
instead of mfn like grant table and other hypercalls. It's more
consistent. So make use of gmfn instead of mfn for
PHYSDEVOP_pirq_eoi_mfn hypercall.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Dec 03 11:44:47 2008 +0000 (2008-12-03)
parents 9a6153a89d66
children 2647c63be4cf
files xen/arch/x86/physdev.c xen/arch/x86/x86_64/physdev.c xen/include/public/physdev.h
line diff
     1.1 --- a/xen/arch/x86/physdev.c	Wed Dec 03 11:38:36 2008 +0000
     1.2 +++ b/xen/arch/x86/physdev.c	Wed Dec 03 11:44:47 2008 +0000
     1.3 @@ -14,6 +14,7 @@
     1.4  #include <public/xen.h>
     1.5  #include <public/physdev.h>
     1.6  #include <xsm/xsm.h>
     1.7 +#include <asm/p2m.h>
     1.8  
     1.9  #ifndef COMPAT
    1.10  typedef long ret_t;
    1.11 @@ -200,8 +201,9 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
    1.12          break;
    1.13      }
    1.14  
    1.15 -    case PHYSDEVOP_pirq_eoi_mfn: {
    1.16 -        struct physdev_pirq_eoi_mfn info;
    1.17 +    case PHYSDEVOP_pirq_eoi_gmfn: {
    1.18 +        struct physdev_pirq_eoi_gmfn info;
    1.19 +        unsigned long mfn;
    1.20  
    1.21          BUILD_BUG_ON(NR_IRQS > (PAGE_SIZE * 8));
    1.22  
    1.23 @@ -210,23 +212,24 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
    1.24              break;
    1.25  
    1.26          ret = -EINVAL;
    1.27 -        if ( !mfn_valid(info.mfn) ||
    1.28 -             !get_page_and_type(mfn_to_page(info.mfn), v->domain,
    1.29 +        mfn = gmfn_to_mfn(current->domain, info.gmfn);
    1.30 +        if ( !mfn_valid(mfn) ||
    1.31 +             !get_page_and_type(mfn_to_page(mfn), v->domain,
    1.32                                  PGT_writable_page) )
    1.33              break;
    1.34  
    1.35 -        if ( cmpxchg(&v->domain->arch.pirq_eoi_map_mfn, 0, info.mfn) != 0 )
    1.36 +        if ( cmpxchg(&v->domain->arch.pirq_eoi_map_mfn, 0, mfn) != 0 )
    1.37          {
    1.38 -            put_page_and_type(mfn_to_page(info.mfn));
    1.39 +            put_page_and_type(mfn_to_page(mfn));
    1.40              ret = -EBUSY;
    1.41              break;
    1.42          }
    1.43  
    1.44 -        v->domain->arch.pirq_eoi_map = map_domain_page_global(info.mfn);
    1.45 +        v->domain->arch.pirq_eoi_map = map_domain_page_global(mfn);
    1.46          if ( v->domain->arch.pirq_eoi_map == NULL )
    1.47          {
    1.48              v->domain->arch.pirq_eoi_map_mfn = 0;
    1.49 -            put_page_and_type(mfn_to_page(info.mfn));
    1.50 +            put_page_and_type(mfn_to_page(mfn));
    1.51              ret = -ENOSPC;
    1.52              break;
    1.53          }
     2.1 --- a/xen/arch/x86/x86_64/physdev.c	Wed Dec 03 11:38:36 2008 +0000
     2.2 +++ b/xen/arch/x86/x86_64/physdev.c	Wed Dec 03 11:44:47 2008 +0000
     2.3 @@ -18,8 +18,8 @@
     2.4  #define physdev_eoi                compat_physdev_eoi
     2.5  #define physdev_eoi_t              physdev_eoi_compat_t
     2.6  
     2.7 -#define physdev_pirq_eoi_mfn       compat_physdev_pirq_eoi_mfn
     2.8 -#define physdev_pirq_eoi_mfn_t     physdev_pirq_eoi_mfn_compat_t
     2.9 +#define physdev_pirq_eoi_gmfn      compat_physdev_pirq_eoi_gmfn
    2.10 +#define physdev_pirq_eoi_gmfn_t    physdev_pirq_eoi_gmfn_compat_t
    2.11  
    2.12  #define physdev_set_iobitmap       compat_physdev_set_iobitmap
    2.13  #define physdev_set_iobitmap_t     physdev_set_iobitmap_compat_t
     3.1 --- a/xen/include/public/physdev.h	Wed Dec 03 11:38:36 2008 +0000
     3.2 +++ b/xen/include/public/physdev.h	Wed Dec 03 11:44:47 2008 +0000
     3.3 @@ -47,13 +47,13 @@ DEFINE_XEN_GUEST_HANDLE(physdev_eoi_t);
     3.4   * will automatically get unmasked. The page registered is used as a bit
     3.5   * array indexed by Xen's PIRQ value.
     3.6   */
     3.7 -#define PHYSDEVOP_pirq_eoi_mfn          17
     3.8 -struct physdev_pirq_eoi_mfn {
     3.9 +#define PHYSDEVOP_pirq_eoi_gmfn         17
    3.10 +struct physdev_pirq_eoi_gmfn {
    3.11      /* IN */
    3.12 -    xen_pfn_t mfn;
    3.13 +    xen_pfn_t gmfn;
    3.14  };
    3.15 -typedef struct physdev_pirq_eoi_mfn physdev_pirq_eoi_mfn_t;
    3.16 -DEFINE_XEN_GUEST_HANDLE(physdev_pirq_eoi_mfn_t);
    3.17 +typedef struct physdev_pirq_eoi_gmfn physdev_pirq_eoi_gmfn_t;
    3.18 +DEFINE_XEN_GUEST_HANDLE(physdev_pirq_eoi_gmfn_t);
    3.19  
    3.20  /*
    3.21   * Query the status of an IRQ line.