qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: Daniel Henrique Barboza <danielhb413@gmail.com>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, david@gibson.dropbear.id.au
Subject: Re: [PATCH v2 1/1] spapr_caps.c: check user input before warning about TCG only caps
Date: Wed, 20 Jan 2021 12:16:26 +0100	[thread overview]
Message-ID: <20210120121626.3e7bf3c4@bahia.lan> (raw)
In-Reply-To: <20210120105406.163074-2-danielhb413@gmail.com>

On Wed, 20 Jan 2021 07:54:06 -0300
Daniel Henrique Barboza <danielhb413@gmail.com> wrote:

> Commit 006e9d361869 added warning messages for cap-cfpc, cap-ibs and
> cap-sbbc when enabled under TCG. Commit 8ff43ee404d3 did the same thing
> when introducing cap-ccf-assist.
> 
> These warning messages, although benign to the machine launch, can make
> users a bit confused. E.g:
> 
> $ sudo ./ppc64-softmmu/qemu-system-ppc64
> qemu-system-ppc64: warning: TCG doesn't support requested feature, cap-cfpc=workaround
> qemu-system-ppc64: warning: TCG doesn't support requested feature, cap-sbbc=workaround
> qemu-system-ppc64: warning: TCG doesn't support requested feature, cap-ibs=workaround
> qemu-system-ppc64: warning: TCG doesn't support requested feature, cap-ccf-assist=on
> 
> We're complaining about "TCG doesn't support requested feature" when the
> user didn't request any of those caps in the command line.
> 
> Check if these caps were set in the command line before sending an user
> warning.
> 
> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> ---

Heh I've just posted a mail suggesting you to do something like that :)

Reviewed-by: Greg Kurz <groug@kaod.org>

>  hw/ppc/spapr_caps.c | 47 ++++++++++++++++++++++++++++++++++-----------
>  1 file changed, 36 insertions(+), 11 deletions(-)
> 
> diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c
> index 9341e9782a..629c24a96d 100644
> --- a/hw/ppc/spapr_caps.c
> +++ b/hw/ppc/spapr_caps.c
> @@ -244,9 +244,15 @@ static void cap_safe_cache_apply(SpaprMachineState *spapr, uint8_t val,
>      uint8_t kvm_val =  kvmppc_get_cap_safe_cache();
>  
>      if (tcg_enabled() && val) {
> -        /* TCG only supports broken, allow other values and print a warning */
> -        warn_report("TCG doesn't support requested feature, cap-cfpc=%s",
> -                    cap_cfpc_possible.vals[val]);
> +        /*
> +         * TCG only supports broken, allow other values and print a warning
> +         * in case the user attempted to set a different value in the command
> +         * line.
> +         */
> +        if (spapr->cmd_line_caps[SPAPR_CAP_CFPC] != SPAPR_CAP_BROKEN) {
> +            warn_report("TCG doesn't support requested feature, cap-cfpc=%s",
> +                        cap_cfpc_possible.vals[val]);
> +        }
>      } else if (kvm_enabled() && (val > kvm_val)) {
>          error_setg(errp,
>                     "Requested safe cache capability level not supported by KVM");
> @@ -269,9 +275,15 @@ static void cap_safe_bounds_check_apply(SpaprMachineState *spapr, uint8_t val,
>      uint8_t kvm_val =  kvmppc_get_cap_safe_bounds_check();
>  
>      if (tcg_enabled() && val) {
> -        /* TCG only supports broken, allow other values and print a warning */
> -        warn_report("TCG doesn't support requested feature, cap-sbbc=%s",
> -                    cap_sbbc_possible.vals[val]);
> +        /*
> +         * TCG only supports broken, allow other values and print a warning
> +         * in case the user attempted to set a different value in the command
> +         * line.
> +         */
> +        if (spapr->cmd_line_caps[SPAPR_CAP_SBBC] != SPAPR_CAP_BROKEN) {
> +            warn_report("TCG doesn't support requested feature, cap-sbbc=%s",
> +                        cap_sbbc_possible.vals[val]);
> +        }
>      } else if (kvm_enabled() && (val > kvm_val)) {
>          error_setg(errp,
>  "Requested safe bounds check capability level not supported by KVM");
> @@ -297,9 +309,15 @@ static void cap_safe_indirect_branch_apply(SpaprMachineState *spapr,
>      uint8_t kvm_val = kvmppc_get_cap_safe_indirect_branch();
>  
>      if (tcg_enabled() && val) {
> -        /* TCG only supports broken, allow other values and print a warning */
> -        warn_report("TCG doesn't support requested feature, cap-ibs=%s",
> -                    cap_ibs_possible.vals[val]);
> +        /*
> +         * TCG only supports broken, allow other values and print a warning
> +         * in case the user attempted to set a different value in the command
> +         * line.
> +         */
> +        if (spapr->cmd_line_caps[SPAPR_CAP_IBS] != SPAPR_CAP_BROKEN) {
> +            warn_report("TCG doesn't support requested feature, cap-ibs=%s",
> +                        cap_ibs_possible.vals[val]);
> +        }
>      } else if (kvm_enabled() && (val > kvm_val)) {
>          error_setg(errp,
>  "Requested safe indirect branch capability level not supported by KVM");
> @@ -483,8 +501,15 @@ static void cap_ccf_assist_apply(SpaprMachineState *spapr, uint8_t val,
>      uint8_t kvm_val = kvmppc_get_cap_count_cache_flush_assist();
>  
>      if (tcg_enabled() && val) {
> -        /* TCG doesn't implement anything here, but allow with a warning */
> -        warn_report("TCG doesn't support requested feature, cap-ccf-assist=on");
> +        /*
> +         * TCG doesn't implement anything here, but allow with a warning
> +         * in case the user attempted to set a different value in the command
> +         * line.
> +         */
> +        if (spapr->cmd_line_caps[SPAPR_CAP_CCF_ASSIST] != SPAPR_CAP_OFF) {
> +            warn_report("TCG doesn't support requested feature, "
> +                        "cap-ccf-assist=on");
> +        }
>      } else if (kvm_enabled() && (val > kvm_val)) {
>          uint8_t kvm_ibs = kvmppc_get_cap_safe_indirect_branch();
>  



  reply	other threads:[~2021-01-20 11:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-20 10:54 [PATCH v2 0/1] spapr_caps.c: check user input before warning about TCG only caps Daniel Henrique Barboza
2021-01-20 10:54 ` [PATCH v2 1/1] " Daniel Henrique Barboza
2021-01-20 11:16   ` Greg Kurz [this message]
2021-01-23  1:46   ` David Gibson
2021-01-25 11:27     ` Daniel Henrique Barboza

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=20210120121626.3e7bf3c4@bahia.lan \
    --to=groug@kaod.org \
    --cc=danielhb413@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --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).