qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Sourabh Jain <sourabhjain@linux.ibm.com>
To: Aditya Gupta <adityag@linux.ibm.com>, qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, Nicholas Piggin <npiggin@gmail.com>,
	Daniel Henrique Barboza <danielhb413@gmail.com>,
	Harsh Prateek Bora <harshpb@linux.ibm.com>,
	Mahesh J Salgaonkar <mahesh@linux.ibm.com>,
	Hari Bathini <hbathini@linux.ibm.com>
Subject: Re: [PATCH v4 6/8] hw/ppc: Pass dump-sizes property for fadump in device tree
Date: Sat, 18 Oct 2025 16:50:12 +0530	[thread overview]
Message-ID: <65b70282-c6ca-4140-92f6-d266082b6d49@linux.ibm.com> (raw)
In-Reply-To: <20250323174007.221116-7-adityag@linux.ibm.com>




On 23/03/25 23:10, Aditya Gupta wrote:
> Platform (ie. QEMU) is expected to pass few device tree properties for
> details for fadump:
>
>    * "ibm,configure-kernel-dump-sizes": Space required to store dump data
>      for firmware provided dump sections (ie. CPU & HPTE regions)
>    * "ibm,configure-kernel-dump-version": Versions of fadump supported
>
> Pass the above device tree nodes so that kernel can reserve sufficient
> space for preserving the CPU state data
>
> Note: As of this patch, the "kernel-dump" device tree entry is still not
> added for the second boot, so after crash, the second kernel will boot
> assuming fadump dump is "NOT" active, and try to register for fadump,
> but since we already have fadump registered in QEMU internal state, the
> register rtas call will fail with: "DUMP ACTIVE"
>
> Signed-off-by: Aditya Gupta <adityag@linux.ibm.com>
> ---
>   hw/ppc/spapr.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 57 insertions(+)
>
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index a415e51d077a..3cbc6a7409b7 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -900,6 +900,61 @@ static int spapr_dt_rng(void *fdt)
>       return ret ? -1 : 0;
>   }
>   
> +static void spapr_dt_rtas_fadump(SpaprMachineState *spapr, void *fdt, int rtas)
> +{
> +    MachineState *ms = MACHINE(spapr);
> +    MachineClass *mc = MACHINE_GET_CLASS(ms);
> +
> +    uint32_t max_possible_cpus = mc->possible_cpu_arch_ids(ms)->len;
> +    uint64_t fadump_cpu_state_size = 0;
> +    uint16_t fadump_versions[2] = {
> +        FADUMP_VERSION /* min supported version */,
> +        FADUMP_VERSION /* max supported version */
> +    };
> +    uint32_t fadump_rgn_sizes[2][3] = {
> +        {
> +            cpu_to_be32(FADUMP_CPU_STATE_DATA),
> +            0, 0 /* Calculated later */
> +        },
> +        {
> +            cpu_to_be32(FADUMP_HPTE_REGION),
> +            0, 0 /* HPTE region not implemented */
> +        }

#nit-pick
Why to advertise if we don't support it? Kernel anyways ignores this for 
now.

> +    };
> +
> +    /*
> +     * CPU State Data contains multiple fields such as header, num_cpus and
> +     * register entries
> +     *
> +     * Calculate the maximum CPU State Data size, according to maximum
> +     * possible CPUs the QEMU VM can have
> +     *
> +     * This calculation must match the 'cpu_state_len' calculation done in
> +     * 'populate_cpu_state_data' in spapr_fadump.c
> +     */
> +    fadump_cpu_state_size += sizeof(struct FadumpRegSaveAreaHeader);
> +    fadump_cpu_state_size += 0xc;                      /* padding as in PAPR */
> +    fadump_cpu_state_size += sizeof(__be32);           /* num_cpus */
> +    fadump_cpu_state_size += max_possible_cpus   *     /* reg entries */
> +                             FADUMP_NUM_PER_CPU_REGS *
> +                             sizeof(struct FadumpRegEntry);
> +
> +    /* Set maximum size for CPU state data region */
> +    assert(fadump_rgn_sizes[0][0] == cpu_to_be32(FADUMP_CPU_STATE_DATA));
> +
> +    /* Upper 32 bits of size, usually 0 */
> +    fadump_rgn_sizes[0][1] = cpu_to_be32(fadump_cpu_state_size >> 32);
> +
> +    /* Lower 32 bits of size */
> +    fadump_rgn_sizes[0][2] = cpu_to_be32(fadump_cpu_state_size & 0xffffffff);
> +
> +    /* Add device tree properties required from platform for fadump */
> +    _FDT((fdt_setprop(fdt, rtas, "ibm,configure-kernel-dump-version",
> +                    fadump_versions, sizeof(fadump_versions))));
> +    _FDT((fdt_setprop(fdt, rtas, "ibm,configure-kernel-dump-sizes",
> +                    fadump_rgn_sizes, sizeof(fadump_rgn_sizes))));
> +}
> +
>   static void spapr_dt_rtas(SpaprMachineState *spapr, void *fdt)
>   {
>       MachineState *ms = MACHINE(spapr);
> @@ -1012,6 +1067,8 @@ static void spapr_dt_rtas(SpaprMachineState *spapr, void *fdt)
>       _FDT(fdt_setprop(fdt, rtas, "ibm,lrdr-capacity",
>                        lrdr_capacity, sizeof(lrdr_capacity)));
>   
> +    spapr_dt_rtas_fadump(spapr, fdt, rtas);
> +
>       spapr_dt_rtas_tokens(fdt, rtas);
>   }
>   



  reply	other threads:[~2025-10-18 11:21 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-23 17:39 [PATCH v4 0/8] Implement Firmware Assisted Dump for PSeries Aditya Gupta
2025-03-23 17:40 ` [PATCH v4 1/8] hw/ppc: Implement skeleton code for fadump in PSeries Aditya Gupta
2025-04-21 10:51   ` Harsh Prateek Bora
2025-04-22  4:48     ` Aditya Gupta
2025-10-17  8:40   ` Sourabh Jain
2025-10-17 11:38     ` Aditya Gupta
2025-10-17 11:44       ` Aditya Gupta
2025-10-20  5:23         ` Sourabh Jain
2025-10-17 11:46       ` Sourabh Jain
2025-10-17 11:56         ` Aditya Gupta
2025-10-18 11:50   ` Sourabh Jain
2025-10-19 11:30     ` Aditya Gupta
2025-03-23 17:40 ` [PATCH v4 2/8] hw/ppc: Implement fadump register command Aditya Gupta
2025-10-17  9:54   ` Sourabh Jain
2025-10-17 11:55     ` Aditya Gupta
2025-10-20  5:26       ` Sourabh Jain
2025-03-23 17:40 ` [PATCH v4 3/8] hw/ppc: Trigger Fadump boot if fadump is registered Aditya Gupta
2025-10-17 11:26   ` Sourabh Jain
2025-10-17 11:59     ` Aditya Gupta
2025-03-23 17:40 ` [PATCH v4 4/8] hw/ppc: Preserve memory regions registered for fadump Aditya Gupta
2025-10-17 13:06   ` Sourabh Jain
2025-10-17 18:13     ` Aditya Gupta
2025-03-23 17:40 ` [PATCH v4 5/8] hw/ppc: Implement saving CPU state in Fadump Aditya Gupta
2025-10-18 10:54   ` Sourabh Jain
2025-10-19 19:22     ` Aditya Gupta
2025-10-20  5:40       ` Sourabh Jain
2025-03-23 17:40 ` [PATCH v4 6/8] hw/ppc: Pass dump-sizes property for fadump in device tree Aditya Gupta
2025-10-18 11:20   ` Sourabh Jain [this message]
2025-10-19 19:30     ` Aditya Gupta
2025-10-20  5:44       ` Sourabh Jain
2025-03-23 17:40 ` [PATCH v4 7/8] hw/ppc: Enable fadump for PSeries Aditya Gupta
2025-10-18 12:04   ` Sourabh Jain
2025-10-20 19:44     ` Aditya Gupta
2025-03-23 17:40 ` [PATCH v4 8/8] tests/functional: Add test for fadump in PSeries Aditya Gupta
2025-04-21  6:27 ` [PATCH v4 0/8] Implement Firmware Assisted Dump for PSeries Aditya Gupta
2025-10-21  5:00 ` Harsh Prateek Bora

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=65b70282-c6ca-4140-92f6-d266082b6d49@linux.ibm.com \
    --to=sourabhjain@linux.ibm.com \
    --cc=adityag@linux.ibm.com \
    --cc=danielhb413@gmail.com \
    --cc=harshpb@linux.ibm.com \
    --cc=hbathini@linux.ibm.com \
    --cc=mahesh@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --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).