* [!! SPAM]Foreign Stakeholder Needed!!!
From: Yung kyu kim @ 2014-02-21 13:08 UTC (permalink / raw)
To: linux-fbdev
Hello,
The Project is about the exportation of 100,000 barrels of Light Crude
Oil daily out from Iraq to Turkey through my client's company in Iraq
at the rate of $92.00 per barrel. This amount to $9,200,000 daily. I ask
for your support as a foreigner to handle this business project with my
client and you are not expected to invest in Iraq
If yes, let me know and we will discuss this project proper.
Kim.
Contact My Private Email : 1469813849@qq.com
^ permalink raw reply
* Re: [PATCH v5] video: add OpenCores VGA/LCD framebuffer driver
From: Uwe Kleine-König @ 2014-02-21 13:54 UTC (permalink / raw)
To: Stefan Kristiansson; +Cc: linux-kernel, linux-fbdev, tomi.valkeinen, plagnioj
In-Reply-To: <1389384793-4710-1-git-send-email-stefan.kristiansson@saunalahti.fi>
Hello,
On Fri, Jan 10, 2014 at 10:13:13PM +0200, Stefan Kristiansson wrote:
> This adds support for the VGA/LCD core available from OpenCores:
> http://opencores.org/project,vga_lcd
>
> The driver have been tested together with both OpenRISC and
> ARM (socfpga) processors.
>
> Signed-off-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
> ---
> Changes in v2:
> - Add Microblaze as an example user and fix a typo in Xilinx Zynq
>
> Changes in v3:
> - Use devm_kzalloc instead of kzalloc
> - Remove superflous MODULE #ifdef
>
> Changes in v4:
> - Remove 'default n' in Kconfig
> - Simplify ioremap/request_mem_region by using devm_ioremap_resource
> - Remove release_mem_region
>
> Changes in v5:
> - Remove static structs to support multiple devices
> ---
> drivers/video/Kconfig | 16 ++
> drivers/video/Makefile | 1 +
> drivers/video/ocfb.c | 440 +++++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 457 insertions(+)
> create mode 100644 drivers/video/ocfb.c
>
> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
> index 84b685f..8e41a1e 100644
> --- a/drivers/video/Kconfig
> +++ b/drivers/video/Kconfig
> @@ -979,6 +979,22 @@ config FB_PVR2
> (<file:drivers/video/pvr2fb.c>). Please see the file
> <file:Documentation/fb/pvr2fb.txt>.
>
> +config FB_OPENCORES
> + tristate "OpenCores VGA/LCD core 2.0 framebuffer support"
> + depends on FB
Maybe add something like:
depends on ARCH_SOCFPGA || ARCH_ZYNQ || MICROBLAZE || OPENRISC || COMPILE_TEST
(Sorry for being late with that suggestion, this attracted my attention
only during make oldconfig on v3.14-rc, so if you agree this is a good
idea you need a seperate patch :-)
Best regards
Uwe
> + select FB_CFB_FILLRECT
> + select FB_CFB_COPYAREA
> + select FB_CFB_IMAGEBLIT
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply
* [PATCH] hyperv-fb: kick off efifb early
From: Gerd Hoffmann @ 2014-02-21 14:39 UTC (permalink / raw)
To: linux-fbdev
Cc: linux-kernel, gregkh, kys, haiyangz, jasowang, Gerd Hoffmann,
Jean-Christophe Plagniol-Villard, Tomi Valkeinen,
open list:Hyper-V CORE AND...
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 f956cd9..3901ffe 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
* RE: [PATCH 4/4] hyperv-fb: add support for generation 2 virtual machines.
From: KY Srinivasan @ 2014-02-21 14:49 UTC (permalink / raw)
To: Gerd Hoffmann, linux-fbdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
Haiyang Zhang, jasowang@redhat.com,
Jean-Christophe Plagniol-Villard, Tomi Valkeinen,
open list:Hyper-V CORE AND...
In-Reply-To: <1392973004-28215-5-git-send-email-kraxel@redhat.com>
> -----Original Message-----
> From: Gerd Hoffmann [mailto:kraxel@redhat.com]
> Sent: Friday, February 21, 2014 12:57 AM
> To: linux-fbdev@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org; gregkh@linuxfoundation.org; KY Srinivasan;
> Haiyang Zhang; jasowang@redhat.com; Gerd Hoffmann; Jean-Christophe
> Plagniol-Villard; Tomi Valkeinen; open list:Hyper-V CORE AND...
> Subject: [PATCH 4/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..f956cd9 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;
> + bool gen2vm = efi_enabled(EFI_BOOT);
Gerd,
efi_enabled() returns an int and not a bool. That is the fix that Haiyang made last night.
K. Y
> + 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");
> + return -ENODEV;
> + }
> + }
>
> - 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
* [PATCH] fbdev: FB_OPENCORES should depend on HAS_DMA
From: Geert Uytterhoeven @ 2014-02-21 19:56 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard, Tomi Valkeinen,
Stefan Kristiansson
Cc: linux-fbdev, linux-kernel, Geert Uytterhoeven
If NO_DMA=y:
drivers/built-in.o: In function `ocfb_remove':
ocfb.c:(.text+0x27fee): undefined reference to `dma_free_coherent'
drivers/built-in.o: In function `ocfb_probe':
ocfb.c:(.text+0x28418): undefined reference to `dma_alloc_coherent'
ocfb.c:(.text+0x284d2): undefined reference to `dma_free_coherent'
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
drivers/video/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 0192900dd183..fb8d31e717bc 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -982,7 +982,7 @@ config FB_PVR2
config FB_OPENCORES
tristate "OpenCores VGA/LCD core 2.0 framebuffer support"
- depends on FB
+ depends on FB && HAS_DMA
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
--
1.7.9.5
^ permalink raw reply related
* [PATCH v2 0/5] hyperv-fb: add support for generation 2 virtual machines.
From: Gerd Hoffmann @ 2014-02-24 10:25 UTC (permalink / raw)
To: linux-fbdev
Cc: linux-kernel, gregkh, kys, abgupta, haiyangz, jasowang,
tomi.valkeinen, Gerd Hoffmann
Hi,
This patch series adds support for uefi-based gen2 virtual machines to
the hyperv-fb driver.
Patch #1 is included just for completeness. Greg picked it up
already and it is in -next, but it isn't in master yet.
Patch #2 is a bugfix for the first patch.
Patch #3 changes vmbus to properly hook the hyperv mmio area into
the linux resource management.
Patch #4 actually implements gen2 vm support for hyperv-fb, building
on the hyperv mmio support added by the other patches.
Patch #5 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.
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
^ permalink raw reply
* [PATCH v2 1/5] Drivers: hv: vmbus: Extract the mmio information from DSDT
From: Gerd Hoffmann @ 2014-02-24 10:25 UTC (permalink / raw)
To: linux-fbdev
Cc: linux-kernel, gregkh, kys, abgupta, haiyangz, jasowang,
tomi.valkeinen, open list:Hyper-V CORE AND...
In-Reply-To: <1393237516-28545-1-git-send-email-kraxel@redhat.com>
From: "K. Y. Srinivasan" <kys@microsoft.com>
On Gen2 firmware, Hyper-V does not emulate the PCI bus. However, the MMIO
information is packaged up in DSDT. Extract this information and export it
for use by the synthetic framebuffer driver. This is the only driver that
needs this currently.
In this version of the patch mmio, I have updated the hyperv header file
(linux/hyperv.h) with mmio definitions.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/hv/vmbus_drv.c | 45 ++++++++++++++++++++++++++++++++-------------
include/linux/hyperv.h | 3 +++
2 files changed, 35 insertions(+), 13 deletions(-)
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index 077bb1b..b37c91b 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -43,6 +43,10 @@ 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);
static int vmbus_exists(void)
{
@@ -886,18 +890,19 @@ void vmbus_device_unregister(struct hv_device *device_obj)
/*
- * VMBUS is an acpi enumerated device. Get the the IRQ information
- * from DSDT.
+ * VMBUS is an acpi enumerated device. Get the the information we
+ * need from DSDT.
*/
-static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *irq)
+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];
- if (res->type = ACPI_RESOURCE_TYPE_IRQ) {
- struct acpi_resource_irq *irqp;
- irqp = &res->data.irq;
-
- *((unsigned int *)irq) = irqp->interrupts[0];
+ case ACPI_RESOURCE_TYPE_ADDRESS64:
+ hyperv_mmio_start = res->data.address64.minimum;
+ hyperv_mmio_size = res->data.address64.address_length;
}
return AE_OK;
@@ -906,18 +911,32 @@ static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *irq)
static int vmbus_acpi_add(struct acpi_device *device)
{
acpi_status result;
+ int ret_val = -ENODEV;
hv_acpi_dev = device;
result = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
- vmbus_walk_resources, &irq);
+ vmbus_walk_resources, NULL);
- if (ACPI_FAILURE(result)) {
- complete(&probe_event);
- return -ENODEV;
+ if (ACPI_FAILURE(result))
+ goto acpi_walk_err;
+ /*
+ * The parent of the vmbus acpi device (Gen2 firmware) is the VMOD that
+ * has the mmio ranges. Get that.
+ */
+ if (device->parent) {
+ result = acpi_walk_resources(device->parent->handle,
+ METHOD_NAME__CRS,
+ vmbus_walk_resources, NULL);
+
+ if (ACPI_FAILURE(result))
+ goto acpi_walk_err;
}
+ ret_val = 0;
+
+acpi_walk_err:
complete(&probe_event);
- return 0;
+ return ret_val;
}
static const struct acpi_device_id vmbus_acpi_device_ids[] = {
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index 344883d..be3028f 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -1459,6 +1459,9 @@ 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;
+
/*
* Negotiated version with the Host.
*/
--
1.8.3.1
^ permalink raw reply related
* [PATCH v2 2/5] vmbus: add missing breaks
From: Gerd Hoffmann @ 2014-02-24 10:25 UTC (permalink / raw)
To: linux-fbdev
Cc: linux-kernel, gregkh, kys, abgupta, haiyangz, jasowang,
tomi.valkeinen, Gerd Hoffmann, open list:Hyper-V CORE AND...
In-Reply-To: <1393237516-28545-1-git-send-email-kraxel@redhat.com>
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
* [PATCH v2 3/5] vmbus: use resource for hyperv mmio region
From: Gerd Hoffmann @ 2014-02-24 10:25 UTC (permalink / raw)
To: linux-fbdev
Cc: linux-kernel, gregkh, kys, abgupta, haiyangz, jasowang,
tomi.valkeinen, Gerd Hoffmann, open list:Hyper-V CORE AND...
In-Reply-To: <1393237516-28545-1-git-send-email-kraxel@redhat.com>
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
* [PATCH v2 4/5] hyperv-fb: add support for generation 2 virtual machines.
From: Gerd Hoffmann @ 2014-02-24 10:25 UTC (permalink / raw)
To: linux-fbdev
Cc: linux-kernel, gregkh, kys, abgupta, haiyangz, jasowang,
tomi.valkeinen, Gerd Hoffmann, Jean-Christophe Plagniol-Villard,
open list:Hyper-V CORE AND...
In-Reply-To: <1393237516-28545-1-git-send-email-kraxel@redhat.com>
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..ec4b22c 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");
+ return -ENODEV;
+ }
+ }
- 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
* [PATCH v2 5/5] hyperv-fb: kick off efifb early
From: Gerd Hoffmann @ 2014-02-24 10:25 UTC (permalink / raw)
To: linux-fbdev
Cc: linux-kernel, gregkh, kys, abgupta, haiyangz, jasowang,
tomi.valkeinen, Gerd Hoffmann, Jean-Christophe Plagniol-Villard,
open list:Hyper-V CORE AND...
In-Reply-To: <1393237516-28545-1-git-send-email-kraxel@redhat.com>
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 ec4b22c..b425951 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
* Re: [PATCH v2 1/5] Drivers: hv: vmbus: Extract the mmio information from DSDT
From: Dan Carpenter @ 2014-02-24 10:36 UTC (permalink / raw)
To: Gerd Hoffmann
Cc: linux-fbdev, gregkh, jasowang, linux-kernel, tomi.valkeinen,
open list:Hyper-V CORE AND..., haiyangz
In-Reply-To: <1393237516-28545-2-git-send-email-kraxel@redhat.com>
On Mon, Feb 24, 2014 at 11:25:12AM +0100, Gerd Hoffmann wrote:
> -static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *irq)
> +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];
>
> - if (res->type = ACPI_RESOURCE_TYPE_IRQ) {
> - struct acpi_resource_irq *irqp;
> - irqp = &res->data.irq;
> -
> - *((unsigned int *)irq) = irqp->interrupts[0];
Add a /* fall through */ comment here.
> + case ACPI_RESOURCE_TYPE_ADDRESS64:
> + hyperv_mmio_start = res->data.address64.minimum;
> + hyperv_mmio_size = res->data.address64.address_length;
> }
regards,
dan carpenter
^ permalink raw reply
* Re: [PATCH v2 2/5] vmbus: add missing breaks
From: Dan Carpenter @ 2014-02-24 10:42 UTC (permalink / raw)
To: Gerd Hoffmann
Cc: linux-fbdev, gregkh, jasowang, linux-kernel, tomi.valkeinen,
open list:Hyper-V CORE AND..., haiyangz
In-Reply-To: <1393237516-28545-3-git-send-email-kraxel@redhat.com>
I'm sorry, I know it sucks to not get credit for fixes, but please just
fold this into [patch 1/5]. We really should have a tag for this kind
of thing.
Would something like this work?
Additional-Fixes: Gerd Hoffmann <kraxel@redhat.com>
regards,
dan carpenter
^ permalink raw reply
* Re: [PATCH v2 2/5] vmbus: add missing breaks
From: Gerd Hoffmann @ 2014-02-24 10:55 UTC (permalink / raw)
To: Dan Carpenter
Cc: linux-fbdev, gregkh, jasowang, linux-kernel, tomi.valkeinen,
open list:Hyper-V CORE AND..., haiyangz
In-Reply-To: <20140224104207.GG26722@mwanda>
On Mo, 2014-02-24 at 13:42 +0300, Dan Carpenter wrote:
> I'm sorry, I know it sucks to not get credit for fixes, but please just
> fold this into [patch 1/5]. We really should have a tag for this kind
> of thing.
It's not because of the credits, but because Greg picked up #1 into one
of his branches already (cover letter explains this). I'll happily
submit a v3 with 1+2 squashed together if that doesn't ruin the patch
workflow. Greg?
cheers,
Gerd
^ permalink raw reply
* Re: [PATCH v2 2/5] vmbus: add missing breaks
From: Dan Carpenter @ 2014-02-24 11:07 UTC (permalink / raw)
To: Gerd Hoffmann
Cc: linux-fbdev, gregkh, jasowang, linux-kernel, tomi.valkeinen,
open list:Hyper-V CORE AND..., haiyangz
In-Reply-To: <1393239343.28750.3.camel@nilsson.home.kraxel.org>
On Mon, Feb 24, 2014 at 11:55:43AM +0100, Gerd Hoffmann wrote:
> On Mo, 2014-02-24 at 13:42 +0300, Dan Carpenter wrote:
> > I'm sorry, I know it sucks to not get credit for fixes, but please just
> > fold this into [patch 1/5]. We really should have a tag for this kind
> > of thing.
>
> It's not because of the credits, but because Greg picked up #1 into one
> of his branches already (cover letter explains this). I'll happily
> submit a v3 with 1+2 squashed together if that doesn't ruin the patch
> workflow. Greg?
>
Ah. My bad. My tree is out of date. No we don't modify staging
history. Once a patch has been applied it is forever.
Why are you resending #1 if it's already been applied.
I haven't recieved the cover letter... Probably it explains that.
Never mind.
regards,
dan carpenter
^ permalink raw reply
* [PATCH v3 0/4] hyperv-fb: add support for generation 2 virtual machines.
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
* [PATCH v3 1/4] vmbus: add missing breaks
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
In-Reply-To: <1393247831-5271-1-git-send-email-kraxel@redhat.com>
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
* [PATCH v3 2/4] vmbus: use resource for hyperv mmio region
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
In-Reply-To: <1393247831-5271-1-git-send-email-kraxel@redhat.com>
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
* [PATCH v3 3/4] hyperv-fb: add support for generation 2 virtual machines.
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
In-Reply-To: <1393247831-5271-1-git-send-email-kraxel@redhat.com>
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
* [PATCH v3 4/4] hyperv-fb: kick off efifb early
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
In-Reply-To: <1393247831-5271-1-git-send-email-kraxel@redhat.com>
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
* RE: [PATCH v3 2/4] vmbus: use resource for hyperv mmio region
From: KY Srinivasan @ 2014-02-24 21:57 UTC (permalink / raw)
To: Gerd Hoffmann, linux-fbdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
Abhishek Gupta (LIS), Haiyang Zhang, jasowang@redhat.com,
tomi.valkeinen@ti.com, devel@linuxdriverproject.org
In-Reply-To: <1393247831-5271-3-git-send-email-kraxel@redhat.com>
> -----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
* RE: [PATCH v3 3/4] hyperv-fb: add support for generation 2 virtual machines.
From: Haiyang Zhang @ 2014-02-24 22:05 UTC (permalink / raw)
To: Gerd Hoffmann, linux-fbdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
KY Srinivasan, Abhishek Gupta (LIS), jasowang@redhat.com,
tomi.valkeinen@ti.com, devel@linuxdriverproject.org,
Jean-Christophe Plagniol-Villard
In-Reply-To: <1393247831-5271-4-git-send-email-kraxel@redhat.com>
> -----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
* RE: [PATCH v3 4/4] hyperv-fb: kick off efifb early
From: Haiyang Zhang @ 2014-02-24 22:06 UTC (permalink / raw)
To: Gerd Hoffmann, linux-fbdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
KY Srinivasan, Abhishek Gupta (LIS), jasowang@redhat.com,
tomi.valkeinen@ti.com, devel@linuxdriverproject.org,
Jean-Christophe Plagniol-Villard
In-Reply-To: <1393247831-5271-5-git-send-email-kraxel@redhat.com>
> -----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
* [PATCH 0/3] Move IPUv3 core out of staging
From: Philipp Zabel @ 2014-02-25 11:43 UTC (permalink / raw)
To: linux-fbdev
Hi,
this series has two small cleanups for the IPUv3 core driver and then moves
it from drivers/staging/imx-drm/ipu-v3 to drivers/gpu. In this directory there
is already the host1x driver, which serves a similar purpose.
I have dropped the CSI (capture interface) patches from the RFC series. This
series applies on top of Russell's imx-drm-staging branch, which just was merged
into staging-next.
I'd like to move the core code out of staging so that we can start submitting
V4L2 code for video capture and scaling / colorspace conversion in parallel.
I'll post the third patch in both versions with and without --find-renames.
To move the remaining DRM part out of staging, I'd like to get the device tree
bindings sorted out. This is currently pending on the move of OF graph parsing
helpers and review of the imx-drm dt bindings patch series.
regards
Philipp
Philipp Zabel (3):
imx-drm: Move IPU_PIX_FMT_GBR24 definition into imx-ipu-v3.h
imx-drm: ipu-dc: Use usleep_range instead of msleep
gpu: ipu-v3: Move i.MX IPUv3 core driver out of staging
drivers/gpu/Makefile | 1 +
drivers/gpu/ipu-v3/Kconfig | 7 +
drivers/gpu/ipu-v3/Makefile | 3 +
drivers/gpu/ipu-v3/ipu-common.c | 1261 +++++++++++++++++++++++++++
drivers/gpu/ipu-v3/ipu-dc.c | 411 +++++++++
drivers/gpu/ipu-v3/ipu-di.c | 730 ++++++++++++++++
drivers/gpu/ipu-v3/ipu-dmfc.c | 418 +++++++++
drivers/gpu/ipu-v3/ipu-dp.c | 338 +++++++
drivers/gpu/ipu-v3/ipu-prv.h | 206 +++++
drivers/staging/imx-drm/Kconfig | 11 +-
drivers/staging/imx-drm/Makefile | 1 -
drivers/staging/imx-drm/imx-drm.h | 4 -
drivers/staging/imx-drm/imx-tve.c | 1 +
drivers/staging/imx-drm/ipu-v3/Makefile | 3 -
drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h | 324 -------
drivers/staging/imx-drm/ipu-v3/ipu-common.c | 1261 ---------------------------
drivers/staging/imx-drm/ipu-v3/ipu-dc.c | 412 ---------
drivers/staging/imx-drm/ipu-v3/ipu-di.c | 730 ----------------
drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c | 418 ---------
drivers/staging/imx-drm/ipu-v3/ipu-dp.c | 338 -------
drivers/staging/imx-drm/ipu-v3/ipu-prv.h | 206 -----
drivers/staging/imx-drm/ipuv3-crtc.c | 2 +-
drivers/staging/imx-drm/ipuv3-plane.c | 2 +-
drivers/video/Kconfig | 1 +
include/video/imx-ipu-v3.h | 326 +++++++
25 files changed, 3706 insertions(+), 3709 deletions(-)
create mode 100644 drivers/gpu/ipu-v3/Kconfig
create mode 100644 drivers/gpu/ipu-v3/Makefile
create mode 100644 drivers/gpu/ipu-v3/ipu-common.c
create mode 100644 drivers/gpu/ipu-v3/ipu-dc.c
create mode 100644 drivers/gpu/ipu-v3/ipu-di.c
create mode 100644 drivers/gpu/ipu-v3/ipu-dmfc.c
create mode 100644 drivers/gpu/ipu-v3/ipu-dp.c
create mode 100644 drivers/gpu/ipu-v3/ipu-prv.h
delete mode 100644 drivers/staging/imx-drm/ipu-v3/Makefile
delete mode 100644 drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h
delete mode 100644 drivers/staging/imx-drm/ipu-v3/ipu-common.c
delete mode 100644 drivers/staging/imx-drm/ipu-v3/ipu-dc.c
delete mode 100644 drivers/staging/imx-drm/ipu-v3/ipu-di.c
delete mode 100644 drivers/staging/imx-drm/ipu-v3/ipu-dmfc.c
delete mode 100644 drivers/staging/imx-drm/ipu-v3/ipu-dp.c
delete mode 100644 drivers/staging/imx-drm/ipu-v3/ipu-prv.h
create mode 100644 include/video/imx-ipu-v3.h
--
1.8.5.3
^ permalink raw reply
* [PATCH 1/3] imx-drm: Move IPU_PIX_FMT_GBR24 definition into imx-ipu-v3.h
From: Philipp Zabel @ 2014-02-25 11:43 UTC (permalink / raw)
To: linux-fbdev
The IPU display controller supports a non-standard green-red-blue ordered
format that is used on the connection between IPU display interface 1 and
the TV encoder on i.MX53.
In preparation for the move of IPU core code out of staging, place the
IPU_PIX_FMT_GBR24 definition in imx-ipu-v3.h, so that both the IPU
display interface driver and the TVE encoder driver can access it.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
drivers/staging/imx-drm/imx-drm.h | 4 ----
drivers/staging/imx-drm/imx-tve.c | 1 +
drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h | 2 ++
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/imx-drm/imx-drm.h b/drivers/staging/imx-drm/imx-drm.h
index aa21028..035ab62 100644
--- a/drivers/staging/imx-drm/imx-drm.h
+++ b/drivers/staging/imx-drm/imx-drm.h
@@ -1,10 +1,6 @@
#ifndef _IMX_DRM_H_
#define _IMX_DRM_H_
-#include <linux/videodev2.h>
-
-#define IPU_PIX_FMT_GBR24 v4l2_fourcc('G', 'B', 'R', '3')
-
struct device_node;
struct drm_crtc;
struct drm_connector;
diff --git a/drivers/staging/imx-drm/imx-tve.c b/drivers/staging/imx-drm/imx-tve.c
index 702c0c3..50b25f1 100644
--- a/drivers/staging/imx-drm/imx-tve.c
+++ b/drivers/staging/imx-drm/imx-tve.c
@@ -31,6 +31,7 @@
#include <drm/drm_fb_helper.h>
#include <drm/drm_crtc_helper.h>
+#include "ipu-v3/imx-ipu-v3.h"
#include "imx-drm.h"
#define TVE_COM_CONF_REG 0x00
diff --git a/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h b/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h
index 4826b5c..c4d14ea 100644
--- a/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h
+++ b/drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.h
@@ -25,6 +25,8 @@ enum ipuv3_type {
IPUV3H,
};
+#define IPU_PIX_FMT_GBR24 v4l2_fourcc('G', 'B', 'R', '3')
+
/*
* Bitfield of Display Interface signal polarities.
*/
--
1.8.5.3
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox