hyperv-fb: add pci stub
PATCH 1/2 hyperv-fb: add pci stub
This patch adds a pci stub driver to hyper-fb. The hyperv framebuffer driver will bind to the pci device then, so linux kernel and userspace know there is a proper kernel driver for the device active. lspci shows this for example:
[root@dhcp231 ~]# lspci -vs8
00:08.0 VGA compatible controller: Microsoft Corporation Hyper-V virtual VGA (prog-if 00 [VGA controller])
Flags: bus master, fast devsel, latency 0, IRQ 11 Memory at f8000000 (32-bit, non-prefetchable) [sizedM] Expansion ROM at <unassigned> [disabled]
Kernel driver in use: hyperv_fb
Another effect is that the xorg vesa driver will not attach to the device and thus the Xorg server will automatically use the fbdev driver instead.
--- drivers/video/hyperv_fb.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-)
drivers/video/hyperv_fb.c +39 -1
@@ -795,12 +795,21 @@ static int hvfb_remove(struct hv_device *hdev) } +static DEFINE_PCI_DEVICE_TABLE (pci_stub_id_table) = { + { + .vendor =PCI_VENDOR_ID_MICROSOFT , + .device =PCI_DEVICE_ID_HYPERV_VIDEO , + }, + {/* end of list */ } +}; +static const struct hv_vmbus_device_id id_table[] = {/* Synthetic Video Device GUID */ {HV_SYNTHVID_GUID }, {} }; +MODULE_DEVICE_TABLE (pci, pci_stub_id_table);MODULE_DEVICE_TABLE (vmbus, id_table);static struct hv_driver hvfb_drv = {
@@ -810,14 +819,43 @@ static struct hv_driver hvfb_drv = { .remove = hvfb_remove, }; +static int hvfb_pci_stub_probe (struct pci_dev *pdev, +const struct pci_device_id *ent) +{ +return 0 ; +} + +static void hvfb_pci_stub_remove (struct pci_dev *pdev) +{ +} + +static struct pci_driver hvfb_pci_stub_driver = { + .name =KBUILD_MODNAME , + .id_table = pci_stub_id_table, + .probe = hvfb_pci_stub_probe, + .remove = hvfb_pci_stub_remove, +};static int __init hvfb_drv_init (void ) { -return vmbus_driver_register (&hvfb_drv); +int ret; + + ret =vmbus_driver_register (&hvfb_drv); +if (ret !=0 ) +return ret; + + ret =pci_register_driver (&hvfb_pci_stub_driver); +if (ret !=0 ) { +vmbus_driver_unregister (&hvfb_drv); +return ret; + } + +return 0 ; } static void __exit hvfb_drv_exit(void) { +pci_unregister_driver (&hvfb_pci_stub_driver);vmbus_driver_unregister (&hvfb_drv); }
Signature · 1 line
1.8.3.1
PATCH 2/2 hyperv-fb: add blanking support
--- drivers/video/hyperv_fb.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/video/hyperv_fb.c +5 -0
@@ -575,6 +575,10 @@ static int hvfb_setcolreg(unsigned regno, unsigned red, unsigned green,return 0 ; } +static int hvfb_blank (int blank,struct fb_info *info) +{ +return 1 ;/* get fb_blank to set the colormap to all black */ +}static struct fb_ops hvfb_ops = { .owner =THIS_MODULE ,
@@ -584,6 +588,7 @@ static struct fb_ops hvfb_ops = { .fb_fillrect = cfb_fillrect, .fb_copyarea = cfb_copyarea, .fb_imageblit = cfb_imageblit, + .fb_blank = hvfb_blank, };
Signature · 1 line
1.8.3.1
Quoted 105 lines
-----Original Message-----
From: Gerd Hoffmann [mailto:[email protected]]
Sent: Wednesday, October 02, 2013 4:55 AM
Cc: Gerd Hoffmann; KY Srinivasan; Haiyang Zhang; Jean-Christophe Plagniol- Villard; Tomi Valkeinen; open list:Hyper-V CORE AND...; open list:FRAMEBUFFER LAYER; open list
Subject: [PATCH 1/2] hyperv-fb: add pci stubThis patch adds a pci stub driver to hyper-fb. The hyperv framebuffer driver will bind to the pci device then, so linux kernel and userspace know there is a proper kernel driver for the device active. lspci shows this for example:
[root@dhcp231 ~]# lspci -vs8
00:08.0 VGA compatible controller: Microsoft Corporation Hyper-V virtual VGA (prog-if 00 [VGA controller])
Flags: bus master, fast devsel, latency 0, IRQ 11 Memory atf8000000(32-bit, non-prefetchable) [sizedM] Expansion ROM at <unassigned> [disabled]
Kernel driver in use:hyperv_fbAnother effect is that the xorg vesa driver will not attach to the device and thus the Xorg server will automatically use the fbdev driver instead.
Signed-off-by Gerd Hoffmann <[email protected]>--- drivers/video/hyperv_fb.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-)drivers/video/hyperv_fb.c +39
-2@@ -795,12 +795,21 @@ static int hvfb_remove(struct hv_device *hdev) } +static DEFINE_PCI_DEVICE_TABLE (pci_stub_id_table) = { + { + .vendor =PCI_VENDOR_ID_MICROSOFT , + .device =PCI_DEVICE_ID_HYPERV_VIDEO , + }, + {/* end of list */ } +}; +static const struct hv_vmbus_device_id id_table[] = {/* Synthetic Video Device GUID */ {HV_SYNTHVID_GUID }, {} }; +MODULE_DEVICE_TABLE (pci, pci_stub_id_table);MODULE_DEVICE_TABLE (vmbus, id_table);static struct hv_driver hvfb_drv = {@@ -810,14 +819,43 @@ static struct hv_driver hvfb_drv = { .remove = hvfb_remove, }; +static int hvfb_pci_stub_probe (struct pci_dev *pdev, +const struct pci_device_id *ent) +{ +return 0 ; +} + +static void hvfb_pci_stub_remove (struct pci_dev *pdev) +{ +} + +static struct pci_driver hvfb_pci_stub_driver = { + .name =KBUILD_MODNAME , + .id_table = pci_stub_id_table, + .probe = hvfb_pci_stub_probe, + .remove = hvfb_pci_stub_remove, +};static int __init hvfb_drv_init (void ) { -return vmbus_driver_register (&hvfb_drv); +int ret; + + ret =vmbus_driver_register (&hvfb_drv); +if (ret !=0 ) +return ret; + + ret =pci_register_driver (&hvfb_pci_stub_driver); +if (ret !=0 ) { +vmbus_driver_unregister (&hvfb_drv); +return ret; + } + +return 0 ; } static void __exit hvfb_drv_exit(void) { +pci_unregister_driver (&hvfb_pci_stub_driver);vmbus_driver_unregister (&hvfb_drv); } --
Quoted 1 line
1.8.3.1
Gerd,
Thanks for doing this. This certainly will address some of the issues that are reported. I do have a question though - how would this work if we don't have PCI bus in the guest.
Regards,
K. Y
Quoted 23 lines
-----Original Message-----
From: [email protected] [mailto:linux-fbdev- [email protected]] On Behalf Of Gerd Hoffmann
Sent: Wednesday, October 2, 2013 7:55 AM
Cc: Gerd Hoffmann; KY Srinivasan; Haiyang Zhang; Jean-Christophe Plagniol- Villard; Tomi Valkeinen; open list:Hyper-V CORE AND...; open list:FRAMEBUFFER LAYER; open list
Subject: [PATCH 1/2] hyperv-fb: add pci stubThis patch adds a pci stub driver to hyper-fb. The hyperv framebuffer driver will bind to the pci device then, so linux kernel and userspace know there is a proper kernel driver for the device active. lspci shows this for example:
[root@dhcp231 ~]# lspci -vs8
00:08.0 VGA compatible controller: Microsoft Corporation Hyper-V virtual VGA (prog-if 00 [VGA controller])
Flags: bus master, fast devsel, latency 0, IRQ 11 Memory atf8000000(32-bit, non-prefetchable) [sizedM] Expansion ROM at <unassigned> [disabled]
Kernel driver in use:hyperv_fb
Quoted 4 lines
Another effect is that the xorg vesa driver will not attach to the device and thus the Xorg server will automatically use the fbdev driver instead.
Signed-off-by Gerd Hoffmann <[email protected]>
Thank you for fixing this!
- Haiyang
RE: [PATCH 2/2] hyperv-fb: add blanking support
In reply to Gerd HoffmannQuoted 10 lines
-----Original Message-----
From: [email protected] [mailto:linux-fbdev- [email protected]] On Behalf Of Gerd Hoffmann
Sent: Wednesday, October 2, 2013 7:55 AM
Cc: Gerd Hoffmann; KY Srinivasan; Haiyang Zhang; Jean-Christophe Plagniol- Villard; Tomi Valkeinen; open list:Hyper-V CORE AND...; open list:FRAMEBUFFER LAYER; open list
Subject: [PATCH 2/2] hyperv-fb: add blanking supportSigned-off-by Gerd Hoffmann <[email protected]>
Quoted 9 lines · KY Srinivasan
Quoted 5 lines
This patch adds a pci stub driver to hyper-fb. The hyperv framebuffer driver will bind to the pci device then, so linux kernel and userspace know there is a proper kernel driver for the device active. lspci shows this for example:
Gerd,
Thanks for doing this. This certainly will address some of the issues that are reported. I do have a question though - how would this work if we don't have PCI bus in the guest.
The hyperv framebuffer driver wouldn't work in the first place then as it looks up the framebuffer address in pci config space (see hvfb_getmem function).
cheers,
Gerd
DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogR2VyZCBIb2ZmbWFubiBb bW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3ZSBkb24ndCBoYXZl IFBDSQ0KPiBidXMgaW4gdGhlIGd1ZXN0Lg0KPiANCj4gVGhlIGh5cGVydiBmcmFtZWJ1ZmZlciBk cml2ZXIgd291bGRuJ3Qgd29yayBpbiB0aGUgZmlyc3QgcGxhY2UgdGhlbiBhcw0KPiBpdCBsb29r cyB1cCB0aGUgZnJhbWVidWZmZXIgYWRkcmVzcyBpbiBwY2kgY29uZmlnIHNwYWNlIChzZWUgaHZm Yl9nZXRtZW0NCj4gZnVuY3Rpb24pLg0KDQpXZSBhcmUgZ29pbmcgdG8gZml4IHRoaXMgYXMgd2Ug bW92ZSB0aGlzIGNvZGUgdG8gcnVuIG9uIG91ciBVRUZJIGZpcm13YXJlLiANCg0KUmVnYXJkcywN Cg0KSy4gWQ0KDQo
Quoted 19 lines · KY Srinivasan
Quoted 19 lines
-----Original Message-----
From: Gerd Hoffmann [mailto:[email protected]]
Sent: Sunday, October 06, 2013 11:51 PM
To: KY Srinivasan
Cc: Haiyang Zhang; Jean-Christophe Plagniol-Villard; Tomi Valkeinen; open list:Hyper-V CORE AND...; open list:FRAMEBUFFER LAYER; open list
Subject: Re: [PATCH 1/2] hyperv-fb: add pci stubQuoted 9 lines · KY Srinivasan
Quoted 5 lines
This patch adds a pci stub driver to hyper-fb. The hyperv framebuffer driver will bind to the pci device then, so linux kernel and userspace know there is a proper kernel driver for the device active. lspci shows this for example:
Gerd,
Thanks for doing this. This certainly will address some of the issues that are
Quoted 8 lines
Quoted 6 lines
reported. I do have a question though - how would this work if we don't have PCI bus in the guest.
The hyperv framebuffer driver wouldn't work in the first place then as it looks up the framebuffer address in pci config space (see
hvfb_getmemfunction).We are going to fix this as we move this code to run on our UEFI firmware.
Hmm, windows server 2012 seems to have no option to enable uefi. So I guess this is still in development? How this is going to look like?
Probably you are going for pure uefi firmware, without csm, to be able to leave all the legacy bios stuff behind in uefi mode. Therefore no vesa bios support. efi drivers for vmbus network/storage/display/input in the firmware. No legacy ide/vga pci devices. Correct?
The linux kernel will come up with efifb then, switching over to hyperv-fb once the driver is loaded. The hyperv-fb pci stub driver will not bind to the hyperv vga pci device if it isn't present in the guest. hyperv-fb will load just fine nevertheless (once hvfb_getmem is fixed to not depend on the pci device config space). The pci stub added by the patch and the vmbus driver in hyperv-fb are completely independent.
cheers,
Gerd
DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogR2VyZCBIb2ZmbWFubiBb bWFpbHRvOmtyYXhlbEByZWRoYXQuY29tXQ0KPiBTZW50OiBUdWVzZGF5LCBPY3RvYmVyIDA4LCAy MDEzIDE6NDEgQU0NCj4gVG86IEtZIFNyaW5pdmFzYW4NCj4gQ2M6IEhhaXlhbmcgWmhhbmc7IEpl YW4tQ2hyaXN0b3BoZSBQbGFnbmlvbC1WaWxsYXJkOyBUb21pIFZhbGtlaW5lbjsgb3Blbg0KPiBs aXN0Okh5cGVyLVYgQ09SRSBBTkQuLi47IG9wZW4gbGlzdDpGUkFNRUJVRkZFUiBMQVlFUjsgb3Bl biBsaXN0DQo+IFN1YmplY3Q6IFJlOiBbUEFUQ0ggMS8yXSBoeXBlcnYtZmI6IGFkZCBwY2kgc3R1 Yg0KPiANCj4gT24gTW8sIDIwMTMtMTAtMDcgYXQgMTc6MTIgKzAwMDAsIEtZIFNyaW5pdmFzYW4g d3JvdGU6DQo+ID4NCj4gPiA+IC0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQo+ID4gPiBGcm9t OiBHZXJkIEhvZmZtYW5uIFttYWlsdG86a3JheGVsQHJlZGhhdC5jb21dDQo+ID4gPiBTZW50OiBT dW5kYXksIE9jdG9iZXIgMDYsIDIwMTMgMTE6NTEgUE0NCj4gPiA+IFRvOiBLWSBTcmluaXZhc2Fu DQo+ID4gPiBDYzogSGFpeWFuZyBaaGFuZzsgSmVhbi1DaHJpc3RvcGhlIFBsYWduaW9sLVZpbGxh cmQ7IFRvbWkgVmFsa2VpbmVuOyBvcGVuDQo+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vDQo+IGh5cGVy di1mYiBvbmNlIHRoZSBkcml2ZXIgaXMgbG9hZGVkLiAgVGhlIGh5cGVydi1mYiBwY2kgc3R1YiBk cml2ZXIgd2lsbA0KPiBub3QgYmluZCB0byB0aGUgaHlwZXJ2IHZnYSBwY2kgZGV2aWNlIGlmIGl0 IGlzbid0IHByZXNlbnQgaW4gdGhlIGd1ZXN0Lg0KPiBoeXBlcnYtZmIgd2lsbCBsb2FkIGp1c3Qg ZmluZSBuZXZlcnRoZWxlc3MgKG9uY2UgaHZmYl9nZXRtZW0gaXMgZml4ZWQgdG8NCj4gbm90IGRl cGVuZCBvbiB0aGUgcGNpIGRldmljZSBjb25maWcgc3BhY2UpLiAgVGhlIHBjaSBzdHViIGFkZGVk IGJ5IHRoZQ0KPiBwYXRjaCBhbmQgdGhlIHZtYnVzIGRyaXZlciBpbiBoeXBlcnYtZmIgYXJlIGNv bXBsZXRlbHkgaW5kZXBlbmRlbnQuDQoNCk9rOyB0aGFua3MuDQoNCksuIFkNCiANCg0K
Quoted 13 lines · Gerd Hoffmann
This patch adds a pci stub driver to hyper-fb. The hyperv framebuffer driver will bind to the pci device then, so linux kernel and userspace know there is a proper kernel driver for the device active. lspci shows this for example:
[root@dhcp231 ~]# lspci -vs8
00:08.0 VGA compatible controller: Microsoft Corporation Hyper-V virtual VGA (prog-if 00 [VGA controller])
Flags: bus master, fast devsel, latency 0, IRQ 11 Memory atf8000000(32-bit, non-prefetchable) [size=64M] Expansion ROM at <unassigned> [disabled]
Kernel driver in use:hyperv_fb
Quoted 9 lines
Another effect is that the xorg vesa driver will not attach to the device and thus the Xorg server will automatically use the fbdev driver instead.
Signed-off-by Gerd Hoffmann <[email protected]>--- drivers/video/hyperv_fb.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-)
Thanks, queuing the series for 3.13.
Tomi