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
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(-)
UEFI-based generation 2 virtual machines support vmbus devices only.
There is no pci bus. Thus they use a different mechanism for the
graphics framebuffer: Instead of using the vga pci bar a chunk of
memory muct be allocated from the hyperv mmio region declared using
APCI. This patch implements support for it.
Based on a patch by Haiyang Zhang [off-list ref]
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
drivers/video/hyperv_fb.c | 86 +++++++++++++++++++++++++++++++++--------------
1 file changed, 60 insertions(+), 26 deletions(-)
@@ -460,13 +462,13 @@ static int synthvid_connect_vsp(struct hv_device *hdev)gotoerror;}-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{+elsescreen_depth=SYNTHVID_DEPTH_WIN8;-screen_fb_size=SYNTHVID_FB_SIZE_WIN8;-}++screen_fb_size=hdev->channel->offermsg.offer.+mmio_megabytes*1024*1024;return0;
@@ -627,26 +629,46 @@ static void hvfb_get_option(struct fb_info *info)/* Get framebuffer memory from Hyper-V video pci space */staticinthvfb_getmem(structfb_info*info){-structpci_dev*pdev;-ulongfb_phys;+structhvfb_par*par=info->par;+structpci_dev*pdev=NULL;void__iomem*fb_virt;+intgen2vm=efi_enabled(EFI_BOOT);+intret;-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)-gotoerr1;+if(!(pci_resource_flags(pdev,0)&IORESOURCE_MEM)||+pci_resource_len(pdev,0)<screen_fb_size)+gotoerr1;-fb_phys=pci_resource_end(pdev,0)-screen_fb_size+1;-if(!request_mem_region(fb_phys,screen_fb_size,KBUILD_MODNAME))-gotoerr1;+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)gotoerr2;
@@ -654,30 +676,42 @@ static int hvfb_getmem(struct fb_info *info)if(!info->apertures)gotoerr3;-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);+return0;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 */staticvoidhvfb_putmem(structfb_info*info){+structhvfb_par*par=info->par;+iounmap(info->screen_base);-release_mem_region(info->fix.smem_start,screen_fb_size);+release_resource(&par->mem);}
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(+)
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(-)
From: Dan Carpenter <hidden> Date: 2014-02-24 10:42:27
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 [off-list ref]
regards,
dan carpenter
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
From: Dan Carpenter <hidden> Date: 2014-02-24 11:08:20
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:
quoted
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