From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: David Hildenbrand <david@redhat.com>
Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org, thuth@redhat.com,
Richard Henderson <richard.henderson@linaro.org>,
Cornelia Huck <cohuck@redhat.com>,
Harald Freudenberger <freude@linux.ibm.com>,
Holger Dengler <dengler@linux.ibm.com>
Subject: Re: [PATCH v2] target/s390x: support PRNO_TRNG instruction
Date: Wed, 20 Jul 2022 13:58:11 +0200 [thread overview]
Message-ID: <Ytft08S2eGaYVwC3@zx2c4.com> (raw)
In-Reply-To: <2b3d579a-295a-cd25-70c3-ecb551e74cf4@redhat.com>
Hi David,
Thanks for the feedback.
On Wed, Jul 20, 2022 at 01:43:48PM +0200, David Hildenbrand wrote:
> > --- a/target/s390x/cpu_models.c
> > +++ b/target/s390x/cpu_models.c
> > @@ -421,8 +421,6 @@ static void check_consistency(const S390CPUModel *model)
> > { S390_FEAT_DFP_FAST, S390_FEAT_DFP },
> > { S390_FEAT_TRANSACTIONAL_EXE, S390_FEAT_STFLE_49 },
> > { S390_FEAT_EDAT_2, S390_FEAT_EDAT},
> > - { S390_FEAT_MSA_EXT_5, S390_FEAT_KIMD_SHA_512 },
> > - { S390_FEAT_MSA_EXT_5, S390_FEAT_KLMD_SHA_512 },
> > { S390_FEAT_MSA_EXT_4, S390_FEAT_MSA_EXT_3 },
> > { S390_FEAT_SIE_CMMA, S390_FEAT_CMM },
> > { S390_FEAT_SIE_CMMA, S390_FEAT_SIE_GSLS },
> > diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c
> > index ad140184b9..3d333e2789 100644
> > --- a/target/s390x/gen-features.c
> > +++ b/target/s390x/gen-features.c
> > @@ -749,6 +749,8 @@ static uint16_t qemu_V7_0[] = {
> > */
> > static uint16_t qemu_MAX[] = {
> > S390_FEAT_VECTOR_ENH2,
> > + S390_FEAT_MSA_EXT_5,
> > + S390_FEAT_PRNO_TRNG,
> > };
>
>
> Again, what about the warning? We don't want to report warnings in the
> QEMU default.
The change to cpu_models.c above gets rid of the warning.
> > + for (size_t i = 0; i < block; ++i)
> > + cpu_stb_data_ra(env, wrap_address(env, buf++), tmp[i], ra);
>
> So, whenever we would get an exception, we would not update the
> registers. This implies that we'd always start anew on an exception,
> even though we already modified page content.
Oh. The thing I had in mind was the r1&1 exception, not realizing that
of course cpu_stb_data_ra() can also generate an exception. I'll update
those registers incrementally.
> What the real HW does is constantly update the registers before the
> exception is delivered, such that you can simply pick up work again when
> re-entering the instruction after the exception was handled by the guest.
>
> I assume we could do the same: updating the registers whenever a store
> succeeded. Doing that after each and every byte is a bit inefficient,
> but not sure if we care.
>
> But as we're only storing random data, maybe we don't really care for
> now and can simply always start anew. (the guest can observe this wrong
> handling, though)
>
> At a minimum we might want to add
>
> /*
> * TODO: we should update the registers constantly, such that we reflect
> * which memory was already processed/modified if we get an exception
> * in-between.
> */
I think I can do it incrementally pretty easy, actually. Let's see how
it looks in v+1 first before I give up and add the TODO.
> > + if (r1 & 1 || !r1 || r2 & 1 || !r2) {
> > + tcg_s390_program_interrupt(env, PGM_SPECIFICATION, ra);
> > + break;
>
> You can drop the "break;", we'll jump right out of that function and
> never return -- the function is flagged as G_NORETURN.
Thanks, will do.
>
> > + }
> > +
> > + fill_buf_random(env, ra, env->regs[r1], env->regs[r1 + 1]);
> > + fill_buf_random(env, ra, env->regs[r2], env->regs[r2 + 1]);
> > +
> > + env->regs[r1] += env->regs[r1 + 1];
> > + env->regs[r1 + 1] = 0;
> > + env->regs[r2] += env->regs[r2 + 1];
> > + env->regs[r2 + 1] = 0;
>
> We have to be careful in 24-bit an 31-bit address mode, we may only
> update selected parts of the registers.
>
> See target/s390x/tcg/mem_helper.c:set_address() as an example on how to
> modify parts of registers using deposit64().
That's not pretty, but I think I see how to do it.
New revision incoming. Thanks for the review!
Jason
next prev parent reply other threads:[~2022-07-20 12:02 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-12 16:46 [PATCH qemu] target/s390x: support PRNO_TRNG instruction Jason A. Donenfeld
2022-07-19 9:54 ` David Hildenbrand
2022-07-19 11:23 ` Jason A. Donenfeld
2022-07-19 11:43 ` [PATCH v2] " Jason A. Donenfeld
2022-07-20 11:43 ` David Hildenbrand
2022-07-20 11:58 ` Jason A. Donenfeld [this message]
2022-07-20 12:08 ` [PATCH v3] " Jason A. Donenfeld
2022-07-20 18:41 ` David Hildenbrand
2022-07-20 19:44 ` Jason A. Donenfeld
2022-07-27 1:35 ` Jason A. Donenfeld
2022-07-27 6:32 ` Thomas Huth
2022-07-27 11:58 ` Jason A. Donenfeld
2022-08-02 13:26 ` Christian Borntraeger
2022-08-02 13:54 ` David Hildenbrand
2022-08-02 14:01 ` Christian Borntraeger
2022-08-02 14:53 ` David Hildenbrand
2022-08-02 15:15 ` Christian Borntraeger
2022-08-02 15:16 ` David Hildenbrand
2022-08-02 15:28 ` Jason A. Donenfeld
2022-08-02 15:32 ` David Hildenbrand
2022-08-02 18:59 ` Jason A. Donenfeld
2022-08-02 19:00 ` [PATCH v4 0/2] MSA EXT 5 for s390x Jason A. Donenfeld
2022-08-02 19:00 ` [PATCH v4 1/2] target/s390x: support PRNO_TRNG instruction Jason A. Donenfeld
2022-08-02 19:00 ` [PATCH v4 2/2] target/s390x: support SHA-512 extensions Jason A. Donenfeld
2022-08-03 11:55 ` David Hildenbrand
2022-08-03 12:14 ` Jason A. Donenfeld
2022-08-03 12:47 ` Jason A. Donenfeld
2022-08-03 12:51 ` [PATCH v5 1/2] target/s390x: support PRNO_TRNG instruction Jason A. Donenfeld
2022-08-03 12:51 ` [PATCH v5 2/2] target/s390x: support SHA-512 extensions Jason A. Donenfeld
2022-08-03 17:15 ` [PATCH 1/2] target/s390x: support PRNO_TRNG instruction Jason A. Donenfeld
2022-08-03 17:15 ` [PATCH 2/2] target/s390x: support SHA-512 extensions Jason A. Donenfeld
2022-08-03 17:15 ` [PATCH v6 1/2] target/s390x: support PRNO_TRNG instruction Jason A. Donenfeld
2022-08-03 17:15 ` [PATCH v6 2/2] target/s390x: support SHA-512 extensions Jason A. Donenfeld
2022-08-05 11:28 ` David Hildenbrand
2022-08-05 13:01 ` Jason A. Donenfeld
2022-08-09 15:03 ` [PATCH v7 1/2] " Jason A. Donenfeld
2022-08-09 15:03 ` [PATCH v7 2/2] target/s390x: support PRNO_TRNG instruction Jason A. Donenfeld
2022-08-26 11:28 ` Thomas Huth
2022-08-29 16:29 ` Jason A. Donenfeld
2022-09-21 10:59 ` Thomas Huth
2022-08-26 10:21 ` [PATCH v7 1/2] target/s390x: support SHA-512 extensions Thomas Huth
2022-08-29 16:27 ` Jason A. Donenfeld
2022-08-11 16:37 ` [PATCH v6 2/2] " David Hildenbrand
2022-08-04 6:51 ` [PATCH v4 " Harald Freudenberger
2022-08-04 6:56 ` Christian Borntraeger
2022-08-04 12:09 ` Jason A. Donenfeld
2022-08-04 8:10 ` David Hildenbrand
2022-08-04 12:07 ` Jason A. Donenfeld
2022-08-02 17:55 ` [PATCH v3] target/s390x: support PRNO_TRNG instruction Jason A. Donenfeld
2022-07-20 18:01 ` [PATCH v2] " David Hildenbrand
2022-08-02 11:54 ` Harald Freudenberger
2022-07-19 10:00 ` [PATCH qemu] " Thomas Huth
2022-07-19 11:27 ` 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=Ytft08S2eGaYVwC3@zx2c4.com \
--to=jason@zx2c4.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=dengler@linux.ibm.com \
--cc=freude@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.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 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.