drivers/crypto/intel/qat/qat_common/adf_init.c
Source file repositories/reference/linux-study-clean/drivers/crypto/intel/qat/qat_common/adf_init.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/intel/qat/qat_common/adf_init.c- Extension
.c- Size
- 14250 bytes
- Lines
- 548
- Domain
- Driver Families
- Bucket
- drivers/crypto
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/mutex.hlinux/list.hlinux/bitops.hlinux/delay.hadf_accel_devices.hadf_cfg.hadf_common_drv.hadf_dbgfs.hadf_heartbeat.hadf_rl.hadf_kpt.hadf_sysfs_anti_rb.hadf_sysfs_ras_counters.hadf_telemetry.h
Detected Declarations
function adf_service_addfunction adf_service_registerfunction adf_service_removefunction adf_service_unregisterfunction adf_dev_initfunction adf_dev_startfunction adf_dev_stopfunction adf_dev_shutdownfunction adf_dev_restarting_notifyfunction adf_dev_restarted_notifyfunction adf_error_notifierfunction adf_dev_downfunction adf_dev_upfunction adf_dev_restartexport adf_dev_downexport adf_dev_upexport adf_dev_restart
Annotated Snippet
if (service->init_status[i] || service->start_status[i]) {
pr_err("QAT: Could not remove active service\n");
return -EFAULT;
}
}
adf_service_remove(service);
return 0;
}
/**
* adf_dev_init() - Init data structures and services for the given accel device
* @accel_dev: Pointer to acceleration device.
*
* Initialize the ring data structures and the admin comms and arbitration
* services.
*
* Return: 0 on success, error code otherwise.
*/
static int adf_dev_init(struct adf_accel_dev *accel_dev)
{
struct service_hndl *service;
struct adf_hw_device_data *hw_data = accel_dev->hw_device;
int ret;
if (!hw_data) {
dev_err(&GET_DEV(accel_dev),
"Failed to init device - hw_data not set\n");
return -EFAULT;
}
adf_set_bme(accel_dev);
if (!test_bit(ADF_STATUS_CONFIGURED, &accel_dev->status) &&
!accel_dev->is_vf) {
dev_err(&GET_DEV(accel_dev), "Device not configured\n");
return -EFAULT;
}
if (adf_init_etr_data(accel_dev)) {
dev_err(&GET_DEV(accel_dev), "Failed initialize etr\n");
return -EFAULT;
}
if (hw_data->init_device && hw_data->init_device(accel_dev)) {
dev_err(&GET_DEV(accel_dev), "Failed to initialize device\n");
return -EFAULT;
}
if (hw_data->init_admin_comms && hw_data->init_admin_comms(accel_dev)) {
dev_err(&GET_DEV(accel_dev), "Failed initialize admin comms\n");
return -EFAULT;
}
if (hw_data->init_arb && hw_data->init_arb(accel_dev)) {
dev_err(&GET_DEV(accel_dev), "Failed initialize hw arbiter\n");
return -EFAULT;
}
if (hw_data->get_ring_to_svc_map)
hw_data->ring_to_svc_map = hw_data->get_ring_to_svc_map(accel_dev);
if (adf_ae_init(accel_dev)) {
dev_err(&GET_DEV(accel_dev),
"Failed to initialise Acceleration Engine\n");
return -EFAULT;
}
set_bit(ADF_STATUS_AE_INITIALISED, &accel_dev->status);
if (adf_ae_fw_load(accel_dev)) {
dev_err(&GET_DEV(accel_dev),
"Failed to load acceleration FW\n");
return -EFAULT;
}
set_bit(ADF_STATUS_AE_UCODE_LOADED, &accel_dev->status);
if (hw_data->alloc_irq(accel_dev)) {
dev_err(&GET_DEV(accel_dev), "Failed to allocate interrupts\n");
return -EFAULT;
}
set_bit(ADF_STATUS_IRQ_ALLOCATED, &accel_dev->status);
if (hw_data->ras_ops.enable_ras_errors)
hw_data->ras_ops.enable_ras_errors(accel_dev);
hw_data->enable_ints(accel_dev);
hw_data->enable_error_correction(accel_dev);
ret = hw_data->pfvf_ops.enable_comms(accel_dev);
if (ret)
return ret;
Annotation
- Immediate include surface: `linux/mutex.h`, `linux/list.h`, `linux/bitops.h`, `linux/delay.h`, `adf_accel_devices.h`, `adf_cfg.h`, `adf_common_drv.h`, `adf_dbgfs.h`.
- Detected declarations: `function adf_service_add`, `function adf_service_register`, `function adf_service_remove`, `function adf_service_unregister`, `function adf_dev_init`, `function adf_dev_start`, `function adf_dev_stop`, `function adf_dev_shutdown`, `function adf_dev_restarting_notify`, `function adf_dev_restarted_notify`.
- Atlas domain: Driver Families / drivers/crypto.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.