> On 9. Mar 2026, at 22:49, Lucas Amaral <lucaaamaral@gmail.com> wrote:
>
> macOS 26 introduces hv_vm_config_set_ipa_granule() which allows
> configuring 4KB IPA granularity for HVF virtual machines. This
> enables hv_vm_map() to accept 4KB-aligned addresses, matching
> the guest kernel's page size.
>
> Without this, virtio-gpu blob BAR offsets that are 4KB-aligned but
> not 16KB-aligned cannot be mapped into the guest, falling back to
> slow MMIO emulation.
>
> Gated behind MAC_OS_VERSION_26_0 compile-time and __builtin_available
> runtime checks. Falls back to the default 16KB granule on older
> macOS versions.
>
> Signed-off-by: Lucas Amaral <lucaaamaral@gmail.com>
> ---
> target/arm/hvf/hvf.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
> index 87ddcdb..b71a98a 100644
> --- a/target/arm/hvf/hvf.c
> +++ b/target/arm/hvf/hvf.c
> @@ -960,6 +960,20 @@ hv_return_t hvf_arch_vm_create(MachineState *ms, uint32_t pa_range)
> }
> chosen_ipa_bit_size = pa_range;
>
> +#ifdef MAC_OS_VERSION_26_0
> +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_26_0
> + if (__builtin_available(macOS 26, *)) {
> + ret = hv_vm_config_set_ipa_granule(config, HV_IPA_GRANULE_4KB);
> + if (ret != HV_SUCCESS) {
> + error_report("HVF: failed to set 4KB IPA granule: %s",
> + hvf_return_string(ret));
> + goto cleanup;
> + }
> + hvf_set_map_granule(4096);
> + }
> +#endif
> +#endif
Hello,
Not really happy about having this as a default… I see a double digit perf impact on compilation workloads here.
So having this as an optional, off by default option sounds best.
Thank you,
-Mohamed
> +
> ret = hv_vm_create(config);
>
> cleanup:
> --
> 2.52.0
>
>