arch/riscv/kvm/vcpu_sbi_hsm.c
Source file repositories/reference/linux-study-clean/arch/riscv/kvm/vcpu_sbi_hsm.c
File Facts
- System
- Linux kernel
- Corpus path
arch/riscv/kvm/vcpu_sbi_hsm.c- Extension
.c- Size
- 2826 bytes
- Lines
- 127
- Domain
- Architecture Layer
- Bucket
- arch/riscv
- 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.
- 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/errno.hlinux/err.hlinux/kvm_host.hlinux/wordpart.hasm/sbi.hasm/kvm_vcpu_sbi.h
Detected Declarations
function Copyrightfunction kvm_sbi_hsm_vcpu_stopfunction kvm_sbi_hsm_vcpu_get_statusfunction kvm_sbi_ext_hsm_handler
Annotated Snippet
if (ret >= 0) {
retdata->out_val = ret;
retdata->err_val = 0;
}
return 0;
case SBI_EXT_HSM_HART_SUSPEND:
switch (lower_32_bits(cp->a0)) {
case SBI_HSM_SUSPEND_RET_DEFAULT:
kvm_riscv_vcpu_wfi(vcpu);
break;
case SBI_HSM_SUSPEND_NON_RET_DEFAULT:
ret = SBI_ERR_NOT_SUPPORTED;
break;
default:
ret = SBI_ERR_INVALID_PARAM;
}
break;
default:
ret = SBI_ERR_NOT_SUPPORTED;
}
retdata->err_val = ret;
return 0;
}
const struct kvm_vcpu_sbi_extension vcpu_sbi_ext_hsm = {
.extid_start = SBI_EXT_HSM,
.extid_end = SBI_EXT_HSM,
.handler = kvm_sbi_ext_hsm_handler,
};
Annotation
- Immediate include surface: `linux/errno.h`, `linux/err.h`, `linux/kvm_host.h`, `linux/wordpart.h`, `asm/sbi.h`, `asm/kvm_vcpu_sbi.h`.
- Detected declarations: `function Copyright`, `function kvm_sbi_hsm_vcpu_stop`, `function kvm_sbi_hsm_vcpu_get_status`, `function kvm_sbi_ext_hsm_handler`.
- Atlas domain: Architecture Layer / arch/riscv.
- Implementation status: source 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.