2 * Copyright (c) 2012, Microsoft Corporation.
5 * Haiyang Zhang <haiyangz@microsoft.com>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
14 * NON INFRINGEMENT. See the GNU General Public License for more
19 * Hyper-V Synthetic Video Frame Buffer Driver
21 * This is the driver for the Hyper-V Synthetic Video, which supports
22 * screen resolution up to Full HD 1920x1080 with 32 bit color on Windows
23 * Server 2012, and 1600x1200 with 16 bit color on Windows Server 2008 R2
26 * It also solves the double mouse cursor issue of the emulated video mode.
28 * The default screen resolution is 1152x864, which may be changed by a
30 * video=hyperv_fb:<width>x<height>
31 * For example: video=hyperv_fb:1280x1024
33 * Portrait orientation is also supported:
34 * For example: video=hyperv_fb:864x1152
37 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
39 #include <linux/module.h>
40 #include <linux/kernel.h>
41 #include <linux/init.h>
42 #include <linux/completion.h>
44 #include <linux/pci.h>
46 #include <linux/hyperv.h>
49 /* Hyper-V Synthetic Video Protocol definitions and structures */
50 #define MAX_VMBUS_PKT_SIZE 0x4000
52 #define SYNTHVID_VERSION(major, minor) ((minor) << 16 | (major))
53 #define SYNTHVID_VERSION_WIN7 SYNTHVID_VERSION(3, 0)
54 #define SYNTHVID_VERSION_WIN8 SYNTHVID_VERSION(3, 2)
56 #define SYNTHVID_DEPTH_WIN7 16
57 #define SYNTHVID_DEPTH_WIN8 32
59 #define SYNTHVID_FB_SIZE_WIN7 (4 * 1024 * 1024)
60 #define SYNTHVID_WIDTH_MAX_WIN7 1600
61 #define SYNTHVID_HEIGHT_MAX_WIN7 1200
63 #define SYNTHVID_FB_SIZE_WIN8 (8 * 1024 * 1024)
65 #define PCI_VENDOR_ID_MICROSOFT 0x1414
66 #define PCI_DEVICE_ID_HYPERV_VIDEO 0x5353
77 u32 size
; /* size of message after this field */
81 enum synthvid_msg_type
{
83 SYNTHVID_VERSION_REQUEST
= 1,
84 SYNTHVID_VERSION_RESPONSE
= 2,
85 SYNTHVID_VRAM_LOCATION
= 3,
86 SYNTHVID_VRAM_LOCATION_ACK
= 4,
87 SYNTHVID_SITUATION_UPDATE
= 5,
88 SYNTHVID_SITUATION_UPDATE_ACK
= 6,
89 SYNTHVID_POINTER_POSITION
= 7,
90 SYNTHVID_POINTER_SHAPE
= 8,
91 SYNTHVID_FEATURE_CHANGE
= 9,
97 struct synthvid_msg_hdr
{
99 u32 size
; /* size of this header + payload after this field*/
103 struct synthvid_version_req
{
107 struct synthvid_version_resp
{
110 u8 max_video_outputs
;
113 struct synthvid_vram_location
{
115 u8 is_vram_gpa_specified
;
119 struct synthvid_vram_location_ack
{
123 struct video_output_situation
{
132 struct synthvid_situation_update
{
134 u8 video_output_count
;
135 struct video_output_situation video_output
[1];
138 struct synthvid_situation_update_ack
{
142 struct synthvid_pointer_position
{
150 #define CURSOR_MAX_X 96
151 #define CURSOR_MAX_Y 96
152 #define CURSOR_ARGB_PIXEL_SIZE 4
153 #define CURSOR_MAX_SIZE (CURSOR_MAX_X * CURSOR_MAX_Y * CURSOR_ARGB_PIXEL_SIZE)
154 #define CURSOR_COMPLETE (-1)
156 struct synthvid_pointer_shape
{
159 u32 width
; /* CURSOR_MAX_X at most */
160 u32 height
; /* CURSOR_MAX_Y at most */
161 u32 hot_x
; /* hotspot relative to upper-left of pointer image */
166 struct synthvid_feature_change
{
168 u8 is_ptr_pos_needed
;
169 u8 is_ptr_shape_needed
;
174 s32 x1
, y1
; /* top left corner */
175 s32 x2
, y2
; /* bottom right corner, exclusive */
178 struct synthvid_dirt
{
184 struct synthvid_msg
{
185 struct pipe_msg_hdr pipe_hdr
;
186 struct synthvid_msg_hdr vid_hdr
;
188 struct synthvid_version_req ver_req
;
189 struct synthvid_version_resp ver_resp
;
190 struct synthvid_vram_location vram
;
191 struct synthvid_vram_location_ack vram_ack
;
192 struct synthvid_situation_update situ
;
193 struct synthvid_situation_update_ack situ_ack
;
194 struct synthvid_pointer_position ptr_pos
;
195 struct synthvid_pointer_shape ptr_shape
;
196 struct synthvid_feature_change feature_chg
;
197 struct synthvid_dirt dirt
;
203 /* FB driver definitions and structures */
204 #define HVFB_WIDTH 1152 /* default screen width */
205 #define HVFB_HEIGHT 864 /* default screen height */
206 #define HVFB_WIDTH_MIN 640
207 #define HVFB_HEIGHT_MIN 480
209 #define RING_BUFSIZE (256 * 1024)
210 #define VSP_TIMEOUT (10 * HZ)
211 #define HVFB_UPDATE_DELAY (HZ / 20)
214 struct fb_info
*info
;
215 bool fb_ready
; /* fb device is ready */
216 struct completion wait
;
217 u32 synthvid_version
;
219 struct delayed_work dwork
;
222 u32 pseudo_palette
[16];
223 u8 init_buf
[MAX_VMBUS_PKT_SIZE
];
224 u8 recv_buf
[MAX_VMBUS_PKT_SIZE
];
227 static uint screen_width
= HVFB_WIDTH
;
228 static uint screen_height
= HVFB_HEIGHT
;
229 static uint screen_depth
;
230 static uint screen_fb_size
;
232 /* Send message to Hyper-V host */
233 static inline int synthvid_send(struct hv_device
*hdev
,
234 struct synthvid_msg
*msg
)
236 static atomic64_t request_id
= ATOMIC64_INIT(0);
239 msg
->pipe_hdr
.type
= PIPE_MSG_DATA
;
240 msg
->pipe_hdr
.size
= msg
->vid_hdr
.size
;
242 ret
= vmbus_sendpacket(hdev
->channel
, msg
,
243 msg
->vid_hdr
.size
+ sizeof(struct pipe_msg_hdr
),
244 atomic64_inc_return(&request_id
),
245 VM_PKT_DATA_INBAND
, 0);
248 pr_err("Unable to send packet via vmbus\n");
254 /* Send screen resolution info to host */
255 static int synthvid_send_situ(struct hv_device
*hdev
)
257 struct fb_info
*info
= hv_get_drvdata(hdev
);
258 struct synthvid_msg msg
;
263 memset(&msg
, 0, sizeof(struct synthvid_msg
));
265 msg
.vid_hdr
.type
= SYNTHVID_SITUATION_UPDATE
;
266 msg
.vid_hdr
.size
= sizeof(struct synthvid_msg_hdr
) +
267 sizeof(struct synthvid_situation_update
);
268 msg
.situ
.user_ctx
= 0;
269 msg
.situ
.video_output_count
= 1;
270 msg
.situ
.video_output
[0].active
= 1;
271 msg
.situ
.video_output
[0].vram_offset
= 0;
272 msg
.situ
.video_output
[0].depth_bits
= info
->var
.bits_per_pixel
;
273 msg
.situ
.video_output
[0].width_pixels
= info
->var
.xres
;
274 msg
.situ
.video_output
[0].height_pixels
= info
->var
.yres
;
275 msg
.situ
.video_output
[0].pitch_bytes
= info
->fix
.line_length
;
277 synthvid_send(hdev
, &msg
);
282 /* Send mouse pointer info to host */
283 static int synthvid_send_ptr(struct hv_device
*hdev
)
285 struct synthvid_msg msg
;
287 memset(&msg
, 0, sizeof(struct synthvid_msg
));
288 msg
.vid_hdr
.type
= SYNTHVID_POINTER_POSITION
;
289 msg
.vid_hdr
.size
= sizeof(struct synthvid_msg_hdr
) +
290 sizeof(struct synthvid_pointer_position
);
291 msg
.ptr_pos
.is_visible
= 1;
292 msg
.ptr_pos
.video_output
= 0;
293 msg
.ptr_pos
.image_x
= 0;
294 msg
.ptr_pos
.image_y
= 0;
295 synthvid_send(hdev
, &msg
);
297 memset(&msg
, 0, sizeof(struct synthvid_msg
));
298 msg
.vid_hdr
.type
= SYNTHVID_POINTER_SHAPE
;
299 msg
.vid_hdr
.size
= sizeof(struct synthvid_msg_hdr
) +
300 sizeof(struct synthvid_pointer_shape
);
301 msg
.ptr_shape
.part_idx
= CURSOR_COMPLETE
;
302 msg
.ptr_shape
.is_argb
= 1;
303 msg
.ptr_shape
.width
= 1;
304 msg
.ptr_shape
.height
= 1;
305 msg
.ptr_shape
.hot_x
= 0;
306 msg
.ptr_shape
.hot_y
= 0;
307 msg
.ptr_shape
.data
[0] = 0;
308 msg
.ptr_shape
.data
[1] = 1;
309 msg
.ptr_shape
.data
[2] = 1;
310 msg
.ptr_shape
.data
[3] = 1;
311 synthvid_send(hdev
, &msg
);
316 /* Send updated screen area (dirty rectangle) location to host */
317 static int synthvid_update(struct fb_info
*info
)
319 struct hv_device
*hdev
= device_to_hv_device(info
->device
);
320 struct synthvid_msg msg
;
322 memset(&msg
, 0, sizeof(struct synthvid_msg
));
324 msg
.vid_hdr
.type
= SYNTHVID_DIRT
;
325 msg
.vid_hdr
.size
= sizeof(struct synthvid_msg_hdr
) +
326 sizeof(struct synthvid_dirt
);
327 msg
.dirt
.video_output
= 0;
328 msg
.dirt
.dirt_count
= 1;
329 msg
.dirt
.rect
[0].x1
= 0;
330 msg
.dirt
.rect
[0].y1
= 0;
331 msg
.dirt
.rect
[0].x2
= info
->var
.xres
;
332 msg
.dirt
.rect
[0].y2
= info
->var
.yres
;
334 synthvid_send(hdev
, &msg
);
341 * Actions on received messages from host:
342 * Complete the wait event.
343 * Or, reply with screen and cursor info.
345 static void synthvid_recv_sub(struct hv_device
*hdev
)
347 struct fb_info
*info
= hv_get_drvdata(hdev
);
348 struct hvfb_par
*par
;
349 struct synthvid_msg
*msg
;
355 msg
= (struct synthvid_msg
*)par
->recv_buf
;
357 /* Complete the wait event */
358 if (msg
->vid_hdr
.type
== SYNTHVID_VERSION_RESPONSE
||
359 msg
->vid_hdr
.type
== SYNTHVID_VRAM_LOCATION_ACK
) {
360 memcpy(par
->init_buf
, msg
, MAX_VMBUS_PKT_SIZE
);
361 complete(&par
->wait
);
365 /* Reply with screen and cursor info */
366 if (msg
->vid_hdr
.type
== SYNTHVID_FEATURE_CHANGE
) {
368 synthvid_send_ptr(hdev
);
369 synthvid_send_situ(hdev
);
372 par
->update
= msg
->feature_chg
.is_dirt_needed
;
374 schedule_delayed_work(&par
->dwork
, HVFB_UPDATE_DELAY
);
378 /* Receive callback for messages from the host */
379 static void synthvid_receive(void *ctx
)
381 struct hv_device
*hdev
= ctx
;
382 struct fb_info
*info
= hv_get_drvdata(hdev
);
383 struct hvfb_par
*par
;
384 struct synthvid_msg
*recv_buf
;
393 recv_buf
= (struct synthvid_msg
*)par
->recv_buf
;
396 ret
= vmbus_recvpacket(hdev
->channel
, recv_buf
,
398 &bytes_recvd
, &req_id
);
399 if (bytes_recvd
> 0 &&
400 recv_buf
->pipe_hdr
.type
== PIPE_MSG_DATA
)
401 synthvid_recv_sub(hdev
);
402 } while (bytes_recvd
> 0 && ret
== 0);
405 /* Check synthetic video protocol version with the host */
406 static int synthvid_negotiate_ver(struct hv_device
*hdev
, u32 ver
)
408 struct fb_info
*info
= hv_get_drvdata(hdev
);
409 struct hvfb_par
*par
= info
->par
;
410 struct synthvid_msg
*msg
= (struct synthvid_msg
*)par
->init_buf
;
413 memset(msg
, 0, sizeof(struct synthvid_msg
));
414 msg
->vid_hdr
.type
= SYNTHVID_VERSION_REQUEST
;
415 msg
->vid_hdr
.size
= sizeof(struct synthvid_msg_hdr
) +
416 sizeof(struct synthvid_version_req
);
417 msg
->ver_req
.version
= ver
;
418 synthvid_send(hdev
, msg
);
420 t
= wait_for_completion_timeout(&par
->wait
, VSP_TIMEOUT
);
422 pr_err("Time out on waiting version response\n");
426 if (!msg
->ver_resp
.is_accepted
) {
431 par
->synthvid_version
= ver
;
437 /* Connect to VSP (Virtual Service Provider) on host */
438 static int synthvid_connect_vsp(struct hv_device
*hdev
)
440 struct fb_info
*info
= hv_get_drvdata(hdev
);
441 struct hvfb_par
*par
= info
->par
;
444 ret
= vmbus_open(hdev
->channel
, RING_BUFSIZE
, RING_BUFSIZE
,
445 NULL
, 0, synthvid_receive
, hdev
);
447 pr_err("Unable to open vmbus channel\n");
451 /* Negotiate the protocol version with host */
452 if (vmbus_proto_version
== VERSION_WS2008
||
453 vmbus_proto_version
== VERSION_WIN7
)
454 ret
= synthvid_negotiate_ver(hdev
, SYNTHVID_VERSION_WIN7
);
456 ret
= synthvid_negotiate_ver(hdev
, SYNTHVID_VERSION_WIN8
);
459 pr_err("Synthetic video device version not accepted\n");
463 if (par
->synthvid_version
== SYNTHVID_VERSION_WIN7
) {
464 screen_depth
= SYNTHVID_DEPTH_WIN7
;
465 screen_fb_size
= SYNTHVID_FB_SIZE_WIN7
;
467 screen_depth
= SYNTHVID_DEPTH_WIN8
;
468 screen_fb_size
= SYNTHVID_FB_SIZE_WIN8
;
474 vmbus_close(hdev
->channel
);
478 /* Send VRAM and Situation messages to the host */
479 static int synthvid_send_config(struct hv_device
*hdev
)
481 struct fb_info
*info
= hv_get_drvdata(hdev
);
482 struct hvfb_par
*par
= info
->par
;
483 struct synthvid_msg
*msg
= (struct synthvid_msg
*)par
->init_buf
;
486 /* Send VRAM location */
487 memset(msg
, 0, sizeof(struct synthvid_msg
));
488 msg
->vid_hdr
.type
= SYNTHVID_VRAM_LOCATION
;
489 msg
->vid_hdr
.size
= sizeof(struct synthvid_msg_hdr
) +
490 sizeof(struct synthvid_vram_location
);
491 msg
->vram
.user_ctx
= msg
->vram
.vram_gpa
= info
->fix
.smem_start
;
492 msg
->vram
.is_vram_gpa_specified
= 1;
493 synthvid_send(hdev
, msg
);
495 t
= wait_for_completion_timeout(&par
->wait
, VSP_TIMEOUT
);
497 pr_err("Time out on waiting vram location ack\n");
501 if (msg
->vram_ack
.user_ctx
!= info
->fix
.smem_start
) {
502 pr_err("Unable to set VRAM location\n");
507 /* Send pointer and situation update */
508 synthvid_send_ptr(hdev
);
509 synthvid_send_situ(hdev
);
517 * Delayed work callback:
518 * It is called at HVFB_UPDATE_DELAY or longer time interval to process
519 * screen updates. It is re-scheduled if further update is necessary.
521 static void hvfb_update_work(struct work_struct
*w
)
523 struct hvfb_par
*par
= container_of(w
, struct hvfb_par
, dwork
.work
);
524 struct fb_info
*info
= par
->info
;
527 synthvid_update(info
);
530 schedule_delayed_work(&par
->dwork
, HVFB_UPDATE_DELAY
);
534 /* Framebuffer operation handlers */
536 static int hvfb_check_var(struct fb_var_screeninfo
*var
, struct fb_info
*info
)
538 if (var
->xres
< HVFB_WIDTH_MIN
|| var
->yres
< HVFB_HEIGHT_MIN
||
539 var
->xres
> screen_width
|| var
->yres
> screen_height
||
540 var
->bits_per_pixel
!= screen_depth
)
543 var
->xres_virtual
= var
->xres
;
544 var
->yres_virtual
= var
->yres
;
549 static int hvfb_set_par(struct fb_info
*info
)
551 struct hv_device
*hdev
= device_to_hv_device(info
->device
);
553 return synthvid_send_situ(hdev
);
557 static inline u32
chan_to_field(u32 chan
, struct fb_bitfield
*bf
)
559 return ((chan
& 0xffff) >> (16 - bf
->length
)) << bf
->offset
;
562 static int hvfb_setcolreg(unsigned regno
, unsigned red
, unsigned green
,
563 unsigned blue
, unsigned transp
, struct fb_info
*info
)
565 u32
*pal
= info
->pseudo_palette
;
570 pal
[regno
] = chan_to_field(red
, &info
->var
.red
)
571 | chan_to_field(green
, &info
->var
.green
)
572 | chan_to_field(blue
, &info
->var
.blue
)
573 | chan_to_field(transp
, &info
->var
.transp
);
579 static struct fb_ops hvfb_ops
= {
580 .owner
= THIS_MODULE
,
581 .fb_check_var
= hvfb_check_var
,
582 .fb_set_par
= hvfb_set_par
,
583 .fb_setcolreg
= hvfb_setcolreg
,
584 .fb_fillrect
= cfb_fillrect
,
585 .fb_copyarea
= cfb_copyarea
,
586 .fb_imageblit
= cfb_imageblit
,
590 /* Get options from kernel paramenter "video=" */
591 static void hvfb_get_option(struct fb_info
*info
)
593 struct hvfb_par
*par
= info
->par
;
594 char *opt
= NULL
, *p
;
597 if (fb_get_options(KBUILD_MODNAME
, &opt
) || !opt
|| !*opt
)
600 p
= strsep(&opt
, "x");
601 if (!*p
|| kstrtouint(p
, 0, &x
) ||
602 !opt
|| !*opt
|| kstrtouint(opt
, 0, &y
)) {
603 pr_err("Screen option is invalid: skipped\n");
607 if (x
< HVFB_WIDTH_MIN
|| y
< HVFB_HEIGHT_MIN
||
608 (par
->synthvid_version
== SYNTHVID_VERSION_WIN8
&&
609 x
* y
* screen_depth
/ 8 > SYNTHVID_FB_SIZE_WIN8
) ||
610 (par
->synthvid_version
== SYNTHVID_VERSION_WIN7
&&
611 (x
> SYNTHVID_WIDTH_MAX_WIN7
|| y
> SYNTHVID_HEIGHT_MAX_WIN7
))) {
612 pr_err("Screen resolution option is out of range: skipped\n");
622 /* Get framebuffer memory from Hyper-V video pci space */
623 static int hvfb_getmem(struct fb_info
*info
)
625 struct pci_dev
*pdev
;
627 void __iomem
*fb_virt
;
629 pdev
= pci_get_device(PCI_VENDOR_ID_MICROSOFT
,
630 PCI_DEVICE_ID_HYPERV_VIDEO
, NULL
);
632 pr_err("Unable to find PCI Hyper-V video\n");
636 if (!(pci_resource_flags(pdev
, 0) & IORESOURCE_MEM
) ||
637 pci_resource_len(pdev
, 0) < screen_fb_size
)
640 fb_phys
= pci_resource_end(pdev
, 0) - screen_fb_size
+ 1;
641 if (!request_mem_region(fb_phys
, screen_fb_size
, KBUILD_MODNAME
))
644 fb_virt
= ioremap(fb_phys
, screen_fb_size
);
648 info
->apertures
= alloc_apertures(1);
649 if (!info
->apertures
)
652 info
->apertures
->ranges
[0].base
= pci_resource_start(pdev
, 0);
653 info
->apertures
->ranges
[0].size
= pci_resource_len(pdev
, 0);
654 info
->fix
.smem_start
= fb_phys
;
655 info
->fix
.smem_len
= screen_fb_size
;
656 info
->screen_base
= fb_virt
;
657 info
->screen_size
= screen_fb_size
;
665 release_mem_region(fb_phys
, screen_fb_size
);
671 /* Release the framebuffer */
672 static void hvfb_putmem(struct fb_info
*info
)
674 iounmap(info
->screen_base
);
675 release_mem_region(info
->fix
.smem_start
, screen_fb_size
);
679 static int hvfb_probe(struct hv_device
*hdev
,
680 const struct hv_vmbus_device_id
*dev_id
)
682 struct fb_info
*info
;
683 struct hvfb_par
*par
;
686 info
= framebuffer_alloc(sizeof(struct hvfb_par
), &hdev
->device
);
688 pr_err("No memory for framebuffer info\n");
694 par
->fb_ready
= false;
695 init_completion(&par
->wait
);
696 INIT_DELAYED_WORK(&par
->dwork
, hvfb_update_work
);
699 hv_set_drvdata(hdev
, info
);
700 ret
= synthvid_connect_vsp(hdev
);
702 pr_err("Unable to connect to VSP\n");
706 ret
= hvfb_getmem(info
);
708 pr_err("No memory for framebuffer\n");
712 hvfb_get_option(info
);
713 pr_info("Screen resolution: %dx%d, Color depth: %d\n",
714 screen_width
, screen_height
, screen_depth
);
718 info
->flags
= FBINFO_DEFAULT
;
720 info
->var
.xres_virtual
= info
->var
.xres
= screen_width
;
721 info
->var
.yres_virtual
= info
->var
.yres
= screen_height
;
722 info
->var
.bits_per_pixel
= screen_depth
;
724 if (info
->var
.bits_per_pixel
== 16) {
725 info
->var
.red
= (struct fb_bitfield
){11, 5, 0};
726 info
->var
.green
= (struct fb_bitfield
){5, 6, 0};
727 info
->var
.blue
= (struct fb_bitfield
){0, 5, 0};
728 info
->var
.transp
= (struct fb_bitfield
){0, 0, 0};
730 info
->var
.red
= (struct fb_bitfield
){16, 8, 0};
731 info
->var
.green
= (struct fb_bitfield
){8, 8, 0};
732 info
->var
.blue
= (struct fb_bitfield
){0, 8, 0};
733 info
->var
.transp
= (struct fb_bitfield
){24, 8, 0};
736 info
->var
.activate
= FB_ACTIVATE_NOW
;
737 info
->var
.height
= -1;
738 info
->var
.width
= -1;
739 info
->var
.vmode
= FB_VMODE_NONINTERLACED
;
741 strcpy(info
->fix
.id
, KBUILD_MODNAME
);
742 info
->fix
.type
= FB_TYPE_PACKED_PIXELS
;
743 info
->fix
.visual
= FB_VISUAL_TRUECOLOR
;
744 info
->fix
.line_length
= screen_width
* screen_depth
/ 8;
745 info
->fix
.accel
= FB_ACCEL_NONE
;
747 info
->fbops
= &hvfb_ops
;
748 info
->pseudo_palette
= par
->pseudo_palette
;
750 /* Send config to host */
751 ret
= synthvid_send_config(hdev
);
755 ret
= register_framebuffer(info
);
757 pr_err("Unable to register framebuffer\n");
761 par
->fb_ready
= true;
768 vmbus_close(hdev
->channel
);
770 cancel_delayed_work_sync(&par
->dwork
);
771 hv_set_drvdata(hdev
, NULL
);
772 framebuffer_release(info
);
777 static int hvfb_remove(struct hv_device
*hdev
)
779 struct fb_info
*info
= hv_get_drvdata(hdev
);
780 struct hvfb_par
*par
= info
->par
;
783 par
->fb_ready
= false;
785 unregister_framebuffer(info
);
786 cancel_delayed_work_sync(&par
->dwork
);
788 vmbus_close(hdev
->channel
);
789 hv_set_drvdata(hdev
, NULL
);
792 framebuffer_release(info
);
798 static const struct hv_vmbus_device_id id_table
[] = {
799 /* Synthetic Video Device GUID */
804 MODULE_DEVICE_TABLE(vmbus
, id_table
);
806 static struct hv_driver hvfb_drv
= {
807 .name
= KBUILD_MODNAME
,
808 .id_table
= id_table
,
810 .remove
= hvfb_remove
,
814 static int __init
hvfb_drv_init(void)
816 return vmbus_driver_register(&hvfb_drv
);
819 static void __exit
hvfb_drv_exit(void)
821 vmbus_driver_unregister(&hvfb_drv
);
824 module_init(hvfb_drv_init
);
825 module_exit(hvfb_drv_exit
);
827 MODULE_LICENSE("GPL");
828 MODULE_VERSION(HV_DRV_VERSION
);
829 MODULE_DESCRIPTION("Microsoft Hyper-V Synthetic Video Frame Buffer Driver");