arch/powerpc/platforms/pseries/plpks.c
Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/pseries/plpks.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/platforms/pseries/plpks.c- Extension
.c- Size
- 38795 bytes
- Lines
- 1380
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- 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/delay.hlinux/errno.hlinux/io.hlinux/printk.hlinux/slab.hlinux/string.hlinux/types.hlinux/of_fdt.hlinux/libfdt.hlinux/memblock.hlinux/bitfield.hasm/hvcall.hasm/machdep.hasm/plpks.hasm/firmware.h
Detected Declarations
struct plpks_authstruct label_attrstruct labelstruct configfunction pseries_status_to_errfunction plpks_gen_passwordfunction _plpks_get_configfunction plpks_get_versionfunction plpks_get_objoverheadfunction plpks_get_maxpwsizefunction plpks_get_maxobjectsizefunction plpks_get_maxobjectlabelsizefunction plpks_get_totalsizefunction plpks_get_usedspacefunction plpks_get_supportedpoliciesfunction plpks_get_maxlargeobjectsizefunction plpks_get_signedupdatealgorithmsfunction plpks_get_wrappingfeaturesfunction plpks_get_passwordlenfunction plpks_is_availablefunction plpks_confirm_object_flushedfunction plpks_signed_update_varfunction plpks_write_varfunction plpks_remove_varfunction plpks_read_varfunction plpks_wrapping_is_supportedfunction plpks_gen_wrapping_keyfunction plpks_wrap_objectfunction plpks_unwrap_objectfunction plpks_read_os_varfunction plpks_read_fw_varfunction plpks_read_bootloader_varfunction plpks_populate_fdtfunction plpks_early_init_devtreefunction pseries_plpks_initexport plpks_wrapping_is_supportedexport plpks_gen_wrapping_keyexport plpks_wrap_objectexport plpks_unwrap_object
Annotated Snippet
struct plpks_auth {
u8 version;
u8 consumer;
__be64 rsvd0;
__be32 rsvd1;
__be16 passwordlength;
u8 password[];
} __packed __aligned(16);
struct label_attr {
u8 prefix[8];
u8 version;
u8 os;
u8 length;
u8 reserved[5];
};
struct label {
struct label_attr attr;
u8 name[PLPKS_MAX_NAME_SIZE];
size_t size;
};
static int pseries_status_to_err(int rc)
{
int err;
switch (rc) {
case H_SUCCESS:
err = 0;
break;
case H_FUNCTION:
err = -ENXIO;
break;
case H_PARAMETER:
case H_P2:
case H_P3:
case H_P4:
case H_P5:
case H_P6:
err = -EINVAL;
break;
case H_NOT_FOUND:
err = -ENOENT;
break;
case H_BUSY:
case H_LONG_BUSY_ORDER_1_MSEC:
case H_LONG_BUSY_ORDER_10_MSEC:
case H_LONG_BUSY_ORDER_100_MSEC:
case H_LONG_BUSY_ORDER_1_SEC:
case H_LONG_BUSY_ORDER_10_SEC:
case H_LONG_BUSY_ORDER_100_SEC:
err = -EBUSY;
break;
case H_AUTHORITY:
err = -EPERM;
break;
case H_NO_MEM:
err = -ENOMEM;
break;
case H_RESOURCE:
err = -EEXIST;
break;
case H_TOO_BIG:
err = -EFBIG;
break;
case H_STATE:
err = -EIO;
break;
case H_R_STATE:
err = -EIO;
break;
case H_IN_USE:
err = -EEXIST;
break;
case H_ABORTED:
err = -EIO;
break;
default:
err = -EINVAL;
}
pr_debug("Converted hypervisor code %d to Linux %d\n", rc, err);
return err;
}
static int plpks_gen_password(void)
{
unsigned long retbuf[PLPAR_HCALL_BUFSIZE] = { 0 };
Annotation
- Immediate include surface: `linux/delay.h`, `linux/errno.h`, `linux/io.h`, `linux/printk.h`, `linux/slab.h`, `linux/string.h`, `linux/types.h`, `linux/of_fdt.h`.
- Detected declarations: `struct plpks_auth`, `struct label_attr`, `struct label`, `struct config`, `function pseries_status_to_err`, `function plpks_gen_password`, `function _plpks_get_config`, `function plpks_get_version`, `function plpks_get_objoverhead`, `function plpks_get_maxpwsize`.
- Atlas domain: Architecture Layer / arch/powerpc.
- 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.