drivers/crypto/ccp/ccp-ops.c
Source file repositories/reference/linux-study-clean/drivers/crypto/ccp/ccp-ops.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/ccp/ccp-ops.c- Extension
.c- Size
- 63410 bytes
- Lines
- 2526
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
crypto/des.hcrypto/scatterwalk.hcrypto/utils.hlinux/ccp.hlinux/dma-mapping.hlinux/errno.hlinux/kernel.hlinux/module.hccp-dev.h
Detected Declarations
function ccp_gen_jobidfunction ccp_sg_freefunction ccp_init_sg_workareafunction ccp_update_sg_workareafunction ccp_dm_freefunction ccp_init_dm_workareafunction ccp_set_dm_areafunction ccp_get_dm_areafunction ccp_reverse_set_dm_areafunction ccp_reverse_get_dm_areafunction ccp_free_datafunction ccp_init_datafunction ccp_queue_buffunction ccp_fill_queue_buffunction ccp_empty_queue_buffunction ccp_prepare_datafunction ccp_process_datafunction ccp_copy_to_from_sbfunction ccp_copy_to_sbfunction ccp_copy_from_sbfunction ccp_run_aes_cmac_cmdfunction ccp_run_aes_gcm_cmdfunction ccp_run_aes_cmdfunction ccp_run_xts_aes_cmdfunction ccp_run_des3_cmdfunction singlefunction ccp_run_sha_cmdfunction ccp_run_rsa_cmdfunction ccp_run_passthru_cmdfunction ccp_run_passthru_nomap_cmdfunction ccp_run_ecc_mm_cmdfunction ccp_run_ecc_pm_cmdfunction ccp_run_ecc_cmdfunction ccp_run_cmd
Annotated Snippet
if (dma_mapping_error(wa->dev, wa->dma.address)) {
kfree(wa->address);
wa->address = NULL;
return -ENOMEM;
}
wa->dma.length = len;
}
wa->dma.dir = dir;
return 0;
}
static int ccp_set_dm_area(struct ccp_dm_workarea *wa, unsigned int wa_offset,
struct scatterlist *sg, unsigned int sg_offset,
unsigned int len)
{
WARN_ON(!wa->address);
if (len > (wa->length - wa_offset))
return -EINVAL;
scatterwalk_map_and_copy(wa->address + wa_offset, sg, sg_offset, len,
0);
return 0;
}
static void ccp_get_dm_area(struct ccp_dm_workarea *wa, unsigned int wa_offset,
struct scatterlist *sg, unsigned int sg_offset,
unsigned int len)
{
WARN_ON(!wa->address);
scatterwalk_map_and_copy(wa->address + wa_offset, sg, sg_offset, len,
1);
}
static int ccp_reverse_set_dm_area(struct ccp_dm_workarea *wa,
unsigned int wa_offset,
struct scatterlist *sg,
unsigned int sg_offset,
unsigned int len)
{
u8 *p, *q;
int rc;
rc = ccp_set_dm_area(wa, wa_offset, sg, sg_offset, len);
if (rc)
return rc;
p = wa->address + wa_offset;
q = p + len - 1;
while (p < q) {
*p = *p ^ *q;
*q = *p ^ *q;
*p = *p ^ *q;
p++;
q--;
}
return 0;
}
static void ccp_reverse_get_dm_area(struct ccp_dm_workarea *wa,
unsigned int wa_offset,
struct scatterlist *sg,
unsigned int sg_offset,
unsigned int len)
{
u8 *p, *q;
p = wa->address + wa_offset;
q = p + len - 1;
while (p < q) {
*p = *p ^ *q;
*q = *p ^ *q;
*p = *p ^ *q;
p++;
q--;
}
ccp_get_dm_area(wa, wa_offset, sg, sg_offset, len);
}
static void ccp_free_data(struct ccp_data *data, struct ccp_cmd_queue *cmd_q)
{
ccp_dm_free(&data->dm_wa);
ccp_sg_free(&data->sg_wa);
}
static int ccp_init_data(struct ccp_data *data, struct ccp_cmd_queue *cmd_q,
Annotation
- Immediate include surface: `crypto/des.h`, `crypto/scatterwalk.h`, `crypto/utils.h`, `linux/ccp.h`, `linux/dma-mapping.h`, `linux/errno.h`, `linux/kernel.h`, `linux/module.h`.
- Detected declarations: `function ccp_gen_jobid`, `function ccp_sg_free`, `function ccp_init_sg_workarea`, `function ccp_update_sg_workarea`, `function ccp_dm_free`, `function ccp_init_dm_workarea`, `function ccp_set_dm_area`, `function ccp_get_dm_area`, `function ccp_reverse_set_dm_area`, `function ccp_reverse_get_dm_area`.
- Atlas domain: Driver Families / drivers/crypto.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.