drivers/crypto/intel/qat/qat_common/adf_kpt.c
Source file repositories/reference/linux-study-clean/drivers/crypto/intel/qat/qat_common/adf_kpt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/intel/qat/qat_common/adf_kpt.c- Extension
.c- Size
- 1427 bytes
- Lines
- 57
- Domain
- Driver Families
- Bucket
- drivers/crypto
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/dma-mapping.hadf_admin.hadf_cfg_services.hadf_common_drv.hadf_kpt.h
Detected Declarations
function adf_kpt_supportedfunction adf_enable_kpt
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright(c) 2026 Intel Corporation */
#include <linux/dma-mapping.h>
#include "adf_admin.h"
#include "adf_cfg_services.h"
#include "adf_common_drv.h"
#include "adf_kpt.h"
static bool adf_kpt_supported(struct adf_accel_dev *accel_dev)
{
struct adf_hw_device_data *hw_data = GET_HW_DATA(accel_dev);
return hw_data->accel_capabilities_mask & ICP_ACCEL_CAPABILITIES_KPT;
}
int adf_enable_kpt(struct adf_accel_dev *accel_dev)
{
struct adf_kpt_interface_data *user_data = GET_KPT_USER_DATA(accel_dev);
struct adf_hw_device_data *hw_data = GET_HW_DATA(accel_dev);
dma_addr_t paddr;
void *vaddr;
int ret;
int svc;
/* Return 0 if KPT is not supported by the hardware */
if (!adf_kpt_supported(accel_dev))
return 0;
if (!user_data->enable) {
/* Disable KPT capability if user has not enabled it */
hw_data->accel_capabilities_mask &= ~ICP_ACCEL_CAPABILITIES_KPT;
return 0;
}
svc = adf_get_service_enabled(accel_dev);
if (svc < 0)
return svc;
if (svc != SVC_ASYM) {
dev_err(&GET_DEV(accel_dev),
"KPT can only be enabled when service is configured as 'asym'\n");
return -EINVAL;
}
vaddr = dma_alloc_coherent(&GET_DEV(accel_dev), PAGE_SIZE, &paddr,
GFP_KERNEL);
if (!vaddr)
return -ENOMEM;
ret = adf_send_admin_kpt_init(accel_dev, vaddr, PAGE_SIZE, paddr);
dma_free_coherent(&GET_DEV(accel_dev), PAGE_SIZE, vaddr, paddr);
return ret;
}
Annotation
- Immediate include surface: `linux/dma-mapping.h`, `adf_admin.h`, `adf_cfg_services.h`, `adf_common_drv.h`, `adf_kpt.h`.
- Detected declarations: `function adf_kpt_supported`, `function adf_enable_kpt`.
- Atlas domain: Driver Families / drivers/crypto.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.