All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Cc: "Romain Caritey" <Romain.Caritey@microchip.com>,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Connor Davis" <connojdavis@gmail.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Anthony PERARD" <anthony.perard@vates.tech>,
	"Michal Orzel" <michal.orzel@amd.com>,
	"Julien Grall" <julien@xen.org>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2 2/4] xen/riscv: add csr_read_safe() helper
Date: Thu, 2 Apr 2026 08:30:24 +0200	[thread overview]
Message-ID: <f28b1c99-9d84-4338-9278-b85cf283e7ef@suse.com> (raw)
In-Reply-To: <f870d5def964ee06471d6dde0f66d6585eb5ca36.1774863161.git.oleksii.kurochko@gmail.com>

On 31.03.2026 21:04, Oleksii Kurochko wrote:
> @@ -78,6 +80,38 @@
>                             : "memory" );                        \
>  })
>  
> +static always_inline bool csr_read_safe(unsigned long csr,
> +                                        unsigned long *val)
> +{
> +#ifdef CONFIG_CC_HAS_ASM_GOTO_OUTPUT
> +    asm_inline goto (
> +        "1: csrr %[val], %[csr]\n"
> +        ASM_EXTABLE(1b, %l[fault])
> +        : [val] "=&r" (*val)

Why the & when there's only a single insn?

> +        : [csr] "i" (csr)
> +        :
> +        : fault );
> +
> +    return true;
> +
> + fault:
> +    return false;
> +#else
> +    bool allowed = false;
> +
> +    asm_inline volatile (
> +        "1: csrr %[val], %[csr]\n"
> +        "   li %[allowed], 1\n"
> +        "2:\n"
> +        ASM_EXTABLE(1b, 2b)
> +        : [val] "=&r" (*val), [allowed] "+r" (allowed)
> +        : [csr] "i" (csr)
> +        : );

Why the excess colon?

With these adjusted (again happy to do so while committing, so long
as you agree):
Reviewed-by: Jan Beulich <jbeulich@suse.com>

Jan


  reply	other threads:[~2026-04-02  6:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-31 19:04 [PATCH v2 0/4] RISCV: Intrdouce SSTC support in Xen Oleksii Kurochko
2026-03-31 19:04 ` [PATCH v2 1/4] xen/riscv: add exception table support Oleksii Kurochko
2026-04-02  6:24   ` Jan Beulich
2026-04-08  9:29     ` Oleksii Kurochko
2026-04-08  9:45       ` Andrew Cooper
2026-03-31 19:04 ` [PATCH v2 2/4] xen/riscv: add csr_read_safe() helper Oleksii Kurochko
2026-04-02  6:30   ` Jan Beulich [this message]
2026-04-08  9:38     ` Oleksii Kurochko
2026-03-31 19:04 ` [PATCH v2 3/4] xen/riscv: allow Xen to use SSTC while hiding it from guests Oleksii Kurochko
2026-04-02  6:41   ` Jan Beulich
2026-04-08 10:58     ` Oleksii Kurochko
2026-04-08 11:25       ` Jan Beulich
2026-04-08 11:52         ` Oleksii Kurochko
2026-03-31 19:04 ` [PATCH v2 4/4] xen/riscv: init_csr_masks()-related improvements Oleksii Kurochko
2026-04-01  6:19   ` Jan Beulich
2026-04-01 13:39     ` Oleksii Kurochko

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=f28b1c99-9d84-4338-9278-b85cf283e7ef@suse.com \
    --to=jbeulich@suse.com \
    --cc=Romain.Caritey@microchip.com \
    --cc=alistair.francis@wdc.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=connojdavis@gmail.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=oleksii.kurochko@gmail.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.