Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/fb-helper: Set flag in struct drm_fb_helper for leaking physical addresses

Uncouple the parameter drm_leak_fbdev_smem from the implementation by
setting a flag in struct drm_fb_helper. This will help to move the
generic fbdev emulation into its own source file, while keeping the
parameter in drm_fb_helper.c. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221103151446.2638-21-tzimmermann@suse.de

+9 -3
+7 -3
drivers/gpu/drm/drm_fb_helper.c
··· 74 74 * considered as a broken and legacy behaviour from a modern fbdev device. 75 75 */ 76 76 #if IS_ENABLED(CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM) 77 - static bool drm_leak_fbdev_smem = false; 77 + static bool drm_leak_fbdev_smem; 78 78 module_param_unsafe(drm_leak_fbdev_smem, bool, 0600); 79 79 MODULE_PARM_DESC(drm_leak_fbdev_smem, 80 80 "Allow unsafe leaking fbdev physical smem address [default=false]"); ··· 1968 1968 sizes.surface_height = config->max_height; 1969 1969 } 1970 1970 1971 + #if IS_ENABLED(CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM) 1972 + fb_helper->hint_leak_smem_start = drm_leak_fbdev_smem; 1973 + #endif 1974 + 1971 1975 /* push down into drivers */ 1972 1976 ret = (*fb_helper->funcs->fb_probe)(fb_helper, &sizes); 1973 1977 if (ret < 0) ··· 2169 2165 info->var.pixclock = 0; 2170 2166 /* Shamelessly allow physical address leaking to userspace */ 2171 2167 #if IS_ENABLED(CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM) 2172 - if (!drm_leak_fbdev_smem) 2168 + if (!fb_helper->hint_leak_smem_start) 2173 2169 #endif 2174 2170 /* don't leak any physical addresses to userspace */ 2175 2171 info->flags |= FBINFO_HIDE_SMEM_START; ··· 2568 2564 * case. 2569 2565 */ 2570 2566 #if IS_ENABLED(CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM) 2571 - if (drm_leak_fbdev_smem && fbi->fix.smem_start == 0 && 2567 + if (fb_helper->hint_leak_smem_start && fbi->fix.smem_start == 0 && 2572 2568 !drm_WARN_ON_ONCE(dev, map.is_iomem)) 2573 2569 fbi->fix.smem_start = 2574 2570 page_to_phys(virt_to_page(fbi->screen_buffer));
+2
include/drm/drm_fb_helper.h
··· 199 199 * See also: @deferred_setup 200 200 */ 201 201 int preferred_bpp; 202 + 203 + bool hint_leak_smem_start; 202 204 }; 203 205 204 206 static inline struct drm_fb_helper *