Skip to contentSkip to conversation

board_f: Fix corruption of relocaddr

PATCH In review Simon Glass 4 participants 26 messages Jul 31, 2023 – Oct 16, 2023 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH v3 5/9 board_f: Fix corruption of relocaddr

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

 common/board_f.c      | 3 ++-
 drivers/video/Kconfig | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
 		if (!ho)
 			return log_msg_ret("blf", -ENOENT);
 		video_reserve_from_bloblist(ho);
-		gd->relocaddr = ho->fb;
+		if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+			gd->relocaddr = ho->fb;
 	} else if (CONFIG_IS_ENABLED(VIDEO)) {
 		ulong addr;
 		int ret;
drivers/video/Kconfig +9 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
 	  if this  option is enabled video driver will be removed at the end of
 	  SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+	bool
+	help
+	  This adjusts reserve_video() to redirect memory reservation when it
+	  sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+	  memory used for framebuffer from being allocated by U-Boot proper,
+	  thus preventing any further memory reservations done by U-Boot proper
+	  from overwriting the framebuffer.
+
 if SPL_SPLASH_SCREEN
 
 config SPL_SPLASH_SCREEN_ALIGN
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#1 lore raw
Quoted 45 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

 common/board_f.c      | 3 ++-
 drivers/video/Kconfig | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
 		if (!ho)
 			return log_msg_ret("blf", -ENOENT);
 		video_reserve_from_bloblist(ho);
-		gd->relocaddr = ho->fb;
+		if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+			gd->relocaddr = ho->fb;
 	} else if (CONFIG_IS_ENABLED(VIDEO)) {
 		ulong addr;
 		int ret;
drivers/video/Kconfig +2 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
 	  if this  option is enabled video driver will be removed at the end of
 	  SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+	bool

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 10 lines
drivers/video/Kconfig +7 -0
+	help
+	  This adjusts reserve_video() to redirect memory reservation when it
+	  sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+	  memory used for framebuffer from being allocated by U-Boot proper,
+	  thus preventing any further memory reservations done by U-Boot proper
+	  from overwriting the framebuffer.
+
 if SPL_SPLASH_SCREEN
 
 config SPL_SPLASH_SCREEN_ALIGN

Nothing selects this and it's not offered as a choice, so now we've just broken the original case?

Signature · 1 line
Tom
#2 lore raw

Hi Tom,

Quoted 57 lines · Tom Rini
Quoted 54 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

 common/board_f.c      | 3 ++-
 drivers/video/Kconfig | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
              if (!ho)
                      return log_msg_ret("blf", -ENOENT);
              video_reserve_from_bloblist(ho);
-             gd->relocaddr = ho->fb;
+             if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+                     gd->relocaddr = ho->fb;
      } else if (CONFIG_IS_ENABLED(VIDEO)) {
              ulong addr;
              int ret;
drivers/video/Kconfig +9 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
        if this  option is enabled video driver will be removed at the end of
        SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+     bool
+     help
+       This adjusts reserve_video() to redirect memory reservation when it
+       sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+       memory used for framebuffer from being allocated by U-Boot proper,
+       thus preventing any further memory reservations done by U-Boot proper
+       from overwriting the framebuffer.
+
 if SPL_SPLASH_SCREEN
 
Quoted 4 lines

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 1 line
drivers/video/Kconfig +0 -0
 config SPL_SPLASH_SCREEN_ALIGN

Nothing selects this and it's not offered as a choice, so now we've just broken the original case?

Yes, I should have mentioned that. I'm not sure which board(s) need this option selected.

Devarsh, do you know?

Regards,
Simon

#3 lore raw
Quoted 65 lines · Simon Glass

Hi Tom,

Quoted 57 lines · Tom Rini
Quoted 54 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

 common/board_f.c      | 3 ++-
 drivers/video/Kconfig | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
              if (!ho)
                      return log_msg_ret("blf", -ENOENT);
              video_reserve_from_bloblist(ho);
-             gd->relocaddr = ho->fb;
+             if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+                     gd->relocaddr = ho->fb;
      } else if (CONFIG_IS_ENABLED(VIDEO)) {
              ulong addr;
              int ret;
drivers/video/Kconfig +9 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
        if this  option is enabled video driver will be removed at the end of
        SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+     bool
+     help
+       This adjusts reserve_video() to redirect memory reservation when it
+       sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+       memory used for framebuffer from being allocated by U-Boot proper,
+       thus preventing any further memory reservations done by U-Boot proper
+       from overwriting the framebuffer.
+
 if SPL_SPLASH_SCREEN
 
Quoted 4 lines

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 1 line
drivers/video/Kconfig +0 -0
 config SPL_SPLASH_SCREEN_ALIGN

Nothing selects this and it's not offered as a choice, so now we've just broken the original case?

Quoted 4 lines

Yes, I should have mentioned that. I'm not sure which board(s) need this option selected.

Devarsh, do you know?

And shouldn't this just be part of the normal flow when we have SPL_BLOBLIST && BLOBLIST, and not need a new symbol? I feel like I'm missing something here.

Signature · 1 line
Tom
#4 lore raw

Hi Tom,

Quoted 67 lines · Tom Rini
Quoted 65 lines · Simon Glass

Hi Tom,

Quoted 61 lines · Tom Rini
Quoted 45 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

 common/board_f.c      | 3 ++-
 drivers/video/Kconfig | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
              if (!ho)
                      return log_msg_ret("blf", -ENOENT);
              video_reserve_from_bloblist(ho);
-             gd->relocaddr = ho->fb;
+             if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+                     gd->relocaddr = ho->fb;
      } else if (CONFIG_IS_ENABLED(VIDEO)) {
              ulong addr;
              int ret;
drivers/video/Kconfig +2 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
        if this  option is enabled video driver will be removed at the end of
        SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+     bool

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 10 lines
drivers/video/Kconfig +7 -0
+     help
+       This adjusts reserve_video() to redirect memory reservation when it
+       sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+       memory used for framebuffer from being allocated by U-Boot proper,
+       thus preventing any further memory reservations done by U-Boot proper
+       from overwriting the framebuffer.
+
 if SPL_SPLASH_SCREEN
 
 config SPL_SPLASH_SCREEN_ALIGN

Nothing selects this and it's not offered as a choice, so now we've just broken the original case?

Quoted 8 lines
Quoted 4 lines

Yes, I should have mentioned that. I'm not sure which board(s) need this option selected.

Devarsh, do you know?

And shouldn't this just be part of the normal flow when we have SPL_BLOBLIST && BLOBLIST, and not need a new symbol? I feel like I'm missing something here.

Most of the discussion was on the v1 patch.

https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Regards,
Simon

#5 lore raw
Quoted 75 lines · Simon Glass

Hi Tom,

Quoted 72 lines · Tom Rini
Quoted 69 lines · Simon Glass

Hi Tom,

Quoted 57 lines · Tom Rini
Quoted 54 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

 common/board_f.c      | 3 ++-
 drivers/video/Kconfig | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
              if (!ho)
                      return log_msg_ret("blf", -ENOENT);
              video_reserve_from_bloblist(ho);
-             gd->relocaddr = ho->fb;
+             if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+                     gd->relocaddr = ho->fb;
      } else if (CONFIG_IS_ENABLED(VIDEO)) {
              ulong addr;
              int ret;
drivers/video/Kconfig +9 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
        if this  option is enabled video driver will be removed at the end of
        SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+     bool
+     help
+       This adjusts reserve_video() to redirect memory reservation when it
+       sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+       memory used for framebuffer from being allocated by U-Boot proper,
+       thus preventing any further memory reservations done by U-Boot proper
+       from overwriting the framebuffer.
+
 if SPL_SPLASH_SCREEN
 
Quoted 4 lines

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 1 line
drivers/video/Kconfig +0 -0
 config SPL_SPLASH_SCREEN_ALIGN

Nothing selects this and it's not offered as a choice, so now we've just broken the original case?

Yes, I should have mentioned that. I'm not sure which board(s) need this option selected.

Devarsh, do you know?

Quoted 7 lines
Quoted 3 lines

And shouldn't this just be part of the normal flow when we have SPL_BLOBLIST && BLOBLIST, and not need a new symbol? I feel like I'm missing something here.

Most of the discussion was on the v1 patch.

https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

OK, yeah. It seems like something more needs to be done then since "don't flicker the screen" is pretty much always the case if we have splash screen / video set up in SPL. Perhaps the case where that's not true should just be treated as the uncommon one, so we can do the ram_top suggestion normally?

Signature · 1 line
Tom
#6 lore raw

Hi Tom,

Quoted 83 lines · Tom Rini
Quoted 81 lines · Simon Glass

Hi Tom,

Quoted 67 lines · Tom Rini
Quoted 65 lines · Simon Glass

Hi Tom,

Quoted 61 lines · Tom Rini
Quoted 45 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

 common/board_f.c      | 3 ++-
 drivers/video/Kconfig | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
              if (!ho)
                      return log_msg_ret("blf", -ENOENT);
              video_reserve_from_bloblist(ho);
-             gd->relocaddr = ho->fb;
+             if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+                     gd->relocaddr = ho->fb;
      } else if (CONFIG_IS_ENABLED(VIDEO)) {
              ulong addr;
              int ret;
drivers/video/Kconfig +2 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
        if this  option is enabled video driver will be removed at the end of
        SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+     bool

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 10 lines
drivers/video/Kconfig +7 -0
+     help
+       This adjusts reserve_video() to redirect memory reservation when it
+       sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+       memory used for framebuffer from being allocated by U-Boot proper,
+       thus preventing any further memory reservations done by U-Boot proper
+       from overwriting the framebuffer.
+
 if SPL_SPLASH_SCREEN
 
 config SPL_SPLASH_SCREEN_ALIGN

Nothing selects this and it's not offered as a choice, so now we've just broken the original case?

Quoted 8 lines
Quoted 4 lines

Yes, I should have mentioned that. I'm not sure which board(s) need this option selected.

Devarsh, do you know?

And shouldn't this just be part of the normal flow when we have SPL_BLOBLIST && BLOBLIST, and not need a new symbol? I feel like I'm missing something here.

Most of the discussion was on the v1 patch.

Quoted 7 lines
Quoted 1 line

https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

OK, yeah. It seems like something more needs to be done then since "don't flicker the screen" is pretty much always the case if we have splash screen / video set up in SPL. Perhaps the case where that's not true should just be treated as the uncommon one, so we can do the ram_top suggestion normally?

Yes I think that would be best. Also the video info needs to be fully filled out to fix the x86 problem.

Regards,
Simon

#7 lore raw

Hi Tom, Simon,

Thanks for sharing all the information.

Quoted 94 lines · Simon Glass

Hi Tom,

Quoted 90 lines · Tom Rini
Quoted 75 lines · Simon Glass

Hi Tom,

Quoted 72 lines · Tom Rini
Quoted 69 lines · Simon Glass

Hi Tom,

Quoted 57 lines · Tom Rini
Quoted 54 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

 common/board_f.c      | 3 ++-
 drivers/video/Kconfig | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
              if (!ho)
                      return log_msg_ret("blf", -ENOENT);
              video_reserve_from_bloblist(ho);
-             gd->relocaddr = ho->fb;
+             if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+                     gd->relocaddr = ho->fb;
      } else if (CONFIG_IS_ENABLED(VIDEO)) {
              ulong addr;
              int ret;
drivers/video/Kconfig +9 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
        if this  option is enabled video driver will be removed at the end of
        SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+     bool
+     help
+       This adjusts reserve_video() to redirect memory reservation when it
+       sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+       memory used for framebuffer from being allocated by U-Boot proper,
+       thus preventing any further memory reservations done by U-Boot proper
+       from overwriting the framebuffer.
+
 if SPL_SPLASH_SCREEN
 
Quoted 4 lines

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 1 line
drivers/video/Kconfig +0 -0
 config SPL_SPLASH_SCREEN_ALIGN

Nothing selects this and it's not offered as a choice, so now we've just broken the original case?

Yes, I should have mentioned that. I'm not sure which board(s) need this option selected.

Devarsh, do you know?

Quoted 7 lines
Quoted 3 lines

And shouldn't this just be part of the normal flow when we have SPL_BLOBLIST && BLOBLIST, and not need a new symbol? I feel like I'm missing something here.

Most of the discussion was on the v1 patch.

https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

OK, yeah. It seems like something more needs to be done then since "don't flicker the screen" is pretty much always the case if we have splash screen / video set up in SPL. Perhaps the case where that's not true should just be treated as the uncommon one, so we can do the ram_top suggestion normally?

The gd->relocaddr points to ram_top at the start and framebuffer is not the first region, I think TLB table is reserved first and then the framebuffer, so I am not sure if it is good idea to move ram_top since old ram_top is already used for reserving page table.

As per my opinion
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
should suffice to fix this issue ?

Simon,
Could you please try with above patch once? ?
In your case ,
gd->relocaddr=c0000000, ho->fb=d0000000

so the relocaddr is already below the framebuffer so condition won't hold true and relocaddr won't get updated.

Quoted 3 lines

Yes I think that would be best. Also the video info needs to be fully filled out to fix the x86 problem.

Sorry I didn't get this, As i understand by the time video_reserve is called only driver is bound but not yet probed and I think below fields are only filled after driver is probed, this for most video drivers as I see.

        u32 size;
        u16 xsize;
        u16 ysize;
        u32 line_length;

So all these fields are zero in the handoff structure.

Kindly let me know if any queries or issues faced.

Regards
Devarsh

Quoted 2 lines

Regards,
Simon

#8 lore raw

Hi Devarsh,

Quoted 110 lines · Devarsh Thakkar

Hi Tom, Simon,

Thanks for sharing all the information.

Quoted 94 lines · Simon Glass

Hi Tom,

Quoted 90 lines · Tom Rini
Quoted 75 lines · Simon Glass

Hi Tom,

Quoted 72 lines · Tom Rini
Quoted 69 lines · Simon Glass

Hi Tom,

Quoted 57 lines · Tom Rini
Quoted 54 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

 common/board_f.c      | 3 ++-
 drivers/video/Kconfig | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
              if (!ho)
                      return log_msg_ret("blf", -ENOENT);
              video_reserve_from_bloblist(ho);
-             gd->relocaddr = ho->fb;
+             if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+                     gd->relocaddr = ho->fb;
      } else if (CONFIG_IS_ENABLED(VIDEO)) {
              ulong addr;
              int ret;
drivers/video/Kconfig +9 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
        if this  option is enabled video driver will be removed at the end of
        SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+     bool
+     help
+       This adjusts reserve_video() to redirect memory reservation when it
+       sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+       memory used for framebuffer from being allocated by U-Boot proper,
+       thus preventing any further memory reservations done by U-Boot proper
+       from overwriting the framebuffer.
+
 if SPL_SPLASH_SCREEN
 
Quoted 4 lines

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 1 line
drivers/video/Kconfig +0 -0
 config SPL_SPLASH_SCREEN_ALIGN

Nothing selects this and it's not offered as a choice, so now we've just broken the original case?

Yes, I should have mentioned that. I'm not sure which board(s) need this option selected.

Devarsh, do you know?

Quoted 7 lines
Quoted 3 lines

And shouldn't this just be part of the normal flow when we have SPL_BLOBLIST && BLOBLIST, and not need a new symbol? I feel like I'm missing something here.

Most of the discussion was on the v1 patch.

https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

OK, yeah. It seems like something more needs to be done then since "don't flicker the screen" is pretty much always the case if we have splash screen / video set up in SPL. Perhaps the case where that's not true should just be treated as the uncommon one, so we can do the ram_top suggestion normally?

The gd->relocaddr points to ram_top at the start and framebuffer is not the first region, I think TLB table is reserved first and then the framebuffer, so I am not sure if it is good idea to move ram_top since old ram_top is already used for reserving page table.

As per my opinion
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
should suffice to fix this issue ?

Quoted 7 lines

Simon,
Could you please try with above patch once? ?
In your case ,
gd->relocaddr=c0000000, ho->fb=d0000000

so the relocaddr is already below the framebuffer so condition won't hold true and relocaddr won't get updated.

Yes I replied to the patch. It is a strange heuristic, IMO, and we should avoid this sort of thing. But if that is the only acceptable solution, we can go with it.

Quoted 9 lines
Quoted 4 lines

Yes I think that would be best. Also the video info needs to be fully filled out to fix the x86 problem.

Sorry I didn't get this, As i understand by the time video_reserve is called only driver is bound but not yet probed and I think below fields are only filled after driver is probed, this for most video drivers as I see.

Quoted 8 lines
        u32 size;
        u16 xsize;
        u16 ysize;
        u32 line_length;

So all these fields are zero in the handoff structure.

Kindly let me know if any queries or issues faced.

Right, so you need to fill these in when the video is probed in SPL, not before. By leaving them out, you are breaking U-Boot proper which is expecting these values.

Regards,
Simon

Reviewed-by on v3 5/9
#9 lore raw
In reply to Simon Glass
Quoted 3 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory

typo: interferes

Quoted 43 lines

allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

 common/board_f.c      | 3 ++-
 drivers/video/Kconfig | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
                if (!ho)
                        return log_msg_ret("blf", -ENOENT);
                video_reserve_from_bloblist(ho);
-               gd->relocaddr = ho->fb;
+               if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+                       gd->relocaddr = ho->fb;
        } else if (CONFIG_IS_ENABLED(VIDEO)) {
                ulong addr;
                int ret;
drivers/video/Kconfig +2 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
          if this  option is enabled video driver will be removed at the end of
          SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+       bool

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 10 lines
drivers/video/Kconfig +7 -0
+       help
+         This adjusts reserve_video() to redirect memory reservation when it
+         sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+         memory used for framebuffer from being allocated by U-Boot proper,
+         thus preventing any further memory reservations done by U-Boot proper
+         from overwriting the framebuffer.
+
 if SPL_SPLASH_SCREEN
 
 config SPL_SPLASH_SCREEN_ALIGN
#10 lore raw
Quoted 60 lines · Bin Meng
Quoted 3 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory

typo: interferes

Quoted 52 lines

allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

 common/board_f.c      | 3 ++-
 drivers/video/Kconfig | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
                if (!ho)
                        return log_msg_ret("blf", -ENOENT);
                video_reserve_from_bloblist(ho);
-               gd->relocaddr = ho->fb;
+               if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+                       gd->relocaddr = ho->fb;
        } else if (CONFIG_IS_ENABLED(VIDEO)) {
                ulong addr;
                int ret;
drivers/video/Kconfig +9 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
          if this  option is enabled video driver will be removed at the end of
          SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+       bool
+       help
+         This adjusts reserve_video() to redirect memory reservation when it
+         sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+         memory used for framebuffer from being allocated by U-Boot proper,
+         thus preventing any further memory reservations done by U-Boot proper
+         from overwriting the framebuffer.
+
 if SPL_SPLASH_SCREEN
 
Quoted 3 lines

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 1 line
drivers/video/Kconfig +0 -0
 config SPL_SPLASH_SCREEN_ALIGN

applied to u-boot-x86, thanks!

#11 lore raw
Quoted 61 lines · Bin Meng
Quoted 60 lines · Bin Meng
Quoted 3 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory

typo: interferes

Quoted 52 lines

allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

 common/board_f.c      | 3 ++-
 drivers/video/Kconfig | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
                if (!ho)
                        return log_msg_ret("blf", -ENOENT);
                video_reserve_from_bloblist(ho);
-               gd->relocaddr = ho->fb;
+               if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+                       gd->relocaddr = ho->fb;
        } else if (CONFIG_IS_ENABLED(VIDEO)) {
                ulong addr;
                int ret;
drivers/video/Kconfig +9 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
          if this  option is enabled video driver will be removed at the end of
          SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+       bool
+       help
+         This adjusts reserve_video() to redirect memory reservation when it
+         sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+         memory used for framebuffer from being allocated by U-Boot proper,
+         thus preventing any further memory reservations done by U-Boot proper
+         from overwriting the framebuffer.
+
 if SPL_SPLASH_SCREEN
 
Quoted 5 lines
Quoted 3 lines

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 1 line
drivers/video/Kconfig +0 -0
 config SPL_SPLASH_SCREEN_ALIGN

applied to u-boot-x86, thanks!

This isn't the right path, we need to test:
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Signature · 1 line
Tom
#12 lore raw

Hi Tom, Simon,

Quoted 63 lines · Tom Rini
Quoted 61 lines · Bin Meng
Quoted 60 lines · Bin Meng
Quoted 3 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory

typo: interferes

Quoted 52 lines

allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

 common/board_f.c      | 3 ++-
 drivers/video/Kconfig | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
                if (!ho)
                        return log_msg_ret("blf", -ENOENT);
                video_reserve_from_bloblist(ho);
-               gd->relocaddr = ho->fb;
+               if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+                       gd->relocaddr = ho->fb;
        } else if (CONFIG_IS_ENABLED(VIDEO)) {
                ulong addr;
                int ret;
drivers/video/Kconfig +9 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
          if this  option is enabled video driver will be removed at the end of
          SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+       bool
+       help
+         This adjusts reserve_video() to redirect memory reservation when it
+         sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+         memory used for framebuffer from being allocated by U-Boot proper,
+         thus preventing any further memory reservations done by U-Boot proper
+         from overwriting the framebuffer.
+
 if SPL_SPLASH_SCREEN
 
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 1 line
drivers/video/Kconfig +0 -0
 config SPL_SPLASH_SCREEN_ALIGN

applied to u-boot-x86, thanks!

This isn't the right path, we need to test:
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

I can drop this commit and apply Devarsh's one, but looks there are some arguments.

Let me know which one is the preferred approach.

Regards,
Bin

#13 lore raw

Hi Bin,

Quoted 73 lines · Bin Meng

Hi Tom, Simon,

Quoted 69 lines · Tom Rini
Quoted 66 lines · Bin Meng
Quoted 60 lines · Bin Meng
Quoted 3 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory

typo: interferes

Quoted 52 lines

allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

 common/board_f.c      | 3 ++-
 drivers/video/Kconfig | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
                if (!ho)
                        return log_msg_ret("blf", -ENOENT);
                video_reserve_from_bloblist(ho);
-               gd->relocaddr = ho->fb;
+               if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+                       gd->relocaddr = ho->fb;
        } else if (CONFIG_IS_ENABLED(VIDEO)) {
                ulong addr;
                int ret;
drivers/video/Kconfig +9 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
          if this  option is enabled video driver will be removed at the end of
          SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+       bool
+       help
+         This adjusts reserve_video() to redirect memory reservation when it
+         sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+         memory used for framebuffer from being allocated by U-Boot proper,
+         thus preventing any further memory reservations done by U-Boot proper
+         from overwriting the framebuffer.
+
 if SPL_SPLASH_SCREEN
 
Quoted 3 lines

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 1 line
drivers/video/Kconfig +0 -0
 config SPL_SPLASH_SCREEN_ALIGN

applied to u-boot-x86, thanks!

Quoted 7 lines
Quoted 2 lines

This isn't the right path, we need to test:
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

I can drop this commit and apply Devarsh's one, but looks there are some arguments.

Let me know which one is the preferred approach.

We can take that one at least for now...I have spent enough time trying to explain the problem.

Regards,
Simon

#14 lore raw
In reply to Bin Meng
Quoted 62 lines · Bin Meng
Quoted 60 lines · Bin Meng
Quoted 3 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory

typo: interferes

Quoted 52 lines

allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

 common/board_f.c      | 3 ++-
 drivers/video/Kconfig | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
                if (!ho)
                        return log_msg_ret("blf", -ENOENT);
                video_reserve_from_bloblist(ho);
-               gd->relocaddr = ho->fb;
+               if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+                       gd->relocaddr = ho->fb;
        } else if (CONFIG_IS_ENABLED(VIDEO)) {
                ulong addr;
                int ret;
drivers/video/Kconfig +9 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
          if this  option is enabled video driver will be removed at the end of
          SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+       bool
+       help
+         This adjusts reserve_video() to redirect memory reservation when it
+         sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+         memory used for framebuffer from being allocated by U-Boot proper,
+         thus preventing any further memory reservations done by U-Boot proper
+         from overwriting the framebuffer.
+
 if SPL_SPLASH_SCREEN
 
Quoted 5 lines
Quoted 3 lines

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 1 line
drivers/video/Kconfig +0 -0
 config SPL_SPLASH_SCREEN_ALIGN

applied to u-boot-x86, thanks!

Dropped this one from the x86 queue per the discussion.

Regards,
Bin

#15 lore raw

Hi Devarsh, Nikhil, Tom,

Quoted 64 lines · Bin Meng
Quoted 62 lines · Bin Meng
Quoted 60 lines · Bin Meng
Quoted 3 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory

typo: interferes

Quoted 52 lines

allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

 common/board_f.c      | 3 ++-
 drivers/video/Kconfig | 9 +++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
                if (!ho)
                        return log_msg_ret("blf", -ENOENT);
                video_reserve_from_bloblist(ho);
-               gd->relocaddr = ho->fb;
+               if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+                       gd->relocaddr = ho->fb;
        } else if (CONFIG_IS_ENABLED(VIDEO)) {
                ulong addr;
                int ret;
drivers/video/Kconfig +9 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
          if this  option is enabled video driver will be removed at the end of
          SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+       bool
+       help
+         This adjusts reserve_video() to redirect memory reservation when it
+         sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+         memory used for framebuffer from being allocated by U-Boot proper,
+         thus preventing any further memory reservations done by U-Boot proper
+         from overwriting the framebuffer.
+
 if SPL_SPLASH_SCREEN
 
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 1 line
drivers/video/Kconfig +0 -0
 config SPL_SPLASH_SCREEN_ALIGN

applied to u-boot-x86, thanks!

Dropped this one from the x86 queue per the discussion.

I just wanted to come back to this discussion.

Do we have an agreed way forward? Who is waiting for who?

Regards,
Simon

#16 lore raw

Hi Simon, Tom,

Quoted 71 lines · Simon Glass

Hi Devarsh, Nikhil, Tom,

Quoted 68 lines · Bin Meng
Quoted 66 lines · Bin Meng
Quoted 63 lines · Bin Meng
Quoted 3 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory

typo: interferes

Quoted 43 lines

allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

  common/board_f.c      | 3 ++-
  drivers/video/Kconfig | 9 +++++++++
  2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
                 if (!ho)
                         return log_msg_ret("blf", -ENOENT);
                 video_reserve_from_bloblist(ho);
-               gd->relocaddr = ho->fb;
+               if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+                       gd->relocaddr = ho->fb;
         } else if (CONFIG_IS_ENABLED(VIDEO)) {
                 ulong addr;
                 int ret;
drivers/video/Kconfig +2 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
           if this  option is enabled video driver will be removed at the end of
           SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+       bool

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 10 lines
drivers/video/Kconfig +7 -0
+       help
+         This adjusts reserve_video() to redirect memory reservation when it
+         sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+         memory used for framebuffer from being allocated by U-Boot proper,
+         thus preventing any further memory reservations done by U-Boot proper
+         from overwriting the framebuffer.
+
  if SPL_SPLASH_SCREEN
 
  config SPL_SPLASH_SCREEN_ALIGN
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

applied to u-boot-x86, thanks!

Dropped this one from the x86 queue per the discussion.

I just wanted to come back to this discussion.

Do we have an agreed way forward? Who is waiting for who?

I was waiting on feedback on https://lore.kernel.org/all/[email protected]/ but per my opinion, I would prefer to go with "Approach 2" with a Kconfig as it looks simpler to me. It would look something like below :

if (gd->relocaddr > (unsigned long)ho->fb) {
     ulong fb_reloc_gap = gd->relocaddr - gd->ho->fb;

     /* Relocate after framebuffer area if nearing too close to it */
     if (fb_reloc_gap < CONFIG_BLOBLIST_FB_RELOC_MIN_GAP)
            gd->relocaddr = ho->fb;
}

Regarding CONFIG_BLOBLIST_FB_RELOC_MIN_GAP
-> This describes minimum gap to keep between framebuffer address and relocation address to avoid overlap when framebuffer address used by blob is below the current relocation address

-> It would be selected as default when CONFIG_BLOBLIST is selected with
default value set to 100Mb

-> SoC specific Vendors can override this in their defconfigs to a custom value if they feel 100Mb is not enough

Also probably we can have some debug/error prints in the code to show overlap happened (or is going happen) so that users can fine tune this Kconfig if they got it wrong at first place.

I can re-spin updated patch if we are aligned on this, Kindly let me know your opinion.

Regards
Devarsh

Quoted 2 lines

Regards,
Simon

#17 lore raw

Hi Devarsh,

Quoted 108 lines · Devarsh Thakkar

Hi Simon, Tom,

Quoted 71 lines · Simon Glass

Hi Devarsh, Nikhil, Tom,

Quoted 68 lines · Bin Meng
Quoted 66 lines · Bin Meng
Quoted 63 lines · Bin Meng
Quoted 3 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory

typo: interferes

Quoted 43 lines

allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

  common/board_f.c      | 3 ++-
  drivers/video/Kconfig | 9 +++++++++
  2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
                 if (!ho)
                         return log_msg_ret("blf", -ENOENT);
                 video_reserve_from_bloblist(ho);
-               gd->relocaddr = ho->fb;
+               if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+                       gd->relocaddr = ho->fb;
         } else if (CONFIG_IS_ENABLED(VIDEO)) {
                 ulong addr;
                 int ret;
drivers/video/Kconfig +2 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
           if this  option is enabled video driver will be removed at the end of
           SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+       bool

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 10 lines
drivers/video/Kconfig +7 -0
+       help
+         This adjusts reserve_video() to redirect memory reservation when it
+         sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+         memory used for framebuffer from being allocated by U-Boot proper,
+         thus preventing any further memory reservations done by U-Boot proper
+         from overwriting the framebuffer.
+
  if SPL_SPLASH_SCREEN
 
  config SPL_SPLASH_SCREEN_ALIGN
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

applied to u-boot-x86, thanks!

Dropped this one from the x86 queue per the discussion.

I just wanted to come back to this discussion.

Do we have an agreed way forward? Who is waiting for who?

I was waiting on feedback on
https://lore.kernel.org/all/[email protected]/
but per my opinion, I would prefer to go with "Approach 2" with a Kconfig as it looks simpler to me. It would look something like below :

if (gd->relocaddr > (unsigned long)ho->fb) {
      ulong fb_reloc_gap = gd->relocaddr - gd->ho->fb;

      /* Relocate after framebuffer area if nearing too close to it */
      if (fb_reloc_gap < CONFIG_BLOBLIST_FB_RELOC_MIN_GAP)
             gd->relocaddr = ho->fb;
}

Regarding CONFIG_BLOBLIST_FB_RELOC_MIN_GAP
-> This describes minimum gap to keep between framebuffer address and relocation address to avoid overlap when framebuffer address used by blob is below the current relocation address

-> It would be selected as default when CONFIG_BLOBLIST is selected with
default value set to 100Mb

-> SoC specific Vendors can override this in their defconfigs to a custom value if they feel 100Mb is not enough

Quoted 6 lines

Also probably we can have some debug/error prints in the code to show overlap happened (or is going happen) so that users can fine tune this Kconfig if they got it wrong at first place.

I can re-spin updated patch if we are aligned on this, Kindly let me know your opinion.

I'm just nervous about the whole idea, TBH. Perhaps I am missing some documentation on how people are supposed to lay out memory in SPL and U-Boot properr, but I'm not really aware of any guidance we give.

Perhaps we should say that the SPL frame buffer should be at the top of memory, and U-Boot's reserve area should start below that?

Regards,
Simon

#18 lore raw

Hi Simon,

Quoted 118 lines · Simon Glass

Hi Devarsh,

Quoted 108 lines · Devarsh Thakkar

Hi Simon, Tom,

Quoted 71 lines · Simon Glass

Hi Devarsh, Nikhil, Tom,

Quoted 68 lines · Bin Meng
Quoted 66 lines · Bin Meng
Quoted 63 lines · Bin Meng
Quoted 3 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory

typo: interferes

Quoted 43 lines

allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

  common/board_f.c      | 3 ++-
  drivers/video/Kconfig | 9 +++++++++
  2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
                 if (!ho)
                         return log_msg_ret("blf", -ENOENT);
                 video_reserve_from_bloblist(ho);
-               gd->relocaddr = ho->fb;
+               if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+                       gd->relocaddr = ho->fb;
         } else if (CONFIG_IS_ENABLED(VIDEO)) {
                 ulong addr;
                 int ret;
drivers/video/Kconfig +2 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
           if this  option is enabled video driver will be removed at the end of
           SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+       bool

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 10 lines
drivers/video/Kconfig +7 -0
+       help
+         This adjusts reserve_video() to redirect memory reservation when it
+         sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+         memory used for framebuffer from being allocated by U-Boot proper,
+         thus preventing any further memory reservations done by U-Boot proper
+         from overwriting the framebuffer.
+
  if SPL_SPLASH_SCREEN
 
  config SPL_SPLASH_SCREEN_ALIGN
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

applied to u-boot-x86, thanks!

Dropped this one from the x86 queue per the discussion.

I just wanted to come back to this discussion.

Do we have an agreed way forward? Who is waiting for who?

I was waiting on feedback on
https://lore.kernel.org/all/[email protected]/
but per my opinion, I would prefer to go with "Approach 2" with a Kconfig as it looks simpler to me. It would look something like below :

if (gd->relocaddr > (unsigned long)ho->fb) {
      ulong fb_reloc_gap = gd->relocaddr - gd->ho->fb;

      /* Relocate after framebuffer area if nearing too close to it */
      if (fb_reloc_gap < CONFIG_BLOBLIST_FB_RELOC_MIN_GAP)
             gd->relocaddr = ho->fb;
}

Regarding CONFIG_BLOBLIST_FB_RELOC_MIN_GAP
-> This describes minimum gap to keep between framebuffer address and relocation address to avoid overlap when framebuffer address used by blob is below the current relocation address

-> It would be selected as default when CONFIG_BLOBLIST is selected with
default value set to 100Mb

-> SoC specific Vendors can override this in their defconfigs to a custom value if they feel 100Mb is not enough

Quoted 6 lines

Also probably we can have some debug/error prints in the code to show overlap happened (or is going happen) so that users can fine tune this Kconfig if they got it wrong at first place.

I can re-spin updated patch if we are aligned on this, Kindly let me know your opinion.

Quoted 6 lines

I'm just nervous about the whole idea, TBH. Perhaps I am missing some documentation on how people are supposed to lay out memory in SPL and U-Boot properr, but I'm not really aware of any guidance we give.

Perhaps we should say that the SPL frame buffer should be at the top of memory, and U-Boot's reserve area should start below that?

1) As per my personal opinion, I don't like putting such constraints and would instead like to give some flexibility to end user for choosing framebuffer area as I earlier mentioned, as for that matter if we are using a predefined address then there is no need of using framebuffer address on videoblob,

2) Also per current reserve flow in u-boot using the reserve_video helper it reserve page table first and then framebuffer, so we would possibly have to change that order to do framebuffer reservation first at the top and that's why we required this condition patch at first place.

3) Also If we are thinking on lines of putting constraints then, I think current constraint i.e. "Relocation will always happen below the framebuffer area so that there is no overlap" as we put in the patch
https://lore.kernel.org/all/[email protected]/ seems little better to me as it gives little bit of flexiblity and avoids problem mentinoed in 2)

4) Also as per your feedback on this patch at
https://lore.kernel.org/all/CAPnjgZ03iQ6iu3gz=Xkp1vHS43=1XXEk2TKdYgj7v4FhxVbj9g@mail.gmail.com/
you mentioned a scenario where although framebuffer region is below current relocation pointer but the gap between the two is 1Gb so we don't require to move relocation pointer and instead continue reservations without worrying about overlap due to huge gap, so to address such scenarios I thought to go with this Kconfig approach.

5) From my POV, Ideal solution could be to have some function that estimates memory requirements for reservation and relocation well in advance and then we can take decision on whether to continue reservation from current relocaddr or move it after receiving the framebuffer address from videoblob but I am not sure how much feasible is it at this point and hence I suggested this Kconfig based approach.

Regards
Devarsh

Quoted 3 lines

Regards,
Simon

#19 lore raw
Quoted 125 lines · Devarsh Thakkar

Hi Simon,

Quoted 122 lines · Simon Glass

Hi Devarsh,

Quoted 108 lines · Devarsh Thakkar

Hi Simon, Tom,

Quoted 71 lines · Simon Glass

Hi Devarsh, Nikhil, Tom,

Quoted 68 lines · Bin Meng
Quoted 66 lines · Bin Meng
Quoted 63 lines · Bin Meng
Quoted 3 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory

typo: interferes

Quoted 43 lines

allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

  common/board_f.c      | 3 ++-
  drivers/video/Kconfig | 9 +++++++++
  2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
                 if (!ho)
                         return log_msg_ret("blf", -ENOENT);
                 video_reserve_from_bloblist(ho);
-               gd->relocaddr = ho->fb;
+               if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+                       gd->relocaddr = ho->fb;
         } else if (CONFIG_IS_ENABLED(VIDEO)) {
                 ulong addr;
                 int ret;
drivers/video/Kconfig +2 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
           if this  option is enabled video driver will be removed at the end of
           SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+       bool

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 10 lines
drivers/video/Kconfig +7 -0
+       help
+         This adjusts reserve_video() to redirect memory reservation when it
+         sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+         memory used for framebuffer from being allocated by U-Boot proper,
+         thus preventing any further memory reservations done by U-Boot proper
+         from overwriting the framebuffer.
+
  if SPL_SPLASH_SCREEN
 
  config SPL_SPLASH_SCREEN_ALIGN
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

applied to u-boot-x86, thanks!

Dropped this one from the x86 queue per the discussion.

I just wanted to come back to this discussion.

Do we have an agreed way forward? Who is waiting for who?

I was waiting on feedback on
https://lore.kernel.org/all/[email protected]/
but per my opinion, I would prefer to go with "Approach 2" with a Kconfig as it looks simpler to me. It would look something like below :

if (gd->relocaddr > (unsigned long)ho->fb) {
      ulong fb_reloc_gap = gd->relocaddr - gd->ho->fb;

      /* Relocate after framebuffer area if nearing too close to it */
      if (fb_reloc_gap < CONFIG_BLOBLIST_FB_RELOC_MIN_GAP)
             gd->relocaddr = ho->fb;
}

Regarding CONFIG_BLOBLIST_FB_RELOC_MIN_GAP
-> This describes minimum gap to keep between framebuffer address and relocation address to avoid overlap when framebuffer address used by blob is below the current relocation address

-> It would be selected as default when CONFIG_BLOBLIST is selected with
default value set to 100Mb

-> SoC specific Vendors can override this in their defconfigs to a custom value if they feel 100Mb is not enough

Quoted 6 lines

Also probably we can have some debug/error prints in the code to show overlap happened (or is going happen) so that users can fine tune this Kconfig if they got it wrong at first place.

I can re-spin updated patch if we are aligned on this, Kindly let me know your opinion.

I'm just nervous about the whole idea, TBH. Perhaps I am missing some documentation on how people are supposed to lay out memory in SPL and U-Boot properr, but I'm not really aware of any guidance we give.

Quoted 8 lines
Quoted 2 lines

Perhaps we should say that the SPL frame buffer should be at the top of memory, and U-Boot's reserve area should start below that?

1) As per my personal opinion, I don't like putting such constraints and would instead like to give some flexibility to end user for choosing framebuffer area as I earlier mentioned, as for that matter if we are using a predefined address then there is no need of using framebuffer address on videoblob,

I think this is the wrong direction. We need to offer strong defaults that shouldn't be deviated without good reason, rather than "pick what you want". Very few cases will deviate from the defaults, and of those it's hard to know if they're being changed for the best, or because someone didn't fully understand the implications and breaks something else.

Signature · 1 line
Tom
#20 lore raw

Hi Devarsh,

Quoted 136 lines · Tom Rini
Quoted 125 lines · Devarsh Thakkar

Hi Simon,

Quoted 122 lines · Simon Glass

Hi Devarsh,

Quoted 108 lines · Devarsh Thakkar

Hi Simon, Tom,

Quoted 71 lines · Simon Glass

Hi Devarsh, Nikhil, Tom,

Quoted 68 lines · Bin Meng
Quoted 66 lines · Bin Meng
Quoted 63 lines · Bin Meng
Quoted 3 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory

typo: interferes

Quoted 43 lines

allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

  common/board_f.c      | 3 ++-
  drivers/video/Kconfig | 9 +++++++++
  2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
                 if (!ho)
                         return log_msg_ret("blf", -ENOENT);
                 video_reserve_from_bloblist(ho);
-               gd->relocaddr = ho->fb;
+               if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+                       gd->relocaddr = ho->fb;
         } else if (CONFIG_IS_ENABLED(VIDEO)) {
                 ulong addr;
                 int ret;
drivers/video/Kconfig +2 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
           if this  option is enabled video driver will be removed at the end of
           SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+       bool

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 10 lines
drivers/video/Kconfig +7 -0
+       help
+         This adjusts reserve_video() to redirect memory reservation when it
+         sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+         memory used for framebuffer from being allocated by U-Boot proper,
+         thus preventing any further memory reservations done by U-Boot proper
+         from overwriting the framebuffer.
+
  if SPL_SPLASH_SCREEN
 
  config SPL_SPLASH_SCREEN_ALIGN
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

applied to u-boot-x86, thanks!

Dropped this one from the x86 queue per the discussion.

I just wanted to come back to this discussion.

Do we have an agreed way forward? Who is waiting for who?

I was waiting on feedback on
https://lore.kernel.org/all/[email protected]/
but per my opinion, I would prefer to go with "Approach 2" with a Kconfig as it looks simpler to me. It would look something like below :

if (gd->relocaddr > (unsigned long)ho->fb) {
      ulong fb_reloc_gap = gd->relocaddr - gd->ho->fb;

      /* Relocate after framebuffer area if nearing too close to it */
      if (fb_reloc_gap < CONFIG_BLOBLIST_FB_RELOC_MIN_GAP)
             gd->relocaddr = ho->fb;
}

Regarding CONFIG_BLOBLIST_FB_RELOC_MIN_GAP
-> This describes minimum gap to keep between framebuffer address and relocation address to avoid overlap when framebuffer address used by blob is below the current relocation address

-> It would be selected as default when CONFIG_BLOBLIST is selected with
default value set to 100Mb

-> SoC specific Vendors can override this in their defconfigs to a custom value if they feel 100Mb is not enough

Quoted 6 lines

Also probably we can have some debug/error prints in the code to show overlap happened (or is going happen) so that users can fine tune this Kconfig if they got it wrong at first place.

I can re-spin updated patch if we are aligned on this, Kindly let me know your opinion.

I'm just nervous about the whole idea, TBH. Perhaps I am missing some documentation on how people are supposed to lay out memory in SPL and U-Boot properr, but I'm not really aware of any guidance we give.

Quoted 8 lines
Quoted 2 lines

Perhaps we should say that the SPL frame buffer should be at the top of memory, and U-Boot's reserve area should start below that?

1) As per my personal opinion, I don't like putting such constraints and would instead like to give some flexibility to end user for choosing framebuffer area as I earlier mentioned, as for that matter if we are using a predefined address then there is no need of using framebuffer address on videoblob,

Quoted 6 lines

I think this is the wrong direction. We need to offer strong defaults that shouldn't be deviated without good reason, rather than "pick what you want". Very few cases will deviate from the defaults, and of those it's hard to know if they're being changed for the best, or because someone didn't fully understand the implications and breaks something else.

So what is next with this? I would like to clean it up...I feel that having SPL pass the top of usable RAM (below the framebuffer) is a reasonable solution. Does constraining things in that way cause any problems for TI?

Regards,
Simon

#21 lore raw

Hi Simon,

Quoted 146 lines · Simon Glass

Hi Devarsh,

Quoted 136 lines · Tom Rini
Quoted 125 lines · Devarsh Thakkar

Hi Simon,

Quoted 122 lines · Simon Glass

Hi Devarsh,

Quoted 108 lines · Devarsh Thakkar

Hi Simon, Tom,

Quoted 71 lines · Simon Glass

Hi Devarsh, Nikhil, Tom,

Quoted 68 lines · Bin Meng
Quoted 66 lines · Bin Meng
Quoted 63 lines · Bin Meng
Quoted 3 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory

typo: interferes

Quoted 43 lines

allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

  common/board_f.c      | 3 ++-
  drivers/video/Kconfig | 9 +++++++++
  2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
                 if (!ho)
                         return log_msg_ret("blf", -ENOENT);
                 video_reserve_from_bloblist(ho);
-               gd->relocaddr = ho->fb;
+               if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+                       gd->relocaddr = ho->fb;
         } else if (CONFIG_IS_ENABLED(VIDEO)) {
                 ulong addr;
                 int ret;
drivers/video/Kconfig +2 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
           if this  option is enabled video driver will be removed at the end of
           SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+       bool

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 10 lines
drivers/video/Kconfig +7 -0
+       help
+         This adjusts reserve_video() to redirect memory reservation when it
+         sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+         memory used for framebuffer from being allocated by U-Boot proper,
+         thus preventing any further memory reservations done by U-Boot proper
+         from overwriting the framebuffer.
+
  if SPL_SPLASH_SCREEN
 
  config SPL_SPLASH_SCREEN_ALIGN
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

applied to u-boot-x86, thanks!

Dropped this one from the x86 queue per the discussion.

I just wanted to come back to this discussion.

Do we have an agreed way forward? Who is waiting for who?

I was waiting on feedback on
https://lore.kernel.org/all/[email protected]/
but per my opinion, I would prefer to go with "Approach 2" with a Kconfig as it looks simpler to me. It would look something like below :

if (gd->relocaddr > (unsigned long)ho->fb) {
      ulong fb_reloc_gap = gd->relocaddr - gd->ho->fb;

      /* Relocate after framebuffer area if nearing too close to it */
      if (fb_reloc_gap < CONFIG_BLOBLIST_FB_RELOC_MIN_GAP)
             gd->relocaddr = ho->fb;
}

Regarding CONFIG_BLOBLIST_FB_RELOC_MIN_GAP
-> This describes minimum gap to keep between framebuffer address and relocation address to avoid overlap when framebuffer address used by blob is below the current relocation address

-> It would be selected as default when CONFIG_BLOBLIST is selected with
default value set to 100Mb

-> SoC specific Vendors can override this in their defconfigs to a custom value if they feel 100Mb is not enough

Quoted 6 lines

Also probably we can have some debug/error prints in the code to show overlap happened (or is going happen) so that users can fine tune this Kconfig if they got it wrong at first place.

I can re-spin updated patch if we are aligned on this, Kindly let me know your opinion.

I'm just nervous about the whole idea, TBH. Perhaps I am missing some documentation on how people are supposed to lay out memory in SPL and U-Boot properr, but I'm not really aware of any guidance we give.

Quoted 8 lines
Quoted 2 lines

Perhaps we should say that the SPL frame buffer should be at the top of memory, and U-Boot's reserve area should start below that?

1) As per my personal opinion, I don't like putting such constraints and would instead like to give some flexibility to end user for choosing framebuffer area as I earlier mentioned, as for that matter if we are using a predefined address then there is no need of using framebuffer address on videoblob,

Quoted 6 lines

I think this is the wrong direction. We need to offer strong defaults that shouldn't be deviated without good reason, rather than "pick what you want". Very few cases will deviate from the defaults, and of those it's hard to know if they're being changed for the best, or because someone didn't fully understand the implications and breaks something else.

Quoted 4 lines

So what is next with this? I would like to clean it up...I feel that having SPL pass the top of usable RAM (below the framebuffer) is a reasonable solution. Does constraining things in that way cause any problems for TI?

TBH, I am not fully able to visualize how this fits current arch :

So instead of blob address will we be passing ram_top inside the video blob ? .Or we will be using separate ram_top blob passing from SPL to u-boot ?

Are we planning to enforce some restriction/hardcoding for framebuffer to be reserved at specific address (near top of RAM) or it would be just a general guideline to keep framebuffer near the RAM top ?

Currently don't see video_reserve API put such constraint and user is free to call it anywhere and it just reserve after previously reserved areas. Now, with this approach I guess we would deviate from the agnostic behavior of video_reserve API then if we plan to update the same API ?

Also u-boot proper starts reserving regions for MMU and few other stuff much before reserving framebuffers so by the time we receive the blob containing updated ram_top, we would have already reserved those regions from old ram_top
so moving the ram_top here seems little counter-intuitive to me. In such
scenario, as per my opinion better option seems to be moving he gd->relocaddr instead.

Lastly, I think as much the user keep framebuffer way from ram_top that much memory will be lost even with this approach (as ram_top will be moved after framebuffer for u-boot proper) and same behavior will be observed with
https://lore.kernel.org/all/[email protected]/ too

but if we are planning to put just a general guideline to user to keep framebuffer near the RAM top then to me above patch looks much simpler than moving the ram_top.

Regards
Devarsh

Quoted 3 lines

Regards,
Simon

#22 lore raw

Hi Devarsh,

Quoted 155 lines · Devarsh Thakkar

Hi Simon,

Quoted 146 lines · Simon Glass

Hi Devarsh,

Quoted 136 lines · Tom Rini
Quoted 125 lines · Devarsh Thakkar

Hi Simon,

Quoted 122 lines · Simon Glass

Hi Devarsh,

Quoted 108 lines · Devarsh Thakkar

Hi Simon, Tom,

Quoted 71 lines · Simon Glass

Hi Devarsh, Nikhil, Tom,

Quoted 68 lines · Bin Meng
Quoted 66 lines · Bin Meng
Quoted 63 lines · Bin Meng
Quoted 3 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory

typo: interferes

Quoted 43 lines

allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

  common/board_f.c      | 3 ++-
  drivers/video/Kconfig | 9 +++++++++
  2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
                 if (!ho)
                         return log_msg_ret("blf", -ENOENT);
                 video_reserve_from_bloblist(ho);
-               gd->relocaddr = ho->fb;
+               if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+                       gd->relocaddr = ho->fb;
         } else if (CONFIG_IS_ENABLED(VIDEO)) {
                 ulong addr;
                 int ret;
drivers/video/Kconfig +2 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
           if this  option is enabled video driver will be removed at the end of
           SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+       bool

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 10 lines
drivers/video/Kconfig +7 -0
+       help
+         This adjusts reserve_video() to redirect memory reservation when it
+         sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+         memory used for framebuffer from being allocated by U-Boot proper,
+         thus preventing any further memory reservations done by U-Boot proper
+         from overwriting the framebuffer.
+
  if SPL_SPLASH_SCREEN
 
  config SPL_SPLASH_SCREEN_ALIGN
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

applied to u-boot-x86, thanks!

Dropped this one from the x86 queue per the discussion.

I just wanted to come back to this discussion.

Do we have an agreed way forward? Who is waiting for who?

I was waiting on feedback on
https://lore.kernel.org/all/[email protected]/
but per my opinion, I would prefer to go with "Approach 2" with a Kconfig as it looks simpler to me. It would look something like below :

if (gd->relocaddr > (unsigned long)ho->fb) {
      ulong fb_reloc_gap = gd->relocaddr - gd->ho->fb;

      /* Relocate after framebuffer area if nearing too close to it */
      if (fb_reloc_gap < CONFIG_BLOBLIST_FB_RELOC_MIN_GAP)
             gd->relocaddr = ho->fb;
}

Regarding CONFIG_BLOBLIST_FB_RELOC_MIN_GAP
-> This describes minimum gap to keep between framebuffer address and relocation address to avoid overlap when framebuffer address used by blob is below the current relocation address

-> It would be selected as default when CONFIG_BLOBLIST is selected with
default value set to 100Mb

-> SoC specific Vendors can override this in their defconfigs to a custom value if they feel 100Mb is not enough

Quoted 6 lines

Also probably we can have some debug/error prints in the code to show overlap happened (or is going happen) so that users can fine tune this Kconfig if they got it wrong at first place.

I can re-spin updated patch if we are aligned on this, Kindly let me know your opinion.

I'm just nervous about the whole idea, TBH. Perhaps I am missing some documentation on how people are supposed to lay out memory in SPL and U-Boot properr, but I'm not really aware of any guidance we give.

Quoted 8 lines
Quoted 2 lines

Perhaps we should say that the SPL frame buffer should be at the top of memory, and U-Boot's reserve area should start below that?

1) As per my personal opinion, I don't like putting such constraints and would instead like to give some flexibility to end user for choosing framebuffer area as I earlier mentioned, as for that matter if we are using a predefined address then there is no need of using framebuffer address on videoblob,

Quoted 6 lines

I think this is the wrong direction. We need to offer strong defaults that shouldn't be deviated without good reason, rather than "pick what you want". Very few cases will deviate from the defaults, and of those it's hard to know if they're being changed for the best, or because someone didn't fully understand the implications and breaks something else.

Quoted 4 lines

So what is next with this? I would like to clean it up...I feel that having SPL pass the top of usable RAM (below the framebuffer) is a reasonable solution. Does constraining things in that way cause any problems for TI?

Quoted 4 lines

TBH, I am not fully able to visualize how this fits current arch :

So instead of blob address will we be passing ram_top inside the video blob ? .Or we will be using separate ram_top blob passing from SPL to u-boot ?

Yes, a separate ram_top in the bloblist, not in the video blob.

Quoted 4 lines

Are we planning to enforce some restriction/hardcoding for framebuffer to be reserved at specific address (near top of RAM) or it would be just a general guideline to keep framebuffer near the RAM top ?

Well it makes sense to put it at the top, since U-Boot relocations itself to the top.

Quoted 13 lines

Currently don't see video_reserve API put such constraint and user is free to call it anywhere and it just reserve after previously reserved areas. Now, with this approach I guess we would deviate from the agnostic behavior of video_reserve API then if we plan to update the same API ?

Also u-boot proper starts reserving regions for MMU and few other stuff much before reserving framebuffers so by the time we receive the blob containing updated ram_top, we would have already reserved those regions from old ram_top
so moving the ram_top here seems little counter-intuitive to me. In such
scenario, as per my opinion better option seems to be moving he gd->relocaddr instead.

Quoted 8 lines

Lastly, I think as much the user keep framebuffer way from ram_top that much memory will be lost even with this approach (as ram_top will be moved after framebuffer for u-boot proper) and same behavior will be observed with
https://lore.kernel.org/all/[email protected]/ too

but if we are planning to put just a general guideline to user to keep framebuffer near the RAM top then to me above patch looks much simpler than moving the ram_top.

I don't really have any more to say here. This is all just confusing and I don't think it needs to be. If SPL allocs stuff, I believe it should do so at the top of memory, then tell U-Boot about it, so U-Boot's reservations can happen below that address.

Regards,
Simon

#23 lore raw

Hi Simon,

Quoted 158 lines · Simon Glass

Hi Devarsh,

Quoted 155 lines · Devarsh Thakkar

Hi Simon,

Quoted 150 lines · Simon Glass

Hi Devarsh,

Quoted 136 lines · Tom Rini
Quoted 125 lines · Devarsh Thakkar

Hi Simon,

Quoted 122 lines · Simon Glass

Hi Devarsh,

Quoted 108 lines · Devarsh Thakkar

Hi Simon, Tom,

Quoted 71 lines · Simon Glass

Hi Devarsh, Nikhil, Tom,

Quoted 68 lines · Bin Meng
Quoted 66 lines · Bin Meng
Quoted 63 lines · Bin Meng
Quoted 3 lines · Simon Glass

When the video framebuffer comes from the bloblist, we should not change relocaddr to this address, since it interfers with the normal memory

typo: interferes

Quoted 43 lines

allocation.

This fixes a boot loop in qemu-x86_64

Fixes 5bc610a7d9d ("common: board_f: Pass frame buffer info from SPL to u-boot")

---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

   common/board_f.c      | 3 ++-
   drivers/video/Kconfig | 9 +++++++++
   2 files changed, 11 insertions(+), 1 deletion(-)
common/board_f.c +2 -1
index 7d2c380e91e..5173d0a0c2d 100644
@@ -419,7 +419,8 @@ static int reserve_video(void)
                  if (!ho)
                          return log_msg_ret("blf", -ENOENT);
                  video_reserve_from_bloblist(ho);
-               gd->relocaddr = ho->fb;
+               if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+                       gd->relocaddr = ho->fb;
          } else if (CONFIG_IS_ENABLED(VIDEO)) {
                  ulong addr;
                  int ret;
drivers/video/Kconfig +2 -0
index b41dc60cec5..f2e56204d52 100644
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
            if this  option is enabled video driver will be removed at the end of
            SPL stage, beforeloading the next stage.
 
+config VIDEO_RESERVE_SPL
+       bool

drivers/video/Kconfig config SPL_VIDEO_REMOVE · line 1120

Quoted 10 lines
drivers/video/Kconfig +7 -0
+       help
+         This adjusts reserve_video() to redirect memory reservation when it
+         sees a video handoff blob (BLOBLISTT_U_BOOT_VIDEO). This avoids the
+         memory used for framebuffer from being allocated by U-Boot proper,
+         thus preventing any further memory reservations done by U-Boot proper
+         from overwriting the framebuffer.
+
   if SPL_SPLASH_SCREEN
 
   config SPL_SPLASH_SCREEN_ALIGN
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

applied to u-boot-x86, thanks!

Dropped this one from the x86 queue per the discussion.

I just wanted to come back to this discussion.

Do we have an agreed way forward? Who is waiting for who?

I was waiting on feedback on
https://lore.kernel.org/all/[email protected]/
but per my opinion, I would prefer to go with "Approach 2" with a Kconfig as it looks simpler to me. It would look something like below :

if (gd->relocaddr > (unsigned long)ho->fb) {
       ulong fb_reloc_gap = gd->relocaddr - gd->ho->fb;

       /* Relocate after framebuffer area if nearing too close to it */
       if (fb_reloc_gap < CONFIG_BLOBLIST_FB_RELOC_MIN_GAP)
              gd->relocaddr = ho->fb;
}

Regarding CONFIG_BLOBLIST_FB_RELOC_MIN_GAP
-> This describes minimum gap to keep between framebuffer address and relocation address to avoid overlap when framebuffer address used by blob is below the current relocation address

-> It would be selected as default when CONFIG_BLOBLIST is selected with
default value set to 100Mb

-> SoC specific Vendors can override this in their defconfigs to a custom value if they feel 100Mb is not enough

Quoted 6 lines

Also probably we can have some debug/error prints in the code to show overlap happened (or is going happen) so that users can fine tune this Kconfig if they got it wrong at first place.

I can re-spin updated patch if we are aligned on this, Kindly let me know your opinion.

I'm just nervous about the whole idea, TBH. Perhaps I am missing some documentation on how people are supposed to lay out memory in SPL and U-Boot properr, but I'm not really aware of any guidance we give.

Quoted 8 lines
Quoted 2 lines

Perhaps we should say that the SPL frame buffer should be at the top of memory, and U-Boot's reserve area should start below that?

1) As per my personal opinion, I don't like putting such constraints and would instead like to give some flexibility to end user for choosing framebuffer area as I earlier mentioned, as for that matter if we are using a predefined address then there is no need of using framebuffer address on videoblob,

Quoted 6 lines

I think this is the wrong direction. We need to offer strong defaults that shouldn't be deviated without good reason, rather than "pick what you want". Very few cases will deviate from the defaults, and of those it's hard to know if they're being changed for the best, or because someone didn't fully understand the implications and breaks something else.

So what is next with this? I would like to clean it up...I feel that having SPL pass the top of usable RAM (below the framebuffer) is a reasonable solution. Does constraining things in that way cause any problems for TI?

Quoted 7 lines
Quoted 4 lines

TBH, I am not fully able to visualize how this fits current arch :

So instead of blob address will we be passing ram_top inside the video blob ? .Or we will be using separate ram_top blob passing from SPL to u-boot ?

Yes, a separate ram_top in the bloblist, not in the video blob.

Ok, but we still need to have video blob too for conveying frame-buffer information, right ?

Also, just wanted to check if we really require a ram_top blob to be passed b/w SPL to u-boot, I thought ram_top addr is know by both stages before-hand if so then, why pass the ram_top blob separately?

Quoted 25 lines
Quoted 4 lines

Are we planning to enforce some restriction/hardcoding for framebuffer to be reserved at specific address (near top of RAM) or it would be just a general guideline to keep framebuffer near the RAM top ?

Well it makes sense to put it at the top, since U-Boot relocations itself to the top. >

Quoted 18 lines

Currently don't see video_reserve API put such constraint and user is free to call it anywhere and it just reserve after previously reserved areas. Now, with this approach I guess we would deviate from the agnostic behavior of video_reserve API then if we plan to update the same API ?

Also u-boot proper starts reserving regions for MMU and few other stuff much before reserving framebuffers so by the time we receive the blob containing updated ram_top, we would have already reserved those regions from old ram_top
so moving the ram_top here seems little counter-intuitive to me. In such
scenario, as per my opinion better option seems to be moving he gd->relocaddr instead.

Lastly, I think as much the user keep framebuffer way from ram_top that much memory will be lost even with this approach (as ram_top will be moved after framebuffer for u-boot proper) and same behavior will be observed with
https://lore.kernel.org/all/[email protected]/ too

Quoted 9 lines
Quoted 3 lines

but if we are planning to put just a general guideline to user to keep framebuffer near the RAM top then to me above patch looks much simpler than moving the ram_top.

I don't really have any more to say here. This is all just confusing and I don't think it needs to be. If SPL allocs stuff, I believe it should do so at the top of memory, then tell U-Boot about it, so U-Boot's reservations can happen below that address.

Ok, thanks for explaining your design, I understand your suggestion here and the design you are proposing i.e. of putting framebuffer at the ram_top, I am just thinking on that if we are to go with this then what is the simplest way to fit it with current u-boot architecture where we are using same API i.e. video_reserve at SPL stage and u-boot proper for both reserving the memory, passing the blob and catching the blob for simplicity.

I think we can probably achieve the same thing what you are proposing, if at u-boot proper also we follow the same paradigm i.e. reserve the video memory first (or for that matter any region which is reserve-able by SPL), this way if u-boot call reserve_video function first in this sequence https://source.denx.de/u-boot/u-boot/-/blob/v2023.10-rc4/common/board_f.c?ref_type=tags#L943 then it will also trigger a call to video_reserve function which can read the blob and move the relocaddr as it is already doing (which is actually the ram_top since reserve_video is getting called at the start with this) after the reserved video area thus avoiding any gaps between reservations. This way we don't require to pass ram_top via blob.

Is that possible to update sequence at https://source.denx.de/u-boot/u-boot/-/blob/v2023.10-rc4/common/board_f.c?ref_type=tags#L943 to reserve video memory first since it is also shared/reserve-able with previous stage ? If so then I think we probably don't require much change there-after as blob will be read first and further reservation will only start below the frame-buffer area even with current video_reserve API.

Kindly let me know your opinion.

Regards
Devarsh

Quoted 2 lines

Regards,
Simon

#24 lore raw

Hi Devarsh,

Quoted 22 lines · Devarsh Thakkar

Hi Simon,

Quoted 18 lines · Simon Glass

Hi Devarsh,

Quoted 15 lines · Devarsh Thakkar

Hi Simon,

Quoted 11 lines · Simon Glass

Hi Devarsh,

Quoted 8 lines · Tom Rini
Quoted 6 lines · Devarsh Thakkar

Hi Simon,

Quoted 3 lines · Simon Glass

Hi Devarsh,

On Tue, 15 Aug 2023 at 03:23, Devarsh Thakkar <[email protected]>

Quoted 9 lines · wrote:
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Hi Simon, Tom,

Quoted 5 lines · Simon Glass

Hi Devarsh, Nikhil, Tom,

Quoted 2 lines · Bin Meng

On Thu, Aug 3, 2023 at 7:03 PM Bin Meng <[email protected]>

Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

On Thu, Aug 3, 2023 at 6:37 PM Bin Meng <[email protected]>

Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

On Tue, Aug 1, 2023 at 12:00 AM Simon Glass <[email protected]>

Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

When the video framebuffer comes from the bloblist, we

should not change

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

relocaddr to this address, since it interfers with the

normal memory

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

typo: interferes

Quoted 6 lines

allocation.

This fixes a boot loop in qemu-x86_64

Signed-off-by: Simon Glass <[email protected]>
Fixes: 5bc610a7d9d ("common: board_f: Pass frame buffer info

from SPL to u-boot")

Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines

Suggested-by: Nikhil M Jain <[email protected]>
---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

common/board_f.c | 3 ++-
drivers/video/Kconfig | 9 +++++++++
2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/common/board_f.c b/common/board_f.c
index 7d2c380e91e..5173d0a0c2d 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -419,7 +419,8 @@ static int reserve_video(void)
if (!ho)
return log_msg_ret("blf", -ENOENT);
video_reserve_from_bloblist(ho);
- gd->relocaddr = ho->fb;
+ if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+ gd->relocaddr = ho->fb;
} else if (CONFIG_IS_ENABLED(VIDEO)) {

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

ulong addr;
int ret;
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index b41dc60cec5..f2e56204d52 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
if this option is enabled video driver will be

removed at the end of

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

SPL stage, beforeloading the next stage.

+config VIDEO_RESERVE_SPL
+ bool
+ help
+ This adjusts reserve_video() to redirect memory

reservation when it

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

+ sees a video handoff blob

(BLOBLISTT_U_BOOT_VIDEO). This avoids the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

+ memory used for framebuffer from being allocated

by U-Boot proper,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

+ thus preventing any further memory reservations

done by U-Boot proper

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 9 lines
Quoted 7 lines
Quoted 5 lines

+ from overwriting the framebuffer.
+
if SPL_SPLASH_SCREEN

config SPL_SPLASH_SCREEN_ALIGN

applied to u-boot-x86, thanks!

Dropped this one from the x86 queue per the discussion.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

I just wanted to come back to this discussion.

Do we have an agreed way forward? Who is waiting for who?

I was waiting on feedback on

https://lore.kernel.org/all/[email protected]/

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

but per my opinion, I would prefer to go with "Approach 2" with a Kconfig as it looks simpler to me. It would look something like

below :

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
if (gd->relocaddr > (unsigned long)ho->fb) {
       ulong fb_reloc_gap = gd->relocaddr - gd->ho->fb;

       /* Relocate after framebuffer area if nearing too close to

it */

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

if (fb_reloc_gap < CONFIG_BLOBLIST_FB_RELOC_MIN_GAP)
gd->relocaddr = ho->fb;
}

Regarding CONFIG_BLOBLIST_FB_RELOC_MIN_GAP
-> This describes minimum gap to keep between framebuffer address

and

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

relocation address to avoid overlap when framebuffer address used

by

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

blob is below the current relocation address

-> It would be selected as default when CONFIG_BLOBLIST is

selected with

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

default value set to 100Mb

-> SoC specific Vendors can override this in their defconfigs to a custom value if they feel 100Mb is not enough

Also probably we can have some debug/error prints in the code to

show

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

overlap happened (or is going happen) so that users can fine tune

this

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

Kconfig if they got it wrong at first place.

I can re-spin updated patch if we are aligned on this, Kindly let me know your opinion.

I'm just nervous about the whole idea, TBH. Perhaps I am missing

some

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

documentation on how people are supposed to lay out memory in SPL

and

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

U-Boot properr, but I'm not really aware of any guidance we give.

Perhaps we should say that the SPL frame buffer should be at the

top

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

of memory, and U-Boot's reserve area should start below that?

1) As per my personal opinion, I don't like putting such

constraints and would

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

instead like to give some flexibility to end user for choosing framebuffer area as I earlier mentioned, as for that matter if we

are using a

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

predefined address then there is no need of using framebuffer

address on

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

videoblob,

I think this is the wrong direction. We need to offer strong

defaults

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

that shouldn't be deviated without good reason, rather than "pick

what

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

you want". Very few cases will deviate from the defaults, and of

those

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

it's hard to know if they're being changed for the best, or because someone didn't fully understand the implications and breaks something else.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

So what is next with this? I would like to clean it up...I feel that having SPL pass the top of usable RAM (below the framebuffer) is a reasonable solution. Does constraining things in that way cause any problems for TI?

TBH, I am not fully able to visualize how this fits current arch :

So instead of blob address will we be passing ram_top inside the video

blob ?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

.Or we will be using separate ram_top blob passing from SPL to u-boot ?

Yes, a separate ram_top in the bloblist, not in the video blob.

Ok, but we still need to have video blob too for conveying frame-buffer information, right ?

Yes

Quoted 4 lines

Also, just wanted to check if we really require a ram_top blob to be passed b/w SPL to u-boot, I thought ram_top addr is know by both stages before-hand if so then, why pass the ram_top blob separately?

I don't believe it can be known at build time, if that is what you mean. At least not in general.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Are we planning to enforce some restriction/hardcoding for framebuffer

to be

Quoted 1 line
Quoted 1 line
Quoted 1 line

reserved at specific address (near top of RAM) or it would be just a

general

Quoted 6 lines
Quoted 6 lines
Quoted 1 line

guideline to keep framebuffer near the RAM top ?

Well it makes sense to put it at the top, since U-Boot relocations itself to the top. >

Quoted 2 lines

Currently don't see video_reserve API put such constraint and user is

free to

Quoted 1 line
Quoted 1 line
Quoted 1 line

call it anywhere and it just reserve after previously reserved areas.

Now,

Quoted 1 line
Quoted 1 line
Quoted 1 line

with this approach I guess we would deviate from the agnostic behavior

of

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

video_reserve API then if we plan to update the same API ?

Also u-boot proper starts reserving regions for MMU and few other

stuff much

Quoted 1 line
Quoted 1 line
Quoted 1 line

before reserving framebuffers so by the time we receive the blob

containing

Quoted 1 line
Quoted 1 line
Quoted 1 line

updated ram_top, we would have already reserved those regions from old

ram_top

Quoted 1 line
Quoted 1 line
Quoted 1 line

so moving the ram_top here seems little counter-intuitive to me. In

such

Quoted 1 line
Quoted 1 line
Quoted 1 line

scenario, as per my opinion better option seems to be moving he

gd->relocaddr

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

instead.

Lastly, I think as much the user keep framebuffer way from ram_top

that much

Quoted 1 line
Quoted 1 line
Quoted 1 line

memory will be lost even with this approach (as ram_top will be moved

after

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

framebuffer for u-boot proper) and same behavior will be observed with
https://lore.kernel.org/all/[email protected]/ too

but if we are planning to put just a general guideline to user to keep framebuffer near the RAM top then to me above patch looks much simpler

than

Quoted 17 lines
Quoted 7 lines
Quoted 1 line

moving the ram_top.

I don't really have any more to say here. This is all just confusing and I don't think it needs to be. If SPL allocs stuff, I believe it should do so at the top of memory, then tell U-Boot about it, so U-Boot's reservations can happen below that address.

Ok, thanks for explaining your design, I understand your suggestion here and the design you are proposing i.e. of putting framebuffer at the ram_top, I am just thinking on that if we are to go with this then what is the simplest way to fit it with current u-boot architecture where we are using same API i.e. video_reserve at SPL stage and u-boot proper for both reserving the memory, passing the blob and catching the blob for simplicity.

Quoted 6 lines

I think we can probably achieve the same thing what you are proposing, if at u-boot proper also we follow the same paradigm i.e. reserve the video memory first (or for that matter any region which is reserve-able by SPL), this way if u-boot call reserve_video function first in this sequence

https://source.denx.de/u-boot/u-boot/-/blob/v2023.10-rc4/common/board_f.c?ref_type=tags#L943

Quoted 8 lines

then it will also trigger a call to video_reserve function which can read the blob and move the relocaddr as it is already doing (which is actually the ram_top since reserve_video is getting called at the start with this) after the reserved video area thus avoiding any gaps between reservations. This way we don't require to pass ram_top via blob.

Is that possible to update sequence at

https://source.denx.de/u-boot/u-boot/-/blob/v2023.10-rc4/common/board_f.c?ref_type=tags#L943

Quoted 7 lines

to reserve video memory first since it is also shared/reserve-able with previous stage ?
If so then I think we probably don't require much change there-after as blob will be read first and further reservation will only start below the frame-buffer area even with current video_reserve API.

Kindly let me know your opinion.

Sure, it is worth a try. I don't see any problem with rearranging the memory reservations.

Regards,
Simon

#25 lore raw

Hi Simon, Tom,

Quoted 296 lines · Simon Glass

Hi Devarsh,

Quoted 22 lines · Devarsh Thakkar

Hi Simon,

Quoted 18 lines · Simon Glass

Hi Devarsh,

Quoted 15 lines · Devarsh Thakkar

Hi Simon,

Quoted 11 lines · Simon Glass

Hi Devarsh,

Quoted 8 lines · Tom Rini
Quoted 6 lines · Devarsh Thakkar

Hi Simon,

Quoted 3 lines · Simon Glass

Hi Devarsh,

On Tue, 15 Aug 2023 at 03:23, Devarsh Thakkar <[email protected]>

Quoted 9 lines · wrote:
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Hi Simon, Tom,

Quoted 5 lines · Simon Glass

Hi Devarsh, Nikhil, Tom,

Quoted 2 lines · Bin Meng

On Thu, Aug 3, 2023 at 7:03 PM Bin Meng <[email protected]>

Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

On Thu, Aug 3, 2023 at 6:37 PM Bin Meng <[email protected]>

Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

On Tue, Aug 1, 2023 at 12:00 AM Simon Glass <[email protected]>

Quoted 2 lines · wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

When the video framebuffer comes from the bloblist, we

should not change

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

relocaddr to this address, since it interfers with the

normal memory

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

typo: interferes

allocation.

This fixes a boot loop in qemu-x86_64

Signed-off-by: Simon Glass <[email protected]>
Fixes: 5bc610a7d9d ("common: board_f: Pass frame buffer info

from SPL to u-boot")

Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines

Suggested-by: Nikhil M Jain <[email protected]>
---

Changes in v3:
- Reword the Kconfig help as suggested

Changes in v2:
- Add a Kconfig as the suggested conditional did not work

common/board_f.c | 3 ++-
drivers/video/Kconfig | 9 +++++++++
2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/common/board_f.c b/common/board_f.c
index 7d2c380e91e..5173d0a0c2d 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -419,7 +419,8 @@ static int reserve_video(void)
if (!ho)
return log_msg_ret("blf", -ENOENT);
video_reserve_from_bloblist(ho);
- gd->relocaddr = ho->fb;
+ if (IS_ENABLED(CONFIG_VIDEO_RESERVE_SPL))
+ gd->relocaddr = ho->fb;
} else if (CONFIG_IS_ENABLED(VIDEO)) {

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

ulong addr;
int ret;
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index b41dc60cec5..f2e56204d52 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1106,6 +1106,15 @@ config SPL_VIDEO_REMOVE
if this option is enabled video driver will be

removed at the end of

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

SPL stage, beforeloading the next stage.

+config VIDEO_RESERVE_SPL
+ bool
+ help
+ This adjusts reserve_video() to redirect memory

reservation when it

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

+ sees a video handoff blob

(BLOBLISTT_U_BOOT_VIDEO). This avoids the

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

+ memory used for framebuffer from being allocated

by U-Boot proper,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

+ thus preventing any further memory reservations

done by U-Boot proper

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 9 lines
Quoted 7 lines

+ from overwriting the framebuffer.
+
if SPL_SPLASH_SCREEN

config SPL_SPLASH_SCREEN_ALIGN

Reviewed-by: Bin Meng <[email protected]>

applied to u-boot-x86, thanks!

Dropped this one from the x86 queue per the discussion.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

I just wanted to come back to this discussion.

Do we have an agreed way forward? Who is waiting for who?

I was waiting on feedback on

https://lore.kernel.org/all/[email protected]/

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

but per my opinion, I would prefer to go with "Approach 2" with a Kconfig as it looks simpler to me. It would look something like

below :

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
if (gd->relocaddr > (unsigned long)ho->fb) {
       ulong fb_reloc_gap = gd->relocaddr - gd->ho->fb;

       /* Relocate after framebuffer area if nearing too close to

it */

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

if (fb_reloc_gap < CONFIG_BLOBLIST_FB_RELOC_MIN_GAP)
gd->relocaddr = ho->fb;
}

Regarding CONFIG_BLOBLIST_FB_RELOC_MIN_GAP
-> This describes minimum gap to keep between framebuffer address

and

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

relocation address to avoid overlap when framebuffer address used

by

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

blob is below the current relocation address

-> It would be selected as default when CONFIG_BLOBLIST is

selected with

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

default value set to 100Mb

-> SoC specific Vendors can override this in their defconfigs to a custom value if they feel 100Mb is not enough

Also probably we can have some debug/error prints in the code to

show

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

overlap happened (or is going happen) so that users can fine tune

this

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

Kconfig if they got it wrong at first place.

I can re-spin updated patch if we are aligned on this, Kindly let me know your opinion.

I'm just nervous about the whole idea, TBH. Perhaps I am missing

some

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

documentation on how people are supposed to lay out memory in SPL

and

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

U-Boot properr, but I'm not really aware of any guidance we give.

Perhaps we should say that the SPL frame buffer should be at the

top

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

of memory, and U-Boot's reserve area should start below that?

1) As per my personal opinion, I don't like putting such

constraints and would

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

instead like to give some flexibility to end user for choosing framebuffer area as I earlier mentioned, as for that matter if we

are using a

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

predefined address then there is no need of using framebuffer

address on

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

videoblob,

I think this is the wrong direction. We need to offer strong

defaults

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

that shouldn't be deviated without good reason, rather than "pick

what

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

you want". Very few cases will deviate from the defaults, and of

those

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

it's hard to know if they're being changed for the best, or because someone didn't fully understand the implications and breaks something else.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

So what is next with this? I would like to clean it up...I feel that having SPL pass the top of usable RAM (below the framebuffer) is a reasonable solution. Does constraining things in that way cause any problems for TI?

TBH, I am not fully able to visualize how this fits current arch :

So instead of blob address will we be passing ram_top inside the video

blob ?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

.Or we will be using separate ram_top blob passing from SPL to u-boot ?

Yes, a separate ram_top in the bloblist, not in the video blob.

Ok, but we still need to have video blob too for conveying frame-buffer information, right ?

Yes

Quoted 4 lines

Also, just wanted to check if we really require a ram_top blob to be passed b/w SPL to u-boot, I thought ram_top addr is know by both stages before-hand if so then, why pass the ram_top blob separately?

I don't believe it can be known at build time, if that is what you mean. At least not in general.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Are we planning to enforce some restriction/hardcoding for framebuffer

to be

Quoted 1 line
Quoted 1 line
Quoted 1 line

reserved at specific address (near top of RAM) or it would be just a

general

Quoted 6 lines
Quoted 6 lines
Quoted 1 line

guideline to keep framebuffer near the RAM top ?

Well it makes sense to put it at the top, since U-Boot relocations itself to the top. >

Quoted 2 lines

Currently don't see video_reserve API put such constraint and user is

free to

Quoted 1 line
Quoted 1 line
Quoted 1 line

call it anywhere and it just reserve after previously reserved areas.

Now,

Quoted 1 line
Quoted 1 line
Quoted 1 line

with this approach I guess we would deviate from the agnostic behavior

of

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

video_reserve API then if we plan to update the same API ?

Also u-boot proper starts reserving regions for MMU and few other

stuff much

Quoted 1 line
Quoted 1 line
Quoted 1 line

before reserving framebuffers so by the time we receive the blob

containing

Quoted 1 line
Quoted 1 line
Quoted 1 line

updated ram_top, we would have already reserved those regions from old

ram_top

Quoted 1 line
Quoted 1 line
Quoted 1 line

so moving the ram_top here seems little counter-intuitive to me. In

such

Quoted 1 line
Quoted 1 line
Quoted 1 line

scenario, as per my opinion better option seems to be moving he

gd->relocaddr

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

instead.

Lastly, I think as much the user keep framebuffer way from ram_top

that much

Quoted 1 line
Quoted 1 line
Quoted 1 line

memory will be lost even with this approach (as ram_top will be moved

after

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

framebuffer for u-boot proper) and same behavior will be observed with
https://lore.kernel.org/all/[email protected]/ too

but if we are planning to put just a general guideline to user to keep framebuffer near the RAM top then to me above patch looks much simpler

than

Quoted 17 lines
Quoted 7 lines
Quoted 1 line

moving the ram_top.

I don't really have any more to say here. This is all just confusing and I don't think it needs to be. If SPL allocs stuff, I believe it should do so at the top of memory, then tell U-Boot about it, so U-Boot's reservations can happen below that address.

Ok, thanks for explaining your design, I understand your suggestion here and the design you are proposing i.e. of putting framebuffer at the ram_top, I am just thinking on that if we are to go with this then what is the simplest way to fit it with current u-boot architecture where we are using same API i.e. video_reserve at SPL stage and u-boot proper for both reserving the memory, passing the blob and catching the blob for simplicity.

Quoted 6 lines

I think we can probably achieve the same thing what you are proposing, if at u-boot proper also we follow the same paradigm i.e. reserve the video memory first (or for that matter any region which is reserve-able by SPL), this way if u-boot call reserve_video function first in this sequence

https://source.denx.de/u-boot/u-boot/-/blob/v2023.10-rc4/common/board_f.c?ref_type=tags#L943

Quoted 8 lines

then it will also trigger a call to video_reserve function which can read the blob and move the relocaddr as it is already doing (which is actually the ram_top since reserve_video is getting called at the start with this) after the reserved video area thus avoiding any gaps between reservations. This way we don't require to pass ram_top via blob.

Is that possible to update sequence at

https://source.denx.de/u-boot/u-boot/-/blob/v2023.10-rc4/common/board_f.c?ref_type=tags#L943

Quoted 6 lines

to reserve video memory first since it is also shared/reserve-able with previous stage ?
If so then I think we probably don't require much change there-after as blob will be read first and further reservation will only start below the frame-buffer area even with current video_reserve API.

Quoted 8 lines
Quoted 1 line

Kindly let me know your opinion.

Sure, it is worth a try. I don't see any problem with rearranging the memory reservations.

Regards,
Simon

Thanks for the feedback, as suggested and discussed, I moved the fb allocation at the end of RAM for SPL and catching bloblist at the start in u-boot proper so that it doesn't impact u-boot's
reservation sequence and posted
https://lore.kernel.org/all/[email protected]/

Could you please have a look at these series and share your opinion ?

P.S I decided against changing reservation sequence at u-boot proper though as thought that this might potentially break backward compatibility with various device-trees in linux kernel which are reserving hard-coded framebuffer addresses based on current sequence of reservation (i.e. video memory being reserved after page table)

If the approach looks good, then I will do some more testing before sending out again.

Regards
Devarsh