From: Peter Maydell <peter.maydell@linaro.org>
To: "Ho, Tong" <tong.ho@amd.com>
Cc: Richard Henderson <richard.henderson@linaro.org>,
"qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"alistair@alistair23.me" <alistair@alistair23.me>,
"edgar.iglesias@gmail.com" <edgar.iglesias@gmail.com>
Subject: Re: [PATCH 1/3] hw/misc: Introduce AMD/Xilix Versal TRNG device
Date: Fri, 8 Sep 2023 14:49:50 +0100 [thread overview]
Message-ID: <CAFEAcA_KJFnxg-msgwiaFBzPYkj4RPQeYwLzd4RCy3_br11AGQ@mail.gmail.com> (raw)
In-Reply-To: <BL0PR12MB48829589D59FA02B93549E65E6E4A@BL0PR12MB4882.namprd12.prod.outlook.com>
On Fri, 1 Sept 2023 at 05:16, Ho, Tong <tong.ho@amd.com> wrote:
>
> Hi Richard,
>
> Thanks for your input.
>
> I have questions regarding using qemu/guest-random.h for QEMU device models.
>
> Using qemu/guest-random.h, how can this TRNG model ensure its independence from
> other uses of the same qemu_guest_getrandom() and qemu_guest_random_seed_*()?
>
> By "other uses", I mean components and/or devices using qemu/guest-random.h but unrelated to this Xilinx Versal TRNG device.
>
> By "independent", I mean the Xilinx Versal TRNG device is:
>
> 1. Not impacted by other uses that may or may not need to set the '-seed' option, and
>
> 2. Not impacting other uses just because a Xilinx Versal machine user decides to use deterministic mode *only" for this TRNG device.
>
> Also, I am at a loss in how unrelated QEMU devices can remain independent when:
>
> 3. qemu/guest-random.h uses '__thread' variable for GRand context, but
>
> 4. QEMU devices run mostly as co-routines and not as separate threads.
You shouldn't need to care about any of this. Just assume you can
get decent quality random numbers from qemu_guest_getrandom() or
qemu_guest_getrandom_nofail(). The -seed option is for the
entire simulation, not specific to individual RNG devices.
> I suppose the Versal TRNG implementation could use g_rand_*() directly,
> having a GRand object in the device state and seeding through g_rand_set_seed_array().
Don't do something non-standard. Write this RNG device the same way
we do all other RNG devices in QEMU.
thanks
-- PMM
next prev parent reply other threads:[~2023-09-08 13:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-31 17:18 [PATCH 0/3] AMD/Xilinx Versal TRNG support Tong Ho
2023-08-31 17:18 ` [PATCH 1/3] hw/misc: Introduce AMD/Xilix Versal TRNG device Tong Ho
2023-08-31 23:44 ` Richard Henderson
2023-09-01 4:16 ` Ho, Tong
2023-09-08 13:49 ` Peter Maydell [this message]
2023-09-08 17:56 ` Ho, Tong
2023-09-08 18:34 ` Peter Maydell
2023-09-08 18:41 ` Ho, Tong
2023-08-31 17:18 ` [PATCH 2/3] hw/arm: xlnx-versal-virt: Add AMD/Xilinx " Tong Ho
2023-08-31 17:18 ` [PATCH 3/3] tests/qtest: Introduce tests for AMD/Xilinx Versal " Tong Ho
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=CAFEAcA_KJFnxg-msgwiaFBzPYkj4RPQeYwLzd4RCy3_br11AGQ@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=alistair@alistair23.me \
--cc=edgar.iglesias@gmail.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=tong.ho@amd.com \
/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).