mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 10:13:56 -06:00
Xen 2016/10/28
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJYE/VuAAoJEIlPj0hw4a6Q/qAP+gMhunO/OJRSwIlYSOt+fVKW LE17QUfdVe204IuWY3h9svTvJXj/pOsE1HtIrGAUwsJxMqMBHeZnKhVZvEbvL2Iy sKSxzQkkPa6qVn/+Nxr9ZxULJZPXWnl61FLbElelff4w46lTaBM3gBaWDekFEO64 RbMvsMAUmav1x88KPvqY71Crbx5wbPhNmFqhbJNaQmm3zIQDK1TzGESv882mQKy2 rKNapBUXq8XnUNN+lIHhnzU9kUjhZxu7uet3GHMVICeAYu3b9jkgomv2OcV/sfRg 3o/NoXp4I7ZY3F0fkbtJOIFx0m+YlWnQhkBGsQoXJW+4lUdQR9ypMY4OdzjRa80e w9GrDt1//LOYrTpB0ZBkW0MIfnUK4TCqtL/aEQtRY9fdRFvcVpCjnqrYw+u9boZ1 hVypTYmAbk/ece6aJ/dngDQVtGC9qMGlHtBqSBRajFxenvFdY+DK6/FhITpNmobU YPWTSwS6WPw/venfvrTMfCQudGW3Jg8iBzRbGPS+GYfYlTHFoO0lKFGWWeTuRFIw /4owDhMJr5hRMRWZxCAu+Z8Ymj1MFuK7zDKjvT9LgWOZORh+rz6Tfn9+oxSt/D9I 1VKb/T9N9wBS3kreZ+Uz5+aQBoQSN5AQjay2ECZ16u9i63EL89CqXyyrJLlKlEGB cP3GzM9DlAtCQR943bys =Ao+X -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/sstabellini/tags/xen-20161028-tag' 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>
This commit is contained in:
commit
5ff06787d4
12 changed files with 603 additions and 525 deletions
|
@ -90,28 +90,29 @@ static int common_bind(struct common *c)
|
|||
xen_pfn_t mfn;
|
||||
|
||||
if (xenstore_read_fe_uint64(&c->xendev, "page-ref", &val) == -1)
|
||||
return -1;
|
||||
return -1;
|
||||
mfn = (xen_pfn_t)val;
|
||||
assert(val == mfn);
|
||||
|
||||
if (xenstore_read_fe_int(&c->xendev, "event-channel", &c->xendev.remote_port) == -1)
|
||||
return -1;
|
||||
return -1;
|
||||
|
||||
c->page = xenforeignmemory_map(xen_fmem, c->xendev.dom,
|
||||
PROT_READ | PROT_WRITE, 1, &mfn, NULL);
|
||||
if (c->page == NULL)
|
||||
return -1;
|
||||
return -1;
|
||||
|
||||
xen_be_bind_evtchn(&c->xendev);
|
||||
xen_be_printf(&c->xendev, 1, "ring mfn %"PRI_xen_pfn", remote-port %d, local-port %d\n",
|
||||
mfn, c->xendev.remote_port, c->xendev.local_port);
|
||||
xen_pv_printf(&c->xendev, 1,
|
||||
"ring mfn %"PRI_xen_pfn", remote-port %d, local-port %d\n",
|
||||
mfn, c->xendev.remote_port, c->xendev.local_port);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void common_unbind(struct common *c)
|
||||
{
|
||||
xen_be_unbind_evtchn(&c->xendev);
|
||||
xen_pv_unbind_evtchn(&c->xendev);
|
||||
if (c->page) {
|
||||
xenforeignmemory_unmap(xen_fmem, c->page, 1);
|
||||
c->page = NULL;
|
||||
|
@ -214,7 +215,7 @@ static int xenfb_kbd_event(struct XenInput *xenfb,
|
|||
XENKBD_IN_RING_REF(page, prod) = *event;
|
||||
xen_wmb(); /* ensure ring contents visible */
|
||||
page->in_prod = prod + 1;
|
||||
return xen_be_send_notify(&xenfb->c.xendev);
|
||||
return xen_pv_send_notify(&xenfb->c.xendev);
|
||||
}
|
||||
|
||||
/* Send a keyboard (or mouse button) event */
|
||||
|
@ -345,7 +346,7 @@ static int input_initialise(struct XenDevice *xendev)
|
|||
int rc;
|
||||
|
||||
if (!in->c.con) {
|
||||
xen_be_printf(xendev, 1, "ds not set (yet)\n");
|
||||
xen_pv_printf(xendev, 1, "ds not set (yet)\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -396,7 +397,7 @@ static void input_event(struct XenDevice *xendev)
|
|||
if (page->out_prod == page->out_cons)
|
||||
return;
|
||||
page->out_cons = page->out_prod;
|
||||
xen_be_send_notify(&xenfb->c.xendev);
|
||||
xen_pv_send_notify(&xenfb->c.xendev);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
@ -500,8 +501,8 @@ out:
|
|||
}
|
||||
|
||||
static int xenfb_configure_fb(struct XenFB *xenfb, size_t fb_len_lim,
|
||||
int width, int height, int depth,
|
||||
size_t fb_len, int offset, int row_stride)
|
||||
int width, int height, int depth,
|
||||
size_t fb_len, int offset, int row_stride)
|
||||
{
|
||||
size_t mfn_sz = sizeof(*((struct xenfb_page *)0)->pd);
|
||||
size_t pd_len = sizeof(((struct xenfb_page *)0)->pd) / mfn_sz;
|
||||
|
@ -510,40 +511,47 @@ static int xenfb_configure_fb(struct XenFB *xenfb, size_t fb_len_lim,
|
|||
int max_width, max_height;
|
||||
|
||||
if (fb_len_lim > fb_len_max) {
|
||||
xen_be_printf(&xenfb->c.xendev, 0, "fb size limit %zu exceeds %zu, corrected\n",
|
||||
fb_len_lim, fb_len_max);
|
||||
fb_len_lim = fb_len_max;
|
||||
xen_pv_printf(&xenfb->c.xendev, 0,
|
||||
"fb size limit %zu exceeds %zu, corrected\n",
|
||||
fb_len_lim, fb_len_max);
|
||||
fb_len_lim = fb_len_max;
|
||||
}
|
||||
if (fb_len_lim && fb_len > fb_len_lim) {
|
||||
xen_be_printf(&xenfb->c.xendev, 0, "frontend fb size %zu limited to %zu\n",
|
||||
fb_len, fb_len_lim);
|
||||
fb_len = fb_len_lim;
|
||||
xen_pv_printf(&xenfb->c.xendev, 0,
|
||||
"frontend fb size %zu limited to %zu\n",
|
||||
fb_len, fb_len_lim);
|
||||
fb_len = fb_len_lim;
|
||||
}
|
||||
if (depth != 8 && depth != 16 && depth != 24 && depth != 32) {
|
||||
xen_be_printf(&xenfb->c.xendev, 0, "can't handle frontend fb depth %d\n",
|
||||
depth);
|
||||
return -1;
|
||||
xen_pv_printf(&xenfb->c.xendev, 0,
|
||||
"can't handle frontend fb depth %d\n",
|
||||
depth);
|
||||
return -1;
|
||||
}
|
||||
if (row_stride <= 0 || row_stride > fb_len) {
|
||||
xen_be_printf(&xenfb->c.xendev, 0, "invalid frontend stride %d\n", row_stride);
|
||||
return -1;
|
||||
xen_pv_printf(&xenfb->c.xendev, 0, "invalid frontend stride %d\n",
|
||||
row_stride);
|
||||
return -1;
|
||||
}
|
||||
max_width = row_stride / (depth / 8);
|
||||
if (width < 0 || width > max_width) {
|
||||
xen_be_printf(&xenfb->c.xendev, 0, "invalid frontend width %d limited to %d\n",
|
||||
width, max_width);
|
||||
width = max_width;
|
||||
xen_pv_printf(&xenfb->c.xendev, 0,
|
||||
"invalid frontend width %d limited to %d\n",
|
||||
width, max_width);
|
||||
width = max_width;
|
||||
}
|
||||
if (offset < 0 || offset >= fb_len) {
|
||||
xen_be_printf(&xenfb->c.xendev, 0, "invalid frontend offset %d (max %zu)\n",
|
||||
offset, fb_len - 1);
|
||||
return -1;
|
||||
xen_pv_printf(&xenfb->c.xendev, 0,
|
||||
"invalid frontend offset %d (max %zu)\n",
|
||||
offset, fb_len - 1);
|
||||
return -1;
|
||||
}
|
||||
max_height = (fb_len - offset) / row_stride;
|
||||
if (height < 0 || height > max_height) {
|
||||
xen_be_printf(&xenfb->c.xendev, 0, "invalid frontend height %d limited to %d\n",
|
||||
height, max_height);
|
||||
height = max_height;
|
||||
xen_pv_printf(&xenfb->c.xendev, 0,
|
||||
"invalid frontend height %d limited to %d\n",
|
||||
height, max_height);
|
||||
height = max_height;
|
||||
}
|
||||
xenfb->fb_len = fb_len;
|
||||
xenfb->row_stride = row_stride;
|
||||
|
@ -553,8 +561,9 @@ static int xenfb_configure_fb(struct XenFB *xenfb, size_t fb_len_lim,
|
|||
xenfb->offset = offset;
|
||||
xenfb->up_fullscreen = 1;
|
||||
xenfb->do_resize = 1;
|
||||
xen_be_printf(&xenfb->c.xendev, 1, "framebuffer %dx%dx%d offset %d stride %d\n",
|
||||
width, height, depth, offset, row_stride);
|
||||
xen_pv_printf(&xenfb->c.xendev, 1,
|
||||
"framebuffer %dx%dx%d offset %d stride %d\n",
|
||||
width, height, depth, offset, row_stride);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -631,7 +640,7 @@ static void xenfb_guest_copy(struct XenFB *xenfb, int x, int y, int w, int h)
|
|||
}
|
||||
}
|
||||
if (oops) /* should not happen */
|
||||
xen_be_printf(&xenfb->c.xendev, 0, "%s: oops: convert %d -> %d bpp?\n",
|
||||
xen_pv_printf(&xenfb->c.xendev, 0, "%s: oops: convert %d -> %d bpp?\n",
|
||||
__FUNCTION__, xenfb->depth, bpp);
|
||||
|
||||
dpy_gfx_update(xenfb->c.con, x, y, w, h);
|
||||
|
@ -663,7 +672,7 @@ static void xenfb_send_event(struct XenFB *xenfb, union xenfb_in_event *event)
|
|||
xen_wmb(); /* ensure ring contents visible */
|
||||
page->in_prod = prod + 1;
|
||||
|
||||
xen_be_send_notify(&xenfb->c.xendev);
|
||||
xen_pv_send_notify(&xenfb->c.xendev);
|
||||
}
|
||||
|
||||
static void xenfb_send_refresh_period(struct XenFB *xenfb, int period)
|
||||
|
@ -696,9 +705,9 @@ static void xenfb_update(void *opaque)
|
|||
return;
|
||||
|
||||
if (!xenfb->feature_update) {
|
||||
/* we don't get update notifications, thus use the
|
||||
* sledge hammer approach ... */
|
||||
xenfb->up_fullscreen = 1;
|
||||
/* we don't get update notifications, thus use the
|
||||
* sledge hammer approach ... */
|
||||
xenfb->up_fullscreen = 1;
|
||||
}
|
||||
|
||||
/* resize if needed */
|
||||
|
@ -721,7 +730,8 @@ static void xenfb_update(void *opaque)
|
|||
break;
|
||||
}
|
||||
dpy_gfx_replace_surface(xenfb->c.con, surface);
|
||||
xen_be_printf(&xenfb->c.xendev, 1, "update: resizing: %dx%d @ %d bpp%s\n",
|
||||
xen_pv_printf(&xenfb->c.xendev, 1,
|
||||
"update: resizing: %dx%d @ %d bpp%s\n",
|
||||
xenfb->width, xenfb->height, xenfb->depth,
|
||||
is_buffer_shared(surface) ? " (shared)" : "");
|
||||
xenfb->up_fullscreen = 1;
|
||||
|
@ -729,18 +739,19 @@ static void xenfb_update(void *opaque)
|
|||
|
||||
/* run queued updates */
|
||||
if (xenfb->up_fullscreen) {
|
||||
xen_be_printf(&xenfb->c.xendev, 3, "update: fullscreen\n");
|
||||
xenfb_guest_copy(xenfb, 0, 0, xenfb->width, xenfb->height);
|
||||
xen_pv_printf(&xenfb->c.xendev, 3, "update: fullscreen\n");
|
||||
xenfb_guest_copy(xenfb, 0, 0, xenfb->width, xenfb->height);
|
||||
} else if (xenfb->up_count) {
|
||||
xen_be_printf(&xenfb->c.xendev, 3, "update: %d rects\n", xenfb->up_count);
|
||||
for (i = 0; i < xenfb->up_count; i++)
|
||||
xenfb_guest_copy(xenfb,
|
||||
xenfb->up_rects[i].x,
|
||||
xenfb->up_rects[i].y,
|
||||
xenfb->up_rects[i].w,
|
||||
xenfb->up_rects[i].h);
|
||||
xen_pv_printf(&xenfb->c.xendev, 3, "update: %d rects\n",
|
||||
xenfb->up_count);
|
||||
for (i = 0; i < xenfb->up_count; i++)
|
||||
xenfb_guest_copy(xenfb,
|
||||
xenfb->up_rects[i].x,
|
||||
xenfb->up_rects[i].y,
|
||||
xenfb->up_rects[i].w,
|
||||
xenfb->up_rects[i].h);
|
||||
} else {
|
||||
xen_be_printf(&xenfb->c.xendev, 3, "update: nothing\n");
|
||||
xen_pv_printf(&xenfb->c.xendev, 3, "update: nothing\n");
|
||||
}
|
||||
xenfb->up_count = 0;
|
||||
xenfb->up_fullscreen = 0;
|
||||
|
@ -794,14 +805,14 @@ static void xenfb_handle_events(struct XenFB *xenfb)
|
|||
w = MIN(event->update.width, xenfb->width - x);
|
||||
h = MIN(event->update.height, xenfb->height - y);
|
||||
if (w < 0 || h < 0) {
|
||||
xen_be_printf(&xenfb->c.xendev, 1, "bogus update ignored\n");
|
||||
xen_pv_printf(&xenfb->c.xendev, 1, "bogus update ignored\n");
|
||||
break;
|
||||
}
|
||||
if (x != event->update.x ||
|
||||
y != event->update.y ||
|
||||
w != event->update.width ||
|
||||
h != event->update.height) {
|
||||
xen_be_printf(&xenfb->c.xendev, 1, "bogus update clipped\n");
|
||||
xen_pv_printf(&xenfb->c.xendev, 1, "bogus update clipped\n");
|
||||
}
|
||||
if (w == xenfb->width && h > xenfb->height / 2) {
|
||||
/* scroll detector: updated more than 50% of the lines,
|
||||
|
@ -883,7 +894,7 @@ static int fb_initialise(struct XenDevice *xendev)
|
|||
if (fb->feature_update)
|
||||
xenstore_write_be_int(xendev, "request-update", 1);
|
||||
|
||||
xen_be_printf(xendev, 1, "feature-update=%d, videoram=%d\n",
|
||||
xen_pv_printf(xendev, 1, "feature-update=%d, videoram=%d\n",
|
||||
fb->feature_update, videoram);
|
||||
return 0;
|
||||
}
|
||||
|
@ -902,7 +913,7 @@ static void fb_disconnect(struct XenDevice *xendev)
|
|||
PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON,
|
||||
-1, 0);
|
||||
if (fb->pixels == MAP_FAILED) {
|
||||
xen_be_printf(xendev, 0,
|
||||
xen_pv_printf(xendev, 0,
|
||||
"Couldn't replace the framebuffer with anonymous memory errno=%d\n",
|
||||
errno);
|
||||
}
|
||||
|
@ -923,7 +934,7 @@ static void fb_frontend_changed(struct XenDevice *xendev, const char *node)
|
|||
if (fb->bug_trigger == 0 && strcmp(node, "state") == 0 &&
|
||||
xendev->fe_state == XenbusStateConnected &&
|
||||
xendev->be_state == XenbusStateConnected) {
|
||||
xen_be_printf(xendev, 2, "re-trigger connected (frontend bug)\n");
|
||||
xen_pv_printf(xendev, 2, "re-trigger connected (frontend bug)\n");
|
||||
xen_be_set_state(xendev, XenbusStateConnected);
|
||||
fb->bug_trigger = 1; /* only once */
|
||||
}
|
||||
|
@ -934,7 +945,7 @@ static void fb_event(struct XenDevice *xendev)
|
|||
struct XenFB *xenfb = container_of(xendev, struct XenFB, c.xendev);
|
||||
|
||||
xenfb_handle_events(xenfb);
|
||||
xen_be_send_notify(&xenfb->c.xendev);
|
||||
xen_pv_send_notify(&xenfb->c.xendev);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
@ -977,14 +988,14 @@ void xen_init_display(int domid)
|
|||
wait_more:
|
||||
i++;
|
||||
main_loop_wait(true);
|
||||
xfb = xen_be_find_xendev("vfb", domid, 0);
|
||||
xin = xen_be_find_xendev("vkbd", domid, 0);
|
||||
xfb = xen_pv_find_xendev("vfb", domid, 0);
|
||||
xin = xen_pv_find_xendev("vkbd", domid, 0);
|
||||
if (!xfb || !xin) {
|
||||
if (i < 256) {
|
||||
usleep(10000);
|
||||
goto wait_more;
|
||||
}
|
||||
xen_be_printf(NULL, 1, "displaystate setup failed\n");
|
||||
xen_pv_printf(NULL, 1, "displaystate setup failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue