Skip to content

Commit a07b50d

Browse files
arndbgregkh
authored andcommitted
hyperv: avoid dependency on screen_info
The two hyperv framebuffer drivers (hyperv_fb or hyperv_drm_drv) access the global screen_info in order to take over from the sysfb framebuffer, which in turn could be handled by simplefb, simpledrm or efifb. Similarly, the vmbus_drv code marks the original EFI framebuffer as reserved, but this is not required if there is no sysfb. As a preparation for making screen_info itself more local to the sysfb helper code, add a compile-time conditional in all three files that relate to hyperv fb and just skip this code if there is no sysfb that needs to be unregistered. Reviewed-by: Javier Martinez Canillas <[email protected]> Acked-by: Helge Deller <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b858a97 commit a07b50d

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

drivers/gpu/drm/hyperv/hyperv_drm_drv.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ static int hyperv_setup_vram(struct hyperv_drm_device *hv,
7373
struct drm_device *dev = &hv->dev;
7474
int ret;
7575

76-
drm_aperture_remove_conflicting_framebuffers(screen_info.lfb_base,
77-
screen_info.lfb_size,
78-
&hyperv_driver);
76+
if (IS_ENABLED(CONFIG_SYSFB))
77+
drm_aperture_remove_conflicting_framebuffers(screen_info.lfb_base,
78+
screen_info.lfb_size,
79+
&hyperv_driver);
7980

8081
hv->fb_size = (unsigned long)hv->mmio_megabytes * 1024 * 1024;
8182

drivers/hv/vmbus_drv.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2100,8 +2100,10 @@ static void __maybe_unused vmbus_reserve_fb(void)
21002100

21012101
if (efi_enabled(EFI_BOOT)) {
21022102
/* Gen2 VM: get FB base from EFI framebuffer */
2103-
start = screen_info.lfb_base;
2104-
size = max_t(__u32, screen_info.lfb_size, 0x800000);
2103+
if (IS_ENABLED(CONFIG_SYSFB)) {
2104+
start = screen_info.lfb_base;
2105+
size = max_t(__u32, screen_info.lfb_size, 0x800000);
2106+
}
21052107
} else {
21062108
/* Gen1 VM: get FB base from PCI */
21072109
pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT,

drivers/video/fbdev/hyperv_fb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
10301030
goto getmem_done;
10311031
}
10321032
pr_info("Unable to allocate enough contiguous physical memory on Gen 1 VM. Using MMIO instead.\n");
1033-
} else {
1033+
} else if (IS_ENABLED(CONFIG_SYSFB)) {
10341034
base = screen_info.lfb_base;
10351035
size = screen_info.lfb_size;
10361036
}
@@ -1076,13 +1076,13 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
10761076
getmem_done:
10771077
aperture_remove_conflicting_devices(base, size, KBUILD_MODNAME);
10781078

1079-
if (gen2vm) {
1079+
if (!gen2vm) {
1080+
pci_dev_put(pdev);
1081+
} else if (IS_ENABLED(CONFIG_SYSFB)) {
10801082
/* framebuffer is reallocated, clear screen_info to avoid misuse from kexec */
10811083
screen_info.lfb_size = 0;
10821084
screen_info.lfb_base = 0;
10831085
screen_info.orig_video_isVGA = 0;
1084-
} else {
1085-
pci_dev_put(pdev);
10861086
}
10871087

10881088
return 0;

0 commit comments

Comments
 (0)