[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [XEN][RFC PATCH 09/15] xc: Add the hypercall for multiple s
From: |
Julien Grall |
Subject: |
[Qemu-devel] [XEN][RFC PATCH 09/15] xc: Add the hypercall for multiple servers |
Date: |
Thu, 22 Mar 2012 15:59:30 +0000 |
This patch add 5 hypercalls to register server, io range and PCI.
Signed-off-by: Julien Grall <address@hidden>
---
tools/libxc/xc_domain.c | 140 +++++++++++++++++++++++++++++++++++++++++++++++
tools/libxc/xenctrl.h | 13 ++++
2 files changed, 153 insertions(+), 0 deletions(-)
diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index d98e68b..8067397 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -1514,6 +1514,146 @@ int xc_domain_set_virq_handler(xc_interface *xch,
uint32_t domid, int virq)
return do_domctl(xch, &domctl);
}
+int xc_hvm_register_ioreq_server(xc_interface *xch, domid_t dom, servid_t *id)
+{
+ DECLARE_HYPERCALL;
+ DECLARE_HYPERCALL_BUFFER(xen_hvm_register_ioreq_server_t, arg);
+ int rc = -1;
+
+ arg = xc_hypercall_buffer_alloc(xch, arg, sizeof (*arg));
+ if (!arg) {
+ PERROR("Could not allocate memory for xc_hvm_register_ioreq_server
hypercall");
+ goto out;
+ }
+
+ hypercall.op = __HYPERVISOR_hvm_op;
+ hypercall.arg[0] = HVMOP_register_ioreq_server;
+ hypercall.arg[1] = HYPERCALL_BUFFER_AS_ARG(arg);
+
+ arg->domid = dom;
+ rc = do_xen_hypercall(xch, &hypercall);
+ *id = arg->id;
+
+ xc_hypercall_buffer_free(xch, arg);
+out:
+ return rc;
+}
+
+int xc_hvm_get_ioreq_server_buf_channel(xc_interface *xch, domid_t dom,
servid_t id,
+ unsigned int *channel)
+{
+ DECLARE_HYPERCALL;
+ DECLARE_HYPERCALL_BUFFER(xen_hvm_get_ioreq_server_buf_channel_t, arg);
+ int rc = -1;
+
+ arg = xc_hypercall_buffer_alloc(xch, arg, sizeof (*arg));
+ if (!arg) {
+ PERROR("Could not allocate memory for
xc_hvm_get_ioreq_servr_buf_channel");
+ goto out;
+ }
+
+ hypercall.op = __HYPERVISOR_hvm_op;
+ hypercall.arg[0] = HVMOP_get_ioreq_server_buf_channel;
+ hypercall.arg[1] = HYPERCALL_BUFFER_AS_ARG(arg);
+
+ arg->domid = dom;
+ arg->id = id;
+ rc = do_xen_hypercall(xch, &hypercall);
+ *channel = arg->channel;
+
+ xc_hypercall_buffer_free(xch, arg);
+
+out:
+ return rc;
+}
+
+int xc_hvm_map_io_range_to_ioreq_server(xc_interface *xch, domid_t dom,
servid_t id,
+ char is_mmio, uint64_t start, uint64_t
end)
+{
+ DECLARE_HYPERCALL;
+ DECLARE_HYPERCALL_BUFFER(xen_hvm_map_io_range_to_ioreq_server_t, arg);
+ int rc = -1;
+
+ arg = xc_hypercall_buffer_alloc(xch, arg, sizeof (*arg));
+ if (!arg) {
+ PERROR("Could not allocate memory for
xc_hvm_map_io_range_to_ioreq_server hypercall");
+ goto out;
+ }
+
+ hypercall.op = __HYPERVISOR_hvm_op;
+ hypercall.arg[0] = HVMOP_map_io_range_to_ioreq_server;
+ hypercall.arg[1] = HYPERCALL_BUFFER_AS_ARG(arg);
+
+ arg->domid = dom;
+ arg->id = id;
+ arg->is_mmio = is_mmio;
+ arg->s = start;
+ arg->e = end;
+
+ rc = do_xen_hypercall(xch, &hypercall);
+
+ xc_hypercall_buffer_free(xch, arg);
+out:
+ return rc;
+}
+
+int xc_hvm_unmap_io_range_from_ioreq_server(xc_interface *xch, domid_t dom,
servid_t id,
+ char is_mmio, uint64_t addr)
+{
+ DECLARE_HYPERCALL;
+ DECLARE_HYPERCALL_BUFFER(xen_hvm_unmap_io_range_from_ioreq_server_t, arg);
+ int rc = -1;
+
+ arg = xc_hypercall_buffer_alloc(xch, arg, sizeof (*arg));
+ if (!arg) {
+ PERROR("Could not allocate memory for
xc_hvm_unmap_io_range_from_ioreq_server hypercall");
+ goto out;
+ }
+
+ hypercall.op = __HYPERVISOR_hvm_op;
+ hypercall.arg[0] = HVMOP_unmap_io_range_from_ioreq_server;
+ hypercall.arg[1] = HYPERCALL_BUFFER_AS_ARG(arg);
+
+ arg->domid = dom;
+ arg->id = id;
+ arg->is_mmio = is_mmio;
+ arg->addr = addr;
+ rc = do_xen_hypercall(xch, &hypercall);
+
+ xc_hypercall_buffer_free(xch, arg);
+out:
+ return rc;
+}
+
+int xc_hvm_register_pcidev(xc_interface *xch, domid_t dom, servid_t id,
+ uint16_t bdf)
+{
+ DECLARE_HYPERCALL;
+ DECLARE_HYPERCALL_BUFFER(xen_hvm_register_pcidev_t, arg);
+ int rc = -1;
+
+ arg = xc_hypercall_buffer_alloc(xch, arg, sizeof (*arg));
+ if (!arg)
+ {
+ PERROR("Could not allocate memory for xc_hvm_create_pci hypercall");
+ goto out;
+ }
+
+ hypercall.op = __HYPERVISOR_hvm_op;
+ hypercall.arg[0] = HVMOP_register_pcidev;
+ hypercall.arg[1] = HYPERCALL_BUFFER_AS_ARG(arg);
+
+ arg->domid = dom;
+ arg->id = id;
+ arg->bdf = bdf;
+ rc = do_xen_hypercall(xch, &hypercall);
+
+ xc_hypercall_buffer_free(xch, arg);
+out:
+ return rc;
+}
+
+
/*
* Local variables:
* mode: C
diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h
index 812e723..bcbfee5 100644
--- a/tools/libxc/xenctrl.h
+++ b/tools/libxc/xenctrl.h
@@ -1648,6 +1648,19 @@ void xc_clear_last_error(xc_interface *xch);
int xc_set_hvm_param(xc_interface *handle, domid_t dom, int param, unsigned
long value);
int xc_get_hvm_param(xc_interface *handle, domid_t dom, int param, unsigned
long *value);
+int xc_hvm_register_ioreq_server(xc_interface *xch, domid_t dom, unsigned int
*id);
+int xc_hvm_get_ioreq_server_buf_channel(xc_interface *xch, domid_t dom,
servid_t id,
+ unsigned int *channel);
+int xc_hvm_map_io_range_to_ioreq_server(xc_interface *xch, domid_t dom,
unsigned int id,
+ char is_mmio, uint64_t start, uint64_t
end);
+int xc_hvm_unmap_io_range_from_ioreq_server(xc_interface *xch, domid_t dom,
unsigned int id,
+ char is_mmio, uint64_t addr);
+/*
+ * Register a PCI device
+ */
+int xc_hvm_register_pcidev(xc_interface *xch, domid_t dom, unsigned int id,
+ uint16_t bdf);
+
/* IA64 specific, nvram save */
int xc_ia64_save_to_nvram(xc_interface *xch, uint32_t dom);
--
Julien Grall
- [Qemu-devel] [XEN][RFC PATCH 03/15] hvm-pci: Handle PCI config space in Xen, (continued)
- [Qemu-devel] [XEN][RFC PATCH 03/15] hvm-pci: Handle PCI config space in Xen, Julien Grall, 2012/03/22
- [Qemu-devel] [XEN][RFC PATCH 01/15] hvm: Modify interface to support multiple ioreq server, Julien Grall, 2012/03/22
- [Qemu-devel] [XEN][RFC PATCH 05/15] hvm: Modify hvm_op, Julien Grall, 2012/03/22
- [Qemu-devel] [XEN][RFC PATCH 11/15] xc: Fix python build, Julien Grall, 2012/03/22
- [Qemu-devel] [XEN][RFC PATCH 07/15] hvm-io: send invalidate map cache to each registered servers, Julien Grall, 2012/03/22
- [Qemu-devel] [XEN][RFC PATCH 13/15] xl-qmp: add device model id to qmp function, Julien Grall, 2012/03/22
- [Qemu-devel] [XEN][RFC PATCH 09/15] xc: Add the hypercall for multiple servers,
Julien Grall <=
- [Qemu-devel] [XEN][RFC PATCH 02/15] hvm: Add functions to handle ioreq servers, Julien Grall, 2012/03/22
- [Qemu-devel] [XEN][RFC PATCH 04/15] hvm: Change initialization/destruction of an hvm, Julien Grall, 2012/03/22
- [Qemu-devel] [XEN][RFC PATCH 06/15] hvm-io: IO refactoring with ioreq server, Julien Grall, 2012/03/22
- [Qemu-devel] [XEN][RFC PATCH 08/15] hvm-io: Handle server in buffered IO, Julien Grall, 2012/03/22
- [Qemu-devel] [XEN][RFC PATCH 10/15] xc: Add argument to allocate more special pages, Julien Grall, 2012/03/22
- [Qemu-devel] [XEN][RFC PATCH 14/15] xl-parsing: Parse the new option device_models, Julien Grall, 2012/03/22
- [Qemu-devel] [XEN][RFC PATCH 12/15] xl: Add interface to handle multiple device models, Julien Grall, 2012/03/22