Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/sstabellini/tags/xen-20161028-t…
Browse files Browse the repository at this point in the history
…ag' into staging

Xen 2016/10/28

# gpg: Signature made Sat 29 Oct 2016 02:03:42 BST
# gpg:                using RSA key 0x894F8F4870E1AE90
# gpg: Good signature from "Stefano Stabellini <sstabellini@kernel.org>"
# gpg:                 aka "Stefano Stabellini <stefano.stabellini@eu.citrix.com>"
# Primary key fingerprint: D04E 33AB A51F 67BA 07D3  0AEA 894F 8F48 70E1 AE90

* remotes/sstabellini/tags/xen-20161028-tag:
  xen: Rename xen_be_del_xendev
  xen: Rename xen_be_find_xendev
  xen: Rename xen_be_evtchn_event
  xen: Rename xen_be_send_notify
  xen: Rename xen_be_unbind_evtchn
  xen: Rename xen_be_printf to xen_pv_printf
  xen: Move xenstore cleanup and mkdir functions
  xen: Prepare xendev qtail to be shared with frontends
  xen: Move evtchn functions to xen_pvdev.c
  xen: Move xenstore_update to xen_pvdev.c
  xen: Create a new file xen_pvdev.c
  xen: Fix coding style warnings
  xen: Fix coding style errors

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
pm215 committed Oct 31, 2016
2 parents 277d44f + 7198136 commit 5ff0678
Show file tree
Hide file tree
Showing 12 changed files with 603 additions and 525 deletions.
65 changes: 33 additions & 32 deletions hw/block/xen_disk.c
Expand Up @@ -167,12 +167,12 @@ static void destroy_grant(gpointer pgnt)
xengnttab_handle *gnt = grant->blkdev->xendev.gnttabdev;

if (xengnttab_unmap(gnt, grant->page, 1) != 0) {
xen_be_printf(&grant->blkdev->xendev, 0,
xen_pv_printf(&grant->blkdev->xendev, 0,
"xengnttab_unmap failed: %s\n",
strerror(errno));
}
grant->blkdev->persistent_gnt_count--;
xen_be_printf(&grant->blkdev->xendev, 3,
xen_pv_printf(&grant->blkdev->xendev, 3,
"unmapped grant %p\n", grant->page);
g_free(grant);
}
Expand All @@ -184,11 +184,11 @@ static void remove_persistent_region(gpointer data, gpointer dev)
xengnttab_handle *gnt = blkdev->xendev.gnttabdev;

if (xengnttab_unmap(gnt, region->addr, region->num) != 0) {
xen_be_printf(&blkdev->xendev, 0,
xen_pv_printf(&blkdev->xendev, 0,
"xengnttab_unmap region %p failed: %s\n",
region->addr, strerror(errno));
}
xen_be_printf(&blkdev->xendev, 3,
xen_pv_printf(&blkdev->xendev, 3,
"unmapped grant region %p with %d pages\n",
region->addr, region->num);
g_free(region);
Expand Down Expand Up @@ -255,7 +255,7 @@ static int ioreq_parse(struct ioreq *ioreq)
size_t len;
int i;

xen_be_printf(&blkdev->xendev, 3,
xen_pv_printf(&blkdev->xendev, 3,
"op %d, nr %d, handle %d, id %" PRId64 ", sector %" PRId64 "\n",
ioreq->req.operation, ioreq->req.nr_segments,
ioreq->req.handle, ioreq->req.id, ioreq->req.sector_number);
Expand All @@ -275,28 +275,28 @@ static int ioreq_parse(struct ioreq *ioreq)
case BLKIF_OP_DISCARD:
return 0;
default:
xen_be_printf(&blkdev->xendev, 0, "error: unknown operation (%d)\n",
xen_pv_printf(&blkdev->xendev, 0, "error: unknown operation (%d)\n",
ioreq->req.operation);
goto err;
};

if (ioreq->req.operation != BLKIF_OP_READ && blkdev->mode[0] != 'w') {
xen_be_printf(&blkdev->xendev, 0, "error: write req for ro device\n");
xen_pv_printf(&blkdev->xendev, 0, "error: write req for ro device\n");
goto err;
}

ioreq->start = ioreq->req.sector_number * blkdev->file_blk;
for (i = 0; i < ioreq->req.nr_segments; i++) {
if (i == BLKIF_MAX_SEGMENTS_PER_REQUEST) {
xen_be_printf(&blkdev->xendev, 0, "error: nr_segments too big\n");
xen_pv_printf(&blkdev->xendev, 0, "error: nr_segments too big\n");
goto err;
}
if (ioreq->req.seg[i].first_sect > ioreq->req.seg[i].last_sect) {
xen_be_printf(&blkdev->xendev, 0, "error: first > last sector\n");
xen_pv_printf(&blkdev->xendev, 0, "error: first > last sector\n");
goto err;
}
if (ioreq->req.seg[i].last_sect * BLOCK_SIZE >= XC_PAGE_SIZE) {
xen_be_printf(&blkdev->xendev, 0, "error: page crossing\n");
xen_pv_printf(&blkdev->xendev, 0, "error: page crossing\n");
goto err;
}

Expand All @@ -308,7 +308,7 @@ static int ioreq_parse(struct ioreq *ioreq)
qemu_iovec_add(&ioreq->v, (void*)mem, len);
}
if (ioreq->start + ioreq->v.size > blkdev->file_size) {
xen_be_printf(&blkdev->xendev, 0, "error: access beyond end of file\n");
xen_pv_printf(&blkdev->xendev, 0, "error: access beyond end of file\n");
goto err;
}
return 0;
Expand All @@ -331,7 +331,7 @@ static void ioreq_unmap(struct ioreq *ioreq)
return;
}
if (xengnttab_unmap(gnt, ioreq->pages, ioreq->num_unmap) != 0) {
xen_be_printf(&ioreq->blkdev->xendev, 0,
xen_pv_printf(&ioreq->blkdev->xendev, 0,
"xengnttab_unmap failed: %s\n",
strerror(errno));
}
Expand All @@ -343,7 +343,7 @@ static void ioreq_unmap(struct ioreq *ioreq)
continue;
}
if (xengnttab_unmap(gnt, ioreq->page[i], 1) != 0) {
xen_be_printf(&ioreq->blkdev->xendev, 0,
xen_pv_printf(&ioreq->blkdev->xendev, 0,
"xengnttab_unmap failed: %s\n",
strerror(errno));
}
Expand Down Expand Up @@ -381,7 +381,7 @@ static int ioreq_map(struct ioreq *ioreq)

if (grant != NULL) {
page[i] = grant->page;
xen_be_printf(&ioreq->blkdev->xendev, 3,
xen_pv_printf(&ioreq->blkdev->xendev, 3,
"using persistent-grant %" PRIu32 "\n",
ioreq->refs[i]);
} else {
Expand Down Expand Up @@ -410,7 +410,7 @@ static int ioreq_map(struct ioreq *ioreq)
ioreq->pages = xengnttab_map_grant_refs
(gnt, new_maps, domids, refs, ioreq->prot);
if (ioreq->pages == NULL) {
xen_be_printf(&ioreq->blkdev->xendev, 0,
xen_pv_printf(&ioreq->blkdev->xendev, 0,
"can't map %d grant refs (%s, %d maps)\n",
new_maps, strerror(errno), ioreq->blkdev->cnt_map);
return -1;
Expand All @@ -426,7 +426,7 @@ static int ioreq_map(struct ioreq *ioreq)
ioreq->page[i] = xengnttab_map_grant_ref
(gnt, domids[i], refs[i], ioreq->prot);
if (ioreq->page[i] == NULL) {
xen_be_printf(&ioreq->blkdev->xendev, 0,
xen_pv_printf(&ioreq->blkdev->xendev, 0,
"can't map grant ref %d (%s, %d maps)\n",
refs[i], strerror(errno), ioreq->blkdev->cnt_map);
ioreq->mapped = 1;
Expand Down Expand Up @@ -474,7 +474,7 @@ static int ioreq_map(struct ioreq *ioreq)
grant->page = ioreq->page[new_maps];
}
grant->blkdev = ioreq->blkdev;
xen_be_printf(&ioreq->blkdev->xendev, 3,
xen_pv_printf(&ioreq->blkdev->xendev, 3,
"adding grant %" PRIu32 " page: %p\n",
refs[new_maps], grant->page);
g_tree_insert(ioreq->blkdev->persistent_gnts,
Expand Down Expand Up @@ -557,15 +557,15 @@ static int ioreq_grant_copy(struct ioreq *ioreq)
rc = xengnttab_grant_copy(gnt, count, segs);

if (rc) {
xen_be_printf(&ioreq->blkdev->xendev, 0,
xen_pv_printf(&ioreq->blkdev->xendev, 0,
"failed to copy data %d\n", rc);
ioreq->aio_errors++;
return -1;
}

for (i = 0; i < count; i++) {
if (segs[i].status != GNTST_okay) {
xen_be_printf(&ioreq->blkdev->xendev, 3,
xen_pv_printf(&ioreq->blkdev->xendev, 3,
"failed to copy data %d for gref %d, domid %d\n",
segs[i].status, ioreq->refs[i], ioreq->domids[i]);
ioreq->aio_errors++;
Expand Down Expand Up @@ -599,7 +599,7 @@ static void qemu_aio_complete(void *opaque, int ret)
struct ioreq *ioreq = opaque;

if (ret != 0) {
xen_be_printf(&ioreq->blkdev->xendev, 0, "%s I/O error\n",
xen_pv_printf(&ioreq->blkdev->xendev, 0, "%s I/O error\n",
ioreq->req.operation == BLKIF_OP_READ ? "read" : "write");
ioreq->aio_errors++;
}
Expand Down Expand Up @@ -796,7 +796,7 @@ static void blk_send_response_all(struct XenBlkDev *blkdev)
ioreq_release(ioreq, true);
}
if (send_notify) {
xen_be_send_notify(&blkdev->xendev);
xen_pv_send_notify(&blkdev->xendev);
}
}

Expand Down Expand Up @@ -866,7 +866,7 @@ static void blk_handle_requests(struct XenBlkDev *blkdev)
};

if (blk_send_response_one(ioreq)) {
xen_be_send_notify(&blkdev->xendev);
xen_pv_send_notify(&blkdev->xendev);
}
ioreq_release(ioreq, false);
continue;
Expand Down Expand Up @@ -910,7 +910,7 @@ static void blk_alloc(struct XenDevice *xendev)
}
if (xengnttab_set_max_grants(xendev->gnttabdev,
MAX_GRANTS(max_requests, BLKIF_MAX_SEGMENTS_PER_REQUEST)) < 0) {
xen_be_printf(xendev, 0, "xengnttab_set_max_grants failed: %s\n",
xen_pv_printf(xendev, 0, "xengnttab_set_max_grants failed: %s\n",
strerror(errno));
}
}
Expand Down Expand Up @@ -1056,22 +1056,23 @@ static int blk_connect(struct XenDevice *xendev)
}

/* setup via xenbus -> create new block driver instance */
xen_be_printf(&blkdev->xendev, 2, "create new bdrv (xenbus setup)\n");
xen_pv_printf(&blkdev->xendev, 2, "create new bdrv (xenbus setup)\n");
blkdev->blk = blk_new_open(blkdev->filename, NULL, options,
qflags, &local_err);
if (!blkdev->blk) {
xen_be_printf(&blkdev->xendev, 0, "error: %s\n",
xen_pv_printf(&blkdev->xendev, 0, "error: %s\n",
error_get_pretty(local_err));
error_free(local_err);
return -1;
}
blk_set_enable_write_cache(blkdev->blk, !writethrough);
} else {
/* setup via qemu cmdline -> already setup for us */
xen_be_printf(&blkdev->xendev, 2, "get configured bdrv (cmdline setup)\n");
xen_pv_printf(&blkdev->xendev, 2,
"get configured bdrv (cmdline setup)\n");
blkdev->blk = blk_by_legacy_dinfo(blkdev->dinfo);
if (blk_is_read_only(blkdev->blk) && !readonly) {
xen_be_printf(&blkdev->xendev, 0, "Unexpected read-only drive");
xen_pv_printf(&blkdev->xendev, 0, "Unexpected read-only drive");
blkdev->blk = NULL;
return -1;
}
Expand All @@ -1084,13 +1085,13 @@ static int blk_connect(struct XenDevice *xendev)
if (blkdev->file_size < 0) {
BlockDriverState *bs = blk_bs(blkdev->blk);
const char *drv_name = bs ? bdrv_get_format_name(bs) : NULL;
xen_be_printf(&blkdev->xendev, 1, "blk_getlength: %d (%s) | drv %s\n",
xen_pv_printf(&blkdev->xendev, 1, "blk_getlength: %d (%s) | drv %s\n",
(int)blkdev->file_size, strerror(-blkdev->file_size),
drv_name ?: "-");
blkdev->file_size = 0;
}

xen_be_printf(xendev, 1, "type \"%s\", fileproto \"%s\", filename \"%s\","
xen_pv_printf(xendev, 1, "type \"%s\", fileproto \"%s\", filename \"%s\","
" size %" PRId64 " (%" PRId64 " MB)\n",
blkdev->type, blkdev->fileproto, blkdev->filename,
blkdev->file_size, blkdev->file_size >> 20);
Expand Down Expand Up @@ -1174,10 +1175,10 @@ static int blk_connect(struct XenDevice *xendev)
blkdev->feature_grant_copy =
(xengnttab_grant_copy(blkdev->xendev.gnttabdev, 0, NULL) == 0);

xen_be_printf(&blkdev->xendev, 3, "grant copy operation %s\n",
xen_pv_printf(&blkdev->xendev, 3, "grant copy operation %s\n",
blkdev->feature_grant_copy ? "enabled" : "disabled");

xen_be_printf(&blkdev->xendev, 1, "ok: proto %s, ring-ref %d, "
xen_pv_printf(&blkdev->xendev, 1, "ok: proto %s, ring-ref %d, "
"remote port %d, local port %d\n",
blkdev->xendev.protocol, blkdev->ring_ref,
blkdev->xendev.remote_port, blkdev->xendev.local_port);
Expand All @@ -1193,7 +1194,7 @@ static void blk_disconnect(struct XenDevice *xendev)
blk_unref(blkdev->blk);
blkdev->blk = NULL;
}
xen_be_unbind_evtchn(&blkdev->xendev);
xen_pv_unbind_evtchn(&blkdev->xendev);

if (blkdev->sring) {
xengnttab_unmap(blkdev->xendev.gnttabdev, blkdev->sring, 1);
Expand Down
30 changes: 16 additions & 14 deletions hw/char/xen_console.c
Expand Up @@ -74,7 +74,7 @@ static void buffer_append(struct XenConsole *con)

xen_mb();
intf->out_cons = cons;
xen_be_send_notify(&con->xendev);
xen_pv_send_notify(&con->xendev);

if (buffer->max_capacity &&
buffer->size > buffer->max_capacity) {
Expand Down Expand Up @@ -142,7 +142,7 @@ static void xencons_receive(void *opaque, const uint8_t *buf, int len)
}
xen_wmb();
intf->in_prod = prod;
xen_be_send_notify(&con->xendev);
xen_pv_send_notify(&con->xendev);
}

static void xencons_send(struct XenConsole *con)
Expand All @@ -158,16 +158,17 @@ static void xencons_send(struct XenConsole *con)
len = size;
}
if (len < 1) {
if (!con->backlog) {
con->backlog = 1;
xen_be_printf(&con->xendev, 1, "backlog piling up, nobody listening?\n");
}
if (!con->backlog) {
con->backlog = 1;
xen_pv_printf(&con->xendev, 1,
"backlog piling up, nobody listening?\n");
}
} else {
buffer_advance(&con->buffer, len);
if (con->backlog && len == size) {
con->backlog = 0;
xen_be_printf(&con->xendev, 1, "backlog is gone\n");
}
buffer_advance(&con->buffer, len);
if (con->backlog && len == size) {
con->backlog = 0;
xen_pv_printf(&con->xendev, 1, "backlog is gone\n");
}
}
}

Expand All @@ -191,7 +192,7 @@ static int con_init(struct XenDevice *xendev)

type = xenstore_read_str(con->console, "type");
if (!type || strcmp(type, "ioemu") != 0) {
xen_be_printf(xendev, 1, "not for me (type=%s)\n", type);
xen_pv_printf(xendev, 1, "not for me (type=%s)\n", type);
ret = -1;
goto out;
}
Expand Down Expand Up @@ -247,7 +248,8 @@ static int con_initialise(struct XenDevice *xendev)
qemu_chr_fe_set_handlers(&con->chr, xencons_can_receive,
xencons_receive, NULL, con, NULL, true);

xen_be_printf(xendev, 1, "ring mfn %d, remote port %d, local port %d, limit %zd\n",
xen_pv_printf(xendev, 1,
"ring mfn %d, remote port %d, local port %d, limit %zd\n",
con->ring_ref,
con->xendev.remote_port,
con->xendev.local_port,
Expand All @@ -260,7 +262,7 @@ static void con_disconnect(struct XenDevice *xendev)
struct XenConsole *con = container_of(xendev, struct XenConsole, xendev);

qemu_chr_fe_deinit(&con->chr);
xen_be_unbind_evtchn(&con->xendev);
xen_pv_unbind_evtchn(&con->xendev);

if (con->sring) {
if (!xendev->dev) {
Expand Down

0 comments on commit 5ff0678

Please sign in to comment.