From: Thomas Zimmermann <tzimmermann@suse.de>
To: daniel@ffwll.ch, airlied@gmail.com, sam@ravnborg.org,
javierm@redhat.com, mripard@kernel.org,
maarten.lankhorst@linux.intel.com
Cc: "linux-hyperv@vger.kernel.orglinux-hyperv"@vger.kernel.org,
linux-aspeed@lists.ozlabs.org, nouveau@lists.freedesktop.org,
dri-devel@lists.freedesktop.org,
virtualization@lists.linux-foundation.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-samsung-soc@vger.kernel.org, amd-gfx@lists.freedesktop.org,
linux-rockchip@lists.infradead.org,
xen-devel@lists.xenproject.org, linux-sunxi@lists.linux.dev,
linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org,
etnaviv@lists.freedesktop.org,
linux-mediatek@lists.infradead.org,
spice-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org,
linux-amlogic@lists.infradead.org,
linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org,
linux-renesas-soc@vger.kernel.org,
freedreno@lists.freedesktop.org,
Thomas Zimmermann <tzimmermann@suse.de>
Subject: [PATCH v3 20/23] drm/fb-helper: Set flag in struct drm_fb_helper for leaking physical addresses
Date: Thu, 3 Nov 2022 16:14:43 +0100 [thread overview]
Message-ID: <20221103151446.2638-21-tzimmermann@suse.de> (raw)
In-Reply-To: <20221103151446.2638-1-tzimmermann@suse.de>
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>
---
drivers/gpu/drm/drm_fb_helper.c | 10 +++++++---
include/drm/drm_fb_helper.h | 2 ++
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 95f389433c4a6..105d9c8fe3250 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -74,7 +74,7 @@ MODULE_PARM_DESC(drm_fbdev_overalloc,
* considered as a broken and legacy behaviour from a modern fbdev device.
*/
#if IS_ENABLED(CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM)
-static bool drm_leak_fbdev_smem = false;
+static bool drm_leak_fbdev_smem;
module_param_unsafe(drm_leak_fbdev_smem, bool, 0600);
MODULE_PARM_DESC(drm_leak_fbdev_smem,
"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,
sizes.surface_height = config->max_height;
}
+#if IS_ENABLED(CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM)
+ fb_helper->hint_leak_smem_start = drm_leak_fbdev_smem;
+#endif
+
/* push down into drivers */
ret = (*fb_helper->funcs->fb_probe)(fb_helper, &sizes);
if (ret < 0)
@@ -2165,7 +2169,7 @@ __drm_fb_helper_initial_config_and_unlock(struct drm_fb_helper *fb_helper,
info->var.pixclock = 0;
/* Shamelessly allow physical address leaking to userspace */
#if IS_ENABLED(CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM)
- if (!drm_leak_fbdev_smem)
+ if (!fb_helper->hint_leak_smem_start)
#endif
/* don't leak any physical addresses to userspace */
info->flags |= FBINFO_HIDE_SMEM_START;
@@ -2564,7 +2568,7 @@ static int drm_fb_helper_generic_probe(struct drm_fb_helper *fb_helper,
* case.
*/
#if IS_ENABLED(CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM)
- if (drm_leak_fbdev_smem && fbi->fix.smem_start == 0 &&
+ if (fb_helper->hint_leak_smem_start && fbi->fix.smem_start == 0 &&
!drm_WARN_ON_ONCE(dev, map.is_iomem))
fbi->fix.smem_start =
page_to_phys(virt_to_page(fbi->screen_buffer));
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 6581183618b89..3dfb5d1093871 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -199,6 +199,8 @@ struct drm_fb_helper {
* See also: @deferred_setup
*/
int preferred_bpp;
+
+ bool hint_leak_smem_start;
};
static inline struct drm_fb_helper *
--
2.38.0
next prev parent reply other threads:[~2022-11-03 15:15 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-03 15:14 [PATCH v3 00/23] drm/fb-helper: Untangle fbdev emulation and helpers Thomas Zimmermann
2022-11-03 15:14 ` [PATCH v3 01/23] drm/komeda: Don't set struct drm_driver.lastclose Thomas Zimmermann
2022-11-03 15:14 ` [PATCH v3 02/23] drm/mcde: " Thomas Zimmermann
2022-11-03 15:14 ` [PATCH v3 03/23] drm/vboxvideo: " Thomas Zimmermann
2022-11-03 15:14 ` [PATCH v3 04/23] drm/amdgpu: Don't set struct drm_driver.output_poll_changed Thomas Zimmermann
2022-11-03 15:14 ` [PATCH v3 05/23] drm/imx/dcss: " Thomas Zimmermann
2022-11-03 15:14 ` [PATCH v3 06/23] drm/ingenic: " Thomas Zimmermann
2022-11-03 15:14 ` [PATCH v3 07/23] drm/logicvc: " Thomas Zimmermann
2022-11-03 15:14 ` [PATCH v3 08/23] drm/rockchip: " Thomas Zimmermann
2022-11-03 15:14 ` [PATCH v3 09/23] drm/panel-ili9341: Include <linux/backlight.h> Thomas Zimmermann
2022-11-03 15:14 ` [PATCH v3 10/23] drm/tve200: Include <linux/of.h> Thomas Zimmermann
2022-11-03 15:14 ` [PATCH v3 11/23] drm/fb-helper: Cleanup include statements in header file Thomas Zimmermann
2022-11-03 15:14 ` [PATCH v3 12/23] drm/fb_helper: Rename field fbdev to info in struct drm_fb_helper Thomas Zimmermann
2022-11-03 15:14 ` [PATCH v3 13/23] drm/fb-helper: Rename drm_fb_helper_alloc_fbi() to use _info postfix Thomas Zimmermann
2022-11-03 15:14 ` [PATCH v3 14/23] drm/fb-helper: Rename drm_fb_helper_unregister_fbi() " Thomas Zimmermann
2022-11-03 15:14 ` [PATCH v3 15/23] drm/fb-helper: Disconnect damage worker from update logic Thomas Zimmermann
2022-11-03 15:14 ` [PATCH v3 16/23] drm/fb-helper: Call fb_sync in I/O functions Thomas Zimmermann
2022-11-03 15:14 ` [PATCH v3 17/23] drm/fb-helper: Perform all fbdev I/O with the same implementation Thomas Zimmermann
2022-11-03 15:14 ` [PATCH v3 18/23] drm/fb_helper: Minimize damage-helper overhead Thomas Zimmermann
2022-11-03 15:14 ` [PATCH v3 19/23] drm/fb-helper: Always initialize generic fbdev emulation Thomas Zimmermann
2022-11-03 15:14 ` Thomas Zimmermann [this message]
2022-11-04 10:37 ` [PATCH v3 20/23] drm/fb-helper: Set flag in struct drm_fb_helper for leaking physical addresses Javier Martinez Canillas
2022-11-03 15:14 ` [PATCH v3 21/23] drm/fb-helper: Move generic fbdev emulation into separate source file Thomas Zimmermann
2022-11-03 15:14 ` [PATCH v3 22/23] drm/fb-helper: Remove unnecessary include statements Thomas Zimmermann
2022-11-03 15:14 ` [PATCH v3 23/23] drm/fb-helper: Clarify use of last_close and output_poll_changed Thomas Zimmermann
2022-11-04 10:38 ` Javier Martinez Canillas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221103151446.2638-21-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc="linux-hyperv@vger.kernel.orglinux-hyperv"@vger.kernel.org \
--cc=airlied@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=etnaviv@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux-sunxi@lists.linux.dev \
--cc=linux-tegra@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=nouveau@lists.freedesktop.org \
--cc=sam@ravnborg.org \
--cc=spice-devel@lists.freedesktop.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).