From: stefano.stabellini@eu.citrix.com
To: qemu-devel@nongnu.org
Cc: Anthony.Perard@citrix.com,
Anthony PERARD <anthony.perard@citrix.com>,
xen-devel@lists.xensource.com,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [Qemu-devel] [PATCH 01/15] xen: Update libxc calls
Date: Thu, 12 Aug 2010 15:09:48 +0100 [thread overview]
Message-ID: <1281622202-3453-1-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1008121244200.2545@kaball-desktop>
From: Anthony PERARD <anthony.perard@citrix.com>
Update the libxenctrl calls in Qemu to use the new interface, otherwise
Qemu wouldn't be able to build against new versions of the library.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
configure | 2 +-
hw/xen_backend.c | 10 +++++-----
hw/xen_backend.h | 2 +-
hw/xen_disk.c | 12 ++++++------
hw/xen_domainbuild.c | 4 +++-
hw/xen_nic.c | 16 ++++++++--------
6 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/configure b/configure
index a20371c..89d9b44 100755
--- a/configure
+++ b/configure
@@ -1102,7 +1102,7 @@ if test "$xen" != "no" ; then
cat > $TMPC <<EOF
#include <xenctrl.h>
#include <xs.h>
-int main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
+int main(void) { xs_daemon_open(); xc_interface_open(0, 0, 0); return 0; }
EOF
if compile_prog "" "$xen_libs" ; then
xen=yes
diff --git a/hw/xen_backend.c b/hw/xen_backend.c
index a2e408f..b2d302b 100644
--- a/hw/xen_backend.c
+++ b/hw/xen_backend.c
@@ -43,7 +43,7 @@
/* ------------------------------------------------------------- */
/* public */
-int xen_xc;
+xc_interface *xen_xc = NULL;
struct xs_handle *xenstore = NULL;
const char *xen_protocol;
@@ -216,7 +216,7 @@ static struct XenDevice *xen_be_get_xendev(const char *type, int dom, int dev,
fcntl(xc_evtchn_fd(xendev->evtchndev), F_SETFD, FD_CLOEXEC);
if (ops->flags & DEVOPS_FLAG_NEED_GNTDEV) {
- xendev->gnttabdev = xc_gnttab_open();
+ xendev->gnttabdev = xc_gnttab_open(xen_xc);
if (xendev->gnttabdev < 0) {
xen_be_printf(NULL, 0, "can't open gnttab device\n");
xc_evtchn_close(xendev->evtchndev);
@@ -269,7 +269,7 @@ static struct XenDevice *xen_be_del_xendev(int dom, int dev)
if (xendev->evtchndev >= 0)
xc_evtchn_close(xendev->evtchndev);
if (xendev->gnttabdev >= 0)
- xc_gnttab_close(xendev->gnttabdev);
+ xc_gnttab_close(xen_xc, xendev->gnttabdev);
QTAILQ_REMOVE(&xendevs, xendev, next);
qemu_free(xendev);
@@ -627,8 +627,8 @@ int xen_be_init(void)
if (qemu_set_fd_handler(xs_fileno(xenstore), xenstore_update, NULL, NULL) < 0)
goto err;
- xen_xc = xc_interface_open();
- if (xen_xc == -1) {
+ xen_xc = xc_interface_open(NULL, NULL, 0);
+ if (xen_xc == NULL) {
xen_be_printf(NULL, 0, "can't open xen interface\n");
goto err;
}
diff --git a/hw/xen_backend.h b/hw/xen_backend.h
index cc25f9d..385e851 100644
--- a/hw/xen_backend.h
+++ b/hw/xen_backend.h
@@ -57,7 +57,7 @@ struct XenDevice {
/* ------------------------------------------------------------- */
/* variables */
-extern int xen_xc;
+extern xc_interface *xen_xc;
extern struct xs_handle *xenstore;
extern const char *xen_protocol;
diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index 9a466f3..3c1d3ef 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -242,7 +242,7 @@ static void ioreq_unmap(struct ioreq *ioreq)
if (batch_maps) {
if (!ioreq->pages)
return;
- if (xc_gnttab_munmap(gnt, ioreq->pages, ioreq->v.niov) != 0)
+ if (xc_gnttab_munmap(xen_xc, gnt, ioreq->pages, ioreq->v.niov) != 0)
xen_be_printf(&ioreq->blkdev->xendev, 0, "xc_gnttab_munmap failed: %s\n",
strerror(errno));
ioreq->blkdev->cnt_map -= ioreq->v.niov;
@@ -251,7 +251,7 @@ static void ioreq_unmap(struct ioreq *ioreq)
for (i = 0; i < ioreq->v.niov; i++) {
if (!ioreq->page[i])
continue;
- if (xc_gnttab_munmap(gnt, ioreq->page[i], 1) != 0)
+ if (xc_gnttab_munmap(xen_xc, gnt, ioreq->page[i], 1) != 0)
xen_be_printf(&ioreq->blkdev->xendev, 0, "xc_gnttab_munmap failed: %s\n",
strerror(errno));
ioreq->blkdev->cnt_map--;
@@ -269,7 +269,7 @@ static int ioreq_map(struct ioreq *ioreq)
return 0;
if (batch_maps) {
ioreq->pages = xc_gnttab_map_grant_refs
- (gnt, ioreq->v.niov, ioreq->domids, ioreq->refs, ioreq->prot);
+ (xen_xc, gnt, ioreq->v.niov, ioreq->domids, ioreq->refs, ioreq->prot);
if (ioreq->pages == NULL) {
xen_be_printf(&ioreq->blkdev->xendev, 0,
"can't map %d grant refs (%s, %d maps)\n",
@@ -283,7 +283,7 @@ static int ioreq_map(struct ioreq *ioreq)
} else {
for (i = 0; i < ioreq->v.niov; i++) {
ioreq->page[i] = xc_gnttab_map_grant_ref
- (gnt, ioreq->domids[i], ioreq->refs[i], ioreq->prot);
+ (xen_xc, gnt, ioreq->domids[i], ioreq->refs[i], ioreq->prot);
if (ioreq->page[i] == NULL) {
xen_be_printf(&ioreq->blkdev->xendev, 0,
"can't map grant ref %d (%s, %d maps)\n",
@@ -683,7 +683,7 @@ static int blk_connect(struct XenDevice *xendev)
blkdev->protocol = BLKIF_PROTOCOL_X86_64;
}
- blkdev->sring = xc_gnttab_map_grant_ref(blkdev->xendev.gnttabdev,
+ blkdev->sring = xc_gnttab_map_grant_ref(xen_xc, blkdev->xendev.gnttabdev,
blkdev->xendev.dom,
blkdev->ring_ref,
PROT_READ | PROT_WRITE);
@@ -738,7 +738,7 @@ static void blk_disconnect(struct XenDevice *xendev)
xen_be_unbind_evtchn(&blkdev->xendev);
if (blkdev->sring) {
- xc_gnttab_munmap(blkdev->xendev.gnttabdev, blkdev->sring, 1);
+ xc_gnttab_munmap(xen_xc, blkdev->xendev.gnttabdev, blkdev->sring, 1);
blkdev->cnt_map--;
blkdev->sring = NULL;
}
diff --git a/hw/xen_domainbuild.c b/hw/xen_domainbuild.c
index 7f1fd66..1620312 100644
--- a/hw/xen_domainbuild.c
+++ b/hw/xen_domainbuild.c
@@ -176,7 +176,9 @@ static int xen_domain_watcher(void)
for (i = 3; i < n; i++) {
if (i == fd[0])
continue;
- if (i == xen_xc)
+ // FIXME The fd of xen_xc is now xen_xc->fd
+ // fd is the first field, so this works
+ if (i == *(int*)xen_xc)
continue;
close(i);
}
diff --git a/hw/xen_nic.c b/hw/xen_nic.c
index 08055b8..4f68850 100644
--- a/hw/xen_nic.c
+++ b/hw/xen_nic.c
@@ -166,7 +166,7 @@ static void net_tx_packets(struct XenNetDev *netdev)
(txreq.flags & NETTXF_more_data) ? " more_data" : "",
(txreq.flags & NETTXF_extra_info) ? " extra_info" : "");
- page = xc_gnttab_map_grant_ref(netdev->xendev.gnttabdev,
+ page = xc_gnttab_map_grant_ref(xen_xc, netdev->xendev.gnttabdev,
netdev->xendev.dom,
txreq.gref, PROT_READ);
if (page == NULL) {
@@ -185,7 +185,7 @@ static void net_tx_packets(struct XenNetDev *netdev)
} else {
qemu_send_packet(&netdev->nic->nc, page + txreq.offset, txreq.size);
}
- xc_gnttab_munmap(netdev->xendev.gnttabdev, page, 1);
+ xc_gnttab_munmap(xen_xc, netdev->xendev.gnttabdev, page, 1);
net_tx_response(netdev, &txreq, NETIF_RSP_OKAY);
}
if (!netdev->tx_work)
@@ -272,7 +272,7 @@ static ssize_t net_rx_packet(VLANClientState *nc, const uint8_t *buf, size_t siz
memcpy(&rxreq, RING_GET_REQUEST(&netdev->rx_ring, rc), sizeof(rxreq));
netdev->rx_ring.req_cons = ++rc;
- page = xc_gnttab_map_grant_ref(netdev->xendev.gnttabdev,
+ page = xc_gnttab_map_grant_ref(xen_xc, netdev->xendev.gnttabdev,
netdev->xendev.dom,
rxreq.gref, PROT_WRITE);
if (page == NULL) {
@@ -282,7 +282,7 @@ static ssize_t net_rx_packet(VLANClientState *nc, const uint8_t *buf, size_t siz
return -1;
}
memcpy(page + NET_IP_ALIGN, buf, size);
- xc_gnttab_munmap(netdev->xendev.gnttabdev, page, 1);
+ xc_gnttab_munmap(xen_xc, netdev->xendev.gnttabdev, page, 1);
net_rx_response(netdev, &rxreq, NETIF_RSP_OKAY, NET_IP_ALIGN, size, 0);
return size;
@@ -350,11 +350,11 @@ static int net_connect(struct XenDevice *xendev)
return -1;
}
- netdev->txs = xc_gnttab_map_grant_ref(netdev->xendev.gnttabdev,
+ netdev->txs = xc_gnttab_map_grant_ref(xen_xc, netdev->xendev.gnttabdev,
netdev->xendev.dom,
netdev->tx_ring_ref,
PROT_READ | PROT_WRITE);
- netdev->rxs = xc_gnttab_map_grant_ref(netdev->xendev.gnttabdev,
+ netdev->rxs = xc_gnttab_map_grant_ref(xen_xc, netdev->xendev.gnttabdev,
netdev->xendev.dom,
netdev->rx_ring_ref,
PROT_READ | PROT_WRITE);
@@ -381,11 +381,11 @@ static void net_disconnect(struct XenDevice *xendev)
xen_be_unbind_evtchn(&netdev->xendev);
if (netdev->txs) {
- xc_gnttab_munmap(netdev->xendev.gnttabdev, netdev->txs, 1);
+ xc_gnttab_munmap(xen_xc, netdev->xendev.gnttabdev, netdev->txs, 1);
netdev->txs = NULL;
}
if (netdev->rxs) {
- xc_gnttab_munmap(netdev->xendev.gnttabdev, netdev->rxs, 1);
+ xc_gnttab_munmap(xen_xc, netdev->xendev.gnttabdev, netdev->rxs, 1);
netdev->rxs = NULL;
}
if (netdev->nic) {
--
1.7.0.4
next prev parent reply other threads:[~2010-08-12 14:10 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-12 14:08 [Qemu-devel] [PATCH 00/15] RFC xen device model support Stefano Stabellini
2010-08-12 14:09 ` stefano.stabellini [this message]
2010-08-12 14:19 ` [Qemu-devel] Re: [PATCH 01/15] xen: Update libxc calls Paolo Bonzini
2010-08-12 14:28 ` Stefano Stabellini
2010-08-12 14:29 ` Stefano Stabellini
2010-08-18 9:50 ` Gerd Hoffmann
2010-08-18 11:47 ` Stefano Stabellini
2010-08-12 14:09 ` [Qemu-devel] [PATCH 02/15] xen: Add xen_machine_fv stefano.stabellini
2010-08-16 13:42 ` Kevin Wolf
2010-08-16 14:04 ` Stefano Stabellini
2010-08-16 14:13 ` Kevin Wolf
2010-08-16 14:38 ` Anthony Liguori
2010-08-16 14:51 ` Kevin Wolf
2010-08-16 15:00 ` Stefano Stabellini
2010-08-16 15:07 ` Anthony Liguori
2010-08-12 14:09 ` [Qemu-devel] [PATCH 03/15] xen: Add a new target to qemu: target-xen stefano.stabellini
2010-08-12 18:56 ` Blue Swirl
2010-08-13 12:47 ` [Xen-devel] " Ian Jackson
2010-08-13 17:35 ` Blue Swirl
2010-08-13 13:10 ` Stefano Stabellini
2010-08-13 17:46 ` Blue Swirl
2010-08-13 18:50 ` [Qemu-devel] " Anthony Liguori
2010-08-12 14:09 ` [Qemu-devel] [PATCH 04/15] xen: xen_machine_fv, initialize xenstore stefano.stabellini
2010-08-12 14:09 ` [Qemu-devel] [PATCH 05/15] xen: add a 8259 Interrupt Controller stefano.stabellini
2010-08-12 14:09 ` [Qemu-devel] [PATCH 06/15] xen: Add the Xen platform pci device stefano.stabellini
2010-08-12 18:26 ` Blue Swirl
2010-08-13 13:09 ` Stefano Stabellini
2010-08-12 14:09 ` [Qemu-devel] [PATCH 07/15] xen: handle xenstore events stefano.stabellini
2010-08-12 14:09 ` [Qemu-devel] [PATCH 08/15] xen: Read and write the state of the VM in xenstore stefano.stabellini
2010-08-13 18:53 ` [Qemu-devel] " Anthony Liguori
2010-08-15 14:12 ` Paolo Bonzini
2010-08-16 11:15 ` Stefano Stabellini
2010-08-16 12:13 ` Paolo Bonzini
2010-08-16 12:59 ` Stefano Stabellini
2010-08-12 14:09 ` [Qemu-devel] [PATCH 09/15] xen: Initialize event channels and io rings stefano.stabellini
2010-08-12 18:42 ` Blue Swirl
2010-08-13 13:10 ` Stefano Stabellini
2010-08-13 18:54 ` [Qemu-devel] " Anthony Liguori
2010-08-12 14:09 ` [Qemu-devel] [PATCH 10/15] xen: Introduce the Xen mapcache stefano.stabellini
2010-08-13 18:55 ` [Qemu-devel] " Anthony Liguori
2010-08-12 14:09 ` [Qemu-devel] [PATCH 11/15] piix3: introduce register_set_irq and register_map_irq stefano.stabellini
2010-08-12 18:44 ` Blue Swirl
2010-08-13 13:10 ` Stefano Stabellini
2010-08-12 14:09 ` [Qemu-devel] [PATCH 12/15] piix_pci: introduce a write_config notifier stefano.stabellini
2010-08-12 18:35 ` Blue Swirl
2010-08-13 13:10 ` Stefano Stabellini
2010-09-05 7:34 ` [Qemu-devel] " Michael S. Tsirkin
2010-08-12 14:10 ` [Qemu-devel] [PATCH 13/15] vl.c: Introduce getter for shutdown_requested and reset_requested stefano.stabellini
2010-08-12 14:10 ` [Qemu-devel] [PATCH 14/15] xen: destroy the VM when shutdown is requested stefano.stabellini
2010-08-13 18:56 ` [Qemu-devel] " Anthony Liguori
2010-08-12 14:10 ` [Qemu-devel] [PATCH 15/15] xen: Add a Xen specific ACPI Implementation to target-xen stefano.stabellini
2010-08-12 18:46 ` Blue Swirl
2010-08-13 13:10 ` Stefano Stabellini
2010-08-13 18:57 ` [Qemu-devel] " Anthony Liguori
2010-08-13 19:37 ` Stefano Stabellini
2010-08-13 20:51 ` Anthony Liguori
2010-08-16 11:10 ` Stefano Stabellini
2010-08-13 19:09 ` [Qemu-devel] Re: [PATCH 00/15] RFC xen device model support Anthony Liguori
2010-08-13 19:35 ` Stefano Stabellini
2010-08-13 20:48 ` Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1281622202-3453-1-git-send-email-stefano.stabellini@eu.citrix.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=Anthony.Perard@citrix.com \
--cc=qemu-devel@nongnu.org \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).