drivers/s390/crypto/pkey_base.c
Source file repositories/reference/linux-study-clean/drivers/s390/crypto/pkey_base.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/crypto/pkey_base.c- Extension
.c- Size
- 8893 bytes
- Lines
- 388
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cpufeature.hlinux/export.hlinux/init.hlinux/list.hlinux/module.hlinux/rculist.hpkey_base.h
Detected Declarations
function pkey_handler_registerfunction pkey_handler_unregisterfunction pkey_handler_putfunction pkey_handler_key_to_protkeyfunction keyfunction pkey_handler_gen_keyfunction pkey_handler_clr_to_keyfunction pkey_handler_verify_keyfunction pkey_handler_apqns_for_keyfunction pkey_handler_apqns_for_keytypefunction pkey_handler_request_modulesfunction list_for_each_entry_rcufunction pkey_initfunction pkey_exitexport pkey_dbf_infoexport pkey_handler_registerexport pkey_handler_unregisterexport pkey_handler_get_keybasedexport pkey_handler_get_keytypebasedexport pkey_handler_putexport pkey_handler_key_to_protkeyexport pkey_handler_slowpath_key_to_protkeyexport pkey_handler_gen_keyexport pkey_handler_clr_to_keyexport pkey_handler_verify_keyexport pkey_handler_apqns_for_keyexport pkey_handler_apqns_for_keytypeexport pkey_handler_request_modules
Annotated Snippet
if (h == handler) {
rcu_read_unlock();
spin_unlock(&handler_list_write_lock);
module_put(handler->module);
return -EEXIST;
}
}
rcu_read_unlock();
list_add_rcu(&handler->list, &handler_list);
spin_unlock(&handler_list_write_lock);
/*
* Fast path to push the info about the updated list to the other
* CPUs. If removed, the other CPUs may get the updated list when the
* RCU context is synched. As this code is in general not performance
* critical and the list update mostly only occurs at the early time in
* system startup the focus is on concurrency versus performance.
*/
synchronize_rcu();
module_put(handler->module);
PKEY_DBF_INFO("%s pkey handler '%s' registered\n", __func__,
handler->name ?: "<no name>");
return 0;
}
EXPORT_SYMBOL(pkey_handler_register);
int pkey_handler_unregister(struct pkey_handler *handler)
{
spin_lock(&handler_list_write_lock);
list_del_rcu(&handler->list);
INIT_LIST_HEAD_RCU(&handler->list);
spin_unlock(&handler_list_write_lock);
synchronize_rcu();
PKEY_DBF_INFO("%s pkey handler '%s' unregistered\n", __func__,
handler->name ?: "<no name>");
return 0;
}
EXPORT_SYMBOL(pkey_handler_unregister);
/*
* Handler invocation functions.
*/
const struct pkey_handler *pkey_handler_get_keybased(const u8 *key, u32 keylen)
{
const struct pkey_handler *h;
rcu_read_lock();
list_for_each_entry_rcu(h, &handler_list, list) {
if (!try_module_get(h->module))
continue;
if (h->is_supported_key(key, keylen)) {
rcu_read_unlock();
return h;
}
module_put(h->module);
}
rcu_read_unlock();
return NULL;
}
EXPORT_SYMBOL(pkey_handler_get_keybased);
const struct pkey_handler *pkey_handler_get_keytypebased(enum pkey_key_type kt)
{
const struct pkey_handler *h;
rcu_read_lock();
list_for_each_entry_rcu(h, &handler_list, list) {
if (!try_module_get(h->module))
continue;
if (h->is_supported_keytype(kt)) {
rcu_read_unlock();
return h;
}
module_put(h->module);
}
rcu_read_unlock();
return NULL;
}
EXPORT_SYMBOL(pkey_handler_get_keytypebased);
void pkey_handler_put(const struct pkey_handler *handler)
{
Annotation
- Immediate include surface: `linux/cpufeature.h`, `linux/export.h`, `linux/init.h`, `linux/list.h`, `linux/module.h`, `linux/rculist.h`, `pkey_base.h`.
- Detected declarations: `function pkey_handler_register`, `function pkey_handler_unregister`, `function pkey_handler_put`, `function pkey_handler_key_to_protkey`, `function key`, `function pkey_handler_gen_key`, `function pkey_handler_clr_to_key`, `function pkey_handler_verify_key`, `function pkey_handler_apqns_for_key`, `function pkey_handler_apqns_for_keytype`.
- 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.