Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'hyperv-fixes-signed-20260112' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux

Pull hyperv fixes from Wei Liu:

- Minor fixes and cleanups for the MSHV driver

* tag 'hyperv-fixes-signed-20260112' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux:
mshv: release mutex on region invalidation failure
hyperv: Avoid -Wflex-array-member-not-at-end warning
mshv: hide x86-specific functions on arm64
mshv: Initialize local variables early upon region invalidation
mshv: Use PMD_ORDER instead of HPAGE_PMD_ORDER when processing regions

+18 -11
+2
drivers/hv/mshv_common.c
··· 142 142 } 143 143 EXPORT_SYMBOL_GPL(hv_call_get_partition_property); 144 144 145 + #ifdef CONFIG_X86 145 146 /* 146 147 * Corresponding sleep states have to be initialized in order for a subsequent 147 148 * HVCALL_ENTER_SLEEP_STATE call to succeed. Currently only S5 state as per ··· 238 237 BUG(); 239 238 240 239 } 240 + #endif
+11 -9
drivers/hv/mshv_regions.c
··· 58 58 59 59 page_order = folio_order(page_folio(page)); 60 60 /* The hypervisor only supports 4K and 2M page sizes */ 61 - if (page_order && page_order != HPAGE_PMD_ORDER) 61 + if (page_order && page_order != PMD_ORDER) 62 62 return -EINVAL; 63 63 64 64 stride = 1 << page_order; ··· 494 494 unsigned long mstart, mend; 495 495 int ret = -EPERM; 496 496 497 - if (mmu_notifier_range_blockable(range)) 498 - mutex_lock(&region->mutex); 499 - else if (!mutex_trylock(&region->mutex)) 500 - goto out_fail; 501 - 502 - mmu_interval_set_seq(mni, cur_seq); 503 - 504 497 mstart = max(range->start, region->start_uaddr); 505 498 mend = min(range->end, region->start_uaddr + 506 499 (region->nr_pages << HV_HYP_PAGE_SHIFT)); ··· 501 508 page_offset = HVPFN_DOWN(mstart - region->start_uaddr); 502 509 page_count = HVPFN_DOWN(mend - mstart); 503 510 511 + if (mmu_notifier_range_blockable(range)) 512 + mutex_lock(&region->mutex); 513 + else if (!mutex_trylock(&region->mutex)) 514 + goto out_fail; 515 + 516 + mmu_interval_set_seq(mni, cur_seq); 517 + 504 518 ret = mshv_region_remap_pages(region, HV_MAP_GPA_NO_ACCESS, 505 519 page_offset, page_count); 506 520 if (ret) 507 - goto out_fail; 521 + goto out_unlock; 508 522 509 523 mshv_region_invalidate_pages(region, page_offset, page_count); 510 524 ··· 519 519 520 520 return true; 521 521 522 + out_unlock: 523 + mutex_unlock(&region->mutex); 522 524 out_fail: 523 525 WARN_ONCE(ret, 524 526 "Failed to invalidate region %#llx-%#llx (range %#lx-%#lx, event: %u, pages %#llx-%#llx, mm: %#llx): %d\n",
+5 -2
include/hyperv/hvgdk_mini.h
··· 578 578 struct hv_tlb_flush_ex { 579 579 u64 address_space; 580 580 u64 flags; 581 - struct hv_vpset hv_vp_set; 582 - u64 gva_list[]; 581 + __TRAILING_OVERLAP(struct hv_vpset, hv_vp_set, bank_contents, __packed, 582 + u64 gva_list[]; 583 + ); 583 584 } __packed; 585 + static_assert(offsetof(struct hv_tlb_flush_ex, hv_vp_set.bank_contents) == 586 + offsetof(struct hv_tlb_flush_ex, gva_list)); 584 587 585 588 struct ms_hyperv_tsc_page { /* HV_REFERENCE_TSC_PAGE */ 586 589 volatile u32 tsc_sequence;