]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
video: fbdev: hyperv_fb: Allow resolutions with size > 64 MB for Gen1
authorSaurabh Sengar <ssengar@linux.microsoft.com>
Wed, 27 Apr 2022 13:47:53 +0000 (06:47 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jun 2022 16:32:38 +0000 (18:32 +0200)
[ Upstream commit c4b4d7047f16a8d138ce76da65faefb7165736f2 ]

This patch fixes a bug where GEN1 VMs doesn't allow resolutions greater
than 64 MB size (eg 7680x4320). Unnecessary PCI check limits Gen1 VRAM
to legacy PCI BAR size only (ie 64MB). Thus any, resolution requesting
greater then 64MB (eg 7680x4320) would fail. MMIO region assigning this
memory shouldn't be limited by PCI bar size.

Signed-off-by: Saurabh Sengar <ssengar@linux.microsoft.com>
Reviewed-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/video/fbdev/hyperv_fb.c

index 3c309ab20887473d3f7f1b97fc1fbf62d9349856..40baa79f8046e19d050d078357a78ef805ad5068 100644 (file)
@@ -1008,7 +1008,6 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
        struct pci_dev *pdev  = NULL;
        void __iomem *fb_virt;
        int gen2vm = efi_enabled(EFI_BOOT);
-       resource_size_t pot_start, pot_end;
        phys_addr_t paddr;
        int ret;
 
@@ -1059,23 +1058,7 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
        dio_fb_size =
                screen_width * screen_height * screen_depth / 8;
 
-       if (gen2vm) {
-               pot_start = 0;
-               pot_end = -1;
-       } else {
-               if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM) ||
-                   pci_resource_len(pdev, 0) < screen_fb_size) {
-                       pr_err("Resource not available or (0x%lx < 0x%lx)\n",
-                              (unsigned long) pci_resource_len(pdev, 0),
-                              (unsigned long) screen_fb_size);
-                       goto err1;
-               }
-
-               pot_end = pci_resource_end(pdev, 0);
-               pot_start = pot_end - screen_fb_size + 1;
-       }
-
-       ret = vmbus_allocate_mmio(&par->mem, hdev, pot_start, pot_end,
+       ret = vmbus_allocate_mmio(&par->mem, hdev, 0, -1,
                                  screen_fb_size, 0x100000, true);
        if (ret != 0) {
                pr_err("Unable to allocate framebuffer memory\n");