Skip to content

Commit e7c5c29

Browse files
committed
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 <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 7ce1953 commit e7c5c29

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

drivers/gpu/drm/drm_fb_helper.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ MODULE_PARM_DESC(drm_fbdev_overalloc,
7474
* considered as a broken and legacy behaviour from a modern fbdev device.
7575
*/
7676
#if IS_ENABLED(CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM)
77-
static bool drm_leak_fbdev_smem = false;
77+
static bool drm_leak_fbdev_smem;
7878
module_param_unsafe(drm_leak_fbdev_smem, bool, 0600);
7979
MODULE_PARM_DESC(drm_leak_fbdev_smem,
8080
"Allow unsafe leaking fbdev physical smem address [default=false]");
@@ -1968,6 +1968,10 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
19681968
sizes.surface_height = config->max_height;
19691969
}
19701970

1971+
#if IS_ENABLED(CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM)
1972+
fb_helper->hint_leak_smem_start = drm_leak_fbdev_smem;
1973+
#endif
1974+
19711975
/* push down into drivers */
19721976
ret = (*fb_helper->funcs->fb_probe)(fb_helper, &sizes);
19731977
if (ret < 0)
@@ -2165,7 +2169,7 @@ __drm_fb_helper_initial_config_and_unlock(struct drm_fb_helper *fb_helper,
21652169
info->var.pixclock = 0;
21662170
/* Shamelessly allow physical address leaking to userspace */
21672171
#if IS_ENABLED(CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM)
2168-
if (!drm_leak_fbdev_smem)
2172+
if (!fb_helper->hint_leak_smem_start)
21692173
#endif
21702174
/* don't leak any physical addresses to userspace */
21712175
info->flags |= FBINFO_HIDE_SMEM_START;
@@ -2564,7 +2568,7 @@ static int drm_fb_helper_generic_probe(struct drm_fb_helper *fb_helper,
25642568
* case.
25652569
*/
25662570
#if IS_ENABLED(CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM)
2567-
if (drm_leak_fbdev_smem && fbi->fix.smem_start == 0 &&
2571+
if (fb_helper->hint_leak_smem_start && fbi->fix.smem_start == 0 &&
25682572
!drm_WARN_ON_ONCE(dev, map.is_iomem))
25692573
fbi->fix.smem_start =
25702574
page_to_phys(virt_to_page(fbi->screen_buffer));

include/drm/drm_fb_helper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ struct drm_fb_helper {
199199
* See also: @deferred_setup
200200
*/
201201
int preferred_bpp;
202+
203+
bool hint_leak_smem_start;
202204
};
203205

204206
static inline struct drm_fb_helper *

0 commit comments

Comments
 (0)