103 lines
3.5 KiB
Diff
103 lines
3.5 KiB
Diff
# HG changeset patch
|
|
# User Keir Fraser <keir.fraser@citrix.com>
|
|
# 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@valinux.co.jp>
|
|
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
|
|
|
|
--- a/xen/arch/x86/physdev.c
|
|
+++ b/xen/arch/x86/physdev.c
|
|
@@ -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;
|
|
@@ -213,8 +214,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));
|
|
|
|
@@ -223,23 +225,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 )
|
|
+ if ( cmpxchg(&v->domain->arch.pirq_eoi_map_mfn, 0, mfn) != 0 )
|
|
{
|
|
- put_page_and_type(mfn_to_page(info.mfn));
|
|
+ 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;
|
|
}
|
|
--- a/xen/arch/x86/x86_64/physdev.c
|
|
+++ b/xen/arch/x86/x86_64/physdev.c
|
|
@@ -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
|
|
--- a/xen/include/public/physdev.h
|
|
+++ b/xen/include/public/physdev.h
|
|
@@ -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 {
|
|
+#define PHYSDEVOP_pirq_eoi_gmfn 17
|
|
+struct physdev_pirq_eoi_gmfn {
|
|
/* IN */
|
|
- xen_pfn_t mfn;
|
|
+ xen_pfn_t gmfn;
|
|
};
|
|
-typedef struct physdev_pirq_eoi_mfn physdev_pirq_eoi_mfn_t;
|
|
-DEFINE_XEN_GUEST_HANDLE(physdev_pirq_eoi_mfn_t);
|
|
+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.
|