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

Re: [PATCH v2 06/15] x86/hyperlaunch: introduce the domain builder


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Tue, 1 Apr 2025 14:01:50 -0400
  • 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=pcUKqZsSMSarP+4zvxYFVt9m2aIJjAWdVhCQvDV839Q=; b=rSjJ/7v3RZox32meY0q9UXTz0jOZUkkIV8K9P3gSDIfmLulZMsMXvsRuCOISFXOl3VV3ANKjwBsqeUy28EGRjqgzIXsNy/0EdMvWgY/3/ioVxXf1ObWrcwnqgR/+PHgsTgn6hm9csBhk0heEDwhF29l45tfE9sesq/0qR9dNibdtkam34N4S9c20JfHfDe0eLZOe+jXHCOsZlzJlKKaKC8DBTfIVyEniws55yiG1M9+2THu9QQaiwOA144Fwso2f2PqfKOlDsN9L93sLUj1+H7Nm84HZgOBVTvLUzcMaA+89YlRgHCK8n0P9m14xRGY2k0XsAjRZVbgbB3kJM8G1JA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XCq2gELE980tJ+f0E4LjlYC7neh5rWxDnE5AqcId/oPOjCYWLAreIss5m3jJIK6j7JcprfDMD/oJCqRsQU3E8iFTGpI1hWTub6NhWDS+ARhvi2sTWwQJDD2NaykIuUKOSuJhTjeTHfv1YPt+w8OfI7orUkT7YxWM+Er8B9Mx87PBoMtoRYka5ygAkP878UzEPrPtlUIX5g3PwspbSe4MB8I00hOTFM+a3wKaV9RQAZ6yTS6MsVH19mlsLts90XrgX96XT211UhKeAG4rSV67smv1Wn806REhGjFqRaWTEBkp1xXtnEl8ifzZc2y0dBlZl3gcc3dKokmFdodUGNwuBg==
  • Cc: <christopher.w.clark@xxxxxxxxx>, <stefano.stabellini@xxxxxxx>, "Andrew Cooper" <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <Alejandro.GarciaVallejo@xxxxxxx>
  • Delivery-date: Tue, 01 Apr 2025 18:02:11 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2025-01-30 09:52, Jan Beulich wrote:
On 26.12.2024 17:57, Daniel P. Smith wrote:
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -81,6 +81,8 @@ obj-$(CONFIG_COMPAT) += x86_64/platform_hypercall.o
  obj-y += sysctl.o
  endif
+obj-y += domain-builder/
The set of subdirs needed in $(obj-y) is specified at the top of the file.
Also shouldn't this be obj-$(CONFIG_DOMAIN_BUILDER)?
Later, all boot-time domain building is handled by 
domain-builder/core.c.  So some of domain-builder/ is always built, and 
Kconfig disables multidomain support.
--- /dev/null
+++ b/xen/arch/x86/domain-builder/core.c
@@ -0,0 +1,57 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2024, Apertus Solutions, LLC
+ */
+#include <xen/err.h>
+#include <xen/init.h>
+#include <xen/kconfig.h>
+#include <xen/lib.h>
+
+#include <asm/bootinfo.h>
+
+#include "fdt.h"
+
+void __init builder_init(struct boot_info *bi)
+{
+    if ( IS_ENABLED(CONFIG_DOMAIN_BUILDER) )
+    {
+        int ret;
+
+        switch ( ret = has_hyperlaunch_fdt(bi) )
+        {
+        case 0:
+            printk("Hyperlaunch device tree detected\n");
+            bi->hyperlaunch_enabled = true;
+            bi->mods[0].type = BOOTMOD_FDT;
+            break;
+
+        case -EINVAL:
+            printk("Hyperlaunch device tree was not detected\n");
+            bi->hyperlaunch_enabled = false;
+            break;
+
+        case -ENOENT:
+        case -ENODATA:
+            printk("Device tree found, but not hyperlaunch (%d)\n", ret);
+            bi->hyperlaunch_enabled = false;
+            bi->mods[0].type = BOOTMOD_FDT;
+            break;
+
+        default:
+            printk("Unknown error (%d) occured checking for hyperlaunch device 
tree\n",
+                   ret);
+            bi->hyperlaunch_enabled = false;
+            break;
+        }
+    }
+}
What is it that's x86-specific in here?
Would you prefer xen/common/domain-builder ?

--- /dev/null
+++ b/xen/arch/x86/domain-builder/fdt.c
+{
+    int ret = 0;
+    const void *fdt = bootstrap_map_bm(&bi->mods[HYPERLAUNCH_MODULE_IDX]);
+
+    if ( fdt_check_header(fdt) < 0 )
+        ret = -EINVAL;
+
+    bootstrap_unmap();
+
+    return ret;
+}
Is this function intended to later be extended? Aiui anything fitting
the hyperlaunch-agnostic fdt_check_header() will do here, despite the
name of the function.
Eventually, there will be some checking to ensure that the DT actually 
contains hyperlaunch device nodes.
And again - what is it that's x86-specific in here?

--- /dev/null
+++ b/xen/arch/x86/include/asm/domainbuilder.h
@@ -0,0 +1,8 @@
+#ifndef __XEN_X86_DOMBUILDER_H__
+#define __XEN_X86_DOMBUILDER_H__
+
+#include <asm/bootinfo.h>
... here, is it? Forward decls of struct boot_info are going to do.
Generally, if you only need a type, just use a forward decl?  Use an 
include when you need function prototypes?
@@ -1285,9 +1286,12 @@ void asmlinkage __init noreturn __start_xen(void)
                 bi->nr_modules);
      }
- /* Dom0 kernel is always first */
-    bi->mods[0].type = BOOTMOD_KERNEL;
-    bi->domains[0].kernel = &bi->mods[0];
+    builder_init(bi);
+
+    /* Find first unknown boot module to use as Dom0 kernel */
+    i = first_boot_module_index(bi, BOOTMOD_UNKNOWN);
+    bi->mods[i].type = BOOTMOD_KERNEL;
+    bi->domains[0].kernel = &bi->mods[i];
This is going to change again later? Or else what about there already
being a module marked BOOTMOD_KERNEL?
Yes, it will change.  There will be two paths, and this is part of the 
non-Hyperlaunch path which needs to implicitly select kernel and initrd 
from the module order, the same as today.  For hyperlaunch, the device 
tree explicitly assigns kernel and initrd.
Regards,
Jason



 


Rackspace

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