Skip to content

Commit 0aa0838

Browse files
Thomas Zimmermannhdeller
authored andcommitted
fbdev/hyperv_fb: Remove firmware framebuffers with aperture helpers
Replace use of screen_info state with the correct interfaces from the aperture helpers. The state is only for architecture and firmware code. It is not guaranteed to contain valid data. Drivers are thus not allowed to use it. For removing conflicting firmware framebuffers, there are aperture helpers. Hence replace screen_info with the correct functions that will remove conflicting framebuffers for the hypervfb driver. For GEN1 PCI devices, the driver reads the framebuffer base and size from the PCI BAR, and uses the range for removing the firmware framebuffer. For GEN2 VMBUS devices no range can be detected, so the driver clears all firmware framebuffers. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Signed-off-by: Helge Deller <[email protected]>
1 parent 778e73d commit 0aa0838

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/video/fbdev/hyperv_fb.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,8 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
975975
struct pci_dev *pdev = NULL;
976976
void __iomem *fb_virt;
977977
int gen2vm = efi_enabled(EFI_BOOT);
978-
resource_size_t base, size;
978+
resource_size_t base = 0;
979+
resource_size_t size = 0;
979980
phys_addr_t paddr;
980981
int ret;
981982

@@ -1010,9 +1011,6 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
10101011
goto getmem_done;
10111012
}
10121013
pr_info("Unable to allocate enough contiguous physical memory on Gen 1 VM. Using MMIO instead.\n");
1013-
} else if (IS_ENABLED(CONFIG_SYSFB)) {
1014-
base = screen_info.lfb_base;
1015-
size = screen_info.lfb_size;
10161014
} else {
10171015
goto err1;
10181016
}
@@ -1056,7 +1054,10 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
10561054
info->screen_size = dio_fb_size;
10571055

10581056
getmem_done:
1059-
aperture_remove_conflicting_devices(base, size, KBUILD_MODNAME);
1057+
if (base && size)
1058+
aperture_remove_conflicting_devices(base, size, KBUILD_MODNAME);
1059+
else
1060+
aperture_remove_all_conflicting_devices(KBUILD_MODNAME);
10601061

10611062
if (!gen2vm) {
10621063
pci_dev_put(pdev);

0 commit comments

Comments
 (0)