Re: [PATCH v13 01/18] target/s390x: Rework s390 cpacf implementations

Harald Freudenberger <[email protected]> Wed, 05 Aug 2026 09:52:29 +0200
Newsgroups gmane.comp.emulators.qemu
Message-ID <[email protected]>
On 2026-08-05 00:23, Ilya Leoshkevich wrote:
> On 8/3/26 18:12, Harald Freudenberger wrote:
>> Fix missing parts for MSA 9 kdsa and rework the cpacf handling code
>> so that further extensions can be made in a clean and structured way.
>> 
>> Introduce a new header file to hold defines, structs and function
>> prototypes around s390 cpacf. Use the cpcaf function defines in the
>> existing code.
>> 
>> Reviewed-by: Holger Dengler <[email protected]>
>> Tested-by: Holger Dengler <[email protected]>
>> Reviewed-by: Ilya Leoshkevich <[email protected]>
>> Signed-off-by: Harald Freudenberger <[email protected]>
>> ---
>>   target/s390x/tcg/cpacf.h         | 226 
>> +++++++++++++++++++++++++++++++
>>   target/s390x/tcg/crypto_helper.c |  90 ++++++++++--
>>   target/s390x/tcg/insn-data.h.inc |   1 +
>>   target/s390x/tcg/translate.c     |   2 +
>>   4 files changed, 306 insertions(+), 13 deletions(-)
>>   create mode 100644 target/s390x/tcg/cpacf.h
>> 
>> diff --git a/target/s390x/tcg/cpacf.h b/target/s390x/tcg/cpacf.h
>> new file mode 100644
>> index 0000000000..49496d39ed
>> --- /dev/null
>> +++ b/target/s390x/tcg/cpacf.h
> 
> [...]
> 
>> +/*
>> + * Function codes for the PCKMO instruction
>> + */
>> +#define CPACF_PCKMO_QUERY                      0x00
>> +#define CPACF_PCKMO_ENC_DES_KEY                0x01
>> +#define CPACF_PCKMO_ENC_TDES_128_KEY           0x02
>> +#define CPACF_PCKMO_ENC_TDES_192_KEY           0x03
>> +#define CPACF_PCKMO_ENC_AES_128_KEY            0x12
>> +#define CPACF_PCKMO_ENC_AES_192_KEY            0x13
>> +#define CPACF_PCKMO_ENC_AES_256_KEY            0x14
>> +#define CPACF_PCKMO_ENC_AES_XTS_128_DOUBLE_KEY 0x14
> 
> 0x14 repeats twice, should it be 0x15?
> 
> [...]

Yes, the double should be a 0x15. See kernel header file
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/s390/include/asm/cpacf.h