drivers/s390/crypto/zcrypt_queue.c
Source file repositories/reference/linux-study-clean/drivers/s390/crypto/zcrypt_queue.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/crypto/zcrypt_queue.c- Extension
.c- Size
- 5556 bytes
- Lines
- 235
- Domain
- Driver Families
- Bucket
- drivers/s390
- 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.
- 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/export.hlinux/module.hlinux/init.hlinux/interrupt.hlinux/miscdevice.hlinux/fs.hlinux/proc_fs.hlinux/seq_file.hlinux/slab.hlinux/atomic.hlinux/uaccess.hlinux/hw_random.hlinux/debugfs.hasm/debug.hzcrypt_debug.hzcrypt_api.hzcrypt_msgtype6.hzcrypt_msgtype50.h
Detected Declarations
function Authorfunction online_storefunction load_showfunction zcrypt_queue_force_onlinefunction zcrypt_queue_freefunction zcrypt_queue_releasefunction zcrypt_queue_getfunction zcrypt_queue_putfunction zcrypt_queue_registerfunction zcrypt_queue_unregisterexport zcrypt_queue_allocexport zcrypt_queue_freeexport zcrypt_queue_getexport zcrypt_queue_putexport zcrypt_queue_registerexport zcrypt_queue_unregister
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright IBM Corp. 2001, 2012
* Author(s): Robert Burroughs
* Eric Rossman (edrossma@us.ibm.com)
* Cornelia Huck <cornelia.huck@de.ibm.com>
*
* Hotplug & misc device support: Jochen Roehrig (roehrig@de.ibm.com)
* Major cleanup & driver split: Martin Schwidefsky <schwidefsky@de.ibm.com>
* Ralph Wuerthner <rwuerthn@de.ibm.com>
* MSGTYPE restruct: Holger Dengler <hd@linux.vnet.ibm.com>
*/
#include <linux/export.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/miscdevice.h>
#include <linux/fs.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/atomic.h>
#include <linux/uaccess.h>
#include <linux/hw_random.h>
#include <linux/debugfs.h>
#include <asm/debug.h>
#include "zcrypt_debug.h"
#include "zcrypt_api.h"
#include "zcrypt_msgtype6.h"
#include "zcrypt_msgtype50.h"
/*
* Device attributes common for all crypto queue devices.
*/
static ssize_t online_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct zcrypt_queue *zq = dev_get_drvdata(dev);
struct ap_queue *aq = to_ap_queue(dev);
int online = aq->config && !aq->chkstop && zq->online ? 1 : 0;
return sysfs_emit(buf, "%d\n", online);
}
static ssize_t online_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct zcrypt_queue *zq = dev_get_drvdata(dev);
struct ap_queue *aq = to_ap_queue(dev);
struct zcrypt_card *zc = zq->zcard;
int online;
if (sscanf(buf, "%d\n", &online) != 1 || online < 0 || online > 1)
return -EINVAL;
if (online && (!aq->config || !aq->card->config ||
aq->chkstop || aq->card->chkstop))
return -ENODEV;
if (online && !zc->online)
return -EINVAL;
zq->online = online;
ZCRYPT_DBF_INFO("%s queue=%02x.%04x online=%d\n",
__func__, AP_QID_CARD(zq->queue->qid),
AP_QID_QUEUE(zq->queue->qid), online);
ap_send_online_uevent(&aq->ap_dev, online);
if (!online)
ap_flush_queue(zq->queue);
return count;
}
static DEVICE_ATTR_RW(online);
static ssize_t load_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct zcrypt_queue *zq = dev_get_drvdata(dev);
return sysfs_emit(buf, "%d\n", atomic_read(&zq->load));
}
Annotation
- Immediate include surface: `linux/export.h`, `linux/module.h`, `linux/init.h`, `linux/interrupt.h`, `linux/miscdevice.h`, `linux/fs.h`, `linux/proc_fs.h`, `linux/seq_file.h`.
- Detected declarations: `function Author`, `function online_store`, `function load_show`, `function zcrypt_queue_force_online`, `function zcrypt_queue_free`, `function zcrypt_queue_release`, `function zcrypt_queue_get`, `function zcrypt_queue_put`, `function zcrypt_queue_register`, `function zcrypt_queue_unregister`.
- Atlas domain: Driver Families / drivers/s390.
- 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.