All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Vallejo <agarciav@amd.com>
To: <dmkhn@proton.me>
Cc: xen-devel@lists.xenproject.org,
	"Daniel P. Smith" <dpsmith@apertussolutions.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Anthony PERARD" <anthony.perard@vates.tech>,
	"Michal Orzel" <michal.orzel@amd.com>,
	"Julien Grall" <julien@xen.org>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Jason Andryuk" <jason.andryuk@amd.com>
Subject: Re: [PATCH v4 04/13] x86/hyperlaunch: initial support for hyperlaunch device tree
Date: Wed, 23 Apr 2025 12:54:18 +0100	[thread overview]
Message-ID: <D9DZXZRPA391.3SLSYKKAIR8OT@amd.com> (raw)
In-Reply-To: <aALN/46JGBJTBCMm@kraken>

On Fri Apr 18, 2025 at 11:11 PM BST, dmkhn wrote:
> On Thu, Apr 17, 2025 at 01:48:26PM +0100, Alejandro Vallejo wrote:
>> From: "Daniel P. Smith" <dpsmith@apertussolutions.com>
>> 
>> Add the ability to detect both a formal hyperlaunch device tree or a dom0less
>> device tree. If the hyperlaunch device tree is found, then count the number of
>> domain entries, reporting an error if more than one is found.
>> 
>> Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
>> Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
>> Signed-off-by: Alejandro Vallejo <agarciav@amd.com>
>> ---
>> v4:
>>   * Panic if we're booting on hyperlaunch, but walking the DTB fails.
>>   * Remove inconsequential "else" clause in fdt.c
>>   * Remove stub, as it's not required due to DCE
>>   * Use min() rather than open-code it
>> ---
>>  xen/arch/x86/include/asm/bootinfo.h |  1 +
>>  xen/common/domain-builder/core.c    | 11 +++++
>>  xen/common/domain-builder/fdt.c     | 63 +++++++++++++++++++++++++++++
>>  xen/common/domain-builder/fdt.h     |  1 +
>>  4 files changed, 76 insertions(+)
>> 
>> diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm/bootinfo.h
>> index 82c2650fcf..1e3d582e45 100644
>> --- a/xen/arch/x86/include/asm/bootinfo.h
>> +++ b/xen/arch/x86/include/asm/bootinfo.h
>> @@ -84,6 +84,7 @@ struct boot_info {
>>      bool hyperlaunch_enabled;
>> 
>>      unsigned int nr_modules;
>> +    unsigned int nr_domains;
>>      struct boot_module mods[MAX_NR_BOOTMODS + 1];
>>      struct boot_domain domains[MAX_NR_BOOTDOMS];
>>  };
>> diff --git a/xen/common/domain-builder/core.c b/xen/common/domain-builder/core.c
>> index a5b21fc179..3b062e85ec 100644
>> --- a/xen/common/domain-builder/core.c
>> +++ b/xen/common/domain-builder/core.c
>> @@ -43,6 +43,17 @@ void __init builder_init(struct boot_info *bi)
>>              break;
>>          }
>>      }
>> +
>> +    if ( bi->hyperlaunch_enabled )
>> +    {
>> +        int ret;
>> +
>> +        printk(XENLOG_INFO "Hyperlaunch configuration:\n");
>> +        if ( (ret = walk_hyperlaunch_fdt(bi)) < 0 )
>> +            panic("Walk of device tree failed (%d)\n", ret);
>> +
>> +        printk(XENLOG_INFO "  number of domains: %u\n", bi->nr_domains);
>> +    }
>>  }
>> 
>>  /*
>> diff --git a/xen/common/domain-builder/fdt.c b/xen/common/domain-builder/fdt.c
>> index aaf8c1cc16..b5ff8220da 100644
>> --- a/xen/common/domain-builder/fdt.c
>> +++ b/xen/common/domain-builder/fdt.c
>> @@ -13,6 +13,36 @@
>> 
>>  #include "fdt.h"
>> 
>> +static int __init find_hyperlaunch_node(const void *fdt)
>> +{
>> +    int hv_node = fdt_path_offset(fdt, "/chosen/hypervisor");
>> +
>> +    if ( hv_node >= 0 )
>> +    {
>> +        /* Anything other than zero indicates no match */
>> +        if ( fdt_node_check_compatible(fdt, hv_node, "hypervisor,xen") )
>> +            return -ENODATA;
>> +
>> +        return hv_node;
>> +    }
>> +    else
>> +    {
>> +        /* Look for dom0less config */
>> +        int node, chosen_node = fdt_path_offset(fdt, "/chosen");
>> +
>> +        if ( chosen_node < 0 )
>> +            return -ENOENT;
>> +
>> +        fdt_for_each_subnode(node, fdt, chosen_node)
>> +        {
>> +            if ( !fdt_node_check_compatible(fdt, node, "xen,domain") )
>> +                return chosen_node;
>> +        }
>> +    }
>> +
>> +    return -ENODATA;
>> +}
>> +
>>  int __init has_hyperlaunch_fdt(const struct boot_info *bi)
>>  {
>>      int ret = 0;
>> @@ -20,7 +50,40 @@ int __init has_hyperlaunch_fdt(const struct boot_info *bi)
>> 
>>      if ( !fdt || fdt_check_header(fdt) < 0 )
>>          ret = -EINVAL;
>> +    else
>> +        ret = find_hyperlaunch_node(fdt);
>> +
>> +    bootstrap_unmap();
>> +
>> +    return min(0, ret);
>> +}
>> +
>> +int __init walk_hyperlaunch_fdt(struct boot_info *bi)
>> +{
>> +    int ret = 0, hv_node, node;
>> +    const void *fdt = bootstrap_map_bm(&bi->mods[HYPERLAUNCH_MODULE_IDX]);
>> +
>> +    if ( unlikely(!fdt) )
>> +        return -EINVAL;
>
> I think this check can be converted to ASSERT() since walk_hyperlaunch_fdt()
> will be called after has_hyperlaunch_fdt() where condition is checked.

True that.

Cheers,
Alejandro


  reply	other threads:[~2025-04-23 11:54 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-17 12:48 [PATCH v4 00/13] Hyperlaunch device tree for dom0 Alejandro Vallejo
2025-04-17 12:48 ` [PATCH v4 01/13] x86/boot: add cmdline to struct boot_domain Alejandro Vallejo
2025-04-17 14:54   ` Jan Beulich
2025-04-17 16:06     ` Alejandro Vallejo
2025-04-18 21:16   ` dmkhn
2025-04-23 11:40     ` Alejandro Vallejo
2025-04-17 12:48 ` [PATCH v4 02/13] kconfig: introduce domain builder config options Alejandro Vallejo
2025-04-17 15:00   ` Jan Beulich
2025-04-17 15:39     ` Jason Andryuk
2025-04-17 16:18     ` Alejandro Vallejo
2025-04-22  6:57       ` Jan Beulich
2025-04-17 12:48 ` [PATCH v4 03/13] common/hyperlaunch: introduce the domain builder Alejandro Vallejo
2025-04-18 21:55   ` dmkhn
2025-04-23 11:52     ` Alejandro Vallejo
2025-04-23 21:53       ` dmkhn
2025-04-17 12:48 ` [PATCH v4 04/13] x86/hyperlaunch: initial support for hyperlaunch device tree Alejandro Vallejo
2025-04-18 22:11   ` dmkhn
2025-04-23 11:54     ` Alejandro Vallejo [this message]
2025-04-17 12:48 ` [PATCH v4 05/13] x86/hyperlaunch: Add helpers to locate multiboot modules Alejandro Vallejo
2025-04-18 22:30   ` dmkhn
2025-04-23 12:12     ` Alejandro Vallejo
2025-04-17 12:48 ` [PATCH v4 06/13] x86/hyperlaunch: locate dom0 kernel with hyperlaunch Alejandro Vallejo
2025-04-18 22:39   ` dmkhn
2025-04-23 12:16     ` Alejandro Vallejo
2025-04-17 12:48 ` [PATCH v4 07/13] x86/hyperlaunch: obtain cmdline from device tree Alejandro Vallejo
2025-04-18 22:53   ` dmkhn
2025-04-23 13:01     ` Alejandro Vallejo
2025-04-23 13:08       ` Jan Beulich
2025-04-24  5:11         ` dmkhn
2025-04-17 12:48 ` [PATCH v4 08/13] x86/hyperlaunch: locate dom0 initrd with hyperlaunch Alejandro Vallejo
2025-04-18 22:58   ` dmkhn
2025-04-23 13:01     ` Alejandro Vallejo
2025-04-17 12:48 ` [PATCH v4 09/13] x86/hyperlaunch: add domain id parsing to domain config Alejandro Vallejo
2025-04-18 23:08   ` dmkhn
2025-04-23 13:03     ` Alejandro Vallejo
2025-04-17 12:48 ` [PATCH v4 10/13] x86/hyperlaunch: specify dom0 mode with device tree Alejandro Vallejo
2025-04-18 23:10   ` dmkhn
2025-04-17 12:48 ` [PATCH v4 11/13] x86/hyperlaunch: add memory parsing to domain config Alejandro Vallejo
2025-04-18 23:21   ` dmkhn
2025-04-23 13:05     ` Alejandro Vallejo
2025-04-17 12:48 ` [PATCH v4 12/13] x86/hyperlaunch: add max vcpu parsing of hyperlaunch device tree Alejandro Vallejo
2025-04-18 23:22   ` dmkhn
2025-04-17 12:48 ` [PATCH v4 13/13] x86/hyperlaunch: add capabilities to boot domain Alejandro Vallejo
2025-04-18 23:24   ` dmkhn
2025-04-23 13:07     ` Alejandro Vallejo
2025-04-17 13:00 ` [PATCH v4 00/13] Hyperlaunch device tree for dom0 Alejandro Vallejo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D9DZXZRPA391.3SLSYKKAIR8OT@amd.com \
    --to=agarciav@amd.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=dmkhn@proton.me \
    --cc=dpsmith@apertussolutions.com \
    --cc=jason.andryuk@amd.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.