* [PATCH] fbdev: vga16fb: Request memory region.
@ 2025-10-16 17:18 Javier Garcia
2025-10-27 18:02 ` Javier Garcia
0 siblings, 1 reply; 5+ messages in thread
From: Javier Garcia @ 2025-10-16 17:18 UTC (permalink / raw)
To: deller; +Cc: linux-fbdev, dri-devel, linux-kernel, shuah, Javier Garcia
This patch reserve and release VGA memory region with `*_mem_region`
fn's.
This align with Documentation/drm/todo.rst
"Request memory regions in all fbdev drivers"
I've tested with kernel and qemu both 32bits.
Signed-off-by: Javier Garcia <rampxxxx@gmail.com>
---
When I've run the code always return -EBUSY which makes sense as
mem is already requested,`/proc/iomem` shows `000a0000-000bffff : Video RAM area`.
I've seen that `cirrusfb` has this kind of code wrapped up with `#if 0`, and I
wonder if it makes sense to also wrap up with `#if 0`, at least , in
that way the code gets commented about expected behavior.
drivers/video/fbdev/vga16fb.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/video/fbdev/vga16fb.c b/drivers/video/fbdev/vga16fb.c
index eedab14c7d51..f506bf144a97 100644
--- a/drivers/video/fbdev/vga16fb.c
+++ b/drivers/video/fbdev/vga16fb.c
@@ -1319,6 +1319,11 @@ static int vga16fb_probe(struct platform_device *dev)
if (ret)
return ret;
+ if (!request_mem_region(vga16fb_fix.smem_start, vga16fb_fix.smem_len,
+ "vga16b")) {
+ dev_err(&dev->dev,"vga16b: cannot reserve video memory at 0x%lx\n",
+ vga16fb_fix.smem_start);
+ }
printk(KERN_DEBUG "vga16fb: initializing\n");
info = framebuffer_alloc(sizeof(struct vga16fb_par), &dev->dev);
@@ -1398,6 +1403,8 @@ static int vga16fb_probe(struct platform_device *dev)
err_ioremap:
framebuffer_release(info);
err_fb_alloc:
+ release_mem_region(vga16fb_fix.smem_start,
+ vga16fb_fix.smem_len);
return ret;
}
--
2.50.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] fbdev: vga16fb: Request memory region.
2025-10-16 17:18 [PATCH] fbdev: vga16fb: Request memory region Javier Garcia
@ 2025-10-27 18:02 ` Javier Garcia
2025-10-27 20:07 ` Helge Deller
0 siblings, 1 reply; 5+ messages in thread
From: Javier Garcia @ 2025-10-27 18:02 UTC (permalink / raw)
To: deller; +Cc: linux-fbdev, dri-devel, linux-kernel, shuah
Hi,
Helge Deller, any comment on this patch?
---
Javier Garcia
On Thu, 16 Oct 2025 at 19:18, Javier Garcia <rampxxxx@gmail.com> wrote:
>
> This patch reserve and release VGA memory region with `*_mem_region`
> fn's.
>
> This align with Documentation/drm/todo.rst
> "Request memory regions in all fbdev drivers"
>
> I've tested with kernel and qemu both 32bits.
>
> Signed-off-by: Javier Garcia <rampxxxx@gmail.com>
> ---
>
> When I've run the code always return -EBUSY which makes sense as
> mem is already requested,`/proc/iomem` shows `000a0000-000bffff : Video RAM area`.
>
> I've seen that `cirrusfb` has this kind of code wrapped up with `#if 0`, and I
> wonder if it makes sense to also wrap up with `#if 0`, at least , in
> that way the code gets commented about expected behavior.
>
>
> drivers/video/fbdev/vga16fb.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/video/fbdev/vga16fb.c b/drivers/video/fbdev/vga16fb.c
> index eedab14c7d51..f506bf144a97 100644
> --- a/drivers/video/fbdev/vga16fb.c
> +++ b/drivers/video/fbdev/vga16fb.c
> @@ -1319,6 +1319,11 @@ static int vga16fb_probe(struct platform_device *dev)
> if (ret)
> return ret;
>
> + if (!request_mem_region(vga16fb_fix.smem_start, vga16fb_fix.smem_len,
> + "vga16b")) {
> + dev_err(&dev->dev,"vga16b: cannot reserve video memory at 0x%lx\n",
> + vga16fb_fix.smem_start);
> + }
> printk(KERN_DEBUG "vga16fb: initializing\n");
> info = framebuffer_alloc(sizeof(struct vga16fb_par), &dev->dev);
>
> @@ -1398,6 +1403,8 @@ static int vga16fb_probe(struct platform_device *dev)
> err_ioremap:
> framebuffer_release(info);
> err_fb_alloc:
> + release_mem_region(vga16fb_fix.smem_start,
> + vga16fb_fix.smem_len);
> return ret;
> }
>
> --
> 2.50.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] fbdev: vga16fb: Request memory region.
2025-10-27 18:02 ` Javier Garcia
@ 2025-10-27 20:07 ` Helge Deller
2025-10-28 19:16 ` [PATCH v2] " Javier Garcia
0 siblings, 1 reply; 5+ messages in thread
From: Helge Deller @ 2025-10-27 20:07 UTC (permalink / raw)
To: Javier Garcia; +Cc: linux-fbdev, dri-devel, linux-kernel, shuah
On 10/27/25 19:02, Javier Garcia wrote:
> Hi,
>
> Helge Deller, any comment on this patch?
Well, it doesn't hurt, as it will not abort (as before) even if the region is occupied.
In that sense, I don't see a problem to add it.
But you are missing to release the memory when the driver is released
via vga16fb_remove.
If you send an updated/fixed patch I will apply it to the fbdev tree
to get some testing.
Helge
> ---
> Javier Garcia
>
>
> On Thu, 16 Oct 2025 at 19:18, Javier Garcia <rampxxxx@gmail.com> wrote:
>>
>> This patch reserve and release VGA memory region with `*_mem_region`
>> fn's.
>>
>> This align with Documentation/drm/todo.rst
>> "Request memory regions in all fbdev drivers"
>>
>> I've tested with kernel and qemu both 32bits.
>>
>> Signed-off-by: Javier Garcia <rampxxxx@gmail.com>
>> ---
>>
>> When I've run the code always return -EBUSY which makes sense as
>> mem is already requested,`/proc/iomem` shows `000a0000-000bffff : Video RAM area`.
>>
>> I've seen that `cirrusfb` has this kind of code wrapped up with `#if 0`, and I
>> wonder if it makes sense to also wrap up with `#if 0`, at least , in
>> that way the code gets commented about expected behavior.
>>
>>
>> drivers/video/fbdev/vga16fb.c | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/video/fbdev/vga16fb.c b/drivers/video/fbdev/vga16fb.c
>> index eedab14c7d51..f506bf144a97 100644
>> --- a/drivers/video/fbdev/vga16fb.c
>> +++ b/drivers/video/fbdev/vga16fb.c
>> @@ -1319,6 +1319,11 @@ static int vga16fb_probe(struct platform_device *dev)
>> if (ret)
>> return ret;
>>
>> + if (!request_mem_region(vga16fb_fix.smem_start, vga16fb_fix.smem_len,
>> + "vga16b")) {
>> + dev_err(&dev->dev,"vga16b: cannot reserve video memory at 0x%lx\n",
>> + vga16fb_fix.smem_start);
>> + }
>> printk(KERN_DEBUG "vga16fb: initializing\n");
>> info = framebuffer_alloc(sizeof(struct vga16fb_par), &dev->dev);
>>
>> @@ -1398,6 +1403,8 @@ static int vga16fb_probe(struct platform_device *dev)
>> err_ioremap:
>> framebuffer_release(info);
>> err_fb_alloc:
>> + release_mem_region(vga16fb_fix.smem_start,
>> + vga16fb_fix.smem_len);
>> return ret;
>> }
>>
>> --
>> 2.50.1
>>
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v2] fbdev: vga16fb: Request memory region.
2025-10-27 20:07 ` Helge Deller
@ 2025-10-28 19:16 ` Javier Garcia
2025-10-28 21:09 ` Helge Deller
0 siblings, 1 reply; 5+ messages in thread
From: Javier Garcia @ 2025-10-28 19:16 UTC (permalink / raw)
To: deller; +Cc: linux-fbdev, dri-devel, linux-kernel, shuah, Javier Garcia
This patch reserve and release VGA memory region.
This align with Documentation/drm/todo.rst
"Request memory regions in all fbdev drivers"
I've tested with 32bits kernel and qemu.
Signed-off-by: Javier Garcia <rampxxxx@gmail.com>
---
v1 -> v2:
* Add release in vga16fb_remove , thanks Helge Deller.
* v1 https://lore.kernel.org/lkml/20251016171845.1397153-1-rampxxxx@gmail.com/
drivers/video/fbdev/vga16fb.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/video/fbdev/vga16fb.c b/drivers/video/fbdev/vga16fb.c
index eedab14c7d51..208e3eefb3ff 100644
--- a/drivers/video/fbdev/vga16fb.c
+++ b/drivers/video/fbdev/vga16fb.c
@@ -1319,6 +1319,11 @@ static int vga16fb_probe(struct platform_device *dev)
if (ret)
return ret;
+ if (!request_mem_region(vga16fb_fix.smem_start, vga16fb_fix.smem_len,
+ "vga16b")) {
+ dev_err(&dev->dev,"vga16b: cannot reserve video memory at 0x%lx\n",
+ vga16fb_fix.smem_start);
+ }
printk(KERN_DEBUG "vga16fb: initializing\n");
info = framebuffer_alloc(sizeof(struct vga16fb_par), &dev->dev);
@@ -1398,6 +1403,8 @@ static int vga16fb_probe(struct platform_device *dev)
err_ioremap:
framebuffer_release(info);
err_fb_alloc:
+ release_mem_region(vga16fb_fix.smem_start,
+ vga16fb_fix.smem_len);
return ret;
}
@@ -1407,6 +1414,8 @@ static void vga16fb_remove(struct platform_device *dev)
if (info)
unregister_framebuffer(info);
+ release_mem_region(vga16fb_fix.smem_start,
+ vga16fb_fix.smem_len);
}
static const struct platform_device_id vga16fb_driver_id_table[] = {
--
2.50.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-10-28 21:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-16 17:18 [PATCH] fbdev: vga16fb: Request memory region Javier Garcia
2025-10-27 18:02 ` Javier Garcia
2025-10-27 20:07 ` Helge Deller
2025-10-28 19:16 ` [PATCH v2] " Javier Garcia
2025-10-28 21:09 ` Helge Deller
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).