All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Vallejo <agarciav@amd.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Daniel P. Smith" <dpsmith@apertussolutions.com>,
	"Jason Andryuk" <jason.andryuk@amd.com>,
	"Xenia Ragiadakou" <xenia.ragiadakou@amd.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Michal Orzel" <michal.orzel@amd.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Julien Grall" <julien@xen.org>,
	"Bertrand Marquis" <bertrand.marquis@arm.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v3 12/16] x86/hyperlaunch: add domain id parsing to domain config
Date: Mon, 14 Apr 2025 19:35:44 +0100	[thread overview]
Message-ID: <D96KUGJTQO7F.39OKDX33SSKYH@amd.com> (raw)
In-Reply-To: <6ce79cc0-1fec-4ad9-834e-680ef1f81549@suse.com>

On Thu Apr 10, 2025 at 12:49 PM BST, Jan Beulich wrote:
> On 08.04.2025 18:07, Alejandro Vallejo wrote:
>> From: "Daniel P. Smith" <dpsmith@apertussolutions.com>
>> 
>> Introduce the ability to specify the desired domain id for the domain
>> definition. The domain id will be populated in the domid property of the
>> domain
>> node in the device tree configuration.
>
> Nit: Odd splitting of lines.

Fixed

>
>> --- a/xen/arch/x86/domain-builder/fdt.c
>> +++ b/xen/arch/x86/domain-builder/fdt.c
>> @@ -8,6 +8,7 @@
>>  #include <xen/libfdt/libfdt.h>
>>  
>>  #include <asm/bootinfo.h>
>> +#include <asm/guest.h>
>
> What is this needed for?

get_initial_domain_id(), but that ought to come from xen/domain.h instead.

Fixed.

>
>> @@ -158,12 +159,42 @@ int __init fdt_read_multiboot_module(const void *fdt, int node,
>>  static int __init process_domain_node(
>>      struct boot_info *bi, const void *fdt, int dom_node)
>>  {
>> -    int node;
>> +    int node, property;
>>      struct boot_domain *bd = &bi->domains[bi->nr_domains];
>>      const char *name = fdt_get_name(fdt, dom_node, NULL) ?: "unknown";
>>      int address_cells = fdt_address_cells(fdt, dom_node);
>>      int size_cells = fdt_size_cells(fdt, dom_node);
>>  
>> +    fdt_for_each_property_offset(property, fdt, dom_node)
>> +    {
>> +        const struct fdt_property *prop;
>> +        const char *prop_name;
>> +        int name_len;
>> +
>> +        prop = fdt_get_property_by_offset(fdt, property, NULL);
>> +        if ( !prop )
>> +            continue; /* silently skip */
>> +
>> +        prop_name = fdt_get_string(fdt, fdt32_to_cpu(prop->nameoff), &name_len);
>> +
>> +        if ( strncmp(prop_name, "domid", name_len) == 0 )
>> +        {
>> +            uint32_t val = DOMID_INVALID;
>> +            if ( fdt_prop_as_u32(prop, &val) != 0 )
>
> Nit: Blank line please between declaration(s) and statement(s).

Ack.

>
>> +            {
>> +                printk("  failed processing domain id for domain %s\n", name);
>> +                return -EINVAL;
>> +            }
>> +            if ( val >= DOMID_FIRST_RESERVED )
>> +            {
>> +                printk("  invalid domain id for domain %s\n", name);
>> +                return -EINVAL;
>> +            }
>> +            bd->domid = (domid_t)val;
>
> And a conflict with other domains' IDs will not be complained about?

Hmmm... sure, I can iterate the domlist and check.

>
>> +            printk("  domid: %d\n", bd->domid);
>
> If the error messages log "name" for (I suppose) disambiguation, why would
> the success message here not also do so?
>
>> @@ -233,6 +264,12 @@ static int __init process_domain_node(
>>          return -ENODATA;
>>      }
>>  
>> +    if ( bd->domid == DOMID_INVALID )
>> +        bd->domid = get_initial_domain_id();
>> +    else if ( bd->domid != get_initial_domain_id() )
>> +        printk(XENLOG_WARNING
>> +               "WARN: Booting without initial domid not supported.\n");
>
> I'm not a native speaker, but (or perhaps because of that) "without" feels
> wrong here.

It's probably the compound effect of without and "not supported". The
statement is correct, but it's arguably a bit obtuse.

I'll replace it with "WARN: Unsupported boot with missing initial domid.".

As for the first branch of that clause... I'm not sure we want to
support running with DTs that are missing the domid property.

>
> Also nit: No full stops please at the end of log messages, at least in the
> common case.

Ack

>
> Is the resolving of DOMID_INVALID invalid really needed both here and ...
>
>> --- a/xen/arch/x86/setup.c
>> +++ b/xen/arch/x86/setup.c
>> @@ -1033,8 +1033,9 @@ static struct domain *__init create_dom0(struct boot_info *bi)
>>      if ( iommu_enabled )
>>          dom0_cfg.flags |= XEN_DOMCTL_CDF_iommu;
>>  
>> -    /* Create initial domain.  Not d0 for pvshim. */
>> -    bd->domid = get_initial_domain_id();
>> +    if ( bd->domid == DOMID_INVALID )
>> +        /* Create initial domain.  Not d0 for pvshim. */
>> +        bd->domid = get_initial_domain_id();
>
> ... here?

I'll rationatise all that on v4.

>
>> @@ -23,6 +24,16 @@ static inline uint64_t  __init fdt_cell_as_u64(const fdt32_t *cell)
>>      return ((uint64_t)fdt32_to_cpu(cell[0]) << 32) | fdt32_to_cpu(cell[1]);
>>  }
>>  
>> +static inline int __init fdt_prop_as_u32(
>> +    const struct fdt_property *prop, uint32_t *val)
>> +{
>> +    if ( !prop || fdt32_to_cpu(prop->len) < sizeof(u32) )
>> +        return -EINVAL;
>> +
>> +    *val = fdt_cell_as_u32((fdt32_t *)prop->data);
>> +    return 0;
>> +}
>
> Path 08 looks to (partly) open-code this. Perhaps better to introduce already
> there?

Already done.

Cheers,
Alejandro



  reply	other threads:[~2025-04-14 18:36 UTC|newest]

Thread overview: 128+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-08 16:07 [PATCH v3 00/16] Hyperlaunch device tree for dom0 Alejandro Vallejo
2025-04-08 16:07 ` [PATCH v3 01/16] x86/boot: introduce boot domain Alejandro Vallejo
2025-04-09  6:24   ` Jan Beulich
2025-04-09 10:28     ` Alejandro Vallejo
2025-04-10 13:13       ` Daniel P. Smith
2025-04-10 20:56         ` Jason Andryuk
2025-04-10 13:09     ` Daniel P. Smith
2025-04-10 15:01       ` Jan Beulich
2025-04-10 20:56         ` Jason Andryuk
2025-04-16 13:02           ` Daniel P. Smith
2025-04-16 13:33             ` Jan Beulich
2025-04-16 14:00               ` Daniel P. Smith
2025-04-16 14:06                 ` Jan Beulich
2025-04-16 15:01                   ` Daniel P. Smith
2025-04-08 16:07 ` [PATCH v3 02/16] x86/boot: introduce domid field to struct boot_domain Alejandro Vallejo
2025-04-09  6:34   ` Jan Beulich
2025-04-09 10:33     ` Alejandro Vallejo
2025-04-10 16:18       ` Jason Andryuk
2025-04-08 16:07 ` [PATCH v3 03/16] x86/boot: add cmdline " Alejandro Vallejo
2025-04-09  6:48   ` Jan Beulich
2025-04-09 11:11     ` Alejandro Vallejo
2025-04-09 11:28       ` Alejandro Vallejo
2025-04-09 14:13         ` Jan Beulich
2025-04-09 14:00       ` Jan Beulich
2025-04-09 21:05   ` Denis Mukhin
2025-04-10 12:02     ` Alejandro Vallejo
2025-04-08 16:07 ` [PATCH v3 04/16] kconfig: introduce option to independently enable libfdt Alejandro Vallejo
2025-04-09 18:57   ` Denis Mukhin
2025-04-10 12:05     ` Alejandro Vallejo
2025-04-10  9:04   ` Jan Beulich
2025-04-10 12:04     ` Alejandro Vallejo
2025-04-08 16:07 ` [PATCH v3 05/16] kconfig: introduce domain builder config option Alejandro Vallejo
2025-04-10  9:08   ` Jan Beulich
2025-04-10 12:52     ` Alejandro Vallejo
2025-04-10 12:57       ` Jan Beulich
2025-04-08 16:07 ` [PATCH v3 06/16] x86/hyperlaunch: introduce the domain builder Alejandro Vallejo
2025-04-09 18:53   ` Denis Mukhin
2025-04-10  7:49     ` Jan Beulich
2025-04-10 13:01     ` Alejandro Vallejo
2025-04-10  9:39   ` Jan Beulich
2025-04-08 16:07 ` [PATCH v3 07/16] x86/hyperlaunch: initial support for hyperlaunch device tree Alejandro Vallejo
2025-04-10 10:10   ` Jan Beulich
2025-04-10 14:50     ` Alejandro Vallejo
2025-04-08 16:07 ` [PATCH v3 08/16] x86/hyperlaunch: Add helpers to locate multiboot modules Alejandro Vallejo
2025-04-10 10:42   ` Jan Beulich
2025-04-14 13:37     ` Alejandro Vallejo
2025-04-14 15:05       ` Jan Beulich
2025-04-14 18:01         ` Alejandro Vallejo
2025-04-15  6:05           ` Jan Beulich
2025-04-15 11:30             ` Alejandro Vallejo
2025-04-16 16:55             ` Nicola Vetrini
2025-04-17 11:50               ` Alejandro Vallejo
2025-04-14 19:09         ` Nicola Vetrini
2025-04-08 16:07 ` [PATCH v3 09/16] x86/hyperlaunch: locate dom0 kernel with hyperlaunch Alejandro Vallejo
2025-04-09 21:24   ` Denis Mukhin
2025-04-14 13:56     ` Alejandro Vallejo
2025-04-10 10:58   ` Jan Beulich
2025-04-14 13:58     ` Alejandro Vallejo
2025-04-08 16:07 ` [PATCH v3 10/16] x86/hyperlaunch: obtain cmdline from device tree Alejandro Vallejo
2025-04-09 22:04   ` Denis Mukhin
2025-04-14 14:54     ` Alejandro Vallejo
2025-04-10 11:12   ` Jan Beulich
2025-04-14 14:23     ` Alejandro Vallejo
2025-04-14 15:09       ` Jan Beulich
2025-04-08 16:07 ` [PATCH v3 11/16] x86/hyperlaunch: locate dom0 initrd with hyperlaunch Alejandro Vallejo
2025-04-09 22:07   ` Denis Mukhin
2025-04-14 15:03     ` Alejandro Vallejo
2025-04-10 11:34   ` Jan Beulich
2025-04-14 17:06     ` Alejandro Vallejo
2025-04-14 17:27       ` Alejandro Vallejo
2025-04-15  6:17         ` Jan Beulich
2025-04-15 11:59           ` Alejandro Vallejo
2025-04-15 14:11             ` Jan Beulich
2025-04-16 13:19             ` Daniel P. Smith
2025-04-15  6:12       ` Jan Beulich
2025-04-08 16:07 ` [PATCH v3 12/16] x86/hyperlaunch: add domain id parsing to domain config Alejandro Vallejo
2025-04-09 22:15   ` Denis Mukhin
2025-04-14 18:07     ` Alejandro Vallejo
2025-04-15  0:28       ` Stefano Stabellini
2025-04-15  6:21       ` Jan Beulich
2025-04-15 11:37         ` Alejandro Vallejo
2025-04-15 14:13           ` Jan Beulich
2025-04-10 11:49   ` Jan Beulich
2025-04-14 18:35     ` Alejandro Vallejo [this message]
2025-04-15  6:27       ` Jan Beulich
2025-04-15 12:05         ` Alejandro Vallejo
2025-04-15 14:16           ` Jan Beulich
2025-04-08 16:07 ` [PATCH v3 13/16] x86/hyperlaunch: specify dom0 mode with device tree Alejandro Vallejo
2025-04-09 22:24   ` Denis Mukhin
2025-04-10 11:55     ` Jan Beulich
2025-04-14 18:45     ` Alejandro Vallejo
2025-04-10 11:57   ` Jan Beulich
2025-04-16 13:32     ` Daniel P. Smith
2025-04-16 13:38       ` Jan Beulich
2025-04-16 14:09         ` Daniel P. Smith
2025-04-16 14:24           ` Jan Beulich
2025-04-08 16:07 ` [PATCH v3 14/16] x86/hyperlaunch: add memory parsing to domain config Alejandro Vallejo
2025-04-09 22:29   ` Denis Mukhin
2025-04-14 18:49     ` Alejandro Vallejo
2025-04-10 12:03   ` Jan Beulich
2025-04-14 18:59     ` Alejandro Vallejo
2025-04-16 13:37     ` Daniel P. Smith
2025-04-16 13:41       ` Jan Beulich
2025-04-16 14:12         ` Daniel P. Smith
2025-04-16 14:27           ` Jan Beulich
2025-04-08 16:07 ` [PATCH v3 15/16] x86/hyperlaunch: add max vcpu parsing of hyperlaunch device tree Alejandro Vallejo
2025-04-09 22:33   ` Denis Mukhin
2025-04-14 19:07     ` Alejandro Vallejo
2025-04-10 12:08   ` Jan Beulich
2025-04-14 19:12     ` Alejandro Vallejo
2025-04-16 13:42     ` Daniel P. Smith
2025-04-16 13:54       ` Alejandro Vallejo
2025-04-16 14:16         ` Daniel P. Smith
2025-04-16 13:54       ` Jan Beulich
2025-04-16 14:19         ` Daniel P. Smith
2025-04-16 14:31           ` Jan Beulich
2025-04-08 16:07 ` [PATCH v3 16/16] x86/hyperlaunch: add capabilities to boot domain Alejandro Vallejo
2025-04-09 22:39   ` Denis Mukhin
2025-04-14 19:17     ` Alejandro Vallejo
2025-04-10 12:18   ` Jan Beulich
2025-04-14 19:31     ` Alejandro Vallejo
2025-04-15  6:38       ` Jan Beulich
2025-04-15 12:22         ` Alejandro Vallejo
2025-04-15 14:20           ` Jan Beulich
2025-04-10 12:18   ` Jan Beulich
2025-04-09  6:29 ` [PATCH v3 00/16] Hyperlaunch device tree for dom0 Jan Beulich
2025-04-09 10:19   ` Alejandro Vallejo
2025-04-09 10:39     ` 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=D96KUGJTQO7F.39OKDX33SSKYH@amd.com \
    --to=agarciav@amd.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bertrand.marquis@arm.com \
    --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 \
    --cc=xenia.ragiadakou@amd.com \
    /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.