drivers/crypto/intel/qat/qat_common/adf_transport_debug.c
Source file repositories/reference/linux-study-clean/drivers/crypto/intel/qat/qat_common/adf_transport_debug.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/intel/qat/qat_common/adf_transport_debug.c- Extension
.c- Size
- 5943 bytes
- Lines
- 217
- 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.
- 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/mutex.hlinux/slab.hlinux/seq_file.hadf_accel_devices.hadf_transport_internal.hadf_transport_access_macros.h
Detected Declarations
function adf_ring_showfunction adf_ring_stopfunction adf_ring_debugfs_addfunction adf_ring_debugfs_rmfunction adf_bank_showfunction adf_bank_stopfunction adf_bank_debugfs_addfunction adf_bank_debugfs_rm
Annotated Snippet
// SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
/* Copyright(c) 2014 - 2020 Intel Corporation */
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/seq_file.h>
#include "adf_accel_devices.h"
#include "adf_transport_internal.h"
#include "adf_transport_access_macros.h"
static DEFINE_MUTEX(ring_read_lock);
static DEFINE_MUTEX(bank_read_lock);
#define ADF_RING_NUM_MSGS(ring) \
(ADF_SIZE_TO_RING_SIZE_IN_BYTES(ring->ring_size) / \
ADF_MSG_SIZE_TO_BYTES(ring->msg_size))
static void *adf_ring_start(struct seq_file *sfile, loff_t *pos)
{
struct adf_etr_ring_data *ring = sfile->private;
unsigned int num_msg = ADF_RING_NUM_MSGS(ring);
loff_t val = *pos;
mutex_lock(&ring_read_lock);
if (val == 0)
return SEQ_START_TOKEN;
if (val >= num_msg)
return NULL;
return ring->base_addr +
(ADF_MSG_SIZE_TO_BYTES(ring->msg_size) * (*pos)++);
}
static void *adf_ring_next(struct seq_file *sfile, void *v, loff_t *pos)
{
struct adf_etr_ring_data *ring = sfile->private;
unsigned int num_msg = ADF_RING_NUM_MSGS(ring);
loff_t val = *pos;
(*pos)++;
if (val >= num_msg)
return NULL;
return ring->base_addr + (ADF_MSG_SIZE_TO_BYTES(ring->msg_size) * val);
}
static int adf_ring_show(struct seq_file *sfile, void *v)
{
struct adf_etr_ring_data *ring = sfile->private;
struct adf_etr_bank_data *bank = ring->bank;
struct adf_hw_csr_ops *csr_ops = GET_CSR_OPS(bank->accel_dev);
void __iomem *csr = ring->bank->csr_addr;
if (v == SEQ_START_TOKEN) {
int head, tail, empty;
head = csr_ops->read_csr_ring_head(csr, bank->bank_number,
ring->ring_number);
tail = csr_ops->read_csr_ring_tail(csr, bank->bank_number,
ring->ring_number);
empty = csr_ops->read_csr_e_stat(csr, bank->bank_number);
seq_puts(sfile, "------- Ring configuration -------\n");
seq_printf(sfile, "ring name: %s\n",
ring->ring_debug->ring_name);
seq_printf(sfile, "ring num %d, bank num %d\n",
ring->ring_number, ring->bank->bank_number);
seq_printf(sfile, "head %x, tail %x, empty: %d\n",
head, tail, (empty & 1 << ring->ring_number)
>> ring->ring_number);
seq_printf(sfile, "ring size %lld, msg size %d\n",
(long long)ADF_SIZE_TO_RING_SIZE_IN_BYTES(ring->ring_size),
ADF_MSG_SIZE_TO_BYTES(ring->msg_size));
seq_puts(sfile, "----------- Ring data ------------\n");
return 0;
}
seq_hex_dump(sfile, "", DUMP_PREFIX_ADDRESS, 32, 4,
v, ADF_MSG_SIZE_TO_BYTES(ring->msg_size), false);
return 0;
}
static void adf_ring_stop(struct seq_file *sfile, void *v)
{
mutex_unlock(&ring_read_lock);
}
static const struct seq_operations adf_ring_debug_sops = {
.start = adf_ring_start,
.next = adf_ring_next,
Annotation
- Immediate include surface: `linux/mutex.h`, `linux/slab.h`, `linux/seq_file.h`, `adf_accel_devices.h`, `adf_transport_internal.h`, `adf_transport_access_macros.h`.
- Detected declarations: `function adf_ring_show`, `function adf_ring_stop`, `function adf_ring_debugfs_add`, `function adf_ring_debugfs_rm`, `function adf_bank_show`, `function adf_bank_stop`, `function adf_bank_debugfs_add`, `function adf_bank_debugfs_rm`.
- 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.
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.