arch/s390/kernel/uv.c
Source file repositories/reference/linux-study-clean/arch/s390/kernel/uv.c
File Facts
- System
- Linux kernel
- Corpus path
arch/s390/kernel/uv.c- Extension
.c- Size
- 24040 bytes
- Lines
- 852
- Domain
- Architecture Layer
- Bucket
- arch/s390
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/kernel.hlinux/types.hlinux/sizes.hlinux/bitmap.hlinux/memblock.hlinux/pagemap.hlinux/swap.hlinux/pagewalk.hlinux/backing-dev.hasm/facility.hasm/sections.hasm/uv.h
Detected Declarations
function uv_initfunction setup_uvfunction uv_pin_sharedfunction uv_destroyfunction uv_destroy_foliofunction uv_destroy_ptefunction pagingfunction uv_convert_from_secure_foliofunction uv_convert_from_secure_ptefunction expected_folio_refsfunction __make_folio_securefunction s390_wiggle_split_foliofunction writebackfunction kvm_s390_pv_make_securefunction uv_query_facilitiesfunction uv_query_supp_se_hdr_verfunction uv_query_supp_se_hdr_pcffunction uv_query_dump_cpu_lenfunction uv_query_dump_storage_state_lenfunction uv_query_dump_finalize_lenfunction uv_query_feature_indicationsfunction uv_query_max_guest_cpusfunction uv_query_max_guest_vmsfunction uv_query_max_guest_addrfunction uv_query_supp_att_req_hdr_verfunction uv_query_supp_att_pflagsfunction uv_query_supp_add_secret_req_verfunction uv_query_supp_add_secret_pcffunction uv_query_supp_secret_typesfunction uv_query_max_secretsfunction uv_query_max_retr_secretsfunction uv_query_max_assoc_secretsfunction uv_query_keysfunction emit_hashfunction uv_keys_host_keyfunction uv_keys_backup_host_keyfunction uv_keys_allfunction uv_is_prot_virt_guestfunction uv_is_prot_virt_hostfunction uv_sysfs_dir_initfunction uv_sysfs_initfunction find_secret_in_pagefunction uv_find_secretfunction uv_retrieve_secretmodule init uv_sysfs_initexport prot_virt_guestexport uv_infoexport prot_virt_host
Annotated Snippet
device_initcall(uv_sysfs_init);
/*
* Locate a secret in the list by its id.
* @secret_id: search pattern.
* @list: ephemeral buffer space
* @secret: output data, containing the secret's metadata.
*
* Search for a secret with the given secret_id in the Ultravisor secret store.
*
* Context: might sleep.
*/
static int find_secret_in_page(const u8 secret_id[UV_SECRET_ID_LEN],
const struct uv_secret_list *list,
struct uv_secret_list_item_hdr *secret)
{
u16 i;
for (i = 0; i < list->total_num_secrets; i++) {
if (memcmp(secret_id, list->secrets[i].id, UV_SECRET_ID_LEN) == 0) {
*secret = list->secrets[i].hdr;
return 0;
}
}
return -ENOENT;
}
/**
* uv_find_secret() - search secret metadata for a given secret id.
* @secret_id: search pattern.
* @list: ephemeral buffer space
* @secret: output data, containing the secret's metadata.
*
* Context: might sleep.
*/
int uv_find_secret(const u8 secret_id[UV_SECRET_ID_LEN],
struct uv_secret_list *list,
struct uv_secret_list_item_hdr *secret)
{
u16 start_idx = 0;
u16 list_rc;
int ret;
do {
uv_list_secrets(list, start_idx, &list_rc, NULL);
if (list_rc != UVC_RC_EXECUTED && list_rc != UVC_RC_MORE_DATA) {
if (list_rc == UVC_RC_INV_CMD)
return -ENODEV;
else
return -EIO;
}
ret = find_secret_in_page(secret_id, list, secret);
if (ret == 0)
return ret;
start_idx = list->next_secret_idx;
} while (list_rc == UVC_RC_MORE_DATA && start_idx < list->next_secret_idx);
return -ENOENT;
}
EXPORT_SYMBOL_GPL(uv_find_secret);
/**
* uv_retrieve_secret() - get the secret value for the secret index.
* @secret_idx: Secret index for which the secret should be retrieved.
* @buf: Buffer to store retrieved secret.
* @buf_size: Size of the buffer. The correct buffer size is reported as part of
* the result from `uv_get_secret_metadata`.
*
* Calls the Retrieve Secret UVC and translates the UV return code into an errno.
*
* Context: might sleep.
*
* Return:
* * %0 - Entry found; buffer contains a valid secret.
* * %ENOENT: - No entry found or secret at the index is non-retrievable.
* * %ENODEV: - Not supported: UV not available or command not available.
* * %EINVAL: - Buffer too small for content.
* * %EIO: - Other unexpected UV error.
*/
int uv_retrieve_secret(u16 secret_idx, u8 *buf, size_t buf_size)
{
struct uv_cb_retr_secr uvcb = {
.header.len = sizeof(uvcb),
.header.cmd = UVC_CMD_RETR_SECRET,
.secret_idx = secret_idx,
.buf_addr = (u64)buf,
.buf_size = buf_size,
};
uv_call_sched(0, (u64)&uvcb);
Annotation
- Immediate include surface: `linux/export.h`, `linux/kernel.h`, `linux/types.h`, `linux/sizes.h`, `linux/bitmap.h`, `linux/memblock.h`, `linux/pagemap.h`, `linux/swap.h`.
- Detected declarations: `function uv_init`, `function setup_uv`, `function uv_pin_shared`, `function uv_destroy`, `function uv_destroy_folio`, `function uv_destroy_pte`, `function paging`, `function uv_convert_from_secure_folio`, `function uv_convert_from_secure_pte`, `function expected_folio_refs`.
- Atlas domain: Architecture Layer / arch/s390.
- Implementation status: integration 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.