|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v4 12/13] x86/hyperlaunch: add max vcpu parsing of hyperlaunch device tree
On Thu, Apr 17, 2025 at 01:48:34PM +0100, Alejandro Vallejo wrote:
> From: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
>
> Introduce the `cpus` property, named as such for dom0less compatibility, that
> represents the maximum number of vcpus to allocate for a domain. In the device
> tree, it will be encoded as a u32 value.
>
> Signed-off-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
> Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx>
> Signed-off-by: Alejandro Vallejo <agarciav@xxxxxxx>
Reviewed-by: Denis Mukhin <dmukhin@xxxxxxxx>
> ---
> v4:
> * s/UINT_MAX/UINT32_MAX/ (cosmetic, but...)
> * s/vpcpus/vcpus/ in commit message.
> * Reworded printk()
> ---
> xen/arch/x86/dom0_build.c | 3 +++
> xen/arch/x86/include/asm/boot-domain.h | 2 ++
> xen/common/domain-builder/fdt.c | 11 +++++++++++
> 3 files changed, 16 insertions(+)
>
> diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
> index 8db24dbc0a..f734104c74 100644
> --- a/xen/arch/x86/dom0_build.c
> +++ b/xen/arch/x86/dom0_build.c
> @@ -635,6 +635,9 @@ int __init construct_dom0(const struct boot_domain *bd)
> if ( !get_memsize(&dom0_max_size, ULONG_MAX) && bd->max_pages )
> dom0_max_size.nr_pages = bd->max_pages;
>
> + if ( opt_dom0_max_vcpus_max == UINT_MAX && bd->max_vcpus )
> + opt_dom0_max_vcpus_max = bd->max_vcpus;
> +
> if ( is_hvm_domain(d) )
> rc = dom0_construct_pvh(bd);
> else if ( is_pv_domain(d) )
> diff --git a/xen/arch/x86/include/asm/boot-domain.h
> b/xen/arch/x86/include/asm/boot-domain.h
> index fa8ea1cc66..969c02a6ea 100644
> --- a/xen/arch/x86/include/asm/boot-domain.h
> +++ b/xen/arch/x86/include/asm/boot-domain.h
> @@ -22,6 +22,8 @@ struct boot_domain {
> unsigned long min_pages;
> unsigned long max_pages;
>
> + unsigned int max_vcpus;
> +
> struct boot_module *kernel;
> struct boot_module *module;
> const char *cmdline;
> diff --git a/xen/common/domain-builder/fdt.c b/xen/common/domain-builder/fdt.c
> index 90218d120a..295ab6e8b3 100644
> --- a/xen/common/domain-builder/fdt.c
> +++ b/xen/common/domain-builder/fdt.c
> @@ -282,6 +282,17 @@ static int __init process_domain_node(
> bd->max_pages = PFN_DOWN(kb * SZ_1K);
> printk(XENLOG_INFO " max memory: %lu KiB\n", kb);
> }
> + else if ( !strncmp(prop_name, "cpus", name_len) )
> + {
> + uint32_t val = UINT32_MAX;
> + if ( (rc = fdt_prop_as_u32(prop, &val)) )
> + {
> + printk(XENLOG_ERR " bad \"cpus\" prop on domain %s\n",
> name);
> + return rc;
> + }
> + bd->max_vcpus = val;
> + printk(XENLOG_INFO " cpus: %d\n", bd->max_vcpus);
> + }
> }
>
> fdt_for_each_subnode(node, fdt, dom_node)
> --
> 2.43.0
>
>
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |