From nobody Sun Dec 14 13:54:19 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1764260809; cv=none; d=zohomail.com; s=zohoarc; b=nYghOPGsCBxF7fEq0si3BwzjmOhcspv5AsM057yFmggoFnbfdLT2kTPwQi+0sIYeUiEkgm8PbCJocH8XriHEcj0ui+BCa6cpkMnYVgMEzHjDG7vd5tJ3MTdaT2TCX9MvqreiXxStt8WKjvH5LY81tHXfuvUdwtN3ScaMBJZ6mo0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764260809; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SDTI5SjlxWLK35k4ON2EstoAV+lLSlfaDyeVS41KSEE=; b=IjVeoui18IodI4IfcCVT2ziLBIS1TynNLguyCStVHmkxVRyZ1gdGY8c3VPvRm/RokMV9qjVHaFeAay5SZhuO038Heo/Vqv29d5NXs4Qv+K6QQrGFeRGHoGTWsN7M5Hpv/z1NlccLIdEGKaoWz9qGkHJs5/3EeDYcBiRjP25pcD0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1764260809840490.2947457111982; Thu, 27 Nov 2025 08:26:49 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1174223.1499192 (Exim 4.92) (envelope-from ) id 1vOepC-0007uD-UM; Thu, 27 Nov 2025 16:26:30 +0000 Received: by outflank-mailman (output) from mailman id 1174223.1499192; Thu, 27 Nov 2025 16:26:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vOepC-0007u6-RL; Thu, 27 Nov 2025 16:26:30 +0000 Received: by outflank-mailman (input) for mailman id 1174223; Thu, 27 Nov 2025 16:26:29 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vOepB-0007Yx-Mm for xen-devel@lists.xenproject.org; Thu, 27 Nov 2025 16:26:29 +0000 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [2a00:1450:4864:20::636]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id d3b73e3a-cbad-11f0-9d18-b5c5bf9af7f9; Thu, 27 Nov 2025 17:26:29 +0100 (CET) Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-b713c7096f9so163529866b.3 for ; Thu, 27 Nov 2025 08:26:29 -0800 (PST) Received: from fedora (user-109-243-71-38.play-internet.pl. [109.243.71.38]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b76f59e8936sm195126666b.48.2025.11.27.08.26.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Nov 2025 08:26:27 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d3b73e3a-cbad-11f0-9d18-b5c5bf9af7f9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764260788; x=1764865588; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SDTI5SjlxWLK35k4ON2EstoAV+lLSlfaDyeVS41KSEE=; b=HX+a6eLVHTbqEJ6PzchhPi6F489QE8CujB0d/8/bBdHRDW6Q6TP7bVJ2A+RwgOG3Uf f+R7Ynvy8yd4Yxg9DYDkvgGioXChI5ywjECMffKF3vocuwcQ+ntLeWiLHKQHlBDILD7t EVrZjHgjna1eyGiOEjnySHOePkb4lVKzOcJgDTyUj3sWLIeEn9/KHAyeU9Nyn88GYR6H Xzd2+OY6Of0uy9Q9wqBDdhK4jHcAxwRKBKGE1dBfjGVdeoDg9UxE3Wb+K/86/HN9dbyu LEAkom0CF13mNWm7RqvXHw5T2H/1JdCuedbUrs2U2YtY5gSZljY3aI5o0RddQ4mEjH7G gZuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764260788; x=1764865588; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=SDTI5SjlxWLK35k4ON2EstoAV+lLSlfaDyeVS41KSEE=; b=NpV2WdpIS6Xbwr5kKnnxRnznOyQIGGW1MsWJeqWj4OAj9pRwz05o4+uAPtSchCWmtF LZq13IpERHKOBcHIGKpfElMQ1vav9QAxpS7xO+XT2GaGvCDSkBShpSTPHLxoTCi49yST C+dgZEb3FnSQeXbwTl9pZ1ZtP/B8psRVS+UFvxybWiWT8xqdWqLf4SKvNfVfoEtlKOma hOFGvQi/yBXKJWazthopcX7Ecmco0orvl5+94DRRoCIR0A9TO1ZPiI0NZXKlB7kdBKF4 22NDmmFhvw46bWkEfanDatelWSRBjDhVPitjWLSZScJ3KBZX8zfv/9/H5LOv6q1+xHDr QsKQ== X-Gm-Message-State: AOJu0YxPhDIxu+B+FDQZUQulmtADE17ZtGAQ/B9aEAVl7Zp8yIp2s7fQ XbkXW3IpYk6b4V3tXfeyj5XVZnOd8OR6jVPYPwY72G/0nzK6HmW5OJ5BKJ6pJCA5 X-Gm-Gg: ASbGnctrywV3iNzpIV1GC0DrMRt90RYNh6Esast5AgWEI9cC0rxXMUr5Ua3Axc8Az14 kuDUrGopBrWWAA+c/y8UlDYXt07DQhv1yeS3N/9Ie37WYPyujTgHAMvWHj4QjNBzPWL35qmYtS6 4ieGFNerg6DRI4Tu3CjzYAHKRUWF/AvncMKKG3LvuOPW7eQwJVNbk2UPZH3j1CPBWJOEoiQ8a4l n/aLMDk0Ex5rM+fj0HKkddHOEHQEEEufMH0wUrFYbXWFtnWGVM14Q1+zyZAh0km2myqoZGZ1iqI hEIPG9mx0lXQG0f/c4DT/RLt1pZWqov8QpsLVXkmLmrE6tEM8xdMS1ngmj7mtzwG5swCx4oE7Wi AHlZxDD/PWO5ulkGuvNaw4DSYdFicYOpLDr2XqZRpaQjg9HtcmK1GtyHDFQJXzmTxU+vj1II/C6 84Or57ssHNxo1GU4Je1Z+WT2qgsKxpCsQo5HVWJuXscTOt6JxxXZv+ZqQ= X-Google-Smtp-Source: AGHT+IHHNpjHScXYYQDy405I4Mb3pQo0I2miUu/PU0mTesLy/0CzocXa3t7WQC+stMJPxe8T6c8Y+Q== X-Received: by 2002:a17:907:f495:b0:b6d:6d66:e8e9 with SMTP id a640c23a62f3a-b7671a494d7mr2307636566b.61.1764260788178; Thu, 27 Nov 2025 08:26:28 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [PATCH v2 1/2] xen/dom0less: move make_chosen_node() to common code Date: Thu, 27 Nov 2025 17:26:15 +0100 Message-ID: <84178652f3cd60303ac1e81f36f852bc685e0ba4.1764260246.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1764260811538019200 Content-Type: text/plain; charset="utf-8" The current implementation of make_chosen_node() does not contain any architecture-specific logic. Therefore, move it from arch-specific files to common code. At this stage, there is no need to introduce an arch_make_chosen_node(), as no architecture-specific customization is required. This change avoids duplication and simplifies future maintenance for architectures like RISC-V and ARM. Signed-off-by: Oleksii Kurochko Acked-by: Michal Orzel Reviewed-by: Luca Fancellu Tested-by: Luca Fancellu --- Changes in v2: - Rebase the patch on top of current staging: s/struct bootmodule/struct boot_module s/kinfo->cmdline/kinfo->bd.cmdline s/kinfo->initrd_bootmodule/kinfo->bd.initrd - Update the comment above make_chosen_node: ... on ACPI systems (on platform where CONFIG_ACPI=3Dy) ... - Move make_chosen_node() to common/domain-build.c as it could be used not only for dom0less. - Based on the previous review it should be added: Reviewed-by: Michal Orzel bd.initrd; - void *fdt =3D kinfo->fdt; - - dt_dprintk("Create chosen node\n"); - res =3D fdt_begin_node(fdt, "chosen"); - if ( res ) - return res; - - if ( kinfo->bd.cmdline && kinfo->bd.cmdline[0] ) - { - bootargs =3D &kinfo->bd.cmdline[0]; - res =3D fdt_property(fdt, "bootargs", bootargs, strlen(bootargs) += 1); - if ( res ) - return res; - } - - /* - * If the bootloader provides an initrd, we must create a placeholder - * for the initrd properties. The values will be replaced later. - */ - if ( initrd && initrd->size ) - { - u64 a =3D 0; - res =3D fdt_property(kinfo->fdt, "linux,initrd-start", &a, sizeof(= a)); - if ( res ) - return res; - - res =3D fdt_property(kinfo->fdt, "linux,initrd-end", &a, sizeof(a)= ); - if ( res ) - return res; - } - - res =3D fdt_end_node(fdt); - - return res; -} - static int __init handle_node(struct domain *d, struct kernel_info *kinfo, struct dt_device_node *node, p2m_type_t p2mt) diff --git a/xen/common/device-tree/domain-build.c b/xen/common/device-tree= /domain-build.c index 95b383e00f..774790aab3 100644 --- a/xen/common/device-tree/domain-build.c +++ b/xen/common/device-tree/domain-build.c @@ -405,6 +405,52 @@ void __init initrd_load(struct kernel_info *kinfo, iounmap(initrd); } =20 +/* + * This function is used as part of the device tree generation for Dom0 + * on ACPI systems (on platform where CONFIG_ACPI=3Dy), and DomUs started + * directly from Xen based on device tree information. + */ +int __init make_chosen_node(const struct kernel_info *kinfo) +{ + int res; + const char *bootargs =3D NULL; + const struct boot_module *initrd =3D kinfo->bd.initrd; + void *fdt =3D kinfo->fdt; + + dt_dprintk("Create chosen node\n"); + res =3D fdt_begin_node(fdt, "chosen"); + if ( res ) + return res; + + if ( kinfo->bd.cmdline && kinfo->bd.cmdline[0] ) + { + bootargs =3D &kinfo->bd.cmdline[0]; + res =3D fdt_property(fdt, "bootargs", bootargs, strlen(bootargs) += 1); + if ( res ) + return res; + } + + /* + * If the bootloader provides an initrd, we must create a placeholder + * for the initrd properties. The values will be replaced later. + */ + if ( initrd && initrd->size ) + { + u64 a =3D 0; + res =3D fdt_property(kinfo->fdt, "linux,initrd-start", &a, sizeof(= a)); + if ( res ) + return res; + + res =3D fdt_property(kinfo->fdt, "linux,initrd-end", &a, sizeof(a)= ); + if ( res ) + return res; + } + + res =3D fdt_end_node(fdt); + + return res; +} + /* * Local variables: * mode: C --=20 2.52.0