On Wed, 28 Aug 2024 at 12:16, Danny Canter <danny_can...@apple.com> wrote:
>
> This addition will be necessary for some HVF related work to follow.
> For HVF on ARM there exists a set of APIs in macOS 13 to be able to
> adjust the IPA size for a given VM. This is useful as by default HVF
> uses 36 bits as the IPA size, so to support guests with > 64GB of RAM
> we'll need to reach for this.
>
> To have all the info necessary to carry this out however, we need some
> plumbing to be able to grab the memory map and compute the highest GPA
> prior to creating the VM. This is almost exactly like what kvm_type is
> used for on ARM today, and is also what this will be used for. We will
> compute the highest GPA and find what IPA size we'd need to satisfy this,
> and if it's valid (macOS today caps at 40b) we'll set this to be the IPA
> size in coming patches. This new method is only needed (today at least)
> on ARM, and obviously only for HVF/macOS, so admittedly it is much less
> generic than kvm_type today, but it seemed a somewhat sane way to get
> the information we need from the memmap at VM creation time.
>
> Signed-off-by: Danny Canter <danny_can...@apple.com>

> diff --git a/hw/i386/x86.c b/hw/i386/x86.c
> index 01fc5e6562..fa7a0f6b98 100644
> --- a/hw/i386/x86.c
> +++ b/hw/i386/x86.c
> @@ -382,6 +382,8 @@ static void x86_machine_class_init(ObjectClass *oc, void 
> *data)
>      mc->get_default_cpu_node_id = x86_get_default_cpu_node_id;
>      mc->possible_cpu_arch_ids = x86_possible_cpu_arch_ids;
>      mc->kvm_type = x86_kvm_type;
> +    /* Not needed for x86 */
> +    mc->hvf_get_physical_address_range = NULL;
>      x86mc->save_tsc_khz = true;
>      x86mc->fwcfg_dma_enabled = true;
>      nc->nmi_monitor_handler = x86_nmi;

We guarantee that object and class structs are zero-initialized,
so we don't need to explicitly set this field to NULL.

Otherwise
Reviewed-by: Peter Maydell <peter.mayd...@linaro.org>

thanks
-- PMM

Reply via email to