2018-12-13 13:55:25

by Christophe Leroy

[permalink] [raw]
Subject: [PATCH] powerpc/prom: fix early DEBUG messages

This patch fixes early DEBUG messages in prom.c:
- Use %px instead of %p to see the addresses
- Use %x instead of %llx when phys_addr_t is not 64 bits.

Signed-off-by: Christophe Leroy <[email protected]>
---
arch/powerpc/kernel/prom.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index fe758cedb93f..d8e56e03c9c6 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -129,7 +129,7 @@ static void __init move_device_tree(void)
p = __va(memblock_phys_alloc(size, PAGE_SIZE));
memcpy(p, initial_boot_params, size);
initial_boot_params = p;
- DBG("Moved device tree to 0x%p\n", p);
+ DBG("Moved device tree to 0x%px\n", p);
}

DBG("<- move_device_tree\n");
@@ -689,7 +689,7 @@ void __init early_init_devtree(void *params)
{
phys_addr_t limit;

- DBG(" -> early_init_devtree(%p)\n", params);
+ DBG(" -> early_init_devtree(%px)\n", params);

/* Too early to BUG_ON(), do it by hand */
if (!early_init_dt_verify(params))
@@ -749,7 +749,11 @@ void __init early_init_devtree(void *params)
memblock_allow_resize();
memblock_dump_all();

+#ifdef CONFIG_PHYS_64BIT
DBG("Phys. mem: %llx\n", memblock_phys_mem_size());
+#else
+ DBG("Phys. mem: %x\n", memblock_phys_mem_size());
+#endif

/* We may need to relocate the flat tree, do it now.
* FIXME .. and the initrd too? */
--
2.13.3



2018-12-14 06:23:52

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH] powerpc/prom: fix early DEBUG messages

Christophe Leroy <[email protected]> writes:

> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index fe758cedb93f..d8e56e03c9c6 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -749,7 +749,11 @@ void __init early_init_devtree(void *params)
> memblock_allow_resize();
> memblock_dump_all();
>
> +#ifdef CONFIG_PHYS_64BIT
> DBG("Phys. mem: %llx\n", memblock_phys_mem_size());
> +#else
> + DBG("Phys. mem: %x\n", memblock_phys_mem_size());
> +#endif

Can we just do:

DBG("Phys. mem: %llx\n", (unsigned long long)memblock_phys_mem_size());

?

cheers

2018-12-14 10:40:31

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH] powerpc/prom: fix early DEBUG messages



Le 14/12/2018 à 07:22, Michael Ellerman a écrit :
> Christophe Leroy <[email protected]> writes:
>
>> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
>> index fe758cedb93f..d8e56e03c9c6 100644
>> --- a/arch/powerpc/kernel/prom.c
>> +++ b/arch/powerpc/kernel/prom.c
>> @@ -749,7 +749,11 @@ void __init early_init_devtree(void *params)
>> memblock_allow_resize();
>> memblock_dump_all();
>>
>> +#ifdef CONFIG_PHYS_64BIT
>> DBG("Phys. mem: %llx\n", memblock_phys_mem_size());
>> +#else
>> + DBG("Phys. mem: %x\n", memblock_phys_mem_size());
>> +#endif
>
> Can we just do:
>
> DBG("Phys. mem: %llx\n", (unsigned long long)memblock_phys_mem_size());
>
> ?
>

Yes that's obviously better, especially as we don't fix the length of
the displayed value.
Christophe