All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/4] hyperv-fb: add support for generation 2 virtual machines.
@ 2014-02-24 13:17 ` Gerd Hoffmann
  0 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2014-02-24 13:17 UTC (permalink / raw)
  To: linux-fbdev
  Cc: linux-kernel, gregkh, kys, abgupta, haiyangz, jasowang,
	tomi.valkeinen, devel, Gerd Hoffmann

  Hi,

This patch series adds support for uefi-based gen2 virtual machines to
the hyperv-fb driver.  It depends on -next commit
90f3453585479d5beb75058da46eb573ced0e6ac

Patch #1 is a bugfix for 90f3453585479d5beb75058da46eb573ced0e6ac.

Patch #2 changes vmbus to properly hook the hyperv mmio area into
the linux resource management.

Patch #3 actually implements gen2 vm support for hyperv-fb, building
on the hyperv mmio support added by the other patches.

Patch #4 unregisters efifb early to make sure the framebuffer isn't used
any more while hyperv-fb initialization is in progress.  This patch is
new in v2 and it fixes the hang listed as "known issue" in v1 of this
patch series.

v3 changes:
 - fix a error handling bug in patch #3.
 - don't include 90f3453585479d5beb75058da46eb573ced0e6ac
   to avoid confusion

please apply,
  Gerd

Gerd Hoffmann (4):
  vmbus: add missing breaks
  vmbus: use resource for hyperv mmio region
  hyperv-fb: add support for generation 2 virtual machines.
  hyperv-fb: kick off efifb early

K. Y. Srinivasan (1):
  Drivers: hv: vmbus: Extract the mmio information from DSDT

 drivers/hv/vmbus_drv.c    | 51 ++++++++++++++++++++-------
 drivers/video/hyperv_fb.c | 87 +++++++++++++++++++++++++++++++++--------------
 include/linux/hyperv.h    |  2 ++
 3 files changed, 101 insertions(+), 39 deletions(-)

-- 
1.8.3.1


Gerd Hoffmann (4):
  vmbus: add missing breaks
  vmbus: use resource for hyperv mmio region
  hyperv-fb: add support for generation 2 virtual machines.
  hyperv-fb: kick off efifb early

 drivers/hv/vmbus_drv.c    | 18 ++++++----
 drivers/video/hyperv_fb.c | 87 +++++++++++++++++++++++++++++++++--------------
 include/linux/hyperv.h    |  3 +-
 3 files changed, 74 insertions(+), 34 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v3 0/4] hyperv-fb: add support for generation 2 virtual machines.
@ 2014-02-24 13:17 ` Gerd Hoffmann
  0 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2014-02-24 13:17 UTC (permalink / raw)
  To: linux-fbdev
  Cc: linux-kernel, gregkh, kys, abgupta, haiyangz, jasowang,
	tomi.valkeinen, devel, Gerd Hoffmann

  Hi,

This patch series adds support for uefi-based gen2 virtual machines to
the hyperv-fb driver.  It depends on -next commit
90f3453585479d5beb75058da46eb573ced0e6ac

Patch #1 is a bugfix for 90f3453585479d5beb75058da46eb573ced0e6ac.

Patch #2 changes vmbus to properly hook the hyperv mmio area into
the linux resource management.

Patch #3 actually implements gen2 vm support for hyperv-fb, building
on the hyperv mmio support added by the other patches.

Patch #4 unregisters efifb early to make sure the framebuffer isn't used
any more while hyperv-fb initialization is in progress.  This patch is
new in v2 and it fixes the hang listed as "known issue" in v1 of this
patch series.

v3 changes:
 - fix a error handling bug in patch #3.
 - don't include 90f3453585479d5beb75058da46eb573ced0e6ac
   to avoid confusion

please apply,
  Gerd

Gerd Hoffmann (4):
  vmbus: add missing breaks
  vmbus: use resource for hyperv mmio region
  hyperv-fb: add support for generation 2 virtual machines.
  hyperv-fb: kick off efifb early

K. Y. Srinivasan (1):
  Drivers: hv: vmbus: Extract the mmio information from DSDT

 drivers/hv/vmbus_drv.c    | 51 ++++++++++++++++++++-------
 drivers/video/hyperv_fb.c | 87 +++++++++++++++++++++++++++++++++--------------
 include/linux/hyperv.h    |  2 ++
 3 files changed, 101 insertions(+), 39 deletions(-)

-- 
1.8.3.1


Gerd Hoffmann (4):
  vmbus: add missing breaks
  vmbus: use resource for hyperv mmio region
  hyperv-fb: add support for generation 2 virtual machines.
  hyperv-fb: kick off efifb early

 drivers/hv/vmbus_drv.c    | 18 ++++++----
 drivers/video/hyperv_fb.c | 87 +++++++++++++++++++++++++++++++++--------------
 include/linux/hyperv.h    |  3 +-
 3 files changed, 74 insertions(+), 34 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v3 1/4] vmbus: add missing breaks
  2014-02-24 13:17 ` Gerd Hoffmann
@ 2014-02-24 13:17   ` Gerd Hoffmann
  -1 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2014-02-24 13:17 UTC (permalink / raw)
  To: linux-fbdev
  Cc: linux-kernel, gregkh, kys, abgupta, haiyangz, jasowang,
	tomi.valkeinen, devel, Gerd Hoffmann

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 drivers/hv/vmbus_drv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index b37c91b..2352ae48 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -899,10 +899,12 @@ static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx)
 	switch (res->type) {
 	case ACPI_RESOURCE_TYPE_IRQ:
 		irq = res->data.irq.interrupts[0];
+		break;
 
 	case ACPI_RESOURCE_TYPE_ADDRESS64:
 		hyperv_mmio_start = res->data.address64.minimum;
 		hyperv_mmio_size = res->data.address64.address_length;
+		break;
 	}
 
 	return AE_OK;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 1/4] vmbus: add missing breaks
@ 2014-02-24 13:17   ` Gerd Hoffmann
  0 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2014-02-24 13:17 UTC (permalink / raw)
  To: linux-fbdev
  Cc: linux-kernel, gregkh, kys, abgupta, haiyangz, jasowang,
	tomi.valkeinen, devel, Gerd Hoffmann

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 drivers/hv/vmbus_drv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index b37c91b..2352ae48 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -899,10 +899,12 @@ static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx)
 	switch (res->type) {
 	case ACPI_RESOURCE_TYPE_IRQ:
 		irq = res->data.irq.interrupts[0];
+		break;
 
 	case ACPI_RESOURCE_TYPE_ADDRESS64:
 		hyperv_mmio_start = res->data.address64.minimum;
 		hyperv_mmio_size = res->data.address64.address_length;
+		break;
 	}
 
 	return AE_OK;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 2/4] vmbus: use resource for hyperv mmio region
  2014-02-24 13:17 ` Gerd Hoffmann
@ 2014-02-24 13:17   ` Gerd Hoffmann
  -1 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2014-02-24 13:17 UTC (permalink / raw)
  To: linux-fbdev
  Cc: linux-kernel, gregkh, kys, abgupta, haiyangz, jasowang,
	tomi.valkeinen, devel, Gerd Hoffmann

Use a resource for the hyperv mmio region instead of start/size
variables.  Register the region properly so it shows up in
/proc/iomem.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 drivers/hv/vmbus_drv.c | 16 ++++++++++------
 include/linux/hyperv.h |  3 +--
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 2352ae48..a14f603 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -43,10 +43,12 @@ static struct acpi_device  *hv_acpi_dev;
 static struct tasklet_struct msg_dpc;
 static struct completion probe_event;
 static int irq;
-u64 hyperv_mmio_start;
-EXPORT_SYMBOL_GPL(hyperv_mmio_start);
-u64 hyperv_mmio_size;
-EXPORT_SYMBOL_GPL(hyperv_mmio_size);
+
+struct resource hyperv_mmio = {
+	.name  = "hyperv mmio",
+	.flags = IORESOURCE_MEM,
+};
+EXPORT_SYMBOL_GPL(hyperv_mmio);
 
 static int vmbus_exists(void)
 {
@@ -902,8 +904,8 @@ static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx)
 		break;
 
 	case ACPI_RESOURCE_TYPE_ADDRESS64:
-		hyperv_mmio_start = res->data.address64.minimum;
-		hyperv_mmio_size = res->data.address64.address_length;
+		hyperv_mmio.start = res->data.address64.minimum;
+		hyperv_mmio.end = res->data.address64.maximum;
 		break;
 	}
 
@@ -933,6 +935,8 @@ static int vmbus_acpi_add(struct acpi_device *device)
 
 		if (ACPI_FAILURE(result))
 			goto acpi_walk_err;
+		if (hyperv_mmio.start && hyperv_mmio.end)
+			request_resource(&iomem_resource, &hyperv_mmio);
 	}
 	ret_val = 0;
 
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index be3028f..c93e342 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -1459,8 +1459,7 @@ int hv_vss_init(struct hv_util_service *);
 void hv_vss_deinit(void);
 void hv_vss_onchannelcallback(void *);
 
-extern u64 hyperv_mmio_start;
-extern u64 hyperv_mmio_size;
+extern struct resource hyperv_mmio;
 
 /*
  * Negotiated version with the Host.
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 2/4] vmbus: use resource for hyperv mmio region
@ 2014-02-24 13:17   ` Gerd Hoffmann
  0 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2014-02-24 13:17 UTC (permalink / raw)
  To: linux-fbdev
  Cc: linux-kernel, gregkh, kys, abgupta, haiyangz, jasowang,
	tomi.valkeinen, devel, Gerd Hoffmann

Use a resource for the hyperv mmio region instead of start/size
variables.  Register the region properly so it shows up in
/proc/iomem.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 drivers/hv/vmbus_drv.c | 16 ++++++++++------
 include/linux/hyperv.h |  3 +--
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 2352ae48..a14f603 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -43,10 +43,12 @@ static struct acpi_device  *hv_acpi_dev;
 static struct tasklet_struct msg_dpc;
 static struct completion probe_event;
 static int irq;
-u64 hyperv_mmio_start;
-EXPORT_SYMBOL_GPL(hyperv_mmio_start);
-u64 hyperv_mmio_size;
-EXPORT_SYMBOL_GPL(hyperv_mmio_size);
+
+struct resource hyperv_mmio = {
+	.name  = "hyperv mmio",
+	.flags = IORESOURCE_MEM,
+};
+EXPORT_SYMBOL_GPL(hyperv_mmio);
 
 static int vmbus_exists(void)
 {
@@ -902,8 +904,8 @@ static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx)
 		break;
 
 	case ACPI_RESOURCE_TYPE_ADDRESS64:
-		hyperv_mmio_start = res->data.address64.minimum;
-		hyperv_mmio_size = res->data.address64.address_length;
+		hyperv_mmio.start = res->data.address64.minimum;
+		hyperv_mmio.end = res->data.address64.maximum;
 		break;
 	}
 
@@ -933,6 +935,8 @@ static int vmbus_acpi_add(struct acpi_device *device)
 
 		if (ACPI_FAILURE(result))
 			goto acpi_walk_err;
+		if (hyperv_mmio.start && hyperv_mmio.end)
+			request_resource(&iomem_resource, &hyperv_mmio);
 	}
 	ret_val = 0;
 
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index be3028f..c93e342 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -1459,8 +1459,7 @@ int hv_vss_init(struct hv_util_service *);
 void hv_vss_deinit(void);
 void hv_vss_onchannelcallback(void *);
 
-extern u64 hyperv_mmio_start;
-extern u64 hyperv_mmio_size;
+extern struct resource hyperv_mmio;
 
 /*
  * Negotiated version with the Host.
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 3/4] hyperv-fb: add support for generation 2 virtual machines.
  2014-02-24 13:17 ` Gerd Hoffmann
@ 2014-02-24 13:17   ` Gerd Hoffmann
  -1 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2014-02-24 13:17 UTC (permalink / raw)
  To: linux-fbdev
  Cc: linux-kernel, gregkh, kys, abgupta, haiyangz, jasowang,
	tomi.valkeinen, devel, Gerd Hoffmann,
	Jean-Christophe Plagniol-Villard

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 <haiyangz@microsoft.com>

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 {
 	struct fb_info *info;
+	struct resource mem;
 	bool fb_ready; /* fb device is ready */
 	struct completion wait;
 	u32 synthvid_version;
@@ -460,13 +462,13 @@ static int synthvid_connect_vsp(struct hv_device *hdev)
 		goto error;
 	}
 
-	if (par->synthvid_version == SYNTHVID_VERSION_WIN7) {
+	if (par->synthvid_version == SYNTHVID_VERSION_WIN7)
 		screen_depth = SYNTHVID_DEPTH_WIN7;
-		screen_fb_size = SYNTHVID_FB_SIZE_WIN7;
-	} else {
+	else
 		screen_depth = SYNTHVID_DEPTH_WIN8;
-		screen_fb_size = SYNTHVID_FB_SIZE_WIN8;
-	}
+
+	screen_fb_size = hdev->channel->offermsg.offer.
+				mmio_megabytes * 1024 * 1024;
 
 	return 0;
 
@@ -627,26 +629,46 @@ static void hvfb_get_option(struct fb_info *info)
 /* Get framebuffer memory from Hyper-V video pci space */
 static int hvfb_getmem(struct fb_info *info)
 {
-	struct pci_dev *pdev;
-	ulong fb_phys;
+	struct hvfb_par *par = info->par;
+	struct pci_dev *pdev  = NULL;
 	void __iomem *fb_virt;
+	int gen2vm = efi_enabled(EFI_BOOT);
+	int ret;
 
-	pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT,
+	par->mem.name = "hyperv_fb";
+	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;
+		}
+	}
 
-	fb_virt = ioremap(fb_phys, screen_fb_size);
+	fb_virt = ioremap(par->mem.start, screen_fb_size);
 	if (!fb_virt)
 		goto err2;
 
@@ -654,30 +676,42 @@ static int hvfb_getmem(struct fb_info *info)
 	if (!info->apertures)
 		goto err3;
 
-	info->apertures->ranges[0].base = pci_resource_start(pdev, 0);
-	info->apertures->ranges[0].size = pci_resource_len(pdev, 0);
-	info->fix.smem_start = fb_phys;
+	if (gen2vm) {
+		info->apertures->ranges[0].base = screen_info.lfb_base;
+		info->apertures->ranges[0].size = screen_info.lfb_size;
+	} else {
+		info->apertures->ranges[0].base = pci_resource_start(pdev, 0);
+		info->apertures->ranges[0].size = pci_resource_len(pdev, 0);
+	}
+
+	info->fix.smem_start = par->mem.start;
 	info->fix.smem_len = screen_fb_size;
 	info->screen_base = fb_virt;
 	info->screen_size = screen_fb_size;
 
-	pci_dev_put(pdev);
+	if (!gen2vm)
+		pci_dev_put(pdev);
+
 	return 0;
 
 err3:
 	iounmap(fb_virt);
 err2:
-	release_mem_region(fb_phys, screen_fb_size);
+	release_resource(&par->mem);
 err1:
-	pci_dev_put(pdev);
+	if (!gen2vm)
+		pci_dev_put(pdev);
+
 	return -ENOMEM;
 }
 
 /* Release the framebuffer */
 static void hvfb_putmem(struct fb_info *info)
 {
+	struct hvfb_par *par = info->par;
+
 	iounmap(info->screen_base);
-	release_mem_region(info->fix.smem_start, screen_fb_size);
+	release_resource(&par->mem);
 }
 
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 3/4] hyperv-fb: add support for generation 2 virtual machines.
@ 2014-02-24 13:17   ` Gerd Hoffmann
  0 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2014-02-24 13:17 UTC (permalink / raw)
  To: linux-fbdev
  Cc: linux-kernel, gregkh, kys, abgupta, haiyangz, jasowang,
	tomi.valkeinen, devel, Gerd Hoffmann,
	Jean-Christophe Plagniol-Villard

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 <haiyangz@microsoft.com>

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 {
 	struct fb_info *info;
+	struct resource mem;
 	bool fb_ready; /* fb device is ready */
 	struct completion wait;
 	u32 synthvid_version;
@@ -460,13 +462,13 @@ static int synthvid_connect_vsp(struct hv_device *hdev)
 		goto error;
 	}
 
-	if (par->synthvid_version = SYNTHVID_VERSION_WIN7) {
+	if (par->synthvid_version = SYNTHVID_VERSION_WIN7)
 		screen_depth = SYNTHVID_DEPTH_WIN7;
-		screen_fb_size = SYNTHVID_FB_SIZE_WIN7;
-	} else {
+	else
 		screen_depth = SYNTHVID_DEPTH_WIN8;
-		screen_fb_size = SYNTHVID_FB_SIZE_WIN8;
-	}
+
+	screen_fb_size = hdev->channel->offermsg.offer.
+				mmio_megabytes * 1024 * 1024;
 
 	return 0;
 
@@ -627,26 +629,46 @@ static void hvfb_get_option(struct fb_info *info)
 /* Get framebuffer memory from Hyper-V video pci space */
 static int hvfb_getmem(struct fb_info *info)
 {
-	struct pci_dev *pdev;
-	ulong fb_phys;
+	struct hvfb_par *par = info->par;
+	struct pci_dev *pdev  = NULL;
 	void __iomem *fb_virt;
+	int gen2vm = efi_enabled(EFI_BOOT);
+	int ret;
 
-	pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT,
+	par->mem.name = "hyperv_fb";
+	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;
+		}
+	}
 
-	fb_virt = ioremap(fb_phys, screen_fb_size);
+	fb_virt = ioremap(par->mem.start, screen_fb_size);
 	if (!fb_virt)
 		goto err2;
 
@@ -654,30 +676,42 @@ static int hvfb_getmem(struct fb_info *info)
 	if (!info->apertures)
 		goto err3;
 
-	info->apertures->ranges[0].base = pci_resource_start(pdev, 0);
-	info->apertures->ranges[0].size = pci_resource_len(pdev, 0);
-	info->fix.smem_start = fb_phys;
+	if (gen2vm) {
+		info->apertures->ranges[0].base = screen_info.lfb_base;
+		info->apertures->ranges[0].size = screen_info.lfb_size;
+	} else {
+		info->apertures->ranges[0].base = pci_resource_start(pdev, 0);
+		info->apertures->ranges[0].size = pci_resource_len(pdev, 0);
+	}
+
+	info->fix.smem_start = par->mem.start;
 	info->fix.smem_len = screen_fb_size;
 	info->screen_base = fb_virt;
 	info->screen_size = screen_fb_size;
 
-	pci_dev_put(pdev);
+	if (!gen2vm)
+		pci_dev_put(pdev);
+
 	return 0;
 
 err3:
 	iounmap(fb_virt);
 err2:
-	release_mem_region(fb_phys, screen_fb_size);
+	release_resource(&par->mem);
 err1:
-	pci_dev_put(pdev);
+	if (!gen2vm)
+		pci_dev_put(pdev);
+
 	return -ENOMEM;
 }
 
 /* Release the framebuffer */
 static void hvfb_putmem(struct fb_info *info)
 {
+	struct hvfb_par *par = info->par;
+
 	iounmap(info->screen_base);
-	release_mem_region(info->fix.smem_start, screen_fb_size);
+	release_resource(&par->mem);
 }
 
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 4/4] hyperv-fb: kick off efifb early
  2014-02-24 13:17 ` Gerd Hoffmann
@ 2014-02-24 13:17   ` Gerd Hoffmann
  -1 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2014-02-24 13:17 UTC (permalink / raw)
  To: linux-fbdev
  Cc: linux-kernel, gregkh, kys, abgupta, haiyangz, jasowang,
	tomi.valkeinen, devel, Gerd Hoffmann,
	Jean-Christophe Plagniol-Villard

Remove firmware framebuffer before initializing hyperv-fb.  Needed
on gen2 virtual machines.   Letting register_framebuffer handle the
switchover results in efifb still being active while hyperv graphics
are initialized, which in turn can make the linux kernel hang.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 drivers/video/hyperv_fb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/hyperv_fb.c b/drivers/video/hyperv_fb.c
index 135d8cd..a570836 100644
--- a/drivers/video/hyperv_fb.c
+++ b/drivers/video/hyperv_fb.c
@@ -683,6 +683,7 @@ static int hvfb_getmem(struct fb_info *info)
 		info->apertures->ranges[0].base = pci_resource_start(pdev, 0);
 		info->apertures->ranges[0].size = pci_resource_len(pdev, 0);
 	}
+	remove_conflicting_framebuffers(info->apertures, "hyperv-fb", false);
 
 	info->fix.smem_start = par->mem.start;
 	info->fix.smem_len = screen_fb_size;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 4/4] hyperv-fb: kick off efifb early
@ 2014-02-24 13:17   ` Gerd Hoffmann
  0 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2014-02-24 13:17 UTC (permalink / raw)
  To: linux-fbdev
  Cc: linux-kernel, gregkh, kys, abgupta, haiyangz, jasowang,
	tomi.valkeinen, devel, Gerd Hoffmann,
	Jean-Christophe Plagniol-Villard

Remove firmware framebuffer before initializing hyperv-fb.  Needed
on gen2 virtual machines.   Letting register_framebuffer handle the
switchover results in efifb still being active while hyperv graphics
are initialized, which in turn can make the linux kernel hang.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 drivers/video/hyperv_fb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/hyperv_fb.c b/drivers/video/hyperv_fb.c
index 135d8cd..a570836 100644
--- a/drivers/video/hyperv_fb.c
+++ b/drivers/video/hyperv_fb.c
@@ -683,6 +683,7 @@ static int hvfb_getmem(struct fb_info *info)
 		info->apertures->ranges[0].base = pci_resource_start(pdev, 0);
 		info->apertures->ranges[0].size = pci_resource_len(pdev, 0);
 	}
+	remove_conflicting_framebuffers(info->apertures, "hyperv-fb", false);
 
 	info->fix.smem_start = par->mem.start;
 	info->fix.smem_len = screen_fb_size;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* RE: [PATCH v3 2/4] vmbus: use resource for hyperv mmio region
  2014-02-24 13:17   ` Gerd Hoffmann
  (?)
@ 2014-02-24 21:57   ` KY Srinivasan
  -1 siblings, 0 replies; 18+ messages in thread
From: KY Srinivasan @ 2014-02-24 21:57 UTC (permalink / raw)
  To: Gerd Hoffmann, linux-fbdev
  Cc: linux-kernel, gregkh, Abhishek Gupta (LIS),
	Haiyang Zhang, jasowang, tomi.valkeinen, devel



> -----Original Message-----
> From: Gerd Hoffmann [mailto:kraxel@redhat.com]
> Sent: Monday, February 24, 2014 5:17 AM
> To: linux-fbdev@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org; gregkh@linuxfoundation.org; KY
> Srinivasan; Abhishek Gupta (LIS); Haiyang Zhang; jasowang@redhat.com;
> tomi.valkeinen@ti.com; devel@linuxdriverproject.org; Gerd Hoffmann
> Subject: [PATCH v3 2/4] vmbus: use resource for hyperv mmio region
> 
> Use a resource for the hyperv mmio region instead of start/size variables.
> Register the region properly so it shows up in /proc/iomem.
> 
Thanks Gerd.

K. Y
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> ---
>  drivers/hv/vmbus_drv.c | 16 ++++++++++------  include/linux/hyperv.h |  3
> +--
>  2 files changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index
> 2352ae48..a14f603 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -43,10 +43,12 @@ static struct acpi_device  *hv_acpi_dev;  static struct
> tasklet_struct msg_dpc;  static struct completion probe_event;  static int irq;
> -u64 hyperv_mmio_start;
> -EXPORT_SYMBOL_GPL(hyperv_mmio_start);
> -u64 hyperv_mmio_size;
> -EXPORT_SYMBOL_GPL(hyperv_mmio_size);
> +
> +struct resource hyperv_mmio = {
> +	.name  = "hyperv mmio",
> +	.flags = IORESOURCE_MEM,
> +};
> +EXPORT_SYMBOL_GPL(hyperv_mmio);
> 
>  static int vmbus_exists(void)
>  {
> @@ -902,8 +904,8 @@ static acpi_status vmbus_walk_resources(struct
> acpi_resource *res, void *ctx)
>  		break;
> 
>  	case ACPI_RESOURCE_TYPE_ADDRESS64:
> -		hyperv_mmio_start = res->data.address64.minimum;
> -		hyperv_mmio_size = res->data.address64.address_length;
> +		hyperv_mmio.start = res->data.address64.minimum;
> +		hyperv_mmio.end = res->data.address64.maximum;
>  		break;
>  	}
> 
> @@ -933,6 +935,8 @@ static int vmbus_acpi_add(struct acpi_device *device)
> 
>  		if (ACPI_FAILURE(result))
>  			goto acpi_walk_err;
> +		if (hyperv_mmio.start && hyperv_mmio.end)
> +			request_resource(&iomem_resource,
> &hyperv_mmio);
>  	}
>  	ret_val = 0;
> 
> diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index
> be3028f..c93e342 100644
> --- a/include/linux/hyperv.h
> +++ b/include/linux/hyperv.h
> @@ -1459,8 +1459,7 @@ int hv_vss_init(struct hv_util_service *);  void
> hv_vss_deinit(void);  void hv_vss_onchannelcallback(void *);
> 
> -extern u64 hyperv_mmio_start;
> -extern u64 hyperv_mmio_size;
> +extern struct resource hyperv_mmio;
> 
>  /*
>   * Negotiated version with the Host.
> --
> 1.8.3.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [PATCH v3 3/4] hyperv-fb: add support for generation 2 virtual machines.
  2014-02-24 13:17   ` Gerd Hoffmann
@ 2014-02-24 22:05     ` Haiyang Zhang
  -1 siblings, 0 replies; 18+ messages in thread
From: Haiyang Zhang @ 2014-02-24 22:05 UTC (permalink / raw)
  To: Gerd Hoffmann, linux-fbdev
  Cc: linux-kernel, gregkh, KY Srinivasan, Abhishek Gupta (LIS),
	jasowang, tomi.valkeinen, devel,
	Jean-Christophe Plagniol-Villard



> -----Original Message-----
> From: Gerd Hoffmann [mailto:kraxel@redhat.com]
> Sent: Monday, February 24, 2014 8:17 AM
> To: linux-fbdev@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org; 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 <haiyangz@microsoft.com>
> 
> 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 {
>  	struct fb_info *info;
> +	struct resource mem;
>  	bool fb_ready; /* fb device is ready */
>  	struct completion wait;
>  	u32 synthvid_version;
> @@ -460,13 +462,13 @@ static int synthvid_connect_vsp(struct hv_device
> *hdev)
>  		goto error;
>  	}
> 
> -	if (par->synthvid_version == SYNTHVID_VERSION_WIN7) {
> +	if (par->synthvid_version == SYNTHVID_VERSION_WIN7)
>  		screen_depth = SYNTHVID_DEPTH_WIN7;
> -		screen_fb_size = SYNTHVID_FB_SIZE_WIN7;
> -	} else {
> +	else
>  		screen_depth = SYNTHVID_DEPTH_WIN8;
> -		screen_fb_size = SYNTHVID_FB_SIZE_WIN8;
> -	}
> +
> +	screen_fb_size = hdev->channel->offermsg.offer.
> +				mmio_megabytes * 1024 * 1024;
> 
>  	return 0;
> 
> @@ -627,26 +629,46 @@ static void hvfb_get_option(struct fb_info *info)
>  /* Get framebuffer memory from Hyper-V video pci space */  static int
> hvfb_getmem(struct fb_info *info)  {
> -	struct pci_dev *pdev;
> -	ulong fb_phys;
> +	struct hvfb_par *par = info->par;
> +	struct pci_dev *pdev  = NULL;
>  	void __iomem *fb_virt;
> +	int gen2vm = efi_enabled(EFI_BOOT);
> +	int ret;
> 
> -	pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT,
> +	par->mem.name = "hyperv_fb";

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;
> +		}
> +	}
> 
> -	fb_virt = ioremap(fb_phys, screen_fb_size);
> +	fb_virt = ioremap(par->mem.start, screen_fb_size);
>  	if (!fb_virt)
>  		goto err2;
> 
> @@ -654,30 +676,42 @@ static int hvfb_getmem(struct fb_info *info)
>  	if (!info->apertures)
>  		goto err3;
> 
> -	info->apertures->ranges[0].base = pci_resource_start(pdev, 0);
> -	info->apertures->ranges[0].size = pci_resource_len(pdev, 0);
> -	info->fix.smem_start = fb_phys;
> +	if (gen2vm) {
> +		info->apertures->ranges[0].base = screen_info.lfb_base;
> +		info->apertures->ranges[0].size = screen_info.lfb_size;
> +	} else {
> +		info->apertures->ranges[0].base = pci_resource_start(pdev, 0);
> +		info->apertures->ranges[0].size = pci_resource_len(pdev, 0);
> +	}
> +
> +	info->fix.smem_start = par->mem.start;
>  	info->fix.smem_len = screen_fb_size;
>  	info->screen_base = fb_virt;
>  	info->screen_size = screen_fb_size;
> 
> -	pci_dev_put(pdev);
> +	if (!gen2vm)
> +		pci_dev_put(pdev);
> +
>  	return 0;
> 
>  err3:
>  	iounmap(fb_virt);
>  err2:
> -	release_mem_region(fb_phys, screen_fb_size);
> +	release_resource(&par->mem);
>  err1:
> -	pci_dev_put(pdev);
> +	if (!gen2vm)
> +		pci_dev_put(pdev);
> +
>  	return -ENOMEM;
>  }
> 
>  /* Release the framebuffer */
>  static void hvfb_putmem(struct fb_info *info)  {
> +	struct hvfb_par *par = info->par;
> +
>  	iounmap(info->screen_base);
> -	release_mem_region(info->fix.smem_start, screen_fb_size);
> +	release_resource(&par->mem);
>  }
> 
> 
> --
> 1.8.3.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [PATCH v3 3/4] hyperv-fb: add support for generation 2 virtual machines.
@ 2014-02-24 22:05     ` Haiyang Zhang
  0 siblings, 0 replies; 18+ messages in thread
From: Haiyang Zhang @ 2014-02-24 22:05 UTC (permalink / raw)
  To: Gerd Hoffmann, linux-fbdev
  Cc: linux-kernel, gregkh, KY Srinivasan, Abhishek Gupta (LIS),
	jasowang, tomi.valkeinen, devel,
	Jean-Christophe Plagniol-Villard



> -----Original Message-----
> From: Gerd Hoffmann [mailto:kraxel@redhat.com]
> Sent: Monday, February 24, 2014 8:17 AM
> To: linux-fbdev@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org; 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 <haiyangz@microsoft.com>
> 
> 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 {
>  	struct fb_info *info;
> +	struct resource mem;
>  	bool fb_ready; /* fb device is ready */
>  	struct completion wait;
>  	u32 synthvid_version;
> @@ -460,13 +462,13 @@ static int synthvid_connect_vsp(struct hv_device
> *hdev)
>  		goto error;
>  	}
> 
> -	if (par->synthvid_version = SYNTHVID_VERSION_WIN7) {
> +	if (par->synthvid_version = SYNTHVID_VERSION_WIN7)
>  		screen_depth = SYNTHVID_DEPTH_WIN7;
> -		screen_fb_size = SYNTHVID_FB_SIZE_WIN7;
> -	} else {
> +	else
>  		screen_depth = SYNTHVID_DEPTH_WIN8;
> -		screen_fb_size = SYNTHVID_FB_SIZE_WIN8;
> -	}
> +
> +	screen_fb_size = hdev->channel->offermsg.offer.
> +				mmio_megabytes * 1024 * 1024;
> 
>  	return 0;
> 
> @@ -627,26 +629,46 @@ static void hvfb_get_option(struct fb_info *info)
>  /* Get framebuffer memory from Hyper-V video pci space */  static int
> hvfb_getmem(struct fb_info *info)  {
> -	struct pci_dev *pdev;
> -	ulong fb_phys;
> +	struct hvfb_par *par = info->par;
> +	struct pci_dev *pdev  = NULL;
>  	void __iomem *fb_virt;
> +	int gen2vm = efi_enabled(EFI_BOOT);
> +	int ret;
> 
> -	pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT,
> +	par->mem.name = "hyperv_fb";

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;
> +		}
> +	}
> 
> -	fb_virt = ioremap(fb_phys, screen_fb_size);
> +	fb_virt = ioremap(par->mem.start, screen_fb_size);
>  	if (!fb_virt)
>  		goto err2;
> 
> @@ -654,30 +676,42 @@ static int hvfb_getmem(struct fb_info *info)
>  	if (!info->apertures)
>  		goto err3;
> 
> -	info->apertures->ranges[0].base = pci_resource_start(pdev, 0);
> -	info->apertures->ranges[0].size = pci_resource_len(pdev, 0);
> -	info->fix.smem_start = fb_phys;
> +	if (gen2vm) {
> +		info->apertures->ranges[0].base = screen_info.lfb_base;
> +		info->apertures->ranges[0].size = screen_info.lfb_size;
> +	} else {
> +		info->apertures->ranges[0].base = pci_resource_start(pdev, 0);
> +		info->apertures->ranges[0].size = pci_resource_len(pdev, 0);
> +	}
> +
> +	info->fix.smem_start = par->mem.start;
>  	info->fix.smem_len = screen_fb_size;
>  	info->screen_base = fb_virt;
>  	info->screen_size = screen_fb_size;
> 
> -	pci_dev_put(pdev);
> +	if (!gen2vm)
> +		pci_dev_put(pdev);
> +
>  	return 0;
> 
>  err3:
>  	iounmap(fb_virt);
>  err2:
> -	release_mem_region(fb_phys, screen_fb_size);
> +	release_resource(&par->mem);
>  err1:
> -	pci_dev_put(pdev);
> +	if (!gen2vm)
> +		pci_dev_put(pdev);
> +
>  	return -ENOMEM;
>  }
> 
>  /* Release the framebuffer */
>  static void hvfb_putmem(struct fb_info *info)  {
> +	struct hvfb_par *par = info->par;
> +
>  	iounmap(info->screen_base);
> -	release_mem_region(info->fix.smem_start, screen_fb_size);
> +	release_resource(&par->mem);
>  }
> 
> 
> --
> 1.8.3.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [PATCH v3 4/4] hyperv-fb: kick off efifb early
  2014-02-24 13:17   ` Gerd Hoffmann
  (?)
@ 2014-02-24 22:06   ` Haiyang Zhang
  -1 siblings, 0 replies; 18+ messages in thread
From: Haiyang Zhang @ 2014-02-24 22:06 UTC (permalink / raw)
  To: Gerd Hoffmann, linux-fbdev
  Cc: linux-kernel, gregkh, KY Srinivasan, Abhishek Gupta (LIS),
	jasowang, tomi.valkeinen, devel,
	Jean-Christophe Plagniol-Villard



> -----Original Message-----
> From: Gerd Hoffmann [mailto:kraxel@redhat.com]
> Sent: Monday, February 24, 2014 8:17 AM
> To: linux-fbdev@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org; 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 4/4] hyperv-fb: kick off efifb early
> 
> Remove firmware framebuffer before initializing hyperv-fb.  Needed
> on gen2 virtual machines.   Letting register_framebuffer handle the
> switchover results in efifb still being active while hyperv graphics are
> initialized, which in turn can make the linux kernel hang.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  drivers/video/hyperv_fb.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/video/hyperv_fb.c b/drivers/video/hyperv_fb.c index
> 135d8cd..a570836 100644
> --- a/drivers/video/hyperv_fb.c
> +++ b/drivers/video/hyperv_fb.c
> @@ -683,6 +683,7 @@ static int hvfb_getmem(struct fb_info *info)
>  		info->apertures->ranges[0].base = pci_resource_start(pdev, 0);
>  		info->apertures->ranges[0].size = pci_resource_len(pdev, 0);
>  	}
> +	remove_conflicting_framebuffers(info->apertures, "hyperv-fb", false);

Please use KBUILD_MODNAME, so that the naming is consistent.

Thanks,
- Haiyang

> 
>  	info->fix.smem_start = par->mem.start;
>  	info->fix.smem_len = screen_fb_size;
> --
> 1.8.3.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 1/4] vmbus: add missing breaks
  2014-02-24 13:17   ` Gerd Hoffmann
@ 2014-02-28  9:05     ` Tomi Valkeinen
  -1 siblings, 0 replies; 18+ messages in thread
From: Tomi Valkeinen @ 2014-02-28  9:05 UTC (permalink / raw)
  To: Gerd Hoffmann, linux-fbdev
  Cc: linux-kernel, gregkh, kys, abgupta, haiyangz, jasowang, devel

[-- Attachment #1: Type: text/plain, Size: 852 bytes --]

On 24/02/14 15:17, Gerd Hoffmann wrote:
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  drivers/hv/vmbus_drv.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index b37c91b..2352ae48 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -899,10 +899,12 @@ static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx)
>  	switch (res->type) {
>  	case ACPI_RESOURCE_TYPE_IRQ:
>  		irq = res->data.irq.interrupts[0];
> +		break;
>  
>  	case ACPI_RESOURCE_TYPE_ADDRESS64:
>  		hyperv_mmio_start = res->data.address64.minimum;
>  		hyperv_mmio_size = res->data.address64.address_length;
> +		break;
>  	}
>  
>  	return AE_OK;
> 

Why is this sent to fbdev list? Is this related to the hyperv-fb patches?

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 1/4] vmbus: add missing breaks
@ 2014-02-28  9:05     ` Tomi Valkeinen
  0 siblings, 0 replies; 18+ messages in thread
From: Tomi Valkeinen @ 2014-02-28  9:05 UTC (permalink / raw)
  To: Gerd Hoffmann, linux-fbdev
  Cc: linux-kernel, gregkh, kys, abgupta, haiyangz, jasowang, devel

[-- Attachment #1: Type: text/plain, Size: 852 bytes --]

On 24/02/14 15:17, Gerd Hoffmann wrote:
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  drivers/hv/vmbus_drv.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index b37c91b..2352ae48 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -899,10 +899,12 @@ static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx)
>  	switch (res->type) {
>  	case ACPI_RESOURCE_TYPE_IRQ:
>  		irq = res->data.irq.interrupts[0];
> +		break;
>  
>  	case ACPI_RESOURCE_TYPE_ADDRESS64:
>  		hyperv_mmio_start = res->data.address64.minimum;
>  		hyperv_mmio_size = res->data.address64.address_length;
> +		break;
>  	}
>  
>  	return AE_OK;
> 

Why is this sent to fbdev list? Is this related to the hyperv-fb patches?

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 1/4] vmbus: add missing breaks
  2014-02-28  9:05     ` Tomi Valkeinen
@ 2014-02-28 11:55       ` Gerd Hoffmann
  -1 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2014-02-28 11:55 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: linux-fbdev, linux-kernel, gregkh, kys, abgupta, haiyangz,
	jasowang, devel


> Why is this sent to fbdev list? Is this related to the hyperv-fb patches?

Yes, the hyperv-fb patches depend on this one.

Greg has picked it up meanwhile, that's why v4 + v5 of the patch series
don't include it any more.

cheers,
  Gerd



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 1/4] vmbus: add missing breaks
@ 2014-02-28 11:55       ` Gerd Hoffmann
  0 siblings, 0 replies; 18+ messages in thread
From: Gerd Hoffmann @ 2014-02-28 11:55 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: linux-fbdev, linux-kernel, gregkh, kys, abgupta, haiyangz,
	jasowang, devel


> Why is this sent to fbdev list? Is this related to the hyperv-fb patches?

Yes, the hyperv-fb patches depend on this one.

Greg has picked it up meanwhile, that's why v4 + v5 of the patch series
don't include it any more.

cheers,
  Gerd



^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2014-02-28 11:55 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-24 13:17 [PATCH v3 0/4] hyperv-fb: add support for generation 2 virtual machines Gerd Hoffmann
2014-02-24 13:17 ` Gerd Hoffmann
2014-02-24 13:17 ` [PATCH v3 1/4] vmbus: add missing breaks Gerd Hoffmann
2014-02-24 13:17   ` Gerd Hoffmann
2014-02-28  9:05   ` Tomi Valkeinen
2014-02-28  9:05     ` Tomi Valkeinen
2014-02-28 11:55     ` Gerd Hoffmann
2014-02-28 11:55       ` Gerd Hoffmann
2014-02-24 13:17 ` [PATCH v3 2/4] vmbus: use resource for hyperv mmio region Gerd Hoffmann
2014-02-24 13:17   ` Gerd Hoffmann
2014-02-24 21:57   ` KY Srinivasan
2014-02-24 13:17 ` [PATCH v3 3/4] hyperv-fb: add support for generation 2 virtual machines Gerd Hoffmann
2014-02-24 13:17   ` Gerd Hoffmann
2014-02-24 22:05   ` Haiyang Zhang
2014-02-24 22:05     ` Haiyang Zhang
2014-02-24 13:17 ` [PATCH v3 4/4] hyperv-fb: kick off efifb early Gerd Hoffmann
2014-02-24 13:17   ` Gerd Hoffmann
2014-02-24 22:06   ` Haiyang Zhang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.