arch/arm64/hyperv/hv_core.c
Source file repositories/reference/linux-study-clean/arch/arm64/hyperv/hv_core.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm64/hyperv/hv_core.c- Extension
.c- Size
- 5304 bytes
- Lines
- 198
- Domain
- Architecture Layer
- Bucket
- arch/arm64
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/export.hlinux/mm.hlinux/arm-smccc.hlinux/module.hasm-generic/bug.hhyperv/hvhdk.hasm/mshyperv.h
Detected Declarations
function Copyrightfunction hv_do_fast_hypercall8function hv_do_fast_hypercall16function hv_set_vpregfunction hv_get_vpreg_128function hv_get_vpregfunction hyperv_report_panicexport hv_do_hypercallexport hv_do_fast_hypercall8export hv_do_fast_hypercall16export hv_set_vpregexport hv_get_vpreg_128export hv_get_vpregexport hyperv_report_panic
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Low level utility routines for interacting with Hyper-V.
*
* Copyright (C) 2021, Microsoft, Inc.
*
* Author : Michael Kelley <mikelley@microsoft.com>
*/
#include <linux/types.h>
#include <linux/export.h>
#include <linux/mm.h>
#include <linux/arm-smccc.h>
#include <linux/module.h>
#include <asm-generic/bug.h>
#include <hyperv/hvhdk.h>
#include <asm/mshyperv.h>
/*
* hv_do_hypercall- Invoke the specified hypercall
*/
u64 hv_do_hypercall(u64 control, void *input, void *output)
{
struct arm_smccc_res res;
u64 input_address;
u64 output_address;
input_address = input ? virt_to_phys(input) : 0;
output_address = output ? virt_to_phys(output) : 0;
arm_smccc_1_1_hvc(HV_FUNC_ID, control,
input_address, output_address, &res);
return res.a0;
}
EXPORT_SYMBOL_GPL(hv_do_hypercall);
/*
* hv_do_fast_hypercall8 -- Invoke the specified hypercall
* with arguments in registers instead of physical memory.
* Avoids the overhead of virt_to_phys for simple hypercalls.
*/
u64 hv_do_fast_hypercall8(u16 code, u64 input)
{
struct arm_smccc_res res;
u64 control;
control = (u64)code | HV_HYPERCALL_FAST_BIT;
arm_smccc_1_1_hvc(HV_FUNC_ID, control, input, &res);
return res.a0;
}
EXPORT_SYMBOL_GPL(hv_do_fast_hypercall8);
/*
* hv_do_fast_hypercall16 -- Invoke the specified hypercall
* with arguments in registers instead of physical memory.
* Avoids the overhead of virt_to_phys for simple hypercalls.
*/
u64 hv_do_fast_hypercall16(u16 code, u64 input1, u64 input2)
{
struct arm_smccc_res res;
u64 control;
control = (u64)code | HV_HYPERCALL_FAST_BIT;
arm_smccc_1_1_hvc(HV_FUNC_ID, control, input1, input2, &res);
return res.a0;
}
EXPORT_SYMBOL_GPL(hv_do_fast_hypercall16);
/*
* Set a single VP register to a 64-bit value.
*/
void hv_set_vpreg(u32 msr, u64 value)
{
struct arm_smccc_res res;
arm_smccc_1_1_hvc(HV_FUNC_ID,
HVCALL_SET_VP_REGISTERS | HV_HYPERCALL_FAST_BIT |
HV_HYPERCALL_REP_COMP_1,
HV_PARTITION_ID_SELF,
HV_VP_INDEX_SELF,
msr,
0,
value,
0,
&res);
Annotation
- Immediate include surface: `linux/types.h`, `linux/export.h`, `linux/mm.h`, `linux/arm-smccc.h`, `linux/module.h`, `asm-generic/bug.h`, `hyperv/hvhdk.h`, `asm/mshyperv.h`.
- Detected declarations: `function Copyright`, `function hv_do_fast_hypercall8`, `function hv_do_fast_hypercall16`, `function hv_set_vpreg`, `function hv_get_vpreg_128`, `function hv_get_vpreg`, `function hyperv_report_panic`, `export hv_do_hypercall`, `export hv_do_fast_hypercall8`, `export hv_do_fast_hypercall16`.
- Atlas domain: Architecture Layer / arch/arm64.
- 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.