Skip to contentSkip to conversation

arm: Implement the 'fake' go command

PATCH New Simon Glass 3 participants 5 messages Jun 20, 2013 – Aug 21, 2013 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH v3 17/21 arm: Implement the 'fake' go command

Implement this feature on ARM for tracing.

It would be nice to have generic bootm support so that it is easily implemented on any arch.

---
Changes in v3:
- Revert to using 'images' instead of 'image' in boot_jump_linux()

Changes in v2: None

 arch/arm/lib/bootm.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)
arch/arm/lib/bootm.c +18 -9
index 1b6e0ac..b22fbc9 100644
@@ -68,12 +68,19 @@ void arch_lmb_reserve(struct lmb *lmb)
 		    gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size - sp);
 }
 
-static void announce_and_cleanup(void)
+/**
+ * announce_and_cleanup() - Print message and prepare for kernel boot
+ *
+ * @fake: non-zero to do everything except actually boot
+ */
+static void announce_and_cleanup(int fake)
 {
-	printf("\nStarting kernel ...\n\n");
+	printf("\nStarting kernel ...%s\n\n", fake ?
+		"(fake run for tracing)" : "");
 	bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
 #ifdef CONFIG_BOOTSTAGE_FDT
-	bootstage_fdt_add_report();
+	if (flag == BOOTM_STATE_OS_FAKE_GO)
+		bootstage_fdt_add_report();
 #endif
 #ifdef CONFIG_BOOTSTAGE_REPORT
 	bootstage_report();
@@ -225,12 +232,13 @@ static void boot_prep_linux(bootm_headers_t *images)
 }
 
 /* Subcommand: GO */
-static void boot_jump_linux(bootm_headers_t *images)
+static void boot_jump_linux(bootm_headers_t *images, int flag)
 {
 	unsigned long machid = gd->bd->bi_arch_number;
 	char *s;
 	void (*kernel_entry)(int zero, int arch, uint params);
 	unsigned long r2;
+	int fake = (flag & BOOTM_STATE_OS_FAKE_GO);
 
 	kernel_entry = (void (*)(int, int, uint))images->ep;
 
@@ -243,14 +251,15 @@ static void boot_jump_linux(bootm_headers_t *images)
 	debug("## Transferring control to Linux (at address %08lx)" \
 		"...\n", (ulong) kernel_entry);
 	bootstage_mark(BOOTSTAGE_ID_RUN_OS);
-	announce_and_cleanup();
+	announce_and_cleanup(fake);
 
 	if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len)
 		r2 = (unsigned long)images->ft_addr;
 	else
 		r2 = gd->bd->bi_boot_params;
 
-	kernel_entry(0, machid, r2);
+	if (!fake)
+		kernel_entry(0, machid, r2);
 }
 
 /* Main Entry point for arm bootm implementation
@@ -270,13 +279,13 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 		return 0;
 	}
 
-	if (flag & BOOTM_STATE_OS_GO) {
-		boot_jump_linux(images);
+	if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
+		boot_jump_linux(images, flag);
 		return 0;
 	}
 
 	boot_prep_linux(images);
-	boot_jump_linux(images);
+	boot_jump_linux(images, flag);
 	return 0;
 }
 
Signature · 1 line
1.8.3
#1 lore raw

PATCH v3 17/21 arm: Implement the 'fake' go command

Hi Simon,

Quoted 11 lines · Simon Glass

Implement this feature on ARM for tracing.

It would be nice to have generic bootm support so that it is easily implemented on any arch.

---
Changes in v3:
- Revert to using 'images' instead of 'image' in boot_jump_linux()

Changes in v2: None

Small nitpick: I prefer whole series to be reposted even when there is only a single patch changed. My rationale for this is: when a series has been posted as V2 and a single patch appears as V3, as a reviewer I do not know whether that patch was really the only one intended as V3, or whether other patches were too but did not make it through for some reason.

Also, as this V3 patch did not have any "In-Reply-To" header, it is not threaded to the V2 series by my claws-mail. That makes it less easy to try and get an overview of the current series.

[insert witty remark about how patman quite adequately addresses the two points above :) ]

Here I will assume 17/21 is the only patch in the series and the rest should come from v2 unchanged. As this is the only pure ARM related patch in the series (1), I guess my contribution shall be...

(1) patch 18/21 is Samsung and patch 19/21 touches on exynos5250-based boards; my ack is less adequate than that of, respectively, Minkyu as the Samsung custodian and the exynos5250-based boards' maintainers.

Note: who/what exactly is "u-boot-review at google.com"?

Amicalement,

Signature · 1 line
Albert.
#2 lore raw

PATCH v3 17/21 arm: Implement the 'fake' go command

Hi Albert,

Quoted 24 lines · Albert ARIBAUD

Hi Simon,

Quoted 11 lines · Simon Glass

Implement this feature on ARM for tracing.

It would be nice to have generic bootm support so that it is easily implemented on any arch.

---
Changes in v3:
- Revert to using 'images' instead of 'image' in boot_jump_linux()

Changes in v2: None

Small nitpick: I prefer whole series to be reposted even when there is only a single patch changed. My rationale for this is: when a series has been posted as V2 and a single patch appears as V3, as a reviewer I do not know whether that patch was really the only one intended as V3, or whether other patches were too but did not make it through for some reason.

Quoted 7 lines

Also, as this V3 patch did not have any "In-Reply-To" header, it is not threaded to the V2 series by my claws-mail. That makes it less easy to try and get an overview of the current series.

[insert witty remark about how patman quite adequately addresses the two points above :) ]

:-) I did use patman but only let it send a single patch. I felt that my list spam quotient was high enough already, but perhaps not.

Quoted 11 lines

Here I will assume 17/21 is the only patch in the series and the rest should come from v2 unchanged. As this is the only pure ARM related patch in the series (1), I guess my contribution shall be...

(1) patch 18/21 is Samsung and patch 19/21 touches on exynos5250-based boards; my ack is less adequate than that of, respectively, Minkyu as the Samsung custodian and the exynos5250-based boards' maintainers.

Yes

Quoted 3 lines

Note: who/what exactly is "u-boot-review at google.com"?

It is a group of U-Boot people in Google, just so I don't have to copy heaps of people and break the cc limit of the mailing list.

Regards,
Simon

#3 lore raw

PATCH v3 17/21 arm: Implement the 'fake' go command

In reply to Simon Glass
Quoted 31 lines · Simon Glass

Implement this feature on ARM for tracing.

It would be nice to have generic bootm support so that it is easily implemented on any arch.

---
Changes in v3:
- Revert to using 'images' instead of 'image' in boot_jump_linux()

Changes in v2: None

 arch/arm/lib/bootm.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)
arch/arm/lib/bootm.c +6 -1
index 1b6e0ac..b22fbc9 100644
@@ -68,12 +68,19 @@ void arch_lmb_reserve(struct lmb *lmb)
                    gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size - sp);
 }
 
-static void announce_and_cleanup(void)
+/**
+ * announce_and_cleanup() - Print message and prepare for kernel boot
+ *
+ * @fake: non-zero to do everything except actually boot
+ */
+static void announce_and_cleanup(int fake)

arch/arm/lib/bootm.c void arch_lmb_reserve(struct lmb *lmb) · line 84

Quoted 10 lines
arch/arm/lib/bootm.c +4 -2
 {
-       printf("\nStarting kernel ...\n\n");
+       printf("\nStarting kernel ...%s\n\n", fake ?
+               "(fake run for tracing)" : "");
        bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
 #ifdef CONFIG_BOOTSTAGE_FDT
-       bootstage_fdt_add_report();
+       if (flag == BOOTM_STATE_OS_FAKE_GO)
+               bootstage_fdt_add_report();
 #endif

was this ever compiled with CONFIG_BOOTSTAGE_FDT defined? `flag' is not defined here, compilation fails for me when I try enabling this config...

--vb

Quoted 59 lines
arch/arm/lib/bootm.c +8 -7
 #ifdef CONFIG_BOOTSTAGE_REPORT
        bootstage_report();
@@ -225,12 +232,13 @@ static void boot_prep_linux(bootm_headers_t *images)
 }
 
 /* Subcommand: GO */
-static void boot_jump_linux(bootm_headers_t *images)
+static void boot_jump_linux(bootm_headers_t *images, int flag)
 {
        unsigned long machid = gd->bd->bi_arch_number;
        char *s;
        void (*kernel_entry)(int zero, int arch, uint params);
        unsigned long r2;
+       int fake = (flag & BOOTM_STATE_OS_FAKE_GO);
 
        kernel_entry = (void (*)(int, int, uint))images->ep;
 
@@ -243,14 +251,15 @@ static void boot_jump_linux(bootm_headers_t *images)
        debug("## Transferring control to Linux (at address %08lx)" \
                "...\n", (ulong) kernel_entry);
        bootstage_mark(BOOTSTAGE_ID_RUN_OS);
-       announce_and_cleanup();
+       announce_and_cleanup(fake);
 
        if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len)
                r2 = (unsigned long)images->ft_addr;
        else
                r2 = gd->bd->bi_boot_params;
 
-       kernel_entry(0, machid, r2);
+       if (!fake)
+               kernel_entry(0, machid, r2);
 }
 
 /* Main Entry point for arm bootm implementation
@@ -270,13 +279,13 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
                return 0;
        }
 
-       if (flag & BOOTM_STATE_OS_GO) {
-               boot_jump_linux(images);
+       if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
+               boot_jump_linux(images, flag);
                return 0;
        }
 
        boot_prep_linux(images);
-       boot_jump_linux(images);
+       boot_jump_linux(images, flag);
        return 0;
 }
 
--

1.8.3

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#4 lore raw

PATCH v3 17/21 arm: Implement the 'fake' go command

Hi Vb,

Quoted 38 lines · On Wed, Aug 21, 2013 at 3:59 PM, <[email protected]> wrote:
Quoted 37 lines · Simon Glass

Implement this feature on ARM for tracing.

It would be nice to have generic bootm support so that it is easily implemented on any arch.

---
Changes in v3:
- Revert to using 'images' instead of 'image' in boot_jump_linux()

Changes in v2: None

 arch/arm/lib/bootm.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)
arch/arm/lib/bootm.c +8 -2
index 1b6e0ac..b22fbc9 100644
@@ -68,12 +68,19 @@ void arch_lmb_reserve(struct lmb *lmb)
                    gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size - sp);
 }
 
-static void announce_and_cleanup(void)
+/**
+ * announce_and_cleanup() - Print message and prepare for kernel boot
+ *
+ * @fake: non-zero to do everything except actually boot
+ */
+static void announce_and_cleanup(int fake)
 {
-       printf("\nStarting kernel ...\n\n");
+       printf("\nStarting kernel ...%s\n\n", fake ?
+               "(fake run for tracing)" : "");
        bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
 #ifdef CONFIG_BOOTSTAGE_FDT
Quoted 8 lines

arch/arm/lib/bootm.c void arch_lmb_reserve(struct lmb *lmb) · line 84

Quoted 4 lines
arch/arm/lib/bootm.c +2 -1
-       bootstage_fdt_add_report();
+       if (flag == BOOTM_STATE_OS_FAKE_GO)
+               bootstage_fdt_add_report();
 #endif

was this ever compiled with CONFIG_BOOTSTAGE_FDT defined? `flag' is not defined here, compilation fails for me when I try enabling this config...

I am not sure of the answer to your question, but if you have fixed this problem you could submit a patch - it would be welcome.

Regards,
Simon