From: Aditya Gupta <adityag@linux.ibm.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Cc: Nicholas Piggin <npiggin@gmail.com>,
Madhavan Srinivasan <maddy@linux.ibm.com>
Subject: Re: [RFC PATCH] ppc/spapr: Change printf format to %HWADDR_PRId for MIN_RMA_SLOF
Date: Mon, 23 Sep 2024 12:29:52 +0530 [thread overview]
Message-ID: <28ccb5c2-dca5-4475-a9c4-bb199fef8578@linux.ibm.com> (raw)
In-Reply-To: <c960cbd9-dc19-4f96-b5f4-cbd3c5c9bcf2@linaro.org>
Hi Philippe,
Sorry for the late reply.
On 12/09/24 12:34, Philippe Mathieu-Daudé wrote:
> Hi Aditya,
>
> On 12/9/24 08:52, Aditya Gupta wrote:
>> Currently starting a pSeries machine, with lesser than 128MiB shows
>> below error:
>>
>> qemu-system-ppc64: pSeries SLOF firmware requires >= 80ldMiB
>> guest RMA (Real Mode Area memory)
>>
>> Above '80ldMib' is in hex, and it means 0x80 MiB = 128 MiB.
>>
>> Change format specifier for this value to use 'HWADDR_PRId', instead of
>> 'HWADDR_PRIx' thus showing decimal value instead of hex.
>>
>> Thus, change the message to below error:
>>
>> qemu-system-ppc64: pSeries SLOF firmware requires >= 128MiB
>> guest RMA (Real Mode Area memory)
>>
>> Signed-off-by: Aditya Gupta <adityag@linux.ibm.com>
>>
>> ---
>> This is an RFC, as it confused me why does QEMU print that error even
>> with '-m' >80 MB.
>>
>> This patch can also be considered a personal preference to see it as
>> a decimal value instead of hex.
>>
>> Or maybe we can have '0x80 MiB' instead ?
>
> Simply use size_to_str(), see hw/ppc/pnv.c:
>
> /* allocate RAM */
> if (machine->ram_size < mc->default_ram_size) {
> char *sz = size_to_str(mc->default_ram_size);
> error_report("Invalid RAM size, should be bigger than %s", sz);
> g_free(sz);
> exit(EXIT_FAILURE);
> }
>
I would prefer the existing printf approach, as it seems simple to me,
but can change to use 'size_to_str' if that's the generally accepted
approach. What do you say ?
Thanks,
Aditya Gupta
>> Does the 'ldMiB' actually mean that the value is in hexadecimal ? I
>> did not find a reason in git history.
>> ---
>> ---
>> hw/ppc/spapr.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
>> index 8aa3ce7449be..b2ddacc6dd01 100644
>> --- a/hw/ppc/spapr.c
>> +++ b/hw/ppc/spapr.c
>> @@ -2819,8 +2819,8 @@ static hwaddr spapr_rma_size(SpaprMachineState
>> *spapr, Error **errp)
>> if (rma_size < MIN_RMA_SLOF) {
>> error_setg(errp,
>> - "pSeries SLOF firmware requires >= %" HWADDR_PRIx
>> - "ldMiB guest RMA (Real Mode Area memory)",
>> + "pSeries SLOF firmware requires >= %" HWADDR_PRId
>> + "MiB guest RMA (Real Mode Area memory)",
>> MIN_RMA_SLOF / MiB);
>> return 0;
>> }
>
> Amusingly MIN_RMA_SLOF is a constant:
>
> #define MIN_RMA_SLOF (128 * MiB)
>
> Anyhow it could be changed, so better not hard-code the value in the
> error message. Your patch becomes:
>
> if (rma_size < MIN_RMA_SLOF) {
> - error_setg(errp,
> - "pSeries SLOF firmware requires >= %" HWADDR_PRIx
> - "ldMiB guest RMA (Real Mode Area memory)",
> - MIN_RMA_SLOF / MiB);
> + g_autofree char *min_rma_size_str = size_to_str(MIN_RMA_SLOF);
> +
> + error_setg(errp, "pSeries SLOF firmware requires >= %s guest"
> + "RMA (Real Mode Area memory)",
> min_rma_size_str);
> return 0;
> }
>
> Regards,
>
> Phil.
prev parent reply other threads:[~2024-09-23 7:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-12 6:52 [RFC PATCH] ppc/spapr: Change printf format to %HWADDR_PRId for MIN_RMA_SLOF Aditya Gupta
2024-09-12 7:04 ` Philippe Mathieu-Daudé
2024-09-23 6:59 ` Aditya Gupta [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=28ccb5c2-dca5-4475-a9c4-bb199fef8578@linux.ibm.com \
--to=adityag@linux.ibm.com \
--cc=maddy@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).