Skip to contentSkip to conversation

Move framebuffer reservation for SPL to RAM end

PATCH In review Devarsh Thakkar 3 participants 14 messages Dec 5, 2023 – Jan 30, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v5 cover Move framebuffer reservation for SPL to RAM end

Move video memory reservation for SPL at end of RAM so that it does not interefere with reservations for next stage so that the next stage need not have holes in between for passed regions and instead it can maintain continuity in reservations.

Also catch the bloblist before starting reservations to avoid the same problem.

While at it, also fill missing fields in video handoff struct before passing it to next stage.

This is as per discussions at :
For moving SPL framebuffer reservation at end of RAM:

https://lore.kernel.org/all/CAPnjgZ3xSoe_G3yrqwuAvoiVjUfZ+YQgkOR0ZTVXGT9VK8TwJg@mail.gmail.com/

For filling missing video handoff fields :
https://lore.kernel.org/all/CAPnjgZ1Hs0rNf0JDirp6YPsOQ5=QqQSP9g9qRwLoOASUV8a4cw@mail.gmail.com/

Changelog:
V2:
- Make a generic function to reserve video memory at SPL stage.
- Add debug prints while skipping framebuffer allocation at uboot.
- Correct commenting style as suggested.

V3:
- Change spl_reserve_video to spl_reserve_video_from_ram_top which enforce framebuffer reservation from end of RAM.
- Use gd->ram_top instead of local ram_top and update gd->reloc_addr after each reservation.
- Print error message on framebuffer reservation.
- Update SPL doc with spl splash screen specific info.

V4:
- Split patches into atomic commits.
- Remove duplicate check for video blob passed addresses and error out if invalid address/size received from blob.
- Improve SPL documentation memory reservation scheme and print message for video memory reservation from bloblist.
- Add Reviewed-By.

V5:
- Add comment for filling video handoff size with aligned size
- Use PHASE_BOARD_F while checking for U-boot proper stage
- Add Reviewed-by

Test logs:
https://gist.github.com/devarsht/30a3c1591270c9ebae00714b48d33058

Devarsh Thakkar (8):
spl: Enforce framebuffer reservation from end of RAM
arm: mach-k3: common: Reserve video memory from end of the RAM
board: ti: am62x: evm: Remove video_setup from spl_board_init common/board_f: Catch bloblist before starting reservations
video: Skip framebuffer reservation if already reserved
video: Fill video handoff in video post probe
doc: spl: Add info for missing Kconfigs
doc: spl: Add info regarding memory reservation

 arch/arm/mach-k3/common.c    | 17 ++++++++++-----
 board/ti/am62x/evm.c         | 18 ----------------
 common/board_f.c             | 41 +++++++++++++++++++++++++++++++-----
 common/spl/spl.c             | 19 +++++++++++++++++
 doc/develop/spl.rst          | 37 ++++++++++++++++++++++++++++++++
 drivers/video/video-uclass.c | 40 ++++++++++++++++++++++++-----------
 include/spl.h                | 10 +++++++++
 7 files changed, 142 insertions(+), 40 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v5 1/8 spl: Enforce framebuffer reservation from end of RAM

Add an API which enforces framebuffer reservation from end of RAM. This is done so that next stage can directly skip this region before carrying out further reservations.

---
V2:
No change.

V3:
Change spl_reserve_video to spl_reserve_video_from_ram_top which enforce framebuffer reservation from end of RAM.

V4:
Split this to an independent patch with more details added in comments for API in header file.

V5:
Add Reviewed-By

---
 common/spl/spl.c | 19 +++++++++++++++++++
 include/spl.h    | 10 ++++++++++
 2 files changed, 29 insertions(+)
common/spl/spl.c +19 -0
index 3ce5bfeec8..b65c439e7a 100644
@@ -42,6 +42,7 @@
 #include <fdt_support.h>
 #include <bootcount.h>
 #include <wdt.h>
+#include <video.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 DECLARE_BINMAN_MAGIC_SYM;
@@ -152,6 +153,24 @@ void spl_fixup_fdt(void *fdt_blob)
 #endif
 }
 
+int spl_reserve_video_from_ram_top(void)
+{
+	if (CONFIG_IS_ENABLED(VIDEO)) {
+		ulong addr;
+		int ret;
+
+		addr = gd->ram_top;
+		ret = video_reserve(&addr);
+		if (ret)
+			return ret;
+		debug("Reserving %luk for video at: %08lx\n",
+		      ((unsigned long)gd->relocaddr - addr) >> 10, addr);
+		gd->relocaddr = addr;
+	}
+
+	return 0;
+}
+
 ulong spl_get_image_pos(void)
 {
 	if (!CONFIG_IS_ENABLED(BINMAN_UBOOT_SYMBOLS))
include/spl.h +10 -0
index 0952188901..043875f10f 100644
@@ -889,6 +889,16 @@ int spl_usb_load(struct spl_image_info *spl_image,
 
 int spl_ymodem_load_image(struct spl_image_info *spl_image,
 			  struct spl_boot_device *bootdev);
+/**
+ * spl_reserve_video_from_ram_top() - Reserve framebuffer memory from end of RAM
+ *
+ * This enforces framebuffer reservation at SPL stage from end of RAM so that
+ * next stage can directly skip this pre-reserved area before carrying out
+ * further reservations. The allocation address is stored in struct video_uc_plat.
+ *
+ * Return: 0 on success, otherwise error code
+ */
+int spl_reserve_video_from_ram_top(void);
 
 /**
  * spl_invoke_atf - boot using an ARM trusted firmware image
Signature · 1 line
2.34.1
#2 lore raw

PATCH v5 2/8 arm: mach-k3: common: Reserve video memory from end of the RAM

In reply to Devarsh Thakkar

Setup video memory before page table reservation using "spl_reserve_video_from_ram_top" which ensures framebuffer memory gets reserved from the end of RAM.

This is done to enable the next stage to directly skip the pre-reserved area from previous stage right from the end of RAM without having to make any gaps/holes to accommodate those regions which was the case before as previous stage reserved region not from the end of RAM.

Use gd->ram_top instead of local ram_top and update gd->reloc_addr after each reservation to ensure further regions are reserved properly.

---
V2:
- Make a generic function "spl_reserve_video" under common/spl which can be re-used by other platforms too for reserving video memory from spl.

V3:
- Change spl_reserve_video to spl_reserve_video_from_ram_top which enforce framebuffer reservation from end of RAM
- Use gd->ram_top instead of local ram_top and update gd->reloc_addr after each reservation
- Print error message on framebuffer reservation

V4:
- Split this into a separate patch

V5:
- Add Reviewed-by

---
 arch/arm/mach-k3/common.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
arch/arm/mach-k3/common.c +12 -5
index fd400e7e3d..42ceeb5296 100644
@@ -524,19 +524,26 @@ void remove_fwl_configs(struct fwl_data *fwl_data, size_t fwl_data_size)
 void spl_enable_cache(void)
 {
 #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
-	phys_addr_t ram_top = CFG_SYS_SDRAM_BASE;
+	gd->ram_top = CFG_SYS_SDRAM_BASE;
+	int ret = 0;
 
 	dram_init();
 
 	/* reserve TLB table */
 	gd->arch.tlb_size = PGTABLE_SIZE;
 
-	ram_top += get_effective_memsize();
+	gd->ram_top += get_effective_memsize();
 	/* keep ram_top in the 32-bit address space */
-	if (ram_top >= 0x100000000)
-		ram_top = (phys_addr_t) 0x100000000;
+	if (gd->ram_top >= 0x100000000)
+		gd->ram_top = (phys_addr_t)0x100000000;
 
-	gd->arch.tlb_addr = ram_top - gd->arch.tlb_size;
+	gd->relocaddr = gd->ram_top;
+
+	ret = spl_reserve_video_from_ram_top();
+	if (ret)
+		panic("Failed to reserve framebuffer memory (%d)\n", ret);
+
+	gd->arch.tlb_addr = gd->relocaddr - gd->arch.tlb_size;
 	gd->arch.tlb_addr &= ~(0x10000 - 1);
 	debug("TLB table from %08lx to %08lx\n", gd->arch.tlb_addr,
 	      gd->arch.tlb_addr + gd->arch.tlb_size);
Signature · 1 line
2.34.1
#3 lore raw

PATCH v5 3/8 board: ti: am62x: evm: Remove video_setup from spl_board_init

In reply to Devarsh Thakkar

Remove video_setup from evm_init sequence since video memory is getting called at an earlier place to make sure video memory is reserved at the end of RAM.

---
V2: No change
V3: No change
V4: Add Reviewed-by
V5: No change

---
 board/ti/am62x/evm.c | 18 ------------------
 1 file changed, 18 deletions(-)
board/ti/am62x/evm.c +0 -18
index ad93908840..88e02155ee 100644
@@ -60,27 +60,9 @@ int dram_init_banksize(void)
 }
 
 #if defined(CONFIG_SPL_BUILD)
-static int video_setup(void)
-{
-	if (CONFIG_IS_ENABLED(VIDEO)) {
-		ulong addr;
-		int ret;
-
-		addr = gd->relocaddr;
-		ret = video_reserve(&addr);
-		if (ret)
-			return ret;
-		debug("Reserving %luk for video at: %08lx\n",
-		      ((unsigned long)gd->relocaddr - addr) >> 10, addr);
-		gd->relocaddr = addr;
-	}
-
-	return 0;
-}
 
 void spl_board_init(void)
 {
-	video_setup();
 	enable_caches();
 	if (IS_ENABLED(CONFIG_SPL_SPLASH_SCREEN) && IS_ENABLED(CONFIG_SPL_BMP))
 		splash_display();
Signature · 1 line
2.34.1
#4 lore raw

PATCH v5 4/8 common/board_f: Catch bloblist before starting reservations

In reply to Devarsh Thakkar

Start reservations needed for init sequence only after catching bloblists from previous stage.

This is to avoid catching bloblists in the middle causing gaps while u-boot is reserving.

Adjust the relocaddr as per video hand-off information received from previous stage so that further reservations start only after regions reserved for previous stages

Skip reservation for video memory if it was already filled by a bloblist.

---
V2: Fix typo in commit title and checkpatch warnings/checks
V3: No change
V4: Add Reviewed-by
V5: No change

---
 common/board_f.c | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)
common/board_f.c +30 -3
index d4d7d01f8f..acf802c9cb 100644
@@ -403,7 +403,7 @@ __weak int arch_reserve_mmu(void)
 	return 0;
 }
 
-static int reserve_video(void)
+static int reserve_video_from_videoblob(void)
 {
 	if (IS_ENABLED(CONFIG_SPL_VIDEO_HANDOFF) && spl_phase() > PHASE_SPL) {
 		struct video_handoff *ho;
@@ -412,8 +412,34 @@ static int reserve_video(void)
 		if (!ho)
 			return log_msg_ret("blf", -ENOENT);
 		video_reserve_from_bloblist(ho);
-		gd->relocaddr = ho->fb;
-	} else if (CONFIG_IS_ENABLED(VIDEO)) {
+
+		/* Sanity check fb from blob is before current relocaddr */
+		if (likely(gd->relocaddr > (unsigned long)ho->fb))
+			gd->relocaddr = ho->fb;
+	}
+
+	return 0;
+}
+
+/*
+ * Check if any bloblist received specifying reserved areas from previous stage and adjust
+ * gd->relocaddr accordingly, so that we start reserving after pre-reserved areas
+ * from previous stage.
+ *
+ * NOTE:
+ * IT is recommended that all bloblists from previous stage are reserved from ram_top
+ * as next stage will simply start reserving further regions after them.
+ */
+static int setup_relocaddr_from_bloblist(void)
+{
+	reserve_video_from_videoblob();
+
+	return 0;
+}
+
+static int reserve_video(void)
+{
+	if (CONFIG_IS_ENABLED(VIDEO)) {
 		ulong addr;
 		int ret;
 
@@ -923,6 +949,7 @@ static const init_fnc_t init_sequence_f[] = {
 	reserve_pram,
 #endif
 	reserve_round_4k,
+	setup_relocaddr_from_bloblist,
 	arch_reserve_mmu,
 	reserve_video,
 	reserve_trace,
Signature · 1 line
2.34.1
#5 lore raw

PATCH v5 5/8 video: Skip framebuffer reservation if already reserved

In reply to Devarsh Thakkar

Skip framebufer reservation if it was already reserved from previous stage and whose information was passed using a bloblist.

Return error in case framebuffer information received from bloblist is invalid i.e NULL or empty.

While at it, improve the debug message to make it more clear that address in discussion is of framebuffer and not bloblist and also match it with printing scheme followed in video_reserve function.

---
V2:
- Add debug prints
- Fix commenting style
V3:
- Fix commenting style
V4:
- Remove extra checks on gd for video data in video_reserve
- Add check and return error if video handoff provided info is invalid
- Improve debug message
- Remove Reviewed-by due to additional changes per review comments V5:
- Use PHASE_BOARD_F to check code running in U-boot proper context
- Add Reviewed-By

---
 common/board_f.c             |  8 ++++++--
 drivers/video/video-uclass.c | 10 ++++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)
common/board_f.c +6 -2
index acf802c9cb..442b8349d0 100644
@@ -407,11 +407,15 @@ static int reserve_video_from_videoblob(void)
 {
 	if (IS_ENABLED(CONFIG_SPL_VIDEO_HANDOFF) && spl_phase() > PHASE_SPL) {
 		struct video_handoff *ho;
+		int ret = 0;
 
 		ho = bloblist_find(BLOBLISTT_U_BOOT_VIDEO, sizeof(*ho));
 		if (!ho)
-			return log_msg_ret("blf", -ENOENT);
-		video_reserve_from_bloblist(ho);
+			return log_msg_ret("Missing video bloblist", -ENOENT);
+
+		ret = video_reserve_from_bloblist(ho);
+		if (ret)
+			return log_msg_ret("Invalid Video handoff info", ret);
 
 		/* Sanity check fb from blob is before current relocaddr */
 		if (likely(gd->relocaddr > (unsigned long)ho->fb))
drivers/video/video-uclass.c +8 -2
index f743ed74c8..d620a29c25 100644
@@ -123,6 +123,9 @@ int video_reserve(ulong *addrp)
 	struct udevice *dev;
 	ulong size;
 
+	if (IS_ENABLED(CONFIG_SPL_VIDEO_HANDOFF) && spl_phase() == PHASE_BOARD_F)
+		return 0;
+
 	gd->video_top = *addrp;
 	for (uclass_find_first_device(UCLASS_VIDEO, &dev);
 	     dev;
@@ -208,11 +211,14 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend,
 
 int video_reserve_from_bloblist(struct video_handoff *ho)
 {
+	if (!ho->fb || ho->size == 0)
+		return -ENOENT;
+
 	gd->video_bottom = ho->fb;
 	gd->fb_base = ho->fb;
 	gd->video_top = ho->fb + ho->size;
-	debug("Reserving %luk for video using blob at: %08x\n",
-	      ((unsigned long)ho->size) >> 10, (u32)ho->fb);
+	debug("%s: Reserving %lx bytes at %08x as per bloblist received\n",
+	      __func__, (unsigned long)ho->size, (u32)ho->fb);
 
 	return 0;
 }
Signature · 1 line
2.34.1
#6 lore raw

PATCH v5 6/8 video: Fill video handoff in video post probe

In reply to Devarsh Thakkar

Fill video handoff fields in video_post_probe as at this point we have full framebuffer-related information.

Also fill all the fields available in video hand-off struct as those were missing earlier and U-boot framework expects them to be filled for some of the functionalities.

While filling framebuffer size in video hand-off structure use the actual framebuffer region size as derived from gd->video_top and gd->video_bottom instead of directly using the size populated in video_uc_plat as it contains unaligned size.

---
V2:
- No change

V3:
- Fix commit message per review comment
- Add a note explaining assumption of single framebuffer

V4:
- Wrap message to 72 chars

V5:
- Add Reviewed-by and comments for framebuffer size usage

---
 drivers/video/video-uclass.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)
drivers/video/video-uclass.c +20 -10
index d620a29c25..3571e62ba2 100644
@@ -144,16 +144,6 @@ int video_reserve(ulong *addrp)
 	debug("Video frame buffers from %lx to %lx\n", gd->video_bottom,
 	      gd->video_top);
 
-	if (spl_phase() == PHASE_SPL && CONFIG_IS_ENABLED(VIDEO_HANDOFF)) {
-		struct video_handoff *ho;
-
-		ho = bloblist_add(BLOBLISTT_U_BOOT_VIDEO, sizeof(*ho), 0);
-		if (!ho)
-			return log_msg_ret("blf", -ENOENT);
-		ho->fb = *addrp;
-		ho->size = size;
-	}
-
 	return 0;
 }
 
@@ -552,6 +542,26 @@ static int video_post_probe(struct udevice *dev)
 
 	priv->fb_size = priv->line_length * priv->ysize;
 
+	/*
+	 * Set up video handoff fields for passing video blob to next stage
+	 * NOTE:
+	 * This assumes that reserved video memory only uses a single framebuffer
+	 */
+	if (spl_phase() == PHASE_SPL && CONFIG_IS_ENABLED(BLOBLIST)) {
+		struct video_handoff *ho;
+
+		ho = bloblist_add(BLOBLISTT_U_BOOT_VIDEO, sizeof(*ho), 0);
+		if (!ho)
+			return log_msg_ret("blf", -ENOENT);
+		ho->fb = gd->video_bottom;
+		/* Fill aligned size here as calculated in video_reserve() */
+		ho->size = gd->video_top - gd->video_bottom;
+		ho->xsize = priv->xsize;
+		ho->ysize = priv->ysize;
+		ho->line_length = priv->line_length;
+		ho->bpix = priv->bpix;
+	}
+
 	if (IS_ENABLED(CONFIG_VIDEO_COPY) && plat->copy_base)
 		priv->copy_fb = map_sysmem(plat->copy_base, plat->size);
 
Signature · 1 line
2.34.1
#7 lore raw

PATCH v5 7/8 doc: spl: Add info for missing Kconfigs

In reply to Devarsh Thakkar

Add info regarding splash screen, video, bloblist and GPIO related Kconfigs which were missing in the documentation.

---
V2: No change
V3: No change
V4: Patch split from parent
V5: Add Reviewed-by

---
 doc/develop/spl.rst | 9 +++++++++
 1 file changed, 9 insertions(+)
doc/develop/spl.rst +9 -0
index 76e87f07c7..814530d348 100644
@@ -65,6 +65,15 @@ CONFIG_SPL_NAND_LOAD (drivers/mtd/nand/raw/nand_spl_load.o)
 CONFIG_SPL_SPI_LOAD (drivers/mtd/spi/spi_spl_load.o)
 CONFIG_SPL_RAM_DEVICE (common/spl/spl.c)
 CONFIG_SPL_WATCHDOG (drivers/watchdog/libwatchdog.o)
+CONFIG_SPL_SYSCON (drivers/core/syscon-uclass.o)
+CONFIG_SPL_GZIP (lib/gzip.o)
+CONFIG_SPL_VIDEO (drivers/video/video-uclass.o drivers/video/vidconsole-uclass.o)
+CONFIG_SPL_SPLASH_SCREEN (common/splash.o)
+CONFIG_SPL_SPLASH_SOURCE (common/splash_source.o)
+CONFIG_SPL_GPIO (drivers/gpio)
+CONFIG_SPL_DM_GPIO (drivers/gpio/gpio-uclass.o)
+CONFIG_SPL_BMP (drivers/video/bmp.o)
+CONFIG_SPL_BLOBLIST (common/bloblist.o)
 
 Adding SPL-specific code
 ------------------------
Signature · 1 line
2.34.1
#8 lore raw

PATCH v5 8/8 doc: spl: Add info regarding memory reservation

In reply to Devarsh Thakkar

Add details regarding scheme which need to be followed in SPL and further stages for those regions which need to be preserved across bootstages.

---
V1->V3:
No change.

V4:
Split this to separate patch and add more details regarding memory reservation scheme that needs to be followed at SPL.

V5:
Add Reviewed-By

---
 doc/develop/spl.rst | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
doc/develop/spl.rst +28 -0
index 814530d348..0a3e572310 100644
@@ -173,3 +173,31 @@ cflow will spit out a number of warnings as it does not parse
 the config files and picks functions based on #ifdef.  Parsing the '.i'
 files instead introduces another set of headaches.  These warnings are
 not usually important to understanding the flow, however.
+
+
+Reserving memory in SPL
+-----------------------
+
+If memory needs to be reserved in RAM during SPL stage with the requirement that
+the SPL reserved memory remains preserved across further boot stages too
+then it needs to be reserved mandatorily starting from end of RAM. This is to
+ensure that further stages can simply skip this region before carrying out
+further reservations or updating the relocation address.
+
+Also out of these regions which are to be preserved across further stages of
+boot, video framebuffer memory region must be reserved first starting from
+end of RAM for which helper function spl_reserve_video_from_ram_top is provided
+which makes sure that video memory is placed at top of reservation area with
+further reservations below it.
+
+The corresponding information of reservation for those regions can be passed to
+further boot stages using a bloblist. For e.g. the information for
+framebuffer area reserved by SPL can be passed onto U-boot using
+BLOBLISTT_U_BOOT_VIDEO.
+
+The further boot stages need to parse each of the bloblist passed from SPL stage
+starting from video bloblist and skip this whole SPL reserved memory area from
+end of RAM as per the bloblists received, before carrying out further
+reservations or updating the relocation address. For e.g, U-boot proper uses
+function "setup_relocaddr_from_bloblist" to parse the bloblists passed from
+previous stage and skip the memory reserved from previous stage accordingly.
Signature · 1 line
2.34.1
#9 lore raw
In reply to Devarsh Thakkar

Hi Antoine,

Quoted 41 lines · Devarsh Thakkar

Move video memory reservation for SPL at end of RAM so that it does not interefere with reservations for next stage so that the next stage need not have holes in between for passed regions and instead it can maintain continuity in reservations.

Also catch the bloblist before starting reservations to avoid the same problem.

While at it, also fill missing fields in video handoff struct before passing it to next stage.

This is as per discussions at :
For moving SPL framebuffer reservation at end of RAM:

https://lore.kernel.org/all/CAPnjgZ3xSoe_G3yrqwuAvoiVjUfZ+YQgkOR0ZTVXGT9VK8TwJg@mail.gmail.com/

For filling missing video handoff fields :
https://lore.kernel.org/all/CAPnjgZ1Hs0rNf0JDirp6YPsOQ5=QqQSP9g9qRwLoOASUV8a4cw@mail.gmail.com/

Changelog:
V2:
- Make a generic function to reserve video memory at SPL stage.
- Add debug prints while skipping framebuffer allocation at uboot.
- Correct commenting style as suggested.

V3:
- Change spl_reserve_video to spl_reserve_video_from_ram_top which enforce framebuffer reservation from end of RAM.
- Use gd->ram_top instead of local ram_top and update gd->reloc_addr after each reservation.
- Print error message on framebuffer reservation.
- Update SPL doc with spl splash screen specific info.

V4:
- Split patches into atomic commits.
- Remove duplicate check for video blob passed addresses and error out if invalid address/size received from blob.
- Improve SPL documentation memory reservation scheme and print message for video memory reservation from bloblist.
- Add Reviewed-By.

Quoted 5 lines

V5:
- Add comment for filling video handoff size with aligned size
- Use PHASE_BOARD_F while checking for U-boot proper stage
- Add Reviewed-by

Is it possible to pull this series in if no further comments ?

Regards
Devarsh

Quoted 22 lines

Test logs:
https://gist.github.com/devarsht/30a3c1591270c9ebae00714b48d33058

Devarsh Thakkar (8):
spl: Enforce framebuffer reservation from end of RAM
arm: mach-k3: common: Reserve video memory from end of the RAM
board: ti: am62x: evm: Remove video_setup from spl_board_init common/board_f: Catch bloblist before starting reservations
video: Skip framebuffer reservation if already reserved
video: Fill video handoff in video post probe
doc: spl: Add info for missing Kconfigs
doc: spl: Add info regarding memory reservation

 arch/arm/mach-k3/common.c    | 17 ++++++++++-----
 board/ti/am62x/evm.c         | 18 ----------------
 common/board_f.c             | 41 +++++++++++++++++++++++++++++++-----
 common/spl/spl.c             | 19 +++++++++++++++++
 doc/develop/spl.rst          | 37 ++++++++++++++++++++++++++++++++
 drivers/video/video-uclass.c | 40 ++++++++++++++++++++++++-----------
 include/spl.h                | 10 +++++++++
 7 files changed, 142 insertions(+), 40 deletions(-)
#10 lore raw
Quoted 45 lines · Devarsh Thakkar

Hi Antoine,

Quoted 41 lines · Devarsh Thakkar

Move video memory reservation for SPL at end of RAM so that it does not interefere with reservations for next stage so that the next stage need not have holes in between for passed regions and instead it can maintain continuity in reservations.

Also catch the bloblist before starting reservations to avoid the same problem.

While at it, also fill missing fields in video handoff struct before passing it to next stage.

This is as per discussions at :
For moving SPL framebuffer reservation at end of RAM:

https://lore.kernel.org/all/CAPnjgZ3xSoe_G3yrqwuAvoiVjUfZ+YQgkOR0ZTVXGT9VK8TwJg@mail.gmail.com/

For filling missing video handoff fields :
https://lore.kernel.org/all/CAPnjgZ1Hs0rNf0JDirp6YPsOQ5=QqQSP9g9qRwLoOASUV8a4cw@mail.gmail.com/

Changelog:
V2:
- Make a generic function to reserve video memory at SPL stage.
- Add debug prints while skipping framebuffer allocation at uboot.
- Correct commenting style as suggested.

V3:
- Change spl_reserve_video to spl_reserve_video_from_ram_top which enforce framebuffer reservation from end of RAM.
- Use gd->ram_top instead of local ram_top and update gd->reloc_addr after each reservation.
- Print error message on framebuffer reservation.
- Update SPL doc with spl splash screen specific info.

V4:
- Split patches into atomic commits.
- Remove duplicate check for video blob passed addresses and error out if invalid address/size received from blob.
- Improve SPL documentation memory reservation scheme and print message for video memory reservation from bloblist.
- Add Reviewed-By.

Quoted 7 lines
Quoted 5 lines

V5:
- Add comment for filling video handoff size with aligned size
- Use PHASE_BOARD_F while checking for U-boot proper stage
- Add Reviewed-by

Is it possible to pull this series in if no further comments ?

Yes please, this has been pending for a while.

Quoted 26 lines

Regards
Devarsh

Quoted 22 lines

Test logs:
https://gist.github.com/devarsht/30a3c1591270c9ebae00714b48d33058

Devarsh Thakkar (8):
spl: Enforce framebuffer reservation from end of RAM
arm: mach-k3: common: Reserve video memory from end of the RAM
board: ti: am62x: evm: Remove video_setup from spl_board_init common/board_f: Catch bloblist before starting reservations
video: Skip framebuffer reservation if already reserved
video: Fill video handoff in video post probe
doc: spl: Add info for missing Kconfigs
doc: spl: Add info regarding memory reservation

 arch/arm/mach-k3/common.c    | 17 ++++++++++-----
 board/ti/am62x/evm.c         | 18 ----------------
 common/board_f.c             | 41 +++++++++++++++++++++++++++++++-----
 common/spl/spl.c             | 19 +++++++++++++++++
 doc/develop/spl.rst          | 37 ++++++++++++++++++++++++++++++++
 drivers/video/video-uclass.c | 40 ++++++++++++++++++++++++-----------
 include/spl.h                | 10 +++++++++
 7 files changed, 142 insertions(+), 40 deletions(-)

Regards,
Simon

#11 lore raw

Hi Anatolij, Tom,

Quoted 52 lines · Simon Glass
Quoted 51 lines · Devarsh Thakkar

Hi Antoine,

Quoted 46 lines · Devarsh Thakkar

Move video memory reservation for SPL at end of RAM so that it does not interefere with reservations for next stage so that the next stage need not have holes in between for passed regions and instead it can maintain continuity in reservations.

Also catch the bloblist before starting reservations to avoid the same problem.

While at it, also fill missing fields in video handoff struct before passing it to next stage.

This is as per discussions at :
For moving SPL framebuffer reservation at end of RAM:

https://lore.kernel.org/all/CAPnjgZ3xSoe_G3yrqwuAvoiVjUfZ+YQgkOR0ZTVXGT9VK8TwJg@mail.gmail.com/

For filling missing video handoff fields :
https://lore.kernel.org/all/CAPnjgZ1Hs0rNf0JDirp6YPsOQ5=QqQSP9g9qRwLoOASUV8a4cw@mail.gmail.com/

Changelog:
V2:
- Make a generic function to reserve video memory at SPL stage.
- Add debug prints while skipping framebuffer allocation at uboot.
- Correct commenting style as suggested.

V3:
- Change spl_reserve_video to spl_reserve_video_from_ram_top which enforce framebuffer reservation from end of RAM.
- Use gd->ram_top instead of local ram_top and update gd->reloc_addr after each reservation.
- Print error message on framebuffer reservation.
- Update SPL doc with spl splash screen specific info.

V4:
- Split patches into atomic commits.
- Remove duplicate check for video blob passed addresses and error out if invalid address/size received from blob.
- Improve SPL documentation memory reservation scheme and print message for video memory reservation from bloblist.
- Add Reviewed-By.

V5:
- Add comment for filling video handoff size with aligned size
- Use PHASE_BOARD_F while checking for U-boot proper stage
- Add Reviewed-by

Quoted 3 lines
Quoted 1 line

Is it possible to pull this series in if no further comments ?

Yes please, this has been pending for a while.

Gentle reminder. Is it possible to pick this series ?

Regards
Devarsh

Quoted 30 lines
Quoted 27 lines

Regards
Devarsh

Quoted 22 lines

Test logs:
https://gist.github.com/devarsht/30a3c1591270c9ebae00714b48d33058

Devarsh Thakkar (8):
spl: Enforce framebuffer reservation from end of RAM
arm: mach-k3: common: Reserve video memory from end of the RAM
board: ti: am62x: evm: Remove video_setup from spl_board_init common/board_f: Catch bloblist before starting reservations
video: Skip framebuffer reservation if already reserved
video: Fill video handoff in video post probe
doc: spl: Add info for missing Kconfigs
doc: spl: Add info regarding memory reservation

 arch/arm/mach-k3/common.c    | 17 ++++++++++-----
 board/ti/am62x/evm.c         | 18 ----------------
 common/board_f.c             | 41 +++++++++++++++++++++++++++++++-----
 common/spl/spl.c             | 19 +++++++++++++++++
 doc/develop/spl.rst          | 37 ++++++++++++++++++++++++++++++++
 drivers/video/video-uclass.c | 40 ++++++++++++++++++++++++-----------
 include/spl.h                | 10 +++++++++
 7 files changed, 142 insertions(+), 40 deletions(-)

Regards,
Simon

#12 lore raw

Hi Anatolij, Tom,

Quoted 55 lines · Devarsh Thakkar

Hi Anatolij, Tom,

Quoted 52 lines · Simon Glass
Quoted 51 lines · Devarsh Thakkar

Hi Antoine,

Quoted 46 lines · Devarsh Thakkar

Move video memory reservation for SPL at end of RAM so that it does not interefere with reservations for next stage so that the next stage need not have holes in between for passed regions and instead it can maintain continuity in reservations.

Also catch the bloblist before starting reservations to avoid the same problem.

While at it, also fill missing fields in video handoff struct before passing it to next stage.

This is as per discussions at :
For moving SPL framebuffer reservation at end of RAM:

https://lore.kernel.org/all/CAPnjgZ3xSoe_G3yrqwuAvoiVjUfZ+YQgkOR0ZTVXGT9VK8TwJg@mail.gmail.com/

For filling missing video handoff fields :
https://lore.kernel.org/all/CAPnjgZ1Hs0rNf0JDirp6YPsOQ5=QqQSP9g9qRwLoOASUV8a4cw@mail.gmail.com/

Changelog:
V2:
- Make a generic function to reserve video memory at SPL stage.
- Add debug prints while skipping framebuffer allocation at uboot.
- Correct commenting style as suggested.

V3:
- Change spl_reserve_video to spl_reserve_video_from_ram_top which enforce framebuffer reservation from end of RAM.
- Use gd->ram_top instead of local ram_top and update gd->reloc_addr after each reservation.
- Print error message on framebuffer reservation.
- Update SPL doc with spl splash screen specific info.

V4:
- Split patches into atomic commits.
- Remove duplicate check for video blob passed addresses and error out if invalid address/size received from blob.
- Improve SPL documentation memory reservation scheme and print message for video memory reservation from bloblist.
- Add Reviewed-By.

V5:
- Add comment for filling video handoff size with aligned size
- Use PHASE_BOARD_F while checking for U-boot proper stage
- Add Reviewed-by

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Is it possible to pull this series in if no further comments ?

Yes please, this has been pending for a while.

Gentle reminder. Is it possible to pick this series ?

Gentle reminder.
Is it possible to pull this in for current merge window for v2024.04 ?

Regards
Devarsh

Quoted 33 lines

Regards
Devarsh

Quoted 30 lines
Quoted 27 lines

Regards
Devarsh

Quoted 22 lines

Test logs:
https://gist.github.com/devarsht/30a3c1591270c9ebae00714b48d33058

Devarsh Thakkar (8):
spl: Enforce framebuffer reservation from end of RAM
arm: mach-k3: common: Reserve video memory from end of the RAM
board: ti: am62x: evm: Remove video_setup from spl_board_init common/board_f: Catch bloblist before starting reservations
video: Skip framebuffer reservation if already reserved
video: Fill video handoff in video post probe
doc: spl: Add info for missing Kconfigs
doc: spl: Add info regarding memory reservation

  arch/arm/mach-k3/common.c    | 17 ++++++++++-----
  board/ti/am62x/evm.c         | 18 ----------------
  common/board_f.c             | 41 +++++++++++++++++++++++++++++++-----
  common/spl/spl.c             | 19 +++++++++++++++++
  doc/develop/spl.rst          | 37 ++++++++++++++++++++++++++++++++
  drivers/video/video-uclass.c | 40 ++++++++++++++++++++++++-----------
  include/spl.h                | 10 +++++++++
  7 files changed, 142 insertions(+), 40 deletions(-)

Regards,
Simon

#13 lore raw
In reply to Devarsh Thakkar
Quoted 9 lines · Devarsh Thakkar

Move video memory reservation for SPL at end of RAM so that it does not interefere with reservations for next stage so that the next stage need not have holes in between for passed regions and instead it can maintain continuity in reservations.

Also catch the bloblist before starting reservations to avoid the same problem.

[...]

Applied to u-boot/master, thanks!

Signature · 1 line
Tom