Skip to content

Commit

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

Xen 2017/07/07

# gpg: Signature made Fri 07 Jul 2017 19:21:22 BST
# gpg:                using RSA key 0x894F8F4870E1AE90
# gpg: Good signature from "Stefano Stabellini <stefano.stabellini@eu.citrix.com>"
# gpg:                 aka "Stefano Stabellini <sstabellini@kernel.org>"
# Primary key fingerprint: D04E 33AB A51F 67BA 07D3  0AEA 894F 8F48 70E1 AE90

* remotes/sstabellini/tags/xen-20170707-tag:
  xen/pt: Fixup addr validation in xen_pt_pci_config_access_check
  xen-platform: Cleanup network infrastructure when emulated NICs are unplugged
  xenfb: remove xen_init_display "temporary" hack

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
pm215 committed Jul 10, 2017
2 parents b113658 + 4daf625 commit 77d4722
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 69 deletions.
81 changes: 18 additions & 63 deletions hw/display/xenfb.c
Expand Up @@ -46,7 +46,6 @@
struct common {
struct XenDevice xendev; /* must be first */
void *page;
QemuConsole *con;
};

struct XenInput {
Expand All @@ -61,6 +60,7 @@ struct XenInput {

struct XenFB {
struct common c;
QemuConsole *con;
size_t fb_len;
int row_stride;
int depth;
Expand All @@ -71,7 +71,6 @@ struct XenFB {
int fbpages;
int feature_update;
int bug_trigger;
int have_console;
int do_resize;

struct {
Expand All @@ -80,6 +79,7 @@ struct XenFB {
int up_count;
int up_fullscreen;
};
static const GraphicHwOps xenfb_ops;

/* -------------------------------------------------------------------- */

Expand Down Expand Up @@ -306,10 +306,18 @@ static void xenfb_mouse_event(void *opaque,
int dx, int dy, int dz, int button_state)
{
struct XenInput *xenfb = opaque;
DisplaySurface *surface = qemu_console_surface(xenfb->c.con);
int dw = surface_width(surface);
int dh = surface_height(surface);
int i;
QemuConsole *con = qemu_console_lookup_by_index(0);
DisplaySurface *surface;
int dw, dh, i;

if (!con) {
xen_pv_printf(&xenfb->c.xendev, 0, "No QEMU console available");
return;
}

surface = qemu_console_surface(con);
dw = surface_width(surface);
dh = surface_height(surface);

trace_xenfb_mouse_event(opaque, dx, dy, dz, button_state,
xenfb->abs_pointer_wanted);
Expand Down Expand Up @@ -344,11 +352,6 @@ static int input_initialise(struct XenDevice *xendev)
struct XenInput *in = container_of(xendev, struct XenInput, c.xendev);
int rc;

if (!in->c.con) {
xen_pv_printf(xendev, 1, "ds not set (yet)\n");
return -1;
}

rc = common_bind(&in->c);
if (rc != 0)
return rc;
Expand Down Expand Up @@ -608,7 +611,7 @@ static int xenfb_configure_fb(struct XenFB *xenfb, size_t fb_len_lim,
*/
static void xenfb_guest_copy(struct XenFB *xenfb, int x, int y, int w, int h)
{
DisplaySurface *surface = qemu_console_surface(xenfb->c.con);
DisplaySurface *surface = qemu_console_surface(xenfb->con);
int line, oops = 0;
int bpp = surface_bits_per_pixel(surface);
int linesize = surface_stride(surface);
Expand Down Expand Up @@ -642,7 +645,7 @@ static void xenfb_guest_copy(struct XenFB *xenfb, int x, int y, int w, int h)
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);
dpy_gfx_update(xenfb->con, x, y, w, h);
}

#ifdef XENFB_TYPE_REFRESH_PERIOD
Expand Down Expand Up @@ -728,7 +731,7 @@ static void xenfb_update(void *opaque)
surface = qemu_create_displaysurface(xenfb->width, xenfb->height);
break;
}
dpy_gfx_replace_surface(xenfb->c.con, surface);
dpy_gfx_replace_surface(xenfb->con, surface);
xen_pv_printf(&xenfb->c.xendev, 1,
"update: resizing: %dx%d @ %d bpp%s\n",
xenfb->width, xenfb->height, xenfb->depth,
Expand Down Expand Up @@ -877,16 +880,7 @@ static int fb_initialise(struct XenDevice *xendev)
if (rc != 0)
return rc;

#if 0 /* handled in xen_init_display() for now */
if (!fb->have_console) {
fb->c.ds = graphic_console_init(xenfb_update,
xenfb_invalidate,
NULL,
NULL,
fb);
fb->have_console = 1;
}
#endif
fb->con = graphic_console_init(NULL, 0, &xenfb_ops, fb);

if (xenstore_read_fe_int(xendev, "feature-update", &fb->feature_update) == -1)
fb->feature_update = 0;
Expand Down Expand Up @@ -972,42 +966,3 @@ static const GraphicHwOps xenfb_ops = {
.gfx_update = xenfb_update,
.update_interval = xenfb_update_interval,
};

/*
* FIXME/TODO: Kill this.
* Temporary needed while DisplayState reorganization is in flight.
*/
void xen_init_display(int domid)
{
struct XenDevice *xfb, *xin;
struct XenFB *fb;
struct XenInput *in;
int i = 0;

wait_more:
i++;
main_loop_wait(true);
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_pv_printf(NULL, 1, "displaystate setup failed\n");
return;
}

/* vfb */
fb = container_of(xfb, struct XenFB, c.xendev);
fb->c.con = graphic_console_init(NULL, 0, &xenfb_ops, fb);
fb->have_console = 1;

/* vkbd */
in = container_of(xin, struct XenInput, c.xendev);
in->c.con = fb->c.con;

/* retry ->init() */
xen_be_check_state(xin);
xen_be_check_state(xfb);
}
11 changes: 11 additions & 0 deletions hw/i386/xen/xen_platform.c
Expand Up @@ -102,8 +102,19 @@ static void unplug_nic(PCIBus *b, PCIDevice *d, void *o)
}
}

/* Remove the peer of the NIC device. Normally, this would be a tap device. */
static void del_nic_peer(NICState *nic, void *opaque)
{
NetClientState *nc;

nc = qemu_get_queue(nic);
if (nc->peer)
qemu_del_net_client(nc->peer);
}

static void pci_unplug_nics(PCIBus *bus)
{
qemu_foreach_nic(del_nic_peer, NULL);
pci_for_each_device(bus, 0, unplug_nic, NULL);
}

Expand Down
2 changes: 1 addition & 1 deletion hw/xen/xen_pt.c
Expand Up @@ -85,7 +85,7 @@ void xen_pt_log(const PCIDevice *d, const char *f, ...)
static int xen_pt_pci_config_access_check(PCIDevice *d, uint32_t addr, int len)
{
/* check offset range */
if (addr >= 0xFF) {
if (addr > 0xFF) {
XEN_PT_ERR(d, "Failed to access register with offset exceeding 0xFF. "
"(addr: 0x%02x, len: %d)\n", addr, len);
return -1;
Expand Down
3 changes: 0 additions & 3 deletions hw/xenpv/xen_machine_pv.c
Expand Up @@ -94,9 +94,6 @@ static void xen_init_pv(MachineState *machine)

/* config cleanup hook */
atexit(xen_config_cleanup);

/* setup framebuffer */
xen_init_display(xen_domid);
}

static void xenpv_machine_init(MachineClass *mc)
Expand Down
2 changes: 0 additions & 2 deletions include/hw/xen/xen_backend.h
Expand Up @@ -55,8 +55,6 @@ extern struct XenDevOps xen_netdev_ops; /* xen_nic.c */
extern struct XenDevOps xen_usb_ops; /* xen-usb.c */
#endif

void xen_init_display(int domid);

/* configuration (aka xenbus setup) */
void xen_config_cleanup(void);
int xen_config_dev_blk(DriveInfo *disk);
Expand Down

0 comments on commit 77d4722

Please sign in to comment.