]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
hyperv: avoid dependency on screen_info
authorArnd Bergmann <arnd@arndb.de>
Mon, 9 Oct 2023 21:18:44 +0000 (23:18 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Oct 2023 08:17:02 +0000 (10:17 +0200)
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 <javierm@redhat.com>
Acked-by: Helge Deller <deller@gmx.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20231009211845.3136536-9-arnd@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/hyperv/hyperv_drm_drv.c
drivers/hv/vmbus_drv.c
drivers/video/fbdev/hyperv_fb.c

index 8026118c6e0330f49fa3851cfaf0b2dd6ec37349..9a44a00effc2483d8e39c558047ed38d97d88a14 100644 (file)
@@ -73,9 +73,10 @@ static int hyperv_setup_vram(struct hyperv_drm_device *hv,
        struct drm_device *dev = &hv->dev;
        int ret;
 
-       drm_aperture_remove_conflicting_framebuffers(screen_info.lfb_base,
-                                                    screen_info.lfb_size,
-                                                    &hyperv_driver);
+       if (IS_ENABLED(CONFIG_SYSFB))
+               drm_aperture_remove_conflicting_framebuffers(screen_info.lfb_base,
+                                                            screen_info.lfb_size,
+                                                            &hyperv_driver);
 
        hv->fb_size = (unsigned long)hv->mmio_megabytes * 1024 * 1024;
 
index edbb38f6956b94514bcf93188df1bc0a6185f25f..b33d5abd9beb234f98fdcb9d50636a3affc93c35 100644 (file)
@@ -2100,8 +2100,10 @@ static void __maybe_unused vmbus_reserve_fb(void)
 
        if (efi_enabled(EFI_BOOT)) {
                /* Gen2 VM: get FB base from EFI framebuffer */
-               start = screen_info.lfb_base;
-               size = max_t(__u32, screen_info.lfb_size, 0x800000);
+               if (IS_ENABLED(CONFIG_SYSFB)) {
+                       start = screen_info.lfb_base;
+                       size = max_t(__u32, screen_info.lfb_size, 0x800000);
+               }
        } else {
                /* Gen1 VM: get FB base from PCI */
                pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT,
index b9965cbdd7642795cd41474cc0c75a661775ced5..0537e9c5d66498e0f4521fadcf2fbcb6abdf4b37 100644 (file)
@@ -1030,7 +1030,7 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
                        goto getmem_done;
                }
                pr_info("Unable to allocate enough contiguous physical memory on Gen 1 VM. Using MMIO instead.\n");
-       } else {
+       } else if (IS_ENABLED(CONFIG_SYSFB)) {
                base = screen_info.lfb_base;
                size = screen_info.lfb_size;
        }
@@ -1076,13 +1076,13 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
 getmem_done:
        aperture_remove_conflicting_devices(base, size, KBUILD_MODNAME);
 
-       if (gen2vm) {
+       if (!gen2vm) {
+               pci_dev_put(pdev);
+       } else if (IS_ENABLED(CONFIG_SYSFB)) {
                /* framebuffer is reallocated, clear screen_info to avoid misuse from kexec */
                screen_info.lfb_size = 0;
                screen_info.lfb_base = 0;
                screen_info.orig_video_isVGA = 0;
-       } else {
-               pci_dev_put(pdev);
        }
 
        return 0;