* [PATCH 1/2] drm/sysfb: Do not page-align visible size of the framebuffer [not found] <20260617112932.511657-1-tzimmermann@suse.de> @ 2026-06-17 11:27 ` Thomas Zimmermann 2026-06-17 11:44 ` Javier Martinez Canillas 2026-06-17 11:27 ` [PATCH 2/2] drm/sysfb: Return errno code from drm_sysfb_get_visible_size() Thomas Zimmermann 1 sibling, 1 reply; 5+ messages in thread From: Thomas Zimmermann @ 2026-06-17 11:27 UTC (permalink / raw) To: javierm, maarten.lankhorst, mripard, airlied, simona Cc: dri-devel, sashiko-reviews, Thomas Zimmermann, stable Only return the actually visible size of the system framebuffer in drm_sysfb_get_visible_size_si(). Drivers use this size value for reserving access to framebuffer memory. Increasing the value can make later attempts to do so fail. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Fixes: 32ae90c66fb6 ("drm/sysfb: Add efidrm for EFI displays") Fixes: a84eb6abe2b6 ("drm/sysfb: Add vesadrm for VESA displays") Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: Javier Martinez Canillas <javierm@redhat.com> Cc: dri-devel@lists.freedesktop.org Cc: <stable@vger.kernel.org> # v6.16+ --- drivers/gpu/drm/sysfb/drm_sysfb_screen_info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sysfb/drm_sysfb_screen_info.c b/drivers/gpu/drm/sysfb/drm_sysfb_screen_info.c index 749290196c6a..361b7233600c 100644 --- a/drivers/gpu/drm/sysfb/drm_sysfb_screen_info.c +++ b/drivers/gpu/drm/sysfb/drm_sysfb_screen_info.c @@ -67,7 +67,7 @@ EXPORT_SYMBOL(drm_sysfb_get_stride_si); u64 drm_sysfb_get_visible_size_si(struct drm_device *dev, const struct screen_info *si, unsigned int height, unsigned int stride, u64 size) { - u64 vsize = PAGE_ALIGN(height * stride); + u64 vsize = height * stride; return drm_sysfb_get_validated_size0(dev, "visible size", vsize, size); } -- 2.54.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] drm/sysfb: Do not page-align visible size of the framebuffer 2026-06-17 11:27 ` [PATCH 1/2] drm/sysfb: Do not page-align visible size of the framebuffer Thomas Zimmermann @ 2026-06-17 11:44 ` Javier Martinez Canillas 2026-06-17 12:36 ` Thomas Zimmermann 0 siblings, 1 reply; 5+ messages in thread From: Javier Martinez Canillas @ 2026-06-17 11:44 UTC (permalink / raw) To: Thomas Zimmermann, maarten.lankhorst, mripard, airlied, simona Cc: dri-devel, sashiko-reviews, Thomas Zimmermann, stable Thomas Zimmermann <tzimmermann@suse.de> writes: Hello Thomas, > Only return the actually visible size of the system framebuffer in > drm_sysfb_get_visible_size_si(). Drivers use this size value for > reserving access to framebuffer memory. Increasing the value can > make later attempts to do so fail. > > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> > Fixes: 32ae90c66fb6 ("drm/sysfb: Add efidrm for EFI displays") > Fixes: a84eb6abe2b6 ("drm/sysfb: Add vesadrm for VESA displays") > Cc: Thomas Zimmermann <tzimmermann@suse.de> > Cc: Javier Martinez Canillas <javierm@redhat.com> > Cc: dri-devel@lists.freedesktop.org > Cc: <stable@vger.kernel.org> # v6.16+ > --- > drivers/gpu/drm/sysfb/drm_sysfb_screen_info.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/sysfb/drm_sysfb_screen_info.c b/drivers/gpu/drm/sysfb/drm_sysfb_screen_info.c > index 749290196c6a..361b7233600c 100644 > --- a/drivers/gpu/drm/sysfb/drm_sysfb_screen_info.c > +++ b/drivers/gpu/drm/sysfb/drm_sysfb_screen_info.c > @@ -67,7 +67,7 @@ EXPORT_SYMBOL(drm_sysfb_get_stride_si); > u64 drm_sysfb_get_visible_size_si(struct drm_device *dev, const struct screen_info *si, > unsigned int height, unsigned int stride, u64 size) > { > - u64 vsize = PAGE_ALIGN(height * stride); Do you know why the original efidrm_get_visible_size_si() (from where you took this code to make it generic) did the page align ? The change makes sense to me though from your explanation: Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> -- Best regards, Javier Martinez Canillas Core Platforms Red Hat ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] drm/sysfb: Do not page-align visible size of the framebuffer 2026-06-17 11:44 ` Javier Martinez Canillas @ 2026-06-17 12:36 ` Thomas Zimmermann 0 siblings, 0 replies; 5+ messages in thread From: Thomas Zimmermann @ 2026-06-17 12:36 UTC (permalink / raw) To: Javier Martinez Canillas, maarten.lankhorst, mripard, airlied, simona Cc: dri-devel, sashiko-reviews, stable Hi Am 17.06.26 um 13:44 schrieb Javier Martinez Canillas: > Thomas Zimmermann <tzimmermann@suse.de> writes: > > Hello Thomas, > >> Only return the actually visible size of the system framebuffer in >> drm_sysfb_get_visible_size_si(). Drivers use this size value for >> reserving access to framebuffer memory. Increasing the value can >> make later attempts to do so fail. >> >> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> >> Fixes: 32ae90c66fb6 ("drm/sysfb: Add efidrm for EFI displays") >> Fixes: a84eb6abe2b6 ("drm/sysfb: Add vesadrm for VESA displays") >> Cc: Thomas Zimmermann <tzimmermann@suse.de> >> Cc: Javier Martinez Canillas <javierm@redhat.com> >> Cc: dri-devel@lists.freedesktop.org >> Cc: <stable@vger.kernel.org> # v6.16+ >> --- >> drivers/gpu/drm/sysfb/drm_sysfb_screen_info.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/sysfb/drm_sysfb_screen_info.c b/drivers/gpu/drm/sysfb/drm_sysfb_screen_info.c >> index 749290196c6a..361b7233600c 100644 >> --- a/drivers/gpu/drm/sysfb/drm_sysfb_screen_info.c >> +++ b/drivers/gpu/drm/sysfb/drm_sysfb_screen_info.c >> @@ -67,7 +67,7 @@ EXPORT_SYMBOL(drm_sysfb_get_stride_si); >> u64 drm_sysfb_get_visible_size_si(struct drm_device *dev, const struct screen_info *si, >> unsigned int height, unsigned int stride, u64 size) >> { >> - u64 vsize = PAGE_ALIGN(height * stride); > Do you know why the original efidrm_get_visible_size_si() (from where > you took this code to make it generic) did the page align ? There's nothing in the old reviews AFAICT. I think, it was an oversight from prototyping the driver. I certainly wanted to return 0 for errors at first, but later changed it to an errno code. There, I forgot to update the code accordingly. > > The change makes sense to me though from your explanation: > > Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Thanks. Best regards Thomas > -- -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg) ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] drm/sysfb: Return errno code from drm_sysfb_get_visible_size() [not found] <20260617112932.511657-1-tzimmermann@suse.de> 2026-06-17 11:27 ` [PATCH 1/2] drm/sysfb: Do not page-align visible size of the framebuffer Thomas Zimmermann @ 2026-06-17 11:27 ` Thomas Zimmermann 2026-06-17 11:45 ` Javier Martinez Canillas 1 sibling, 1 reply; 5+ messages in thread From: Thomas Zimmermann @ 2026-06-17 11:27 UTC (permalink / raw) To: javierm, maarten.lankhorst, mripard, airlied, simona Cc: dri-devel, sashiko-reviews, Thomas Zimmermann, stable Change the return type of drm_sysfb_get_visible_size() to s64 so that it returns a possible errno code from _get_validated_size0(). Fix callers to handle the errno code. The currently returned unsigned type converts an errno code to a very large size value, which drivers interpret as visible size of the system framebuffer. Later efforts to reserve the framebuffer resource fail. The bug has been present since efidrm and vesadrm got merged. It was then part of each driver. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Fixes: 32ae90c66fb6 ("drm/sysfb: Add efidrm for EFI displays") Fixes: a84eb6abe2b6 ("drm/sysfb: Add vesadrm for VESA displays") Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: Javier Martinez Canillas <javierm@redhat.com> Cc: dri-devel@lists.freedesktop.org Cc: <stable@vger.kernel.org> # v6.16+ --- drivers/gpu/drm/sysfb/drm_sysfb_helper.h | 2 +- drivers/gpu/drm/sysfb/drm_sysfb_screen_info.c | 2 +- drivers/gpu/drm/sysfb/efidrm.c | 7 ++++--- drivers/gpu/drm/sysfb/vesadrm.c | 6 +++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/sysfb/drm_sysfb_helper.h b/drivers/gpu/drm/sysfb/drm_sysfb_helper.h index 2a2b553366fb..547f2327af5e 100644 --- a/drivers/gpu/drm/sysfb/drm_sysfb_helper.h +++ b/drivers/gpu/drm/sysfb/drm_sysfb_helper.h @@ -50,7 +50,7 @@ struct resource *drm_sysfb_get_memory_si(struct drm_device *dev, int drm_sysfb_get_stride_si(struct drm_device *dev, const struct screen_info *si, const struct drm_format_info *format, unsigned int width, unsigned int height, u64 size); -u64 drm_sysfb_get_visible_size_si(struct drm_device *dev, const struct screen_info *si, +s64 drm_sysfb_get_visible_size_si(struct drm_device *dev, const struct screen_info *si, unsigned int height, unsigned int stride, u64 size); #endif diff --git a/drivers/gpu/drm/sysfb/drm_sysfb_screen_info.c b/drivers/gpu/drm/sysfb/drm_sysfb_screen_info.c index 361b7233600c..40b4f7883b9b 100644 --- a/drivers/gpu/drm/sysfb/drm_sysfb_screen_info.c +++ b/drivers/gpu/drm/sysfb/drm_sysfb_screen_info.c @@ -64,7 +64,7 @@ int drm_sysfb_get_stride_si(struct drm_device *dev, const struct screen_info *si } EXPORT_SYMBOL(drm_sysfb_get_stride_si); -u64 drm_sysfb_get_visible_size_si(struct drm_device *dev, const struct screen_info *si, +s64 drm_sysfb_get_visible_size_si(struct drm_device *dev, const struct screen_info *si, unsigned int height, unsigned int stride, u64 size) { u64 vsize = height * stride; diff --git a/drivers/gpu/drm/sysfb/efidrm.c b/drivers/gpu/drm/sysfb/efidrm.c index 1a1e36700976..3f9cd5d03efb 100644 --- a/drivers/gpu/drm/sysfb/efidrm.c +++ b/drivers/gpu/drm/sysfb/efidrm.c @@ -152,7 +152,8 @@ static struct efidrm_device *efidrm_device_create(struct drm_driver *drv, const struct screen_info *si; const struct drm_format_info *format; int width, height, stride; - u64 vsize, mem_flags; + s64 vsize; + u64 mem_flags; struct resource resbuf; struct resource *res; struct efidrm_device *efi; @@ -206,8 +207,8 @@ static struct efidrm_device *efidrm_device_create(struct drm_driver *drv, if (stride < 0) return ERR_PTR(stride); vsize = drm_sysfb_get_visible_size_si(dev, si, height, stride, resource_size(res)); - if (!vsize) - return ERR_PTR(-EINVAL); + if (vsize < 0) + return ERR_PTR(vsize); drm_dbg(dev, "framebuffer format=%p4cc, size=%dx%d, stride=%d bytes\n", &format->format, width, height, stride); diff --git a/drivers/gpu/drm/sysfb/vesadrm.c b/drivers/gpu/drm/sysfb/vesadrm.c index dbc317778d54..6a67b2d2e451 100644 --- a/drivers/gpu/drm/sysfb/vesadrm.c +++ b/drivers/gpu/drm/sysfb/vesadrm.c @@ -402,7 +402,7 @@ static struct vesadrm_device *vesadrm_device_create(struct drm_driver *drv, const struct screen_info *si; const struct drm_format_info *format; int width, height, stride; - u64 vsize; + s64 vsize; struct resource resbuf; struct resource *res; struct vesadrm_device *vesa; @@ -457,8 +457,8 @@ static struct vesadrm_device *vesadrm_device_create(struct drm_driver *drv, if (stride < 0) return ERR_PTR(stride); vsize = drm_sysfb_get_visible_size_si(dev, si, height, stride, resource_size(res)); - if (!vsize) - return ERR_PTR(-EINVAL); + if (vsize < 0) + return ERR_PTR(vsize); drm_dbg(dev, "framebuffer format=%p4cc, size=%dx%d, stride=%d bytes\n", &format->format, width, height, stride); -- 2.54.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] drm/sysfb: Return errno code from drm_sysfb_get_visible_size() 2026-06-17 11:27 ` [PATCH 2/2] drm/sysfb: Return errno code from drm_sysfb_get_visible_size() Thomas Zimmermann @ 2026-06-17 11:45 ` Javier Martinez Canillas 0 siblings, 0 replies; 5+ messages in thread From: Javier Martinez Canillas @ 2026-06-17 11:45 UTC (permalink / raw) To: Thomas Zimmermann, maarten.lankhorst, mripard, airlied, simona Cc: dri-devel, sashiko-reviews, Thomas Zimmermann, stable Thomas Zimmermann <tzimmermann@suse.de> writes: > Change the return type of drm_sysfb_get_visible_size() to s64 so > that it returns a possible errno code from _get_validated_size0(). > Fix callers to handle the errno code. > > The currently returned unsigned type converts an errno code to a > very large size value, which drivers interpret as visible size of > the system framebuffer. Later efforts to reserve the framebuffer > resource fail. > > The bug has been present since efidrm and vesadrm got merged. It > was then part of each driver. > > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> > Fixes: 32ae90c66fb6 ("drm/sysfb: Add efidrm for EFI displays") > Fixes: a84eb6abe2b6 ("drm/sysfb: Add vesadrm for VESA displays") > Cc: Thomas Zimmermann <tzimmermann@suse.de> > Cc: Javier Martinez Canillas <javierm@redhat.com> > Cc: dri-devel@lists.freedesktop.org > Cc: <stable@vger.kernel.org> # v6.16+ > --- Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> -- Best regards, Javier Martinez Canillas Core Platforms Red Hat ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-06-17 12:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260617112932.511657-1-tzimmermann@suse.de>
2026-06-17 11:27 ` [PATCH 1/2] drm/sysfb: Do not page-align visible size of the framebuffer Thomas Zimmermann
2026-06-17 11:44 ` Javier Martinez Canillas
2026-06-17 12:36 ` Thomas Zimmermann
2026-06-17 11:27 ` [PATCH 2/2] drm/sysfb: Return errno code from drm_sysfb_get_visible_size() Thomas Zimmermann
2026-06-17 11:45 ` Javier Martinez Canillas
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox