0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
0022
0023 #include <linux/console.h>
0024 #include <linux/kernel.h>
0025 #include <linux/errno.h>
0026 #include <linux/fb.h>
0027 #include <linux/module.h>
0028 #include <linux/slab.h>
0029 #include <linux/vmalloc.h>
0030 #include <linux/mm.h>
0031
0032 #include <asm/xen/hypervisor.h>
0033
0034 #include <xen/xen.h>
0035 #include <xen/events.h>
0036 #include <xen/page.h>
0037 #include <xen/interface/io/fbif.h>
0038 #include <xen/interface/io/protocols.h>
0039 #include <xen/xenbus.h>
0040 #include <xen/platform_pci.h>
0041
0042 struct xenfb_info {
0043 unsigned char *fb;
0044 struct fb_info *fb_info;
0045 int x1, y1, x2, y2;
0046
0047 spinlock_t dirty_lock;
0048 int nr_pages;
0049 int irq;
0050 struct xenfb_page *page;
0051 unsigned long *gfns;
0052 int update_wanted;
0053 int feature_resize;
0054 struct xenfb_resize resize;
0055 int resize_dpy;
0056 spinlock_t resize_lock;
0057
0058 struct xenbus_device *xbdev;
0059 };
0060
0061 #define XENFB_DEFAULT_FB_LEN (XENFB_WIDTH * XENFB_HEIGHT * XENFB_DEPTH / 8)
0062
0063 enum { KPARAM_MEM, KPARAM_WIDTH, KPARAM_HEIGHT, KPARAM_CNT };
0064 static int video[KPARAM_CNT] = { 2, XENFB_WIDTH, XENFB_HEIGHT };
0065 module_param_array(video, int, NULL, 0);
0066 MODULE_PARM_DESC(video,
0067 "Video memory size in MB, width, height in pixels (default 2,800,600)");
0068
0069 static void xenfb_make_preferred_console(void);
0070 static int xenfb_remove(struct xenbus_device *);
0071 static void xenfb_init_shared_page(struct xenfb_info *, struct fb_info *);
0072 static int xenfb_connect_backend(struct xenbus_device *, struct xenfb_info *);
0073 static void xenfb_disconnect_backend(struct xenfb_info *);
0074
0075 static void xenfb_send_event(struct xenfb_info *info,
0076 union xenfb_out_event *event)
0077 {
0078 u32 prod;
0079
0080 prod = info->page->out_prod;
0081
0082 mb();
0083 XENFB_OUT_RING_REF(info->page, prod) = *event;
0084 wmb();
0085 info->page->out_prod = prod + 1;
0086
0087 notify_remote_via_irq(info->irq);
0088 }
0089
0090 static void xenfb_do_update(struct xenfb_info *info,
0091 int x, int y, int w, int h)
0092 {
0093 union xenfb_out_event event;
0094
0095 memset(&event, 0, sizeof(event));
0096 event.type = XENFB_TYPE_UPDATE;
0097 event.update.x = x;
0098 event.update.y = y;
0099 event.update.width = w;
0100 event.update.height = h;
0101
0102
0103 xenfb_send_event(info, &event);
0104 }
0105
0106 static void xenfb_do_resize(struct xenfb_info *info)
0107 {
0108 union xenfb_out_event event;
0109
0110 memset(&event, 0, sizeof(event));
0111 event.resize = info->resize;
0112
0113
0114 xenfb_send_event(info, &event);
0115 }
0116
0117 static int xenfb_queue_full(struct xenfb_info *info)
0118 {
0119 u32 cons, prod;
0120
0121 prod = info->page->out_prod;
0122 cons = info->page->out_cons;
0123 return prod - cons == XENFB_OUT_RING_LEN;
0124 }
0125
0126 static void xenfb_handle_resize_dpy(struct xenfb_info *info)
0127 {
0128 unsigned long flags;
0129
0130 spin_lock_irqsave(&info->resize_lock, flags);
0131 if (info->resize_dpy) {
0132 if (!xenfb_queue_full(info)) {
0133 info->resize_dpy = 0;
0134 xenfb_do_resize(info);
0135 }
0136 }
0137 spin_unlock_irqrestore(&info->resize_lock, flags);
0138 }
0139
0140 static void xenfb_refresh(struct xenfb_info *info,
0141 int x1, int y1, int w, int h)
0142 {
0143 unsigned long flags;
0144 int x2 = x1 + w - 1;
0145 int y2 = y1 + h - 1;
0146
0147 xenfb_handle_resize_dpy(info);
0148
0149 if (!info->update_wanted)
0150 return;
0151
0152 spin_lock_irqsave(&info->dirty_lock, flags);
0153
0154
0155 if (info->y1 < y1)
0156 y1 = info->y1;
0157 if (info->y2 > y2)
0158 y2 = info->y2;
0159 if (info->x1 < x1)
0160 x1 = info->x1;
0161 if (info->x2 > x2)
0162 x2 = info->x2;
0163
0164 if (xenfb_queue_full(info)) {
0165
0166 info->x1 = x1;
0167 info->x2 = x2;
0168 info->y1 = y1;
0169 info->y2 = y2;
0170 spin_unlock_irqrestore(&info->dirty_lock, flags);
0171 return;
0172 }
0173
0174
0175 info->x1 = info->y1 = INT_MAX;
0176 info->x2 = info->y2 = 0;
0177
0178 spin_unlock_irqrestore(&info->dirty_lock, flags);
0179
0180 if (x1 <= x2 && y1 <= y2)
0181 xenfb_do_update(info, x1, y1, x2 - x1 + 1, y2 - y1 + 1);
0182 }
0183
0184 static void xenfb_deferred_io(struct fb_info *fb_info, struct list_head *pagereflist)
0185 {
0186 struct xenfb_info *info = fb_info->par;
0187 struct fb_deferred_io_pageref *pageref;
0188 unsigned long beg, end;
0189 int y1, y2, miny, maxy;
0190
0191 miny = INT_MAX;
0192 maxy = 0;
0193 list_for_each_entry(pageref, pagereflist, list) {
0194 beg = pageref->offset;
0195 end = beg + PAGE_SIZE - 1;
0196 y1 = beg / fb_info->fix.line_length;
0197 y2 = end / fb_info->fix.line_length;
0198 if (y2 >= fb_info->var.yres)
0199 y2 = fb_info->var.yres - 1;
0200 if (miny > y1)
0201 miny = y1;
0202 if (maxy < y2)
0203 maxy = y2;
0204 }
0205 xenfb_refresh(info, 0, miny, fb_info->var.xres, maxy - miny + 1);
0206 }
0207
0208 static struct fb_deferred_io xenfb_defio = {
0209 .delay = HZ / 20,
0210 .deferred_io = xenfb_deferred_io,
0211 };
0212
0213 static int xenfb_setcolreg(unsigned regno, unsigned red, unsigned green,
0214 unsigned blue, unsigned transp,
0215 struct fb_info *info)
0216 {
0217 u32 v;
0218
0219 if (regno > info->cmap.len)
0220 return 1;
0221
0222 #define CNVT_TOHW(val, width) ((((val)<<(width))+0x7FFF-(val))>>16)
0223 red = CNVT_TOHW(red, info->var.red.length);
0224 green = CNVT_TOHW(green, info->var.green.length);
0225 blue = CNVT_TOHW(blue, info->var.blue.length);
0226 #undef CNVT_TOHW
0227
0228 v = (red << info->var.red.offset) |
0229 (green << info->var.green.offset) |
0230 (blue << info->var.blue.offset);
0231
0232 switch (info->var.bits_per_pixel) {
0233 case 16:
0234 case 24:
0235 case 32:
0236 ((u32 *)info->pseudo_palette)[regno] = v;
0237 break;
0238 }
0239
0240 return 0;
0241 }
0242
0243 static void xenfb_fillrect(struct fb_info *p, const struct fb_fillrect *rect)
0244 {
0245 struct xenfb_info *info = p->par;
0246
0247 sys_fillrect(p, rect);
0248 xenfb_refresh(info, rect->dx, rect->dy, rect->width, rect->height);
0249 }
0250
0251 static void xenfb_imageblit(struct fb_info *p, const struct fb_image *image)
0252 {
0253 struct xenfb_info *info = p->par;
0254
0255 sys_imageblit(p, image);
0256 xenfb_refresh(info, image->dx, image->dy, image->width, image->height);
0257 }
0258
0259 static void xenfb_copyarea(struct fb_info *p, const struct fb_copyarea *area)
0260 {
0261 struct xenfb_info *info = p->par;
0262
0263 sys_copyarea(p, area);
0264 xenfb_refresh(info, area->dx, area->dy, area->width, area->height);
0265 }
0266
0267 static ssize_t xenfb_write(struct fb_info *p, const char __user *buf,
0268 size_t count, loff_t *ppos)
0269 {
0270 struct xenfb_info *info = p->par;
0271 ssize_t res;
0272
0273 res = fb_sys_write(p, buf, count, ppos);
0274 xenfb_refresh(info, 0, 0, info->page->width, info->page->height);
0275 return res;
0276 }
0277
0278 static int
0279 xenfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
0280 {
0281 struct xenfb_info *xenfb_info;
0282 int required_mem_len;
0283
0284 xenfb_info = info->par;
0285
0286 if (!xenfb_info->feature_resize) {
0287 if (var->xres == video[KPARAM_WIDTH] &&
0288 var->yres == video[KPARAM_HEIGHT] &&
0289 var->bits_per_pixel == xenfb_info->page->depth) {
0290 return 0;
0291 }
0292 return -EINVAL;
0293 }
0294
0295
0296 if (var->xres > video[KPARAM_WIDTH] || var->yres > video[KPARAM_HEIGHT])
0297 return -EINVAL;
0298
0299 required_mem_len = var->xres * var->yres * xenfb_info->page->depth / 8;
0300 if (var->bits_per_pixel == xenfb_info->page->depth &&
0301 var->xres <= info->fix.line_length / (XENFB_DEPTH / 8) &&
0302 required_mem_len <= info->fix.smem_len) {
0303 var->xres_virtual = var->xres;
0304 var->yres_virtual = var->yres;
0305 return 0;
0306 }
0307 return -EINVAL;
0308 }
0309
0310 static int xenfb_set_par(struct fb_info *info)
0311 {
0312 struct xenfb_info *xenfb_info;
0313 unsigned long flags;
0314
0315 xenfb_info = info->par;
0316
0317 spin_lock_irqsave(&xenfb_info->resize_lock, flags);
0318 xenfb_info->resize.type = XENFB_TYPE_RESIZE;
0319 xenfb_info->resize.width = info->var.xres;
0320 xenfb_info->resize.height = info->var.yres;
0321 xenfb_info->resize.stride = info->fix.line_length;
0322 xenfb_info->resize.depth = info->var.bits_per_pixel;
0323 xenfb_info->resize.offset = 0;
0324 xenfb_info->resize_dpy = 1;
0325 spin_unlock_irqrestore(&xenfb_info->resize_lock, flags);
0326 return 0;
0327 }
0328
0329 static const struct fb_ops xenfb_fb_ops = {
0330 .owner = THIS_MODULE,
0331 .fb_read = fb_sys_read,
0332 .fb_write = xenfb_write,
0333 .fb_setcolreg = xenfb_setcolreg,
0334 .fb_fillrect = xenfb_fillrect,
0335 .fb_copyarea = xenfb_copyarea,
0336 .fb_imageblit = xenfb_imageblit,
0337 .fb_check_var = xenfb_check_var,
0338 .fb_set_par = xenfb_set_par,
0339 .fb_mmap = fb_deferred_io_mmap,
0340 };
0341
0342 static irqreturn_t xenfb_event_handler(int rq, void *dev_id)
0343 {
0344
0345
0346
0347
0348
0349 struct xenfb_info *info = dev_id;
0350 struct xenfb_page *page = info->page;
0351
0352 if (page->in_cons != page->in_prod) {
0353 info->page->in_cons = info->page->in_prod;
0354 notify_remote_via_irq(info->irq);
0355 }
0356
0357
0358 xenfb_refresh(info, INT_MAX, INT_MAX, -INT_MAX, -INT_MAX);
0359
0360 return IRQ_HANDLED;
0361 }
0362
0363 static int xenfb_probe(struct xenbus_device *dev,
0364 const struct xenbus_device_id *id)
0365 {
0366 struct xenfb_info *info;
0367 struct fb_info *fb_info;
0368 int fb_size;
0369 int val;
0370 int ret = 0;
0371
0372 info = kzalloc(sizeof(*info), GFP_KERNEL);
0373 if (info == NULL) {
0374 xenbus_dev_fatal(dev, -ENOMEM, "allocating info structure");
0375 return -ENOMEM;
0376 }
0377
0378
0379 if (xenbus_scanf(XBT_NIL, dev->otherend, "videoram", "%d", &val) == 1) {
0380 if (val < video[KPARAM_MEM])
0381 video[KPARAM_MEM] = val;
0382 }
0383
0384 video[KPARAM_WIDTH] = xenbus_read_unsigned(dev->otherend, "width",
0385 video[KPARAM_WIDTH]);
0386 video[KPARAM_HEIGHT] = xenbus_read_unsigned(dev->otherend, "height",
0387 video[KPARAM_HEIGHT]);
0388
0389
0390 fb_size = video[KPARAM_MEM] * 1024 * 1024;
0391 if (video[KPARAM_WIDTH] * video[KPARAM_HEIGHT] * XENFB_DEPTH / 8
0392 > fb_size) {
0393 pr_warn("display parameters %d,%d,%d invalid, use defaults\n",
0394 video[KPARAM_MEM], video[KPARAM_WIDTH],
0395 video[KPARAM_HEIGHT]);
0396 video[KPARAM_WIDTH] = XENFB_WIDTH;
0397 video[KPARAM_HEIGHT] = XENFB_HEIGHT;
0398 fb_size = XENFB_DEFAULT_FB_LEN;
0399 }
0400
0401 dev_set_drvdata(&dev->dev, info);
0402 info->xbdev = dev;
0403 info->irq = -1;
0404 info->x1 = info->y1 = INT_MAX;
0405 spin_lock_init(&info->dirty_lock);
0406 spin_lock_init(&info->resize_lock);
0407
0408 info->fb = vzalloc(fb_size);
0409 if (info->fb == NULL)
0410 goto error_nomem;
0411
0412 info->nr_pages = (fb_size + PAGE_SIZE - 1) >> PAGE_SHIFT;
0413
0414 info->gfns = vmalloc(array_size(sizeof(unsigned long), info->nr_pages));
0415 if (!info->gfns)
0416 goto error_nomem;
0417
0418
0419 info->page = (void *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
0420 if (!info->page)
0421 goto error_nomem;
0422
0423
0424 fb_info = framebuffer_alloc(sizeof(u32) * 256, NULL);
0425 if (fb_info == NULL)
0426 goto error_nomem;
0427
0428
0429 fb_info->pseudo_palette = fb_info->par;
0430 fb_info->par = info;
0431
0432 fb_info->screen_base = info->fb;
0433
0434 fb_info->fbops = &xenfb_fb_ops;
0435 fb_info->var.xres_virtual = fb_info->var.xres = video[KPARAM_WIDTH];
0436 fb_info->var.yres_virtual = fb_info->var.yres = video[KPARAM_HEIGHT];
0437 fb_info->var.bits_per_pixel = XENFB_DEPTH;
0438
0439 fb_info->var.red = (struct fb_bitfield){16, 8, 0};
0440 fb_info->var.green = (struct fb_bitfield){8, 8, 0};
0441 fb_info->var.blue = (struct fb_bitfield){0, 8, 0};
0442
0443 fb_info->var.activate = FB_ACTIVATE_NOW;
0444 fb_info->var.height = -1;
0445 fb_info->var.width = -1;
0446 fb_info->var.vmode = FB_VMODE_NONINTERLACED;
0447
0448 fb_info->fix.visual = FB_VISUAL_TRUECOLOR;
0449 fb_info->fix.line_length = fb_info->var.xres * XENFB_DEPTH / 8;
0450 fb_info->fix.smem_start = 0;
0451 fb_info->fix.smem_len = fb_size;
0452 strcpy(fb_info->fix.id, "xen");
0453 fb_info->fix.type = FB_TYPE_PACKED_PIXELS;
0454 fb_info->fix.accel = FB_ACCEL_NONE;
0455
0456 fb_info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB;
0457
0458 ret = fb_alloc_cmap(&fb_info->cmap, 256, 0);
0459 if (ret < 0) {
0460 framebuffer_release(fb_info);
0461 xenbus_dev_fatal(dev, ret, "fb_alloc_cmap");
0462 goto error;
0463 }
0464
0465 fb_info->fbdefio = &xenfb_defio;
0466 fb_deferred_io_init(fb_info);
0467
0468 xenfb_init_shared_page(info, fb_info);
0469
0470 ret = xenfb_connect_backend(dev, info);
0471 if (ret < 0) {
0472 xenbus_dev_fatal(dev, ret, "xenfb_connect_backend");
0473 goto error_fb;
0474 }
0475
0476 ret = register_framebuffer(fb_info);
0477 if (ret) {
0478 xenbus_dev_fatal(dev, ret, "register_framebuffer");
0479 goto error_fb;
0480 }
0481 info->fb_info = fb_info;
0482
0483 xenfb_make_preferred_console();
0484 return 0;
0485
0486 error_fb:
0487 fb_deferred_io_cleanup(fb_info);
0488 fb_dealloc_cmap(&fb_info->cmap);
0489 framebuffer_release(fb_info);
0490 error_nomem:
0491 if (!ret) {
0492 ret = -ENOMEM;
0493 xenbus_dev_fatal(dev, ret, "allocating device memory");
0494 }
0495 error:
0496 xenfb_remove(dev);
0497 return ret;
0498 }
0499
0500 static void xenfb_make_preferred_console(void)
0501 {
0502 struct console *c;
0503
0504 if (console_set_on_cmdline)
0505 return;
0506
0507 console_lock();
0508 for_each_console(c) {
0509 if (!strcmp(c->name, "tty") && c->index == 0)
0510 break;
0511 }
0512 console_unlock();
0513 if (c) {
0514 unregister_console(c);
0515 c->flags |= CON_CONSDEV;
0516 c->flags &= ~CON_PRINTBUFFER;
0517 register_console(c);
0518 }
0519 }
0520
0521 static int xenfb_resume(struct xenbus_device *dev)
0522 {
0523 struct xenfb_info *info = dev_get_drvdata(&dev->dev);
0524
0525 xenfb_disconnect_backend(info);
0526 xenfb_init_shared_page(info, info->fb_info);
0527 return xenfb_connect_backend(dev, info);
0528 }
0529
0530 static int xenfb_remove(struct xenbus_device *dev)
0531 {
0532 struct xenfb_info *info = dev_get_drvdata(&dev->dev);
0533
0534 xenfb_disconnect_backend(info);
0535 if (info->fb_info) {
0536 fb_deferred_io_cleanup(info->fb_info);
0537 unregister_framebuffer(info->fb_info);
0538 fb_dealloc_cmap(&info->fb_info->cmap);
0539 framebuffer_release(info->fb_info);
0540 }
0541 free_page((unsigned long)info->page);
0542 vfree(info->gfns);
0543 vfree(info->fb);
0544 kfree(info);
0545
0546 return 0;
0547 }
0548
0549 static unsigned long vmalloc_to_gfn(void *address)
0550 {
0551 return xen_page_to_gfn(vmalloc_to_page(address));
0552 }
0553
0554 static void xenfb_init_shared_page(struct xenfb_info *info,
0555 struct fb_info *fb_info)
0556 {
0557 int i;
0558 int epd = PAGE_SIZE / sizeof(info->gfns[0]);
0559
0560 for (i = 0; i < info->nr_pages; i++)
0561 info->gfns[i] = vmalloc_to_gfn(info->fb + i * PAGE_SIZE);
0562
0563 for (i = 0; i * epd < info->nr_pages; i++)
0564 info->page->pd[i] = vmalloc_to_gfn(&info->gfns[i * epd]);
0565
0566 info->page->width = fb_info->var.xres;
0567 info->page->height = fb_info->var.yres;
0568 info->page->depth = fb_info->var.bits_per_pixel;
0569 info->page->line_length = fb_info->fix.line_length;
0570 info->page->mem_length = fb_info->fix.smem_len;
0571 info->page->in_cons = info->page->in_prod = 0;
0572 info->page->out_cons = info->page->out_prod = 0;
0573 }
0574
0575 static int xenfb_connect_backend(struct xenbus_device *dev,
0576 struct xenfb_info *info)
0577 {
0578 int ret, evtchn, irq;
0579 struct xenbus_transaction xbt;
0580
0581 ret = xenbus_alloc_evtchn(dev, &evtchn);
0582 if (ret)
0583 return ret;
0584 irq = bind_evtchn_to_irqhandler(evtchn, xenfb_event_handler,
0585 0, dev->devicetype, info);
0586 if (irq < 0) {
0587 xenbus_free_evtchn(dev, evtchn);
0588 xenbus_dev_fatal(dev, ret, "bind_evtchn_to_irqhandler");
0589 return irq;
0590 }
0591 again:
0592 ret = xenbus_transaction_start(&xbt);
0593 if (ret) {
0594 xenbus_dev_fatal(dev, ret, "starting transaction");
0595 goto unbind_irq;
0596 }
0597 ret = xenbus_printf(xbt, dev->nodename, "page-ref", "%lu",
0598 virt_to_gfn(info->page));
0599 if (ret)
0600 goto error_xenbus;
0601 ret = xenbus_printf(xbt, dev->nodename, "event-channel", "%u",
0602 evtchn);
0603 if (ret)
0604 goto error_xenbus;
0605 ret = xenbus_printf(xbt, dev->nodename, "protocol", "%s",
0606 XEN_IO_PROTO_ABI_NATIVE);
0607 if (ret)
0608 goto error_xenbus;
0609 ret = xenbus_printf(xbt, dev->nodename, "feature-update", "1");
0610 if (ret)
0611 goto error_xenbus;
0612 ret = xenbus_transaction_end(xbt, 0);
0613 if (ret) {
0614 if (ret == -EAGAIN)
0615 goto again;
0616 xenbus_dev_fatal(dev, ret, "completing transaction");
0617 goto unbind_irq;
0618 }
0619
0620 xenbus_switch_state(dev, XenbusStateInitialised);
0621 info->irq = irq;
0622 return 0;
0623
0624 error_xenbus:
0625 xenbus_transaction_end(xbt, 1);
0626 xenbus_dev_fatal(dev, ret, "writing xenstore");
0627 unbind_irq:
0628 unbind_from_irqhandler(irq, info);
0629 return ret;
0630 }
0631
0632 static void xenfb_disconnect_backend(struct xenfb_info *info)
0633 {
0634
0635 info->update_wanted = 0;
0636 if (info->irq >= 0)
0637 unbind_from_irqhandler(info->irq, info);
0638 info->irq = -1;
0639 }
0640
0641 static void xenfb_backend_changed(struct xenbus_device *dev,
0642 enum xenbus_state backend_state)
0643 {
0644 struct xenfb_info *info = dev_get_drvdata(&dev->dev);
0645
0646 switch (backend_state) {
0647 case XenbusStateInitialising:
0648 case XenbusStateInitialised:
0649 case XenbusStateReconfiguring:
0650 case XenbusStateReconfigured:
0651 case XenbusStateUnknown:
0652 break;
0653
0654 case XenbusStateInitWait:
0655 xenbus_switch_state(dev, XenbusStateConnected);
0656 break;
0657
0658 case XenbusStateConnected:
0659
0660
0661
0662
0663
0664 if (dev->state != XenbusStateConnected)
0665
0666 xenbus_switch_state(dev, XenbusStateConnected);
0667
0668 if (xenbus_read_unsigned(info->xbdev->otherend,
0669 "request-update", 0))
0670 info->update_wanted = 1;
0671
0672 info->feature_resize = xenbus_read_unsigned(dev->otherend,
0673 "feature-resize", 0);
0674 break;
0675
0676 case XenbusStateClosed:
0677 if (dev->state == XenbusStateClosed)
0678 break;
0679 fallthrough;
0680 case XenbusStateClosing:
0681 xenbus_frontend_closed(dev);
0682 break;
0683 }
0684 }
0685
0686 static const struct xenbus_device_id xenfb_ids[] = {
0687 { "vfb" },
0688 { "" }
0689 };
0690
0691 static struct xenbus_driver xenfb_driver = {
0692 .ids = xenfb_ids,
0693 .probe = xenfb_probe,
0694 .remove = xenfb_remove,
0695 .resume = xenfb_resume,
0696 .otherend_changed = xenfb_backend_changed,
0697 .not_essential = true,
0698 };
0699
0700 static int __init xenfb_init(void)
0701 {
0702 if (!xen_domain())
0703 return -ENODEV;
0704
0705
0706 if (xen_initial_domain())
0707 return -ENODEV;
0708
0709 if (!xen_has_pv_devices())
0710 return -ENODEV;
0711
0712 return xenbus_register_frontend(&xenfb_driver);
0713 }
0714
0715 static void __exit xenfb_cleanup(void)
0716 {
0717 xenbus_unregister_driver(&xenfb_driver);
0718 }
0719
0720 module_init(xenfb_init);
0721 module_exit(xenfb_cleanup);
0722
0723 MODULE_DESCRIPTION("Xen virtual framebuffer device frontend");
0724 MODULE_LICENSE("GPL");
0725 MODULE_ALIAS("xen:vfb");