[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 07/16] x86/hyperlaunch: initial support for hyperlaunch device tree


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Alejandro Vallejo <agarciav@xxxxxxx>
  • Date: Thu, 10 Apr 2025 15:50:31 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BsZCMLM8fuXEze6eAp5yW+8gSJPL3qLdf1XtYTjFS8Q=; b=seHar2if7gGGnNWAUiE2BLIJ64LzsWoHSjTtS9+lPQHqQe3jt8YD983Rg4rvtvisoCP15rwTG7OWxvzWMdzjayNaT+akwOfcbkfiY2UK0pTkMn0Ilowu7qzoXuIdFVlwoRTUua8wIHHcTk5h0nwHWfAy5KgxLcUlnhC7LMR+w+0PXdzyRMLJ8Pfwfk63L4+t8Vvw5mmGFoS8moQqBfLIogHDkptV7+bRTmrm6ig9BYVWKtpE/CUFHp/TaMTZrENoI6AOPCUAi8lNY2kaJFczKiCF5LgIlFJZRfDXxTfdvHaBpIF1HAhk7DxwMq+UX/DzreOZQHen6oVKmDgbRXebJQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Y5HWmD8eDZCrG2dVHdu+OM+LLe19TzzXomynDtsfUX1gWtYg4BjQe1DvoTmMNnspTzmZUg/IsFooWE+ZMlTzjMZseYjVUIplyusQrpwnxTtQHfnlOQBbNinESQqAH34CPMC4i8ZPo7RENgHTfUJayA9inlOjJ0t+zrsSyZp7+BBkhM3J3KwJ21ED5CczfxOrBuSWORuPFku/YMDJX2248QwqEXHo7hdmLrw2gmsWj4xBCglxx2i2TdZZhc29UC1XvwWzhR2f931iPzpv4t8DZ4mjQIEJWW+P/2qrH/D9FoQaJFZcM5SyAtwLd4Hfuley1fY98DDAfr1oxm+1BecoxQ==
  • Cc: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Jason Andryuk <jason.andryuk@xxxxxxx>, Xenia Ragiadakou <xenia.ragiadakou@xxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 10 Apr 2025 14:51:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu Apr 10, 2025 at 11:10 AM BST, Jan Beulich wrote:
> On 08.04.2025 18:07, Alejandro Vallejo wrote:
>> --- a/xen/arch/x86/domain-builder/core.c
>> +++ b/xen/arch/x86/domain-builder/core.c
>> @@ -44,6 +44,21 @@ void __init builder_init(struct boot_info *bi)
>>              break;
>>          }
>>      }
>> +
>> +    if ( bi->hyperlaunch_enabled )
>> +    {
>
> Not knowing what else if going to appear here and in what shape, could the
> if() here be avoided by making case blocks in the earlier switch setting
> the field to false (which is kind of redundant anyway with it starting out
> false) use "return" instead of "break"? The the setting of the field to
> true could also be centralized below the switch().

Looking ahead in the patchlist, not much. There's an else clause for
non-hyperlaunch with code picked from setup.c . It could very well stay
there and prevent core.c from being included at all, removing the if
guards here as well when the file is no longer included.

>
>> --- a/xen/arch/x86/domain-builder/fdt.c
>> +++ b/xen/arch/x86/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;
>> +        else
>> +            return hv_node;
>
> Could I talk you into omitting such unnecessary "else"?

Yes, sure.

>
>> @@ -20,7 +50,41 @@ 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 ret < 0 ? ret : 0;
>> +}
>> +
>> +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;
>> +
>> +    hv_node = find_hyperlaunch_node(fdt);
>> +    if ( hv_node < 0 )
>> +    {
>> +        ret = hv_node;
>> +        goto err_out;
>> +    }
>> +
>> +    fdt_for_each_subnode(node, fdt, hv_node)
>> +    {
>> +        ret = fdt_node_check_compatible(fdt, node, "xen,domain");
>> +        if ( ret == 0 )
>> +            bi->nr_domains++;
>> +    }
>> +
>> +    /* Until multi-domain construction is added, throw an error */
>> +    if ( !bi->nr_domains || bi->nr_domains > 1 )
>
> Simply "!= 1"?

That would be simpler, yes :)

It's all temporary until the restriction is lifted later on, but will do.

>
>> --- a/xen/arch/x86/domain-builder/fdt.h
>> +++ b/xen/arch/x86/domain-builder/fdt.h
>> @@ -11,11 +11,16 @@ struct boot_info;
>>  
>>  #ifdef CONFIG_DOMAIN_BUILDER
>>  int has_hyperlaunch_fdt(const struct boot_info *bi);
>> +int walk_hyperlaunch_fdt(struct boot_info *bi);
>>  #else
>>  static inline int __init has_hyperlaunch_fdt(const struct boot_info *bi)
>>  {
>>      return -EINVAL;
>>  }
>> +static inline int __init walk_hyperlaunch_fdt(struct boot_info *bi)
>> +{
>> +    return -EINVAL;
>> +}
>
> There's no need for this stub (nor the has_hyperlaunch_fdt() one, as I
> notice only now) - even with present arrangements calling code is guarded
> such that DCE will take care of eliminating the call, and hence having a
> declaration suffices.
>
> Jan

There's some refactoring to do for other helpers later on, but sure. It
should be fine.

Cheers,
Alejandro



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.