arch/powerpc/kernel/secvar-sysfs.c
Source file repositories/reference/linux-study-clean/arch/powerpc/kernel/secvar-sysfs.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/kernel/secvar-sysfs.c- Extension
.c- Size
- 5929 bytes
- Lines
- 285
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: implementation source
- Status
- source 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.
- 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/slab.hlinux/compat.hlinux/string.hlinux/of.hasm/secvar.hasm/plpks.h
Detected Declarations
function format_showfunction size_showfunction data_readfunction update_writefunction update_kobj_sizefunction add_varfunction secvar_sysfs_loadfunction secvar_sysfs_load_staticfunction secvar_sysfs_init
Annotated Snippet
if (rc) {
if (rc != -ENOENT)
pr_err("error getting secvar from firmware %d\n", rc);
else
rc = 0;
break;
}
rc = add_var(name);
} while (!rc);
kfree(name);
return rc;
}
static __init int secvar_sysfs_load_static(void)
{
const char * const *name_ptr = secvar_ops->var_names;
int rc;
while (*name_ptr) {
rc = add_var(*name_ptr);
if (rc)
return rc;
name_ptr++;
}
return 0;
}
static __init int secvar_sysfs_init(void)
{
u64 max_size;
int rc;
if (!secvar_ops) {
pr_warn("Failed to retrieve secvar operations\n");
return -ENODEV;
}
secvar_kobj = kobject_create_and_add("secvar", firmware_kobj);
if (!secvar_kobj) {
pr_err("Failed to create firmware kobj\n");
return -ENOMEM;
}
rc = sysfs_create_file(secvar_kobj, &format_attr.attr);
if (rc) {
pr_err("Failed to create format object\n");
rc = -ENOMEM;
goto err;
}
secvar_kset = kset_create_and_add("vars", NULL, secvar_kobj);
if (!secvar_kset) {
pr_err("sysfs kobject registration failed\n");
rc = -ENOMEM;
goto err;
}
rc = update_kobj_size();
if (rc) {
pr_err("Cannot read the size of the attribute\n");
goto err;
}
rc = plpks_config_create_softlink(secvar_kobj);
if (rc) {
pr_err("Failed to create softlink to PLPKS config directory");
goto err;
}
pr_info("/sys/firmware/secvar/config is now deprecated.\n");
pr_info("Will be removed in future versions.\n");
if (secvar_ops->get_next)
rc = secvar_sysfs_load();
else
rc = secvar_sysfs_load_static();
if (rc) {
pr_err("Failed to create variable attributes\n");
goto err;
}
// Due to sysfs limitations, we will only ever get a write buffer of
// up to 1 page in size. Print a warning if this is potentially going
// to cause problems, so that the user is aware.
secvar_ops->max_size(&max_size);
Annotation
- Immediate include surface: `linux/slab.h`, `linux/compat.h`, `linux/string.h`, `linux/of.h`, `asm/secvar.h`, `asm/plpks.h`.
- Detected declarations: `function format_show`, `function size_show`, `function data_read`, `function update_write`, `function update_kobj_size`, `function add_var`, `function secvar_sysfs_load`, `function secvar_sysfs_load_static`, `function secvar_sysfs_init`.
- Atlas domain: Architecture Layer / arch/powerpc.
- 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.