[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] physdev: make PHYSDEVOP_pirq_eoi_mfn use of gmfn instead of mfn.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1228304687 0 # Node ID cb526325927c0abac441588b4a69bccd0b99d7b3 # Parent 9a6153a89d6642555c9ed4dc386d243c3df23eab 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@xxxxxxxxxxxxx> Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> --- xen/arch/x86/physdev.c | 21 ++++++++++++--------- xen/arch/x86/x86_64/physdev.c | 4 ++-- xen/include/public/physdev.h | 14 +++++++------- 3 files changed, 21 insertions(+), 18 deletions(-) diff -r 9a6153a89d66 -r cb526325927c xen/arch/x86/physdev.c --- a/xen/arch/x86/physdev.c Wed Dec 03 11:38:36 2008 +0000 +++ b/xen/arch/x86/physdev.c Wed Dec 03 11:44:47 2008 +0000 @@ -14,6 +14,7 @@ #include <public/xen.h> #include <public/physdev.h> #include <xsm/xsm.h> +#include <asm/p2m.h> #ifndef COMPAT typedef long ret_t; @@ -200,8 +201,9 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H break; } - case PHYSDEVOP_pirq_eoi_mfn: { - struct physdev_pirq_eoi_mfn info; + case PHYSDEVOP_pirq_eoi_gmfn: { + struct physdev_pirq_eoi_gmfn info; + unsigned long mfn; BUILD_BUG_ON(NR_IRQS > (PAGE_SIZE * 8)); @@ -210,23 +212,24 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H break; ret = -EINVAL; - if ( !mfn_valid(info.mfn) || - !get_page_and_type(mfn_to_page(info.mfn), v->domain, + mfn = gmfn_to_mfn(current->domain, info.gmfn); + if ( !mfn_valid(mfn) || + !get_page_and_type(mfn_to_page(mfn), v->domain, PGT_writable_page) ) break; - if ( cmpxchg(&v->domain->arch.pirq_eoi_map_mfn, 0, info.mfn) != 0 ) - { - put_page_and_type(mfn_to_page(info.mfn)); + if ( cmpxchg(&v->domain->arch.pirq_eoi_map_mfn, 0, mfn) != 0 ) + { + put_page_and_type(mfn_to_page(mfn)); ret = -EBUSY; break; } - v->domain->arch.pirq_eoi_map = map_domain_page_global(info.mfn); + v->domain->arch.pirq_eoi_map = map_domain_page_global(mfn); if ( v->domain->arch.pirq_eoi_map == NULL ) { v->domain->arch.pirq_eoi_map_mfn = 0; - put_page_and_type(mfn_to_page(info.mfn)); + put_page_and_type(mfn_to_page(mfn)); ret = -ENOSPC; break; } diff -r 9a6153a89d66 -r cb526325927c xen/arch/x86/x86_64/physdev.c --- a/xen/arch/x86/x86_64/physdev.c Wed Dec 03 11:38:36 2008 +0000 +++ b/xen/arch/x86/x86_64/physdev.c Wed Dec 03 11:44:47 2008 +0000 @@ -18,8 +18,8 @@ #define physdev_eoi compat_physdev_eoi #define physdev_eoi_t physdev_eoi_compat_t -#define physdev_pirq_eoi_mfn compat_physdev_pirq_eoi_mfn -#define physdev_pirq_eoi_mfn_t physdev_pirq_eoi_mfn_compat_t +#define physdev_pirq_eoi_gmfn compat_physdev_pirq_eoi_gmfn +#define physdev_pirq_eoi_gmfn_t physdev_pirq_eoi_gmfn_compat_t #define physdev_set_iobitmap compat_physdev_set_iobitmap #define physdev_set_iobitmap_t physdev_set_iobitmap_compat_t diff -r 9a6153a89d66 -r cb526325927c xen/include/public/physdev.h --- a/xen/include/public/physdev.h Wed Dec 03 11:38:36 2008 +0000 +++ b/xen/include/public/physdev.h Wed Dec 03 11:44:47 2008 +0000 @@ -47,13 +47,13 @@ DEFINE_XEN_GUEST_HANDLE(physdev_eoi_t); * will automatically get unmasked. The page registered is used as a bit * array indexed by Xen's PIRQ value. */ -#define PHYSDEVOP_pirq_eoi_mfn 17 -struct physdev_pirq_eoi_mfn { - /* IN */ - xen_pfn_t mfn; -}; -typedef struct physdev_pirq_eoi_mfn physdev_pirq_eoi_mfn_t; -DEFINE_XEN_GUEST_HANDLE(physdev_pirq_eoi_mfn_t); +#define PHYSDEVOP_pirq_eoi_gmfn 17 +struct physdev_pirq_eoi_gmfn { + /* IN */ + xen_pfn_t gmfn; +}; +typedef struct physdev_pirq_eoi_gmfn physdev_pirq_eoi_gmfn_t; +DEFINE_XEN_GUEST_HANDLE(physdev_pirq_eoi_gmfn_t); /* * Query the status of an IRQ line. _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |