Skip to contentSkip to conversation

video: simplefb: Map framebuffer region on probe on ARM64

PATCH Superseded Luca Weiss 3 participants 5 messages Mar 18 – Mar 26 Framebuffer layer

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Luca Weiss

author
#0 lore raw

PATCH 1/1 video: simplefb: Map framebuffer region on probe on ARM64

The framebuffer buffer might not be mapped on some devices.

This is #ifdef'ed for ARM64 since mmu_map_region() is not defined for any other architecture.

---
Map 0x1000 extra due to unknown reason, but otherwise it's not enough and we still get a "Synchronous Abort" when drawing at the bottom of the framebuffer.

For milos-fairphone-fp6 the framebuffer is reg=0xe3940000 size=0xa932c0 (2484*1116*4).

When just calling mmu_map_region with plat->size, then it's crashing at 0xe43d3000 even though everything up to 0xe43d32c0 should be mapped. With size+0x800 (or less) it was also still crashing, only size+0x1000 then worked.

Possible I just don't know enough about memory mapping things, so suggestions welcome! :)

---
 drivers/video/simplefb.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/video/simplefb.c +6 -0
index 8d0772d4e51..e144fde697b 100644
@@ -9,6 +9,7 @@
 #include <log.h>
 #include <video.h>
 #include <asm/global_data.h>
+#include <asm/system.h>
 
 static int simple_video_probe(struct udevice *dev)
 {
@@ -37,6 +38,11 @@ static int simple_video_probe(struct udevice *dev)
 	plat->base = base;
 	plat->size = size;
 
+#ifdef CONFIG_ARM64
+	/* The framebuffer buffer might not be mapped on some devices */
+	mmu_map_region((phys_addr_t)plat->base, (phys_addr_t)plat->size + 0x1000, false);
+#endif
+
 	video_set_flush_dcache(dev, true);
 
 	debug("%s: Query resolution...\n", __func__);

---
base-commit: ba7bf918dafcd093ad733b07ba490baeb20cf5da
change-id: 20260318-simplefb-map-abb9dba0eed1

Best regards,

Signature · 1 line
Luca Weiss <[email protected]>
#1 lore raw

Hi Luca,

Quoted 4 lines · Luca Weiss

The framebuffer buffer might not be mapped on some devices.

This is #ifdef'ed for ARM64 since mmu_map_region() is not defined for any other architecture.

This isn't an appropriate fix to the problem.

Quoted 10 lines

---
Map 0x1000 extra due to unknown reason, but otherwise it's not enough and we still get a "Synchronous Abort" when drawing at the bottom of the framebuffer.

For milos-fairphone-fp6 the framebuffer is reg=0xe3940000 size=0xa932c0 (2484*1116*4).

Quoted 7 lines

When just calling mmu_map_region with plat->size, then it's crashing at 0xe43d3000 even though everything up to 0xe43d32c0 should be mapped. With size+0x800 (or less) it was also still crashing, only size+0x1000 then worked.

Possible I just don't know enough about memory mapping things, so suggestions welcome! :)

This sounds more likely the synchronous aborts caused by cache prefetch of nearby reserved memory regions. I see there are some reserved mememory regions around the address space you have mentioned on Milos.

On Qcom platforms, the default memory map strategy is to map the overall DRAM space without excluding reserved reqions. One can exclude reserved regions in a SoC specific manner here [1] but it adds some runtime overhead. Give it a try for Milos as well in case it resolves your issue.

I think we still need to revisit that reserved memory strategy where default should rather be we unmap the reserved regions.

[1] https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-snapdragon/board.c#L743

-Sumit

Quoted 37 lines
---
 drivers/video/simplefb.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/video/simplefb.c +6 -1
index 8d0772d4e51..e144fde697b 100644
@@ -9,6 +9,7 @@
 #include <log.h>
 #include <video.h>
 #include <asm/global_data.h>
+#include <asm/system.h>
 
 static int simple_video_probe(struct udevice *dev)
 {
@@ -37,6 +38,11 @@ static int simple_video_probe(struct udevice *dev)
 	plat->base = base;
 	plat->size = size;
 
+#ifdef CONFIG_ARM64
+	/* The framebuffer buffer might not be mapped on some devices */
+	mmu_map_region((phys_addr_t)plat->base, (phys_addr_t)plat->size + 0x1000, false);
+#endif
+
 	video_set_flush_dcache(dev, true);
 
 	debug("%s: Query resolution...\n", __func__);
 
---

base-commit: ba7bf918dafcd093ad733b07ba490baeb20cf5da
change-id: 20260318-simplefb-map-abb9dba0eed1

Best regards,

Signature · 1 line
Luca Weiss <[email protected]>
author
#2 lore raw

Hi Sumit,

Quoted 32 lines · Sumit Garg

Hi Luca,

Quoted 4 lines · Luca Weiss

The framebuffer buffer might not be mapped on some devices.

This is #ifdef'ed for ARM64 since mmu_map_region() is not defined for any other architecture.

This isn't an appropriate fix to the problem.

Quoted 10 lines

---
Map 0x1000 extra due to unknown reason, but otherwise it's not enough and we still get a "Synchronous Abort" when drawing at the bottom of the framebuffer.

For milos-fairphone-fp6 the framebuffer is reg=0xe3940000 size=0xa932c0 (2484*1116*4).

Quoted 7 lines

When just calling mmu_map_region with plat->size, then it's crashing at 0xe43d3000 even though everything up to 0xe43d32c0 should be mapped. With size+0x800 (or less) it was also still crashing, only size+0x1000 then worked.

Possible I just don't know enough about memory mapping things, so suggestions welcome! :)

This sounds more likely the synchronous aborts caused by cache prefetch of nearby reserved memory regions. I see there are some reserved mememory regions around the address space you have mentioned on Milos.

Quoted 5 lines

On Qcom platforms, the default memory map strategy is to map the overall DRAM space without excluding reserved reqions. One can exclude reserved regions in a SoC specific manner here [1] but it adds some runtime overhead. Give it a try for Milos as well in case it resolves your issue.

Casey's verdict from dump_pagetable() was that the ABL doesn't include the framebuffer in the memory map it provides, so we need to map it ourselves. I honestly have less understanding of how that works, so please correct me/us if that's wrong.

As a reminder, the framebuffer is reg = <0xe3940000 (2484 * 1116 * 4)>, so 0xe3940000 - 0xe43d32c0

<debug_uart>

U-Boot 2026.04-rc2-00021-gbae2991415b0-dirty (Mar 05 2026 - 16:37:20 +0100)

Model: The Fairphone (Gen. 6)
DRAM:  38 GiB (total 7.4 GiB)
Walking pagetable at 00000009fff00000, va_bits: 36. Using 3 levels
[0x000009fff01000]                        |  Table |            |               |          
  [0x000009fff02000]                      |  Table |            |               |          
    [0x00000000001000 - 0x00000000200000] |  Pages | PXN UXN    | Device-nGnRnE | Non-shareable   
  [0x00000000200000 - 0x00000040000000]   |  Block | PXN UXN    | Device-nGnRnE | Non-shareable   
[0x00000040000000 - 0x00000080000000]     |  Block | PXN UXN    | Device-nGnRnE | Non-shareable   
[0x000009fff03000]                        |  Table |            |               |          
  [0x00000080000000 - 0x00000080e00000]   |  Block | PXN UXN    | Device-nGnRnE | Non-shareable   
  [0x00000080e00000 - 0x00000081800000]   |  Block | RWX        | Normal        | Inner-shareable 
  [0x000009fff04000]                      |  Table |            |               |          
    [0x00000081cf5000 - 0x00000081cff000] |  Pages | RWX        | Normal        | Inner-shareable 
  [0x000009fff05000]                      |  Table |            |               |          
    [0x00000081f20000 - 0x00000082000000] |  Pages | RWX        | Normal        | Inner-shareable 
  [0x00000082000000 - 0x00000082400000]   |  Block | RWX        | Normal        | Inner-shareable 
  [0x000009fff06000]                      |  Table |            |               |          
    [0x00000082400000 - 0x000000824a0000] |  Pages | RWX        | Normal        | Inner-shareable 
  [0x00000082800000 - 0x0000008ac00000]   |  Block | RWX        | Normal        | Inner-shareable 
  [0x000009fff07000]                      |  Table |            |               |          
    [0x0000009ea9c000 - 0x0000009eb00000] |  Pages | RWX        | Normal        | Inner-shareable 
  [0x000009fff08000]                      |  Table |            |               |          
    [0x0000009f300000 - 0x0000009f400000] |  Pages | RWX        | Normal        | Inner-shareable 
  [0x0000009f400000 - 0x000000a6400000]   |  Block | RWX        | Normal        | Inner-shareable 
  [0x000000a7000000 - 0x000000c0000000]   |  Block | RWX        | Normal        | Inner-shareable 
[0x000009fff09000]                        |  Table |            |               |          
  [0x000000c0000000 - 0x000000e0600000]   |  Block | RWX        | Normal        | Inner-shareable 
  [0x000000e0a00000 - 0x000000e1e00000]   |  Block | RWX        | Normal        | Inner-shareable 
  [0x000009fff0a000]                      |  Table |            |               |          
    [0x000000e1e00000 - 0x000000e1f00000] |  Pages | RWX        | Normal        | Inner-shareable 
  [0x000009fff0b000]                      |  Table |            |               |          
    [0x000000e2500000 - 0x000000e2600000] |  Pages | RWX        | Normal        | Inner-shareable 
  [0x000000e2600000 - 0x000000e3800000]   |  Block | RWX        | Normal        | Inner-shareable 
  [0x000009fff0c000]                      |  Table |            |               |          
    [0x000000e3800000 - 0x000000e3940000] |  Pages | RWX        | Normal        | Inner-shareable 
  [0x000009fff0d000]                      |  Table |            |               |          
    [0x000000e6440000 - 0x000000e6600000] |  Pages | RWX        | Normal        | Inner-shareable 
  [0x000000e6600000 - 0x000000e8800000]   |  Block | RWX        | Normal        | Inner-shareable 
  [0x000009fff0e000]                      |  Table |            |               |          
    [0x000000e8800000 - 0x000000e8900000] |  Pages | RWX        | Normal        | Inner-shareable 
  [0x000009fff0f000]                      |  Table |            |               |          
    [0x000000f0d00000 - 0x000000f0e00000] |  Pages | RWX        | Normal        | Inner-shareable 
  [0x000000f0e00000 - 0x00000100000000]   |  Block | RWX        | Normal        | Inner-shareable 
[0x000009fff10000]                        |  Table |            |               |          
  [0x00000880000000 - 0x000008afa00000]   |  Block | RWX        | Normal        | Inner-shareable 
  [0x000009fff11000]                      |  Table |            |               |          
    [0x000008afa00000 - 0x000008afafe000] |  Pages | RWX        | Normal        | Inner-shareable 
  [0x000008b0000000 - 0x000008b9600000]   |  Block | RWX        | Normal        | Inner-shareable 
  [0x000009fff12000]                      |  Table |            |               |          
    [0x000008b9600000 - 0x000008b9700000] |  Pages | RWX        | Normal        | Inner-shareable 
  [0x000008bf800000 - 0x000008c0000000]   |  Block | RWX        | Normal        | Inner-shareable 
[0x000008c0000000 - 0x00000a00000000]     |  Block | RWX        | Normal        | Inner-shareable 
Core:  124 devices, 32 uclasses, devicetree: board
MMC:   mmc@8804000: 0

Loading Environment from nowhere... OK "Synchronous Abort" handler, esr 0x96000047, far 0x0
elr: 000000000003bdac lr : 000000000003bdac (reloc)
elr: 00000009ffe05dac lr : 00000009ffe05dac x0 : 00000000fffffffe x1 : 00000009ffec5170 x2 : 0000000000000003 x3 : 0000000000000001 x4 : 0000000000000063 x5 : 0000000000000000 x6 : 00000009efd9c7f0 x7 : 0000000000000000 x8 : 000000000000000a x9 : 0000000000000034
x10: 000000000000000d x11: 0000000000000006
x12: 00000009efd9ca38 x13: 00000000b7dfe000
x14: 00000000fffffffb x15: 00000009ffefbb9c
x16: 00000009ffe30cec x17: 0000000000000001
x18: 00000009efdaac30 x19: 0000000000000000
x20: 00000009efde2990 x21: 00000009ffecd110
x22: 00000009ffeb2e8e x23: 00000009efdb1430
x24: 00000009efdd8290 x25: 00000000e3940000
x26: 0000000000000002 x27: 0000000000000002
x28: 0000000000000002 x29: 00000009efd9c840

Code: 90000602 9105c021 91047842 9400291b (f900027f) 

Resetting CPU ...

### ERROR ### Please RESET the board ###

Regards
Luca

Quoted 45 lines

I think we still need to revisit that reserved memory strategy where default should rather be we unmap the reserved regions.

[1] https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-snapdragon/board.c#L743

-Sumit

Quoted 37 lines
---
 drivers/video/simplefb.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/video/simplefb.c +6 -1
index 8d0772d4e51..e144fde697b 100644
@@ -9,6 +9,7 @@
 #include <log.h>
 #include <video.h>
 #include <asm/global_data.h>
+#include <asm/system.h>
 
 static int simple_video_probe(struct udevice *dev)
 {
@@ -37,6 +38,11 @@ static int simple_video_probe(struct udevice *dev)
 	plat->base = base;
 	plat->size = size;
 
+#ifdef CONFIG_ARM64
+	/* The framebuffer buffer might not be mapped on some devices */
+	mmu_map_region((phys_addr_t)plat->base, (phys_addr_t)plat->size + 0x1000, false);
+#endif
+
 	video_set_flush_dcache(dev, true);
 
 	debug("%s: Query resolution...\n", __func__);
 
---

base-commit: ba7bf918dafcd093ad733b07ba490baeb20cf5da
change-id: 20260318-simplefb-map-abb9dba0eed1

Best regards,

Signature · 1 line
Luca Weiss <[email protected]>
#3 lore raw
In reply to Sumit Garg
Quoted 25 lines · Sumit Garg

Hi Luca,

Quoted 4 lines · Luca Weiss

The framebuffer buffer might not be mapped on some devices.

This is #ifdef'ed for ARM64 since mmu_map_region() is not defined for any other architecture.

This isn't an appropriate fix to the problem.

Quoted 15 lines

---
Map 0x1000 extra due to unknown reason, but otherwise it's not enough and we still get a "Synchronous Abort" when drawing at the bottom of the framebuffer.

For milos-fairphone-fp6 the framebuffer is reg=0xe3940000 size=0xa932c0 (2484*1116*4).

When just calling mmu_map_region with plat->size, then it's crashing at 0xe43d3000 even though everything up to 0xe43d32c0 should be mapped. With size+0x800 (or less) it was also still crashing, only size+0x1000 then worked.

Quoted 6 lines
Quoted 2 lines

Possible I just don't know enough about memory mapping things, so suggestions welcome! :)

This sounds more likely the synchronous aborts caused by cache prefetch of nearby reserved memory regions. I see there are some reserved mememory regions around the address space you have mentioned on Milos.

I don't think so, more likely mmu_map_region() is doing an ALIGN_DOWN() somewhere.

Luca: I think you should do ALIGN(plat->size, SZ_4K) and assert that plat->stat is 4k aligned as well (or at least WARN if it's not). That will round up the size 0xa932c0 to 0xa94000.

Quoted 51 lines

On Qcom platforms, the default memory map strategy is to map the overall DRAM space without excluding reserved reqions. One can exclude reserved regions in a SoC specific manner here [1] but it adds some runtime overhead. Give it a try for Milos as well in case it resolves your issue.

I think we still need to revisit that reserved memory strategy where default should rather be we unmap the reserved regions.

[1] https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-snapdragon/board.c#L743

-Sumit

Quoted 37 lines
---
 drivers/video/simplefb.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/video/simplefb.c +6 -1
index 8d0772d4e51..e144fde697b 100644
@@ -9,6 +9,7 @@
 #include <log.h>
 #include <video.h>
 #include <asm/global_data.h>
+#include <asm/system.h>
 
 static int simple_video_probe(struct udevice *dev)
 {
@@ -37,6 +38,11 @@ static int simple_video_probe(struct udevice *dev)
 	plat->base = base;
 	plat->size = size;
 
+#ifdef CONFIG_ARM64
+	/* The framebuffer buffer might not be mapped on some devices */
+	mmu_map_region((phys_addr_t)plat->base, (phys_addr_t)plat->size + 0x1000, false);
+#endif
+
 	video_set_flush_dcache(dev, true);
 
 	debug("%s: Query resolution...\n", __func__);
 
---

base-commit: ba7bf918dafcd093ad733b07ba490baeb20cf5da
change-id: 20260318-simplefb-map-abb9dba0eed1

Best regards,

Signature · 1 line
Luca Weiss <[email protected]>
Signature · 1 line
// Casey (she/her)
#4 lore raw
In reply to Sumit Garg
Quoted 32 lines · Sumit Garg

Hi Luca,

Quoted 4 lines · Luca Weiss

The framebuffer buffer might not be mapped on some devices.

This is #ifdef'ed for ARM64 since mmu_map_region() is not defined for any other architecture.

This isn't an appropriate fix to the problem.

Quoted 10 lines

---
Map 0x1000 extra due to unknown reason, but otherwise it's not enough and we still get a "Synchronous Abort" when drawing at the bottom of the framebuffer.

For milos-fairphone-fp6 the framebuffer is reg=0xe3940000 size=0xa932c0 (2484*1116*4).

Quoted 7 lines

When just calling mmu_map_region with plat->size, then it's crashing at 0xe43d3000 even though everything up to 0xe43d32c0 should be mapped. With size+0x800 (or less) it was also still crashing, only size+0x1000 then worked.

Possible I just don't know enough about memory mapping things, so suggestions welcome! :)

This sounds more likely the synchronous aborts caused by cache prefetch of nearby reserved memory regions. I see there are some reserved mememory regions around the address space you have mentioned on Milos.

Quoted 8 lines

On Qcom platforms, the default memory map strategy is to map the overall DRAM space without excluding reserved reqions. One can exclude reserved regions in a SoC specific manner here [1] but it adds some runtime overhead. Give it a try for Milos as well in case it resolves your issue.

I think we still need to revisit that reserved memory strategy where default should rather be we unmap the reserved regions.

I think it would be nice to get dcache enabled with a very basic map and the livetree built pre-relocation, then when we go to build the full memory map and switch to it we can add this more complex logic without introducing a big slowdown. U-Boots MMU code will need further improvements to do all this properly.

Quoted 42 lines

[1] https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-snapdragon/board.c#L743

-Sumit

Quoted 37 lines
---
 drivers/video/simplefb.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/video/simplefb.c +6 -1
index 8d0772d4e51..e144fde697b 100644
@@ -9,6 +9,7 @@
 #include <log.h>
 #include <video.h>
 #include <asm/global_data.h>
+#include <asm/system.h>
 
 static int simple_video_probe(struct udevice *dev)
 {
@@ -37,6 +38,11 @@ static int simple_video_probe(struct udevice *dev)
 	plat->base = base;
 	plat->size = size;
 
+#ifdef CONFIG_ARM64
+	/* The framebuffer buffer might not be mapped on some devices */
+	mmu_map_region((phys_addr_t)plat->base, (phys_addr_t)plat->size + 0x1000, false);
+#endif
+
 	video_set_flush_dcache(dev, true);
 
 	debug("%s: Query resolution...\n", __func__);
 
---

base-commit: ba7bf918dafcd093ad733b07ba490baeb20cf5da
change-id: 20260318-simplefb-map-abb9dba0eed1

Best regards,

Signature · 1 line
Luca Weiss <[email protected]>
Signature · 1 line
// Casey (she/her)