drivers/crypto/qce/core.c
Source file repositories/reference/linux-study-clean/drivers/crypto/qce/core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/qce/core.c- Extension
.c- Size
- 6085 bytes
- Lines
- 272
- 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.
- 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
linux/cleanup.hlinux/clk.hlinux/device.hlinux/dma-mapping.hlinux/interconnect.hlinux/interrupt.hlinux/module.hlinux/mod_devicetable.hlinux/platform_device.hlinux/types.hcrypto/algapi.hcrypto/internal/hash.hcore.hcipher.hsha.haead.h
Detected Declarations
function qce_unregister_algsfunction devm_qce_register_algsfunction qce_handle_requestfunction qce_handle_queuefunction scoped_guardfunction qce_req_done_workfunction scoped_guardfunction qce_async_request_enqueuefunction qce_async_request_donefunction qce_check_versionfunction qce_crypto_probe
Annotated Snippet
if (ret) {
for (j = i - 1; j >= 0; j--)
ops->unregister_algs(qce);
return ret;
}
}
return devm_add_action_or_reset(qce->dev, qce_unregister_algs, qce);
}
static int qce_handle_request(struct crypto_async_request *async_req)
{
int ret = -EINVAL, i;
const struct qce_algo_ops *ops;
u32 type = crypto_tfm_alg_type(async_req->tfm);
for (i = 0; i < ARRAY_SIZE(qce_ops); i++) {
ops = qce_ops[i];
if (type != ops->type)
continue;
ret = ops->async_req_handle(async_req);
break;
}
return ret;
}
static int qce_handle_queue(struct qce_device *qce,
struct crypto_async_request *req)
{
struct crypto_async_request *async_req, *backlog;
int ret = 0, err;
scoped_guard(mutex, &qce->lock) {
if (req)
ret = crypto_enqueue_request(&qce->queue, req);
/* busy, do not dequeue request */
if (qce->req)
return ret;
backlog = crypto_get_backlog(&qce->queue);
async_req = crypto_dequeue_request(&qce->queue);
if (async_req)
qce->req = async_req;
}
if (!async_req)
return ret;
if (backlog) {
scoped_guard(mutex, &qce->lock)
crypto_request_complete(backlog, -EINPROGRESS);
}
err = qce_handle_request(async_req);
if (err) {
qce->result = err;
schedule_work(&qce->done_work);
}
return ret;
}
static void qce_req_done_work(struct work_struct *work)
{
struct qce_device *qce = container_of(work, struct qce_device,
done_work);
struct crypto_async_request *req;
scoped_guard(mutex, &qce->lock) {
req = qce->req;
qce->req = NULL;
}
if (req)
crypto_request_complete(req, qce->result);
qce_handle_queue(qce, NULL);
}
static int qce_async_request_enqueue(struct qce_device *qce,
struct crypto_async_request *req)
{
return qce_handle_queue(qce, req);
}
static void qce_async_request_done(struct qce_device *qce, int ret)
{
qce->result = ret;
Annotation
- Immediate include surface: `linux/cleanup.h`, `linux/clk.h`, `linux/device.h`, `linux/dma-mapping.h`, `linux/interconnect.h`, `linux/interrupt.h`, `linux/module.h`, `linux/mod_devicetable.h`.
- Detected declarations: `function qce_unregister_algs`, `function devm_qce_register_algs`, `function qce_handle_request`, `function qce_handle_queue`, `function scoped_guard`, `function qce_req_done_work`, `function scoped_guard`, `function qce_async_request_enqueue`, `function qce_async_request_done`, `function qce_check_version`.
- Atlas domain: Driver Families / drivers/crypto.
- Implementation status: source implementation candidate.
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.