Re: [PATCH v2 19/20] s390/zcrypt/pkey: Provide and pass xflags within pkey and zcrypt layers

Holger Dengler
2025-03-20T16:30:59Z

On 04/03/2025 18:21, Harald Freudenberger wrote:
> Provide and pass the xflag parameter from pkey ioctls through
> the pkey handler and further down to the implementations
> (CCA, EP11, PCKMO and UV). So all the code is now prepared
> and ready to support the currently only xflag ("execution flag"):
>
> * ZCRYPT_XFLAG_NOMEMALLOC - If this flag is set, no memory
> allocations which may trigger any IO operations are done.
>
> The in-kernel pkey API still does not provide this xflag param.
> That's intended to come with another patch which more or less
> only enables this functionality.
>
> Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>

Without the findcard() function or with a changed parameter name according to my comment
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>

> ---
> drivers/s390/crypto/pkey_api.c | 49 +++++++++++-----------
> drivers/s390/crypto/pkey_base.c | 34 ++++++++-------
> drivers/s390/crypto/pkey_base.h | 37 ++++++++++-------
> drivers/s390/crypto/pkey_cca.c | 59 +++++++++++++++------------
> drivers/s390/crypto/pkey_ep11.c | 49 ++++++++++++----------
> drivers/s390/crypto/pkey_pckmo.c | 9 ++--
> drivers/s390/crypto/pkey_sysfs.c | 4 +-
> drivers/s390/crypto/pkey_uv.c | 16 +++++++-
> drivers/s390/crypto/zcrypt_ccamisc.c | 53 +++++++++++-------------
> drivers/s390/crypto/zcrypt_ccamisc.h | 25 +++++++-----
> drivers/s390/crypto/zcrypt_ep11misc.c | 10 ++---
> drivers/s390/crypto/zcrypt_ep11misc.h | 7 ++--
> 12 files changed, 196 insertions(+), 156 deletions(-)
>
[...]
> diff --git a/drivers/s390/crypto/zcrypt_ccamisc.c b/drivers/s390/crypto/zcrypt_ccamisc.c
> index e4ec922aae0d..3b80ce605192 100644
> --- a/drivers/s390/crypto/zcrypt_ccamisc.c
> +++ b/drivers/s390/crypto/zcrypt_ccamisc.c
[...]
> @@ -1828,13 +1822,12 @@ EXPORT_SYMBOL(cca_get_info);
> * Master Key Verification Pattern given.
> */
> static int findcard(u64 mkvp, u16 *pcardnr, u16 *pdomain,
> - int verify, int minhwtype)
> + int verify, int minhwtype, u32 xflg)
> {
> struct zcrypt_device_status_ext *device_status;
> u16 card, dom;
> struct cca_info ci;
> int i, rc, oi = -1;
> - u32 xflg = 0; /* xflags */

If you keep findcard() please name the parameter `xflags` instead of `xflg`.

>
> /* mkvp must not be zero, minhwtype needs to be >= 0 */
> if (mkvp == 0 || minhwtype < 0)

--
Mit freundlichen Grüßen / Kind regards
Holger Dengler
--
IBM Systems, Linux on IBM Z Development
dengler@linux.ibm.com