qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mayuresh Chitale <mchitale@ventanamicro.com>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: qemu-devel@nongnu.org, qemu-riscv@nongnu.org,
	alistair.francis@wdc.com,
	 Alistair Francis <alistair23@gmail.com>,
	Daniel Barboza <dbarboza@ventanamicro.com>,
	liweiwei@iscas.ac.cn
Subject: Re: [RFC PATCH 3/4] target/riscv: check smstateen fcsr flag
Date: Fri, 14 Apr 2023 11:14:04 +0530	[thread overview]
Message-ID: <CAN37VV4cUptywft_pAdfkyr=jo2iM=nr0++o92khCmVw02Oa5A@mail.gmail.com> (raw)
In-Reply-To: <9592dac6-2ba7-533a-1d70-2244ecc59761@linaro.org>

On Tue, Apr 11, 2023 at 7:23 AM Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 4/10/23 07:13, Mayuresh Chitale wrote:
> > +#ifndef CONFIG_USER_ONLY
> > +#define smstateen_fcsr_check(ctx) do { \
> > +    if (!ctx->smstateen_fcsr_ok) { \
> > +        if (ctx->virt_enabled) { \
> > +            generate_exception(ctx, RISCV_EXCP_VIRT_INSTRUCTION_FAULT); \
> > +        } else { \
> > +            generate_exception(ctx, RISCV_EXCP_ILLEGAL_INST); \
> > +        } \
> > +        return true; \
> > +    } \
> > +} while (0)
> > +#else
> > +#define smstateen_fcsr_check(ctx)
> > +#endif
> > +
> > +#define REQUIRE_ZFINX_OR_F(ctx) do { \
> > +    if (!has_ext(ctx, RVF)) { \
> > +        if (!ctx->cfg_ptr->ext_zfinx) { \
> > +            return false; \
> > +        } \
> > +        smstateen_fcsr_check(ctx); \
> >       } \
> >   } while (0)
>
> As a matter of style, I strongly object to a *nested* macro returning from the calling
> function.  These should all be changed to normal functions of the form
>
>      if (!require_xyz(ctx) || !require_abc(ctx)) {
>          return something;
>      }
>
> etc.  insn_trans/trans_rvv.c.inc is much much cleaner in this respect.
Ok. I will change smstateen_fcsr_check to a function.
>
>
> r~


  reply	other threads:[~2023-04-14  5:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-10 14:13 [RFC PATCH 0/4] Smstateen FCSR implementation Mayuresh Chitale
2023-04-10 14:13 ` [RFC PATCH 1/4] target/riscv: smstateen check for fcsr Mayuresh Chitale
2023-04-10 14:44   ` liweiwei
2023-04-14  5:41     ` Mayuresh Chitale
2023-04-10 14:13 ` [RFC PATCH 2/4] target/riscv: Add fcsr field in tb->flags Mayuresh Chitale
2023-04-11  1:47   ` Richard Henderson
2023-04-14  5:46     ` Mayuresh Chitale
2023-04-10 14:13 ` [RFC PATCH 3/4] target/riscv: check smstateen fcsr flag Mayuresh Chitale
2023-04-10 14:30   ` liweiwei
2023-04-14  5:42     ` Mayuresh Chitale
2023-04-11  1:52   ` Richard Henderson
2023-04-14  5:44     ` Mayuresh Chitale [this message]
2023-04-10 14:13 ` [RFC PATCH 4/4] target/riscv: smstateen knobs Mayuresh Chitale

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='CAN37VV4cUptywft_pAdfkyr=jo2iM=nr0++o92khCmVw02Oa5A@mail.gmail.com' \
    --to=mchitale@ventanamicro.com \
    --cc=alistair.francis@wdc.com \
    --cc=alistair23@gmail.com \
    --cc=dbarboza@ventanamicro.com \
    --cc=liweiwei@iscas.ac.cn \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=richard.henderson@linaro.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).