From: jsg Date: Mon, 8 Jul 2024 02:13:36 +0000 (+0000) Subject: drm/fbdev-dma: Only set smem_start is enable per module option X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=487b42552fffe876dc34998382f8d31e4484d2fa;p=openbsd drm/fbdev-dma: Only set smem_start is enable per module option From Thomas Zimmermann f29fcfbf6067c0d8c83f84a045da9276c08deac5 in linux-6.6.y/6.6.37 d92a7580392ad4681b1d4f9275d00b95375ebe01 in mainline linux --- diff --git a/sys/dev/pci/drm/drm_fb_helper.c b/sys/dev/pci/drm/drm_fb_helper.c index 0911eb6cdfd..1a0be9cb24e 100644 --- a/sys/dev/pci/drm/drm_fb_helper.c +++ b/sys/dev/pci/drm/drm_fb_helper.c @@ -532,6 +532,9 @@ struct fb_info *drm_fb_helper_alloc_info(struct drm_fb_helper *fb_helper) if (!info) return ERR_PTR(-ENOMEM); + if (!drm_leak_fbdev_smem) + info->flags |= FBINFO_HIDE_SMEM_START; + #ifdef __linux__ ret = fb_alloc_cmap(&info->cmap, 256, 0); if (ret) @@ -1925,9 +1928,6 @@ __drm_fb_helper_initial_config_and_unlock(struct drm_fb_helper *fb_helper) info = fb_helper->info; info->var.pixclock = 0; - if (!drm_leak_fbdev_smem) - info->flags |= FBINFO_HIDE_SMEM_START; - /* Need to drop locks to avoid recursive deadlock in * register_framebuffer. This is ok because the only thing left to do is * register the fbdev emulation instance in kernel_fb_helper_list. */ diff --git a/sys/dev/pci/drm/drm_fbdev_dma.c b/sys/dev/pci/drm/drm_fbdev_dma.c index 4ef5cbb3af2..64e81c320b5 100644 --- a/sys/dev/pci/drm/drm_fbdev_dma.c +++ b/sys/dev/pci/drm/drm_fbdev_dma.c @@ -138,7 +138,10 @@ static int drm_fbdev_dma_helper_fb_probe(struct drm_fb_helper *fb_helper, info->flags |= FBINFO_READS_FAST; /* signal caching */ info->screen_size = sizes->surface_height * fb->pitches[0]; info->screen_buffer = map.vaddr; - info->fix.smem_start = page_to_phys(virt_to_page(info->screen_buffer)); + if (!(info->flags & FBINFO_HIDE_SMEM_START)) { + if (!drm_WARN_ON(dev, is_vmalloc_addr(info->screen_buffer))) + info->fix.smem_start = page_to_phys(virt_to_page(info->screen_buffer)); + } info->fix.smem_len = info->screen_size; return 0;