diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-05-01 10:30:22 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-05-01 10:30:22 +0100 |
commit | ca0074e519fdc29c8574356b1ba551c8a1b235bb (patch) | |
tree | 4d65accb82731b261759c982e39a6a4ad78e9fc1 /tools/libxc | |
parent | 154c5516cb1264c9630f6100b28a7c7ed138430a (diff) | |
download | xen-ca0074e519fdc29c8574356b1ba551c8a1b235bb.tar.gz xen-ca0074e519fdc29c8574356b1ba551c8a1b235bb.tar.bz2 xen-ca0074e519fdc29c8574356b1ba551c8a1b235bb.zip |
MSI 2/6: change the pirq to be per-domain
Signed-off-by: Jiang Yunhong <yunhong.jiang@intel.com>
Signed-off-by: Shan Haitao <haitao.shan@intel.com>
Diffstat (limited to 'tools/libxc')
-rw-r--r-- | tools/libxc/xc_physdev.c | 40 | ||||
-rw-r--r-- | tools/libxc/xc_private.h | 30 | ||||
-rw-r--r-- | tools/libxc/xenctrl.h | 11 |
3 files changed, 81 insertions, 0 deletions
diff --git a/tools/libxc/xc_physdev.c b/tools/libxc/xc_physdev.c index 43ea7ff53f..1c5e8cb5da 100644 --- a/tools/libxc/xc_physdev.c +++ b/tools/libxc/xc_physdev.c @@ -19,3 +19,43 @@ int xc_physdev_pci_access_modify(int xc_handle, errno = ENOSYS; return -1; } + +int xc_physdev_map_pirq(int xc_handle, + int domid, + int type, + int index, + int *pirq) +{ + int rc; + struct physdev_map_pirq map; + + if ( !pirq ) + return -EINVAL; + + map.domid = domid; + map.type = type; + map.index = index; + map.pirq = *pirq; + + rc = do_physdev_op(xc_handle, PHYSDEVOP_map_pirq, &map); + + if ( !rc ) + *pirq = map.pirq; + + return rc; +} + +int xc_physdev_unmap_pirq(int xc_handle, + int domid, + int pirq) +{ + int rc; + struct physdev_unmap_pirq unmap; + + unmap.domid = domid; + unmap.pirq = pirq; + + rc = do_physdev_op(xc_handle, PHYSDEVOP_unmap_pirq, &unmap); + + return rc; +} diff --git a/tools/libxc/xc_private.h b/tools/libxc/xc_private.h index b068e45dbe..0570e62dfb 100644 --- a/tools/libxc/xc_private.h +++ b/tools/libxc/xc_private.h @@ -24,10 +24,12 @@ #define DECLARE_HYPERCALL privcmd_hypercall_t hypercall = { 0 } #define DECLARE_DOMCTL struct xen_domctl domctl = { 0 } #define DECLARE_SYSCTL struct xen_sysctl sysctl = { 0 } +#define DECLARE_PHYSDEV_OP struct physdev_op physdev_op = { 0 } #else #define DECLARE_HYPERCALL privcmd_hypercall_t hypercall #define DECLARE_DOMCTL struct xen_domctl domctl #define DECLARE_SYSCTL struct xen_sysctl sysctl +#define DECLARE_PHYSDEV_OP struct physdev_op physdev_op #endif #undef PAGE_SHIFT @@ -96,6 +98,34 @@ static inline int do_xen_version(int xc_handle, int cmd, void *dest) return do_xen_hypercall(xc_handle, &hypercall); } +static inline int do_physdev_op(int xc_handle, int cmd, void *op) +{ + int ret = -1; + + DECLARE_HYPERCALL; + hypercall.op = __HYPERVISOR_physdev_op; + hypercall.arg[0] = (unsigned long) cmd; + hypercall.arg[1] = (unsigned long) op; + + if ( lock_pages(op, sizeof(*op)) != 0 ) + { + PERROR("Could not lock memory for Xen hypercall"); + goto out1; + } + + if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 ) + { + if ( errno == EACCES ) + DPRINTF("physdev operation failed -- need to" + " rebuild the user-space tool set?\n"); + } + + unlock_pages(op, sizeof(*op)); + +out1: + return ret; +} + static inline int do_domctl(int xc_handle, struct xen_domctl *domctl) { int ret = -1; diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h index e05df73162..09e7becea3 100644 --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -21,6 +21,7 @@ #include <stdint.h> #include <xen/xen.h> #include <xen/domctl.h> +#include <xen/physdev.h> #include <xen/sysctl.h> #include <xen/version.h> #include <xen/event_channel.h> @@ -849,6 +850,16 @@ int xc_gnttab_munmap(int xcg_handle, int xc_gnttab_set_max_grants(int xcg_handle, uint32_t count); +int xc_physdev_map_pirq(int xc_handle, + int domid, + int type, + int index, + int *pirq); + +int xc_physdev_unmap_pirq(int xc_handle, + int domid, + int pirq); + int xc_hvm_set_pci_intx_level( int xc_handle, domid_t dom, uint8_t domain, uint8_t bus, uint8_t device, uint8_t intx, |