Subject: Re: [RFC 3/8] book3s64/hash: Fix phys_addr_t printf format in htab_initialize()

From: Ritesh Harjani (IBM) <[email-masked]>
Date: Sat, 30 Aug 2025 13:00:58 +0530

Christophe Leroy <[email-masked]> writes:

> Le 30/08/2025 à 05:51, Ritesh Harjani (IBM) a écrit :
>> We get below errors when we try to enable debug logs in book3s64/hash_utils.c
>> This patch fixes these errors related to phys_addr_t printf format.
>> 
>> arch/powerpc/mm/book3s64/hash_utils.c: In function ‘htab_initialize’:
>> arch/powerpc/mm/book3s64/hash_utils.c:1401:21: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘phys_addr_t’ {aka ‘long long unsigned int’} [-Werror=format=]
>>   1401 |                 DBG("creating mapping for region: %lx..%lx (prot: %lx)\n",
>> arch/powerpc/mm/book3s64/hash_utils.c:1401:21: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘phys_addr_t’ {aka ‘long long unsigned int’} [-Werror=format=]
>> cc1: all warnings being treated as errors
>> make[6]: *** [../scripts/Makefile.build:287: arch/powerpc/mm/book3s64/hash_utils.o] Error 1
>> 
>> Cc: Madhavan Srinivasan <[email-masked]>
>> Cc: Michael Ellerman <[email-masked]>
>> Cc: Nicholas Piggin <[email-masked]>
>> Cc: Christophe Leroy <[email-masked]>
>> Cc: Paul Mackerras <[email-masked]>
>> Cc: "Aneesh Kumar K.V" <[email-masked]>
>> Cc: Donet Tom <[email-masked]>
>> Cc: [email-masked]
>> Signed-off-by: Ritesh Harjani (IBM) <[email-masked]>
>> ---
>>   arch/powerpc/mm/book3s64/hash_utils.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c
>> index 1e062056cfb8..495b6da6f5d4 100644
>> --- a/arch/powerpc/mm/book3s64/hash_utils.c
>> +++ b/arch/powerpc/mm/book3s64/hash_utils.c
>> @@ -1394,7 +1394,7 @@ static void __init htab_initialize(void)
>>   		size = end - base;
>>   		base = (unsigned long)__va(base);
>> 
>> -		DBG("creating mapping for region: %lx..%lx (prot: %lx)\n",
>> +		DBG("creating mapping for region: %llx..%llx (prot: %lx)\n",
>
> Use %pa
>
> See 
> https://docs.kernel.org/core-api/printk-formats.html#physical-address-types-phys-addr-t
>

Right. Make sense. Will change it in the next spin. 

-ritesh

>>   		    base, size, prot);
>> 
>>   		if ((base + size) >= H_VMALLOC_START) {
>> --
>> 2.50.1
>>