From: Christian Borntraeger <borntraeger@linux.ibm.com>
To: freude@linux.ibm.com, "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: David Hildenbrand <david@redhat.com>,
qemu-s390x@nongnu.org, qemu-devel@nongnu.org,
Thomas Huth <thuth@redhat.com>,
Richard Henderson <richard.henderson@linaro.org>,
Cornelia Huck <cohuck@redhat.com>,
Holger Dengler <dengler@linux.ibm.com>
Subject: Re: [PATCH v4 2/2] target/s390x: support SHA-512 extensions
Date: Thu, 4 Aug 2022 08:56:19 +0200 [thread overview]
Message-ID: <bbd57148-6d6d-f1c3-73f8-73e2512a8012@linux.ibm.com> (raw)
In-Reply-To: <0ff11adb819138cfed16dfb489b66f6f@linux.ibm.com>
Am 04.08.22 um 08:51 schrieb Harald Freudenberger:
> On 2022-08-03 14:14, Jason A. Donenfeld wrote:
>> Hi David,
>>
>> On Wed, Aug 03, 2022 at 01:55:21PM +0200, David Hildenbrand wrote:
>>> On 02.08.22 21:00, Jason A. Donenfeld wrote:
>>> > In order to fully support MSA_EXT_5, we have to also support the SHA-512
>>> > special instructions. So implement those.
>>> >
>>> > The implementation began as something TweetNacl-like, and then was
>>> > adjusted to be useful here. It's not very beautiful, but it is quite
>>> > short and compact, which is what we're going for.
>>> >
>>>
>>> Do we have to worry about copyright/authorship of the original code or
>>> did you write that from scratch?
>>
>> I actually don't really remember how much of that is leftover from
>> tweetnacl and how much I've rewritten - I've had some variant of this
>> code or another kicking around in various projects and repos for a long
>> time. But the tweetnacl stuff is public domain to begin with, so all
>> good.
>>
>>> Are we properly handling the length register (r2 + 1) in the
>>> 24-bit/31-bit addressing mode?
>>> Similarly, are we properly handling updates to the message register (r2)
>>> depending on the addressing mode?
>>
>> Ugh, probably not... I didn't do any of the deposit_64 stuff. I guess
>> I'll look into that.
>>
>>> It's worth noting that we might want to implement (also for PRNO-TRNG):
>>>
>>> "The operation is ended when all
>>> source bytes in the second operand have been pro-
>>> cessed (called normal completion), or when a CPU-
>>> determined number of blocks that is less than the
>>> length of the second operand have been processed
>>> (called partial completion). The CPU-determined
>>> number of blocks depends on the model, and may be
>>> a different number each time the instruction is exe-
>>> cuted. The CPU-determined number of blocks is usu-
>>> ally nonzero. In certain unusual situations, this
>>> number may be zero, and condition code 3 may be
>>> set with no progress."
>>>
>>> Otherwise, a large length can make us loop quite a while in QEMU,
>>> without the chance to deliver any other interrupts.
>>
>> Hmm, okay. Looking at the Linux code, I see:
>>
>> s.even = (unsigned long)src;
>> s.odd = (unsigned long)src_len;
>> asm volatile(
>> " lgr 0,%[fc]\n"
>> " lgr 1,%[pba]\n"
>> "0: .insn rre,%[opc] << 16,0,%[src]\n"
>> " brc 1,0b\n" /* handle partial completion */
>> : [src] "+&d" (s.pair)
>> : [fc] "d" (func), [pba] "d" ((unsigned long)(param)),
>> [opc] "i" (CPACF_KIMD)
>> : "cc", "memory", "0", "1");
>>
>> So I guess that means it'll just loop until it's done? Or do I need to
>> return "1" from HELPER(msa)?
>>
>> Jason
>
> Hm, you don't really want to implement some kind of particial complete.
> Qemu is an emulation and you would have to implement some kind of
> fragmenting this based on machine generation. For my feeling this is
> way too overengineered. Btw. as there came the request to handle
> the 24-bit/31-bit addressing correctly. Is Qemu 32 bit supported ?
We do not support the esa390 mode, but the 24/31 bit _addressing_ modes are
totally valid to be used in zarch mode (with sam31 for example). The kernel
does that for example for some diagnoses under z/VM.
Nobody in problem state should probably do that, but its possible.
next prev parent reply other threads:[~2022-08-04 6:58 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
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 [this message]
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=bbd57148-6d6d-f1c3-73f8-73e2512a8012@linux.ibm.com \
--to=borntraeger@linux.ibm.com \
--cc=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 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).