qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Christian Borntraeger <borntraeger@linux.ibm.com>,
	"Jason A. Donenfeld" <Jason@zx2c4.com>,
	qemu-s390x@nongnu.org, qemu-devel@nongnu.org
Cc: Thomas Huth <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 v3] target/s390x: support PRNO_TRNG instruction
Date: Tue, 2 Aug 2022 16:53:22 +0200	[thread overview]
Message-ID: <71b1b0f6-95b9-0249-e996-b8348470693f@redhat.com> (raw)
In-Reply-To: <71d173c2-21eb-5966-8458-91de9bc48620@linux.ibm.com>

On 02.08.22 16:01, Christian Borntraeger wrote:
> 
> 
> Am 02.08.22 um 15:54 schrieb David Hildenbrand:
>> On 02.08.22 15:26, Christian Borntraeger wrote:
>>>
>>>
>>> Am 20.07.22 um 14:08 schrieb Jason A. Donenfeld:
>>>> In order for hosts running inside of TCG to initialize the kernel's
>>>> random number generator, we should support the PRNO_TRNG instruction,
>>>> backed in the usual way with the qemu_guest_getrandom helper. This is
>>>> confirmed working on Linux 5.19-rc6.
>>>>
>>>> Cc: Thomas Huth <thuth@redhat.com>
>>>> Cc: David Hildenbrand <david@redhat.com>
>>>> Cc: Richard Henderson <richard.henderson@linaro.org>
>>>> Cc: Cornelia Huck <cohuck@redhat.com>
>>>> Cc: Harald Freudenberger <freude@linux.ibm.com>
>>>> Cc: Holger Dengler <dengler@linux.ibm.com>
>>>> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
>>> [...]
>>>> +    case 114:
>>>> +        if (r1 & 1 || !r1 || r2 & 1 || !r2)
>>>> +                tcg_s390_program_interrupt(env, PGM_SPECIFICATION, ra);
>>>> +        fill_buf_random(env, ra, &env->regs[r1], &env->regs[r1 + 1]);
>>>> +        fill_buf_random(env, ra, &env->regs[r2], &env->regs[r2 + 1]);
>>>> +        break;
>>>
>>> I think I agree with Harald that some aspects are missing.
>>> Linux does not seem to check, but we should also modify the query function to
>>> indicate the availability of 114.
>>>
>>> As the msa helper deals with many instructions
>>> ...
>>> target/s390x/tcg/insn-data.def:    D(0xb91e, KMAC,    RRE,   MSA,  0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMAC)
>>> target/s390x/tcg/insn-data.def:    D(0xb928, PCKMO,   RRE,   MSA3, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_PCKMO)
>>> target/s390x/tcg/insn-data.def:    D(0xb92a, KMF,     RRE,   MSA4, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMF)
>>> target/s390x/tcg/insn-data.def:    D(0xb92b, KMO,     RRE,   MSA4, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMO)
>>> target/s390x/tcg/insn-data.def:    D(0xb92c, PCC,     RRE,   MSA4, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_PCC)
>>> target/s390x/tcg/insn-data.def:    D(0xb92d, KMCTR,   RRF_b, MSA4, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMCTR)
>>> target/s390x/tcg/insn-data.def:    D(0xb92e, KM,      RRE,   MSA,  0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KM)
>>> target/s390x/tcg/insn-data.def:    D(0xb92f, KMC,     RRE,   MSA,  0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMC)
>>> target/s390x/tcg/insn-data.def:    D(0xb929, KMA,     RRF_b, MSA8, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMA)
>>> target/s390x/tcg/insn-data.def:    D(0xb93c, PPNO,    RRE,   MSA5, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_PPNO)
>>> target/s390x/tcg/insn-data.def:    D(0xb93e, KIMD,    RRE,   MSA,  0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KIMD)
>>> target/s390x/tcg/insn-data.def:    D(0xb93f, KLMD,    RRE,   MSA,  0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KLMD)
>>> ...
>>> and in theory other instructions might also have 114 we should at least check that this is ppno/prno.
>>> Or we split out a prno helper from the msa helper.
>>>
>>
>> Doesn't
>>
>> s390_get_feat_block(type, subfunc);
>> if (!test_be_bit(fc, subfunc)) {
>> 	tcg_s390_program_interrupt(env, PGM_SPECIFICATION, ra);
>> }
>>
>> check that? As long as we don't implement 114 for any other instruction.
>> that should properly fence off the other instructions.
> 
> Right that would help. We should still take care of the query function.
> 
s390_get_feat_block() should already take care of that as well, no?


-- 
Thanks,

David / dhildenb



  reply	other threads:[~2022-08-02 14:56 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 [this message]
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=71b1b0f6-95b9-0249-e996-b8348470693f@redhat.com \
    --to=david@redhat.com \
    --cc=Jason@zx2c4.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=cohuck@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).