From: David Gibson <david@gibson.dropbear.id.au>
To: Nicholas Piggin <npiggin@gmail.com>
Cc: "Fabiano Rosas" <farosas@linux.ibm.com>,
qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
"Cédric Le Goater" <clg@kaod.org>
Subject: Re: [PATCH v2 3/3] target/ppc/kvm: Use KVM_CAP_PPC_AIL_MODE_3 to determine cap-ail-mode-3 support
Date: Thu, 17 Feb 2022 11:19:41 +1100 [thread overview]
Message-ID: <Yg2UnVAb9u42pt50@yekko> (raw)
In-Reply-To: <20220216063903.1782281-3-npiggin@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3126 bytes --]
On Wed, Feb 16, 2022 at 04:39:03PM +1000, Nicholas Piggin wrote:
> Use KVM_CAP_PPC_AIL_MODE_3 to determine cap-ail-mode-3 support for KVM
> guests. Keep the fallback heuristic for KVM hosts that pre-date this
> CAP.
>
> This is only proposed the KVM CAP has not yet been allocated. I will
> ask to merge the new KVM cap when there are no objections on the QEMU
> side.
>
> not-yet-Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
LGTM, once the kernel side work is done.
> ---
> Since v1:
> - Remove incorrect test for unsupported cap query. Add comment instead.
>
> linux-headers/linux/kvm.h | 1 +
> target/ppc/kvm.c | 18 ++++++++++++++++++
> 2 files changed, 19 insertions(+)
>
> diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
> index 02c5e7b7bb..d91f578200 100644
> --- a/linux-headers/linux/kvm.h
> +++ b/linux-headers/linux/kvm.h
> @@ -1130,6 +1130,7 @@ struct kvm_ppc_resize_hpt {
> #define KVM_CAP_BINARY_STATS_FD 203
> #define KVM_CAP_EXIT_ON_EMULATION_FAILURE 204
> #define KVM_CAP_ARM_MTE 205
> +#define KVM_CAP_PPC_AIL_MODE_3 210
You may be aware of this already, but once the cap is allocated on the
kernel side, you should do a full update of the kernel headers as a
separate patch. A direct hack to the headers copy is fine for a
preliminary posting, though.
>
> #ifdef KVM_CAP_IRQ_ROUTING
>
> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> index 1338c41f8f..7f71f78253 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -90,6 +90,7 @@ static int cap_ppc_nested_kvm_hv;
> static int cap_large_decr;
> static int cap_fwnmi;
> static int cap_rpt_invalidate;
> +static int cap_ail_mode_3;
>
> static uint32_t debug_inst_opcode;
>
> @@ -154,6 +155,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
> }
>
> cap_rpt_invalidate = kvm_vm_check_extension(s, KVM_CAP_PPC_RPT_INVALIDATE);
> + cap_ail_mode_3 = kvm_vm_check_extension(s, KVM_CAP_PPC_AIL_MODE_3);
> kvm_ppc_register_host_cpu_type();
>
> return 0;
> @@ -2567,6 +2569,17 @@ bool kvmppc_supports_ail_3(void)
> {
> PowerPCCPUClass *pcc = kvm_ppc_get_host_cpu_class();
>
> + if (cap_ail_mode_3) {
> + return 1;
> + }
> +
> + /*
> + * cap-ail-mode-3 is disabled, but it may be because the KVM host pre-dates
> + * the cap. Special-case the test because the performance cost for
> + * disabling the feature unconditionally is prohibitive until updated
> + * KVM is widely in use.
> + */
> +
> /*
> * KVM PR only supports AIL-0
> */
> @@ -2589,6 +2602,11 @@ bool kvmppc_supports_ail_3(void)
> return 0;
> }
>
> + /*
> + * Beyond ISA v3.1 (POWER10), this could return 0, because all KVM
> + * implementations for such hosts would support the cap.
> + */
> +
> return 1;
> }
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2022-02-17 2:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-16 6:39 [PATCH v2 1/3] target/ppc: Fix POWER9 DD2.0 PVR, add DD2.1 Nicholas Piggin
2022-02-16 6:39 ` [PATCH v2 2/3] spapr: Add SPAPR_CAP_AIL_MODE_3 for AIL mode 3 support for H_SET_MODE hcall Nicholas Piggin
2022-02-17 0:17 ` David Gibson
2022-02-23 7:42 ` Nicholas Piggin
2022-02-28 2:09 ` David Gibson
2022-02-28 14:09 ` Cédric Le Goater
2022-02-16 6:39 ` [PATCH v2 3/3] target/ppc/kvm: Use KVM_CAP_PPC_AIL_MODE_3 to determine cap-ail-mode-3 support Nicholas Piggin
2022-02-17 0:19 ` David Gibson [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=Yg2UnVAb9u42pt50@yekko \
--to=david@gibson.dropbear.id.au \
--cc=clg@kaod.org \
--cc=farosas@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).