qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Subject: Re: [PATCH-for-10.1 2/4] target/sparc: Restrict SPARC64 specific features
Date: Tue, 25 Mar 2025 07:07:05 -0700	[thread overview]
Message-ID: <3776d8fe-f94c-41f2-baba-81c76655703e@linaro.org> (raw)
In-Reply-To: <20250325123927.74939-3-philmd@linaro.org>

On 3/25/25 05:39, Philippe Mathieu-Daudé wrote:
> @@ -2750,12 +2752,16 @@ static bool trans_SETHI(DisasContext *dc, arg_SETHI *a)
>   static bool do_tcc(DisasContext *dc, int cond, int cc,
>                      int rs1, bool imm, int rs2_or_imm)
>   {
> -    int mask = ((dc->def->features & CPU_FEATURE_HYPV) && supervisor(dc)
> -                ? UA2005_HTRAP_MASK : V8_TRAP_MASK);
> +    int mask = 0;
>       DisasCompare cmp;
>       TCGLabel *lab;
>       TCGv_i32 trap;
>   
> +#ifdef TARGET_SPARC64
> +    mask = ((dc->def->features & CPU_FEATURE_HYPV) && supervisor(dc))
> +           ? UA2005_HTRAP_MASK : V8_TRAP_MASK;
> +#endif

This is wrong.  The conversion could have been

   int mask = V8_TRAP_MASK;
#ifdef
   if (HYPV && super) {
     mask = UA2005_HTRAP_MASK;
   }
#endif

but that's an excellent reason not to have the ifdef at all.

If you want to hide the features from sparc32, so they don't show up on the command-line, 
fine.  But I think you want to introduce

#define CPU_FEATURE_HYPV 0

etc for sparc32 to automatically fail such tests as these without further modification.


r~


  reply	other threads:[~2025-03-25 14:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-25 12:39 [PATCH-for-10.1 0/4] target/sparc: Spring cleanups around CPU features & LEON3 Philippe Mathieu-Daudé
2025-03-25 12:39 ` [PATCH-for-10.1 1/4] target/sparc: Expose more CPU features Philippe Mathieu-Daudé
2025-03-25 14:11   ` Richard Henderson
2025-03-25 14:43     ` Philippe Mathieu-Daudé
2025-03-25 12:39 ` [PATCH-for-10.1 2/4] target/sparc: Restrict SPARC64 specific features Philippe Mathieu-Daudé
2025-03-25 14:07   ` Richard Henderson [this message]
2025-03-25 14:41     ` Philippe Mathieu-Daudé
2025-03-25 12:39 ` [PATCH-for-10.1 3/4] target/sparc: Log unimplemented ASI load/store accesses Philippe Mathieu-Daudé
2025-03-26 14:49   ` Clément Chigot
2025-03-25 12:39 ` [PATCH-for-10.1 4/4] target/sparc: Move hardware fields from CPUSPARCState to SPARCCPU Philippe Mathieu-Daudé
2025-03-26 14:54   ` Clément Chigot

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=3776d8fe-f94c-41f2-baba-81c76655703e@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=qemu-devel@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).