diff options
| author | Stanislav Kinsburskii <skinsburskii@linux.microsoft.com> | 2026-01-28 21:11:41 +0300 |
|---|---|---|
| committer | Wei Liu <wei.liu@kernel.org> | 2026-02-04 09:17:05 +0300 |
| commit | 2de4516aa8f726946eadb9831c610b7aeb5bc682 (patch) | |
| tree | 6bf0ac6edbb89f7998f5a75e925798dce2b7ef20 | |
| parent | 7538b80e5a4b473b73428d13b3a47ceaad9a8a7c (diff) | |
| download | linux-2de4516aa8f726946eadb9831c610b7aeb5bc682.tar.xz | |
mshv: Use typed hv_stats_page pointers
Refactor all relevant functions to use struct hv_stats_page pointers
instead of void pointers for stats page mapping and unmapping thus
improving type safety and code clarity across the Hyper-V stats mapping
APIs.
Signed-off-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
Acked-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
| -rw-r--r-- | drivers/hv/mshv_root.h | 5 | ||||
| -rw-r--r-- | drivers/hv/mshv_root_hv_call.c | 12 | ||||
| -rw-r--r-- | drivers/hv/mshv_root_main.c | 8 |
3 files changed, 14 insertions, 11 deletions
diff --git a/drivers/hv/mshv_root.h b/drivers/hv/mshv_root.h index 3c1d88b36741..05ba1f716f9e 100644 --- a/drivers/hv/mshv_root.h +++ b/drivers/hv/mshv_root.h @@ -307,8 +307,9 @@ int hv_call_disconnect_port(u64 connection_partition_id, int hv_call_notify_port_ring_empty(u32 sint_index); int hv_map_stats_page(enum hv_stats_object_type type, const union hv_stats_object_identity *identity, - void **addr); -int hv_unmap_stats_page(enum hv_stats_object_type type, void *page_addr, + struct hv_stats_page **addr); +int hv_unmap_stats_page(enum hv_stats_object_type type, + struct hv_stats_page *page_addr, const union hv_stats_object_identity *identity); int hv_call_modify_spa_host_access(u64 partition_id, struct page **pages, u64 page_struct_count, u32 host_access, diff --git a/drivers/hv/mshv_root_hv_call.c b/drivers/hv/mshv_root_hv_call.c index 1f93b94d7580..daee036e48bc 100644 --- a/drivers/hv/mshv_root_hv_call.c +++ b/drivers/hv/mshv_root_hv_call.c @@ -890,9 +890,10 @@ hv_stats_get_area_type(enum hv_stats_object_type type, * caller should check for this case and instead fallback to the SELF area * alone. */ -static int hv_call_map_stats_page(enum hv_stats_object_type type, - const union hv_stats_object_identity *identity, - void **addr) +static int +hv_call_map_stats_page(enum hv_stats_object_type type, + const union hv_stats_object_identity *identity, + struct hv_stats_page **addr) { unsigned long flags; struct hv_input_map_stats_page *input; @@ -942,7 +943,7 @@ static int hv_call_map_stats_page(enum hv_stats_object_type type, int hv_map_stats_page(enum hv_stats_object_type type, const union hv_stats_object_identity *identity, - void **addr) + struct hv_stats_page **addr) { int ret; struct page *allocated_page = NULL; @@ -990,7 +991,8 @@ static int hv_call_unmap_stats_page(enum hv_stats_object_type type, return hv_result_to_errno(status); } -int hv_unmap_stats_page(enum hv_stats_object_type type, void *page_addr, +int hv_unmap_stats_page(enum hv_stats_object_type type, + struct hv_stats_page *page_addr, const union hv_stats_object_identity *identity) { int ret; diff --git a/drivers/hv/mshv_root_main.c b/drivers/hv/mshv_root_main.c index d3e8a66443ad..f2cd48101d2b 100644 --- a/drivers/hv/mshv_root_main.c +++ b/drivers/hv/mshv_root_main.c @@ -958,7 +958,7 @@ mshv_vp_release(struct inode *inode, struct file *filp) } static void mshv_vp_stats_unmap(u64 partition_id, u32 vp_index, - void *stats_pages[]) + struct hv_stats_page *stats_pages[]) { union hv_stats_object_identity identity = { .vp.partition_id = partition_id, @@ -973,7 +973,7 @@ static void mshv_vp_stats_unmap(u64 partition_id, u32 vp_index, } static int mshv_vp_stats_map(u64 partition_id, u32 vp_index, - void *stats_pages[]) + struct hv_stats_page *stats_pages[]) { union hv_stats_object_identity identity = { .vp.partition_id = partition_id, @@ -1011,7 +1011,7 @@ mshv_partition_ioctl_create_vp(struct mshv_partition *partition, struct mshv_create_vp args; struct mshv_vp *vp; struct page *intercept_msg_page, *register_page, *ghcb_page; - void *stats_pages[2]; + struct hv_stats_page *stats_pages[2]; long ret; if (copy_from_user(&args, arg, sizeof(args))) @@ -1730,7 +1730,7 @@ static void destroy_partition(struct mshv_partition *partition) if (hv_scheduler_type == HV_SCHEDULER_TYPE_ROOT) mshv_vp_stats_unmap(partition->pt_id, vp->vp_index, - (void **)vp->vp_stats_pages); + vp->vp_stats_pages); if (vp->vp_register_page) { (void)hv_unmap_vp_state_page(partition->pt_id, |
