qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Harsh Prateek Bora <harshpb@linux.ibm.com>
To: Nicholas Piggin <npiggin@gmail.com>, qemu-ppc@nongnu.org
Cc: Daniel Henrique Barboza <danielhb413@gmail.com>,
	David Gibson <david@gibson.dropbear.id.au>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH] ppc/spapr: Add ibm,pi-features
Date: Mon, 20 May 2024 13:15:29 +0530	[thread overview]
Message-ID: <f0ad2844-eccd-4bb2-9aa9-42bd2f08e1c2@linux.ibm.com> (raw)
In-Reply-To: <20240518095641.408598-1-npiggin@gmail.com>



On 5/18/24 15:26, Nicholas Piggin wrote:
> The ibm,pi-features property has a bit to say whether or not
> msgsndp should be used. Linux checks if it is being run under
> KVM and avoids msgsndp anyway, but it would be preferable to
> rely on this bit.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>

> ---
>   hw/ppc/spapr.c | 27 +++++++++++++++++++++++++++
>   1 file changed, 27 insertions(+)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 611a9e5184..6891d91e6e 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -353,6 +353,31 @@ static void spapr_dt_pa_features(SpaprMachineState *spapr,
>       _FDT((fdt_setprop(fdt, offset, "ibm,pa-features", pa_features, pa_size)));
>   }
>   
> +static void spapr_dt_pi_features(SpaprMachineState *spapr,
> +                                 PowerPCCPU *cpu,
> +                                 void *fdt, int offset)
> +{
> +    uint8_t pi_features[] = { 1, 0,
> +        0x00 };
> +
> +    if (kvm_enabled() && ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_3_00,
> +                                          0, cpu->compat_pvr)) {
> +        /*
> +         * POWER9 and later CPUs with KVM run in LPAR-per-thread mode where
> +         * all threads are essentially independent CPUs, and msgsndp does not
> +         * work (because it is physically-addressed) and therefore is
> +         * emulated by KVM, so disable it here to ensure XIVE will be used.
> +         * This is both KVM and CPU implementation-specific behaviour so a KVM
> +         * cap would be cleanest, but for now this works. If KVM ever permits
> +         * native msgsndp execution by guests, a cap could be added at that
> +         * time.
> +         */
> +        pi_features[2] |= 0x08; /* 4: No msgsndp */
> +    }
> +
> +    _FDT((fdt_setprop(fdt, offset, "ibm,pi-features", pi_features, sizeof(pi_features))));
> +}
> +
>   static hwaddr spapr_node0_size(MachineState *machine)
>   {
>       if (machine->numa_state->num_nodes) {
> @@ -815,6 +840,8 @@ static void spapr_dt_cpu(CPUState *cs, void *fdt, int offset,
>   
>       spapr_dt_pa_features(spapr, cpu, fdt, offset);
>   
> +    spapr_dt_pi_features(spapr, cpu, fdt, offset);
> +
>       _FDT((fdt_setprop_cell(fdt, offset, "ibm,chip-id",
>                              cs->cpu_index / vcpus_per_socket)));
>   


      reply	other threads:[~2024-05-20  7:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-18  9:56 [PATCH] ppc/spapr: Add ibm,pi-features Nicholas Piggin
2024-05-20  7:45 ` Harsh Prateek Bora [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=f0ad2844-eccd-4bb2-9aa9-42bd2f08e1c2@linux.ibm.com \
    --to=harshpb@linux.ibm.com \
    --cc=danielhb413@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --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).