quoted hunk
-----Original Message-----
From: Gerd Hoffmann [mailto:kraxel@redhat.com]
Sent: Monday, February 24, 2014 8:17 AM
To: <redacted>
Cc: <redacted>; gregkh@linuxfoundation.org; KY Srinivasan;
Abhishek Gupta (LIS); Haiyang Zhang; jasowang@redhat.com;
tomi.valkeinen@ti.com; devel@linuxdriverproject.org; Gerd Hoffmann; Jean-
Christophe Plagniol-Villard
Subject: [PATCH v3 3/4] hyperv-fb: add support for generation 2 virtual
machines.
UEFI-based generation 2 virtual machines support vmbus devices only.
There is no pci bus. Thus they use a different mechanism for the graphics
framebuffer: Instead of using the vga pci bar a chunk of memory muct be
allocated from the hyperv mmio region declared using APCI. This patch
implements support for it.
Based on a patch by Haiyang Zhang [off-list ref]
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
drivers/video/hyperv_fb.c | 86 +++++++++++++++++++++++++++++++++---------
-----
1 file changed, 60 insertions(+), 26 deletions(-)
diff --git a/drivers/video/hyperv_fb.c b/drivers/video/hyperv_fb.c index
130708f..135d8cd 100644
--- a/drivers/video/hyperv_fb.c
+++ b/drivers/video/hyperv_fb.c
@@ -42,6 +42,7 @@
#include <linux/completion.h>
#include <linux/fb.h>
#include <linux/pci.h>
+#include <linux/efi.h>
#include <linux/hyperv.h>
@@ -212,6 +213,7 @@ struct synthvid_msg {
struct hvfb_par {
38 more quoted lines
Please use KBUILD_MODNAME, so that the naming is consistent.
Thanks,
- Haiyang
+ par->mem.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
+ if (gen2vm) {
+ ret = allocate_resource(&hyperv_mmio, &par->mem,
+ screen_fb_size,
+ 0, -1,
+ screen_fb_size,
+ NULL, NULL);
+ if (ret != 0) {
+ pr_err("Unable to allocate framebuffer memory\n");
+ return -ENODEV;
+ }
+ } else {
+ pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT,
PCI_DEVICE_ID_HYPERV_VIDEO, NULL);
- if (!pdev) {
- pr_err("Unable to find PCI Hyper-V video\n");
- return -ENODEV;
- }
+ if (!pdev) {
+ pr_err("Unable to find PCI Hyper-V video\n");
+ return -ENODEV;
+ }
- if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM) ||
- pci_resource_len(pdev, 0) < screen_fb_size)
- goto err1;
+ if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM) ||
+ pci_resource_len(pdev, 0) < screen_fb_size)
+ goto err1;
- fb_phys = pci_resource_end(pdev, 0) - screen_fb_size + 1;
- if (!request_mem_region(fb_phys, screen_fb_size,
KBUILD_MODNAME))
- goto err1;
+ par->mem.end = pci_resource_end(pdev, 0);
+ par->mem.start = par->mem.end - screen_fb_size + 1;
+ ret = request_resource(&pdev->resource[0], &par->mem);
+ if (ret != 0) {
+ pr_err("Unable to request framebuffer memory\n");
+ goto err1;
59 more quoted lines