arch/powerpc/platforms/pseries/htmdump.c
Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/pseries/htmdump.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/platforms/pseries/htmdump.c- Extension
.c- Size
- 15960 bytes
- Lines
- 590
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/debugfs.hlinux/module.hasm/io.hasm/machdep.hasm/plpar_wrappers.hasm/kvm_guest.h
Detected Declarations
function htm_return_checkfunction htmdump_readfunction htmsystem_mem_readfunction htmconfigure_setfunction htmconfigure_getfunction htmstart_setfunction htmstart_getfunction htmstatus_readfunction htminfo_readfunction htmcaps_readfunction htmsetup_setfunction htmsetup_getfunction htmflags_setfunction htmflags_getfunction htmdump_init_debugfsfunction htmdump_initfunction htmdump_exitmodule init htmdump_init
Annotated Snippet
static const struct file_operations htmdump_fops = {
.llseek = NULL,
.read = htmdump_read,
.open = simple_open,
};
static const struct file_operations htmsystem_mem_fops = {
.llseek = NULL,
.read = htmsystem_mem_read,
.open = simple_open,
};
static int htmconfigure_set(void *data, u64 val)
{
long rc, ret;
unsigned long param1 = -1, param2 = -1;
/*
* value as 1 : configure HTM.
* value as 0 : deconfigure HTM. Return -EINVAL for
* other values.
*/
if (val == HTM_ENABLE) {
/*
* Invoke H_HTM call with:
* - operation as htm configure (H_HTM_OP_CONFIGURE)
* - If htmflags is set, param1 and param2 will be -1
* which is an indicator to use default htm mode reg mask
* and htm mode reg value.
* - last three values are unused, hence set to zero
*/
if (!htmflags) {
param1 = 0;
param2 = 0;
}
rc = htm_hcall_wrapper(htmflags, nodeindex, nodalchipindex, coreindexonchip,
htmtype, H_HTM_OP_CONFIGURE, param1, param2, 0);
} else if (val == HTM_DISABLE) {
/*
* Invoke H_HTM call with:
* - operation as htm deconfigure (H_HTM_OP_DECONFIGURE)
* - last three values are unused, hence set to zero
*/
rc = htm_hcall_wrapper(htmflags, nodeindex, nodalchipindex, coreindexonchip,
htmtype, H_HTM_OP_DECONFIGURE, 0, 0, 0);
} else
return -EINVAL;
ret = htm_return_check(rc);
if (ret <= 0) {
pr_debug("H_HTM hcall failed, returning %ld\n", ret);
return ret;
}
/* Set htmconfigure if operation succeeds */
htmconfigure = val;
return 0;
}
static int htmconfigure_get(void *data, u64 *val)
{
*val = htmconfigure;
return 0;
}
static int htmstart_set(void *data, u64 val)
{
long rc, ret;
/*
* value as 1: start HTM
* value as 0: stop HTM
* Return -EINVAL for other values.
*/
if (val == HTM_ENABLE) {
/*
* Invoke H_HTM call with:
* - operation as htm start (H_HTM_OP_START)
* - last three values are unused, hence set to zero
*/
rc = htm_hcall_wrapper(htmflags, nodeindex, nodalchipindex, coreindexonchip,
htmtype, H_HTM_OP_START, 0, 0, 0);
} else if (val == HTM_DISABLE) {
/*
* Invoke H_HTM call with:
* - operation as htm stop (H_HTM_OP_STOP)
* - last three values are unused, hence set to zero
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/module.h`, `asm/io.h`, `asm/machdep.h`, `asm/plpar_wrappers.h`, `asm/kvm_guest.h`.
- Detected declarations: `function htm_return_check`, `function htmdump_read`, `function htmsystem_mem_read`, `function htmconfigure_set`, `function htmconfigure_get`, `function htmstart_set`, `function htmstart_get`, `function htmstatus_read`, `function htminfo_read`, `function htmcaps_read`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: pattern 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.