github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/dev_qat_adf_ctl.txt (about)

     1  # Copyright 2020 syzkaller project authors. All rights reserved.
     2  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  # NEED: These descriptions need an actual Intel QAT device or an emulation so we can fuzz deeper into the subsystem.
     5  # /dev/qat_adf_ctl is only the control interface, and currently ioctl$IOCTL_GET_NUM_DEVICES returns 0 on qemu.
     6  
     7  include <linux/fcntl.h>
     8  include <drivers/crypto/intel/qat/qat_common/adf_cfg_user.h>
     9  include <drivers/crypto/intel/qat/qat_common/adf_cfg_common.h>
    10  resource fd_qat[fd]
    11  
    12  openat$qat_adf_ctl(fd const[AT_FDCWD], file ptr[in, string["/dev/qat_adf_ctl"]], flags flags[open_flags], mode const[0]) fd_qat
    13  ioctl$IOCTL_CONFIG_SYS_RESOURCE_PARAMETERS(fd fd_qat, cmd const[IOCTL_CONFIG_SYS_RESOURCE_PARAMETERS], arg ptr[in, adf_user_cfg_ctl_data])
    14  ioctl$IOCTL_STOP_ACCEL_DEV(fd fd_qat, cmd const[IOCTL_STOP_ACCEL_DEV], arg ptr[in, adf_user_cfg_ctl_data])
    15  ioctl$IOCTL_START_ACCEL_DEV(fd fd_qat, cmd const[IOCTL_START_ACCEL_DEV], arg ptr[in, adf_user_cfg_ctl_data])
    16  ioctl$IOCTL_GET_NUM_DEVICES(fd fd_qat, cmd const[IOCTL_GET_NUM_DEVICES], arg ptr[out, int32])
    17  ioctl$IOCTL_STATUS_ACCEL_DEV(fd fd_qat, cmd const[IOCTL_STATUS_ACCEL_DEV], arg ptr[inout, adf_dev_status_info])
    18  
    19  adf_user_cfg_ctl_data {
    20  	config_section	adf_ptr64[adf_user_cfg_section]
    21  	device_id	int8
    22  } [packed]
    23  
    24  # Section
    25  
    26  adf_user_cfg_section {
    27  	name	string[qat_section_name, ADF_CFG_MAX_SECTION_LEN_IN_BYTES]
    28  	params	adf_ptr64[adf_user_cfg_key_val_u]
    29  	next	adf_ptr64[adf_user_cfg_section]
    30  } [packed]
    31  
    32  qat_section_name = "GENERAL", "KERNEL", "Accelerator", "Accelerator0", "Accelerator1"
    33  
    34  # Key-values
    35  
    36  adf_user_cfg_key_val_u [
    37  	adf_dec	adf_user_cfg_key_val[ADF_DEC, adf_user_cfg_val_dec]
    38  	adf_hex	adf_user_cfg_key_val[ADF_HEX, adf_user_cfg_val_hex]
    39  	adf_str	adf_user_cfg_key_val[ADF_STR, adf_user_cfg_val_str]
    40  ]
    41  
    42  type adf_user_cfg_key_val[TYPE, VAL] {
    43  	key	adf_user_cfg_key
    44  	val	VAL
    45  	next	adf_ptr64[adf_user_cfg_key_val_u]
    46  	type	const[TYPE, int32]
    47  } [packed]
    48  
    49  # Key
    50  
    51  adf_user_cfg_key [
    52  	normal	string[adf_user_cfg_normal_keys, ADF_CFG_MAX_KEY_LEN_IN_BYTES]
    53  	format	adf_user_cfg_format_keys
    54  	bank	adf_user_cfg_bank_keys
    55  ]
    56  
    57  adf_user_cfg_format_keys {
    58  	prefix	stringnoz[adf_user_cfg_format_keys_prefix]
    59  	number	stringnoz[adf_user_cfg_numbers]
    60  	postfix	string[adf_user_cfg_format_keys_postfix, ADF_KEYS_POSTFIX_MAX_LEN]
    61  } [size[ADF_CFG_MAX_KEY_LEN_IN_BYTES]]
    62  
    63  adf_user_cfg_bank_keys {
    64  	prefix	stringnoz["Bank"]
    65  	number	stringnoz[adf_user_cfg_numbers]
    66  	postfix	string[adf_user_cfg_bank_keys_postfix, ADF_KEYS_POSTFIX_MAX_LEN]
    67  } [size[ADF_CFG_MAX_KEY_LEN_IN_BYTES]]
    68  
    69  adf_user_cfg_normal_keys = "NumberCyInstances", "NumberDcInstances"
    70  adf_user_cfg_numbers = "0", "1", "2", "3", "4", "5"
    71  adf_user_cfg_format_keys_prefix = "Cy", "Dc"
    72  adf_user_cfg_format_keys_postfix = "NumConcurrentSymRequests", "NumConcurrentAsymRequests", "NumConcurrentRequests", "RingAsymTx", "RingSymTx", "RingAsymRx", "RingSymRx", "RingTx", "RingRx", "BankNumber"
    73  adf_user_cfg_bank_keys_postfix = "InterruptCoalescingEnabled", "InterruptCoalescingTimerNs", "InterruptCoalescingNumResponses", "CoreAffinity"
    74  
    75  # This constant 32 needs to be at least the length of the longest string in
    76  # adf_user_cfg_format_keys_postfix and adf_user_cfg_bank_keys_postfix
    77  define ADF_KEYS_POSTFIX_MAX_LEN	32
    78  
    79  # Value
    80  
    81  adf_user_cfg_val_dec {
    82  	val	fmt[dec, intptr]
    83  	null	const[0, int8]
    84  } [packed, size[ADF_CFG_MAX_VAL_LEN_IN_BYTES]]
    85  
    86  adf_user_cfg_val_hex {
    87  	val	fmt[hex, intptr]
    88  	null	const[0, int8]
    89  } [packed, size[ADF_CFG_MAX_VAL_LEN_IN_BYTES]]
    90  
    91  adf_user_cfg_val_str {
    92  	val	array[int8, ADF_CFG_MAX_VAL_LEN_IN_BYTES]
    93  }
    94  
    95  # Ptr
    96  
    97  type adf_ptr64[T] {
    98  	ptr	ptr[in, T, opt]
    99  } [size[8]]
   100  
   101  adf_dev_status_info {
   102  	type			flags[adf_device_type, int32]
   103  	accel_id		int32
   104  	instance_id		int32
   105  	num_ae			int8
   106  	num_accel		int8
   107  	num_logical_accel	int8
   108  	banks_per_accel		int8
   109  	state			int8
   110  	bus			int8
   111  	dev			int8
   112  	fun			int8
   113  	name			array[int8, MAX_DEVICE_NAME_SIZE]
   114  }
   115  
   116  adf_device_type = DEV_UNKNOWN, DEV_DH895XCC, DEV_DH895XCCVF, DEV_C62X, DEV_C62XVF, DEV_C3XXX, DEV_C3XXXVF