From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Xi Ruoyao <xry111@xry111.site>
Cc: Huacai Chen <chenhuacai@kernel.org>,
WANG Xuerui <kernel@xen0n.name>,
linux-crypto@vger.kernel.org, loongarch@lists.linux.dev,
Jinyang He <hejinyang@loongson.cn>,
Tiezhu Yang <yangtiezhu@loongson.cn>,
Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH v4 1/4] LoongArch: vDSO: Wire up getrandom() vDSO implementation
Date: Tue, 27 Aug 2024 15:49:14 +0200 [thread overview]
Message-ID: <Zs3ZWm-218Cb_ir0@zx2c4.com> (raw)
In-Reply-To: <20240827132018.88854-2-xry111@xry111.site>
On Tue, Aug 27, 2024 at 09:20:14PM +0800, Xi Ruoyao wrote:
> + register long ret asm("a0");
> + register long int nr asm("a7") = __NR_getrandom;
The first line is `long` and the second line is `long int` here. Just
call them both `long` like usual?
> struct loongarch_vdso_data {
> struct vdso_pcpu_data pdata[NR_CPUS];
> +#ifdef CONFIG_VDSO_GETRANDOM
> + struct vdso_rng_data rng_data;
> +#endif
If VSO_GETRANDOM is selected unconditionally for the arch, why the ifdef
here?
> +obj-vdso-$(CONFIG_VDSO_GETRANDOM) += vgetrandom.o vgetrandom-chacha.o
Likewise, same question here.
> + /* copy[3] = "expa" */
> + li.w copy3, 0x6b206574
Might want to mention why you're doing this.
/* copy[3] = "expa", because it was clobbered by the i index. */
Or something like that.
But on the topic of those constants,
> + li.w copy0, 0x61707865
> + li.w copy1, 0x3320646e
> + li.w copy2, 0x79622d32
What if you avoid doing this,
> +
> + ld.w cnt_lo, counter, 0
> + ld.w cnt_hi, counter, 4
> +
> +.Lblock:
> + /* state[0,1,2,3] = "expand 32-byte k" */
> + move state0, copy0
> + move state1, copy1
> + move state2, copy2
Use li.w here with the integer literals,
> + /* copy[3] = "expa" */
> + li.w copy3, 0x6b206574
Skip this,
> + add.w state0, state0, copy0
> + add.w state1, state1, copy1
> + add.w state2, state2, copy2
> + add.w state3, state3, copy3
And then use addi.w here with the integer literals instead?
I don't know anything about loongarch, so just guessing.
BTW, can you confirm that this passes the test in test_vdso_chacha?
next prev parent reply other threads:[~2024-08-27 13:49 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-27 13:20 [PATCH v4 0/4] LoongArch: Implement getrandom() in vDSO Xi Ruoyao
2024-08-27 13:20 ` [PATCH v4 1/4] LoongArch: vDSO: Wire up getrandom() vDSO implementation Xi Ruoyao
2024-08-27 13:36 ` Xi Ruoyao
2024-08-27 13:49 ` Jason A. Donenfeld [this message]
2024-08-27 14:26 ` Xi Ruoyao
2024-08-27 14:30 ` Jason A. Donenfeld
2024-08-27 15:07 ` Xi Ruoyao
2024-08-28 14:26 ` Jason A. Donenfeld
2024-08-28 14:33 ` Jason A. Donenfeld
2024-08-27 13:20 ` [PATCH v4 2/4] selftests/vDSO: Add --cflags for pkg-config command querying libsodium Xi Ruoyao
2024-08-27 13:54 ` Jason A. Donenfeld
2024-08-27 13:20 ` [PATCH v4 3/4] selftests/vDSO: Use KHDR_INCLUDES to locate UAPI headers for vdso_test_getrandom Xi Ruoyao
2024-08-27 13:58 ` Jason A. Donenfeld
2024-08-27 14:07 ` LEROY Christophe
2024-08-27 14:15 ` Jason A. Donenfeld
2024-08-27 14:41 ` Xi Ruoyao
2024-08-27 14:50 ` Christophe Leroy
2024-08-27 15:00 ` Jason A. Donenfeld
2024-08-27 15:05 ` Xi Ruoyao
2024-08-27 15:10 ` Jason A. Donenfeld
2024-08-27 15:28 ` Xi Ruoyao
2024-08-27 15:29 ` Jason A. Donenfeld
2024-08-28 11:36 ` Jason A. Donenfeld
2024-08-28 12:00 ` Xi Ruoyao
2024-08-27 15:12 ` Christophe Leroy
2024-08-27 13:20 ` [PATCH v4 4/4] selftests/vDSO: Enable vdso getrandom tests for LoongArch Xi Ruoyao
2024-08-27 14:00 ` Jason A. Donenfeld
2024-08-27 14:45 ` Xi Ruoyao
2024-08-27 13:51 ` [PATCH v4 0/4] LoongArch: Implement getrandom() in vDSO Jason A. Donenfeld
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=Zs3ZWm-218Cb_ir0@zx2c4.com \
--to=jason@zx2c4.com \
--cc=arnd@arndb.de \
--cc=chenhuacai@kernel.org \
--cc=hejinyang@loongson.cn \
--cc=kernel@xen0n.name \
--cc=linux-crypto@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=xry111@xry111.site \
--cc=yangtiezhu@loongson.cn \
/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.