drivers/hv/mshv_root_hv_call.c
Source file repositories/reference/linux-study-clean/drivers/hv/mshv_root_hv_call.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hv/mshv_root_hv_call.c- Extension
.c- Size
- 27397 bytes
- Lines
- 1075
- Domain
- Driver Families
- Bucket
- drivers/hv
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- 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/kernel.hlinux/mm.hlinux/export.hasm/mshyperv.hmshv_root.h
Detected Declarations
function Copyrightfunction hv_call_create_partitionfunction hv_call_initialize_partitionfunction hv_call_finalize_partitionfunction hv_call_delete_partitionfunction hv_do_map_gpa_hcallfunction hv_call_map_gpa_pagesfunction hv_call_map_mmio_pagesfunction hv_call_unmap_gpa_pagesfunction hv_call_get_gpa_access_statesfunction hv_call_assert_virtual_interruptfunction hv_call_delete_vpfunction hv_call_get_vp_statefunction hv_call_set_vp_statefunction hv_call_map_vp_state_pagefunction mshv_use_overlay_gpfnfunction hv_map_vp_state_pagefunction hv_call_unmap_vp_state_pagefunction hv_unmap_vp_state_pagefunction hv_call_get_partition_property_exfunction hv_call_clear_virtual_interruptfunction hv_call_create_portfunction hv_call_delete_portfunction hv_call_connect_portfunction hv_call_disconnect_portfunction hv_call_notify_port_ring_emptyfunction hv_call_map_stats_pagefunction hv_stats_get_area_typefunction hv_call_map_stats_pagefunction hv_map_stats_pagefunction hv_call_unmap_stats_pagefunction hv_unmap_stats_pagefunction hv_call_modify_spa_host_accessexport hv_call_delete_vp
Annotated Snippet
if (!hv_result_success(status)) {
if (hv_result(status) == HV_STATUS_NO_RESOURCES)
status = HV_STATUS_SUCCESS;
break;
}
withdrawn += completed;
}
free_page((unsigned long)output_page);
trace_mshv_hvcall_withdraw_memory(partition_id, withdrawn, status);
return hv_result_to_errno(status);
}
int hv_call_create_partition(u64 flags,
struct hv_partition_creation_properties creation_properties,
union hv_partition_isolation_properties isolation_properties,
u64 *partition_id)
{
struct hv_input_create_partition *input;
struct hv_output_create_partition *output;
u64 status;
int ret;
unsigned long irq_flags;
do {
local_irq_save(irq_flags);
input = *this_cpu_ptr(hyperv_pcpu_input_arg);
output = *this_cpu_ptr(hyperv_pcpu_output_arg);
memset(input, 0, sizeof(*input));
input->flags = flags;
input->compatibility_version = HV_COMPATIBILITY_21_H2;
memcpy(&input->partition_creation_properties, &creation_properties,
sizeof(creation_properties));
memcpy(&input->isolation_properties, &isolation_properties,
sizeof(isolation_properties));
status = hv_do_hypercall(HVCALL_CREATE_PARTITION,
input, output);
if (!hv_result_needs_memory(status)) {
if (hv_result_success(status))
*partition_id = output->partition_id;
local_irq_restore(irq_flags);
ret = hv_result_to_errno(status);
break;
}
local_irq_restore(irq_flags);
ret = hv_deposit_memory(hv_current_partition_id, status);
} while (!ret);
trace_mshv_hvcall_create_partition(flags, ret ? ret : *partition_id);
return ret;
}
int hv_call_initialize_partition(u64 partition_id)
{
struct hv_input_initialize_partition input;
u64 status;
int ret;
input.partition_id = partition_id;
ret = hv_call_deposit_pages(NUMA_NO_NODE, partition_id,
HV_INIT_PARTITION_DEPOSIT_PAGES);
if (ret)
return ret;
do {
status = hv_do_fast_hypercall8(HVCALL_INITIALIZE_PARTITION,
*(u64 *)&input);
if (!hv_result_needs_memory(status)) {
ret = hv_result_to_errno(status);
break;
}
ret = hv_deposit_memory(partition_id, status);
} while (!ret);
trace_mshv_hvcall_initialize_partition(partition_id, status);
return ret;
}
int hv_call_finalize_partition(u64 partition_id)
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/mm.h`, `linux/export.h`, `asm/mshyperv.h`, `mshv_root.h`.
- Detected declarations: `function Copyright`, `function hv_call_create_partition`, `function hv_call_initialize_partition`, `function hv_call_finalize_partition`, `function hv_call_delete_partition`, `function hv_do_map_gpa_hcall`, `function hv_call_map_gpa_pages`, `function hv_call_map_mmio_pages`, `function hv_call_unmap_gpa_pages`, `function hv_call_get_gpa_access_states`.
- Atlas domain: Driver Families / drivers/hv.
- 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.