]> www.infradead.org Git - users/jedix/linux-maple.git/commit
s390/pkey: Introduce pkey base with handler registry and handler modules
authorHarald Freudenberger <freude@linux.ibm.com>
Thu, 22 Aug 2024 09:32:19 +0000 (11:32 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Thu, 29 Aug 2024 20:56:34 +0000 (22:56 +0200)
commit8fcc231ce3bea12b78bb94b280cdc03cff342435
tree4ca85e885a942c42c2c2fe59973cf84797585a24
parentea88e1710a9f19345c94c195f9cd7365e50343b0
s390/pkey: Introduce pkey base with handler registry and handler modules

Introduce pkey base kernel code with a simple pkey handler registry.
Regroup the pkey code into these kernel modules:
- pkey is the pkey api supporting the ioctls, sysfs and in-kernel api.
  Also the pkey base code which offers the handler registry and
  handler wrapping invocation functions is integrated there. This
  module is automatically loaded in via CPU feature if the MSA feature
  is available.
- pkey-cca is the CCA related handler code kernel module a offering
  CCA specific implementation for pkey. This module is loaded in
  via MODULE_DEVICE_TABLE when a CEX[4-8] card becomes available.
- pkey-ep11 is the EP11 related handler code kernel module offering an
  EP11 specific implementation for pkey. This module is loaded in via
  MODULE_DEVICE_TABLE when a CEX[4-8] card becomes available.
- pkey-pckmo is the PCKMO related handler code kernel module. This
  module is loaded in via CPU feature if the MSA feature is available,
  but on init a check for availability of the pckmo instruction is
  performed.

The handler modules register via a pkey_handler struct at the pkey
base code and the pkey customer (that is currently the pkey api code
fetches a handler via pkey handler registry functions and calls the
unified handler functions via the pkey base handler functions.

As a result the pkey-cca, pkey-ep11 and pkey-pckmo modules get
independent from each other and it becomes possible to write new
handlers which offer another kind of implementation without implicit
dependencies to other handler implementations and/or kernel device
drivers.

For each of these 4 kernel modules there is an individual Kconfig
entry: CONFIG_PKEY for the base and api, CONFIG_PKEY_CCA for the PKEY
CCA support handler, CONFIG_PKEY_EP11 for the EP11 support handler and
CONFIG_PKEY_PCKMO for the pckmo support. The both CEX related handler
modules (PKEY CCA and PKEY EP11) have a dependency to the zcrypt api
of the zcrypt device driver.

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
12 files changed:
arch/s390/configs/debug_defconfig
arch/s390/configs/defconfig
arch/s390/include/uapi/asm/pkey.h
drivers/crypto/Kconfig
drivers/s390/crypto/Makefile
drivers/s390/crypto/pkey_api.c
drivers/s390/crypto/pkey_base.c [new file with mode: 0644]
drivers/s390/crypto/pkey_base.h
drivers/s390/crypto/pkey_cca.c
drivers/s390/crypto/pkey_ep11.c
drivers/s390/crypto/pkey_pckmo.c
drivers/s390/crypto/pkey_sysfs.c