s390 updates for 6.5 merge window

- Fix the style of protected key API driver source: use
  x-mas tree for all local variable declarations.

- Rework protected key API driver to not use the struct
  pkey_protkey and pkey_clrkey anymore. Both structures
  have a fixed size buffer, but with the support of ECC
  protected key these buffers are not big enough. Use
  dynamic buffers internally and transparently for
  userspace.

- Add support for a new 'non CCA clear key token' with
  ECC clear keys supported: ECC P256, ECC P384, ECC P521,
  ECC ED25519 and ECC ED448. This makes it possible to
  derive a protected key from the ECC clear key input via
  PKEY_KBLOB2PROTK3 ioctl, while currently the only way
  to derive is via PCKMO instruction.

- The s390 PMU of PAI crypto and extension 1 NNPA counters
  use atomic_t for reference counting. Replace this with
  the proper data type refcount_t.

- Select ARCH_SUPPORTS_INT128, but limit this to clang for
  now, since gcc generates inefficient code, which may lead
  to stack overflows.

- Replace one-element array with flexible-array member in
  struct vfio_ccw_parent and refactor the rest of the code
  accordingly. Also, prefer struct_size() over sizeof() open-
  coded versions.

- Introduce OS_INFO_FLAGS_ENTRY pointing to a flags field and
  OS_INFO_FLAG_REIPL_CLEAR flag that informs a dumper whether
  the system memory should be cleared or not once dumped.

- Fix a hang when a user attempts to remove a VFIO-AP mediated
  device attached to a guest: add VFIO_DEVICE_GET_IRQ_INFO and
  VFIO_DEVICE_SET_IRQS IOCTLs and wire up the VFIO bus driver
  callback to request a release of the device.

- Fix calculation for R_390_GOTENT relocations for modules.

- Allow any user space process with CAP_PERFMON capability
  read and display the CPU Measurement facility counter sets.

- Rework large statically-defined per-CPU cpu_cf_events data
  structure and replace it with dynamically allocated structures
  created when a perf_event_open() system call is invoked or
  /dev/hwctr device is accessed.
s390/cpum_cf: rework PER_CPU_DEFINE of struct cpu_cf_events

Struct cpu_cf_events is a large data structure and is statically defined
for each possible CPU. Rework this and replace it by dynamically
allocated data structures created when a perf_event_open() system call
is invoked or an access via character device /dev/hwctr takes place.

It is replaced by an array of pointers to all possible CPUs and
reference counting. The array of pointers is allocated when the first
event is created. For each online CPU an event is installed on, a struct
cpu_cf_events is allocated and a pointer to struct cpu_cf_events is
stored in the array:

                   CPU   0   1   2   3  ...  N
                       +---+---+---+---+---+---+
 cpu_cf_root::cpucf--> | * |   |   |   |...|   |
                       +-|-+---+---+---+---+---+
                         |
                         |
                        \|/
                     +-------------+
		     |cpu_cf_events|
		     |             |
                     +-------------+

With this approach the large data structure is only allocated when
an event is actually installed and used.
Also implement proper reference counting for allocation and removal.

During interrupt processing make sure the pointer to cpu_cf_events
is valid. The interrupt handler is shared and might be called when
no event is active.
This requires checking for a valid pointer to struct cpu_cf_events.
When the pointer to the per-cpu cpu_cf_events is NULL, simply return.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
1 file changed