From nobody Mon Apr 29 16:16:31 2024 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 header.i=dpsmith@apertussolutions.com; 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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) ARC-Seal: i=2; a=rsa-sha256; t=1639769581; cv=pass; d=zohomail.com; s=zohoarc; b=UN9XOa+aY8hvY0JlBli9+dgetQiMXR7UmqgU42hN6o9uHTmxz40xQ7DTMfaYPn573a6pjazDqdAISh+8wxwpWY8Trz1Mn8XkyM4Ig0DVDOSDaIPXU0eDlwHHGe2dW5feptloVmPzrGcugsTOSMNJ/8YfNrK3U3PQcHtU5kRj9Dw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639769581; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/VbuytX0Q+D4LsMewdpZJiBY6pOL9LLoWZ6MNlm7AeU=; b=CMbS6JM/7T8iGREjjQVyxfbxNdR1VoG2LqCGp2VE1D6QHf2Pwt117vlA6MG7AT3qk4Gq7desgcwU0lKDDBYCAGoe4YD7MI1yEFPqqJaNpz7yJQujZYLgNDocxBTe5NTgka5OgoI5S/ENVB+xAI6RG4sEUNgO9vgzavzYKmsyrM0= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dpsmith@apertussolutions.com; 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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1639769581069567.3032047217264; Fri, 17 Dec 2021 11:33:01 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.248832.429221 (Exim 4.92) (envelope-from ) id 1myIxw-0007hp-4r; Fri, 17 Dec 2021 19:32:28 +0000 Received: by outflank-mailman (output) from mailman id 248832.429221; Fri, 17 Dec 2021 19:32:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1myIxw-0007hg-1H; Fri, 17 Dec 2021 19:32:28 +0000 Received: by outflank-mailman (input) for mailman id 248832; Fri, 17 Dec 2021 19:32:26 +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 1myIxt-0007M8-T0 for xen-devel@lists.xenproject.org; Fri, 17 Dec 2021 19:32:26 +0000 Received: from sender3-of-o51.zoho.com (sender3-of-o51.zoho.com [136.143.184.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0f0f9589-5f70-11ec-9e60-abaf8a552007; Fri, 17 Dec 2021 20:32:25 +0100 (CET) Received: from sisyou.hme. (static-72-81-132-2.bltmmd.fios.verizon.net [72.81.132.2]) by mx.zohomail.com with SMTPS id 1639769524862112.54010405527049; Fri, 17 Dec 2021 11:32:04 -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: 0f0f9589-5f70-11ec-9e60-abaf8a552007 ARC-Seal: i=1; a=rsa-sha256; t=1639769527; cv=none; d=zohomail.com; s=zohoarc; b=ljqU0Yxk3HOkGSLVjYIS2HhHILvsIGXieSamAN+iNBVQ9PVTmH6ko/dwbVmzJb9uWWixOY8DncM+cOj1W3e3Q8BrI49IAr4u7ozv0kwr81VrKhCPmqs+R6PBRJK6kLHsbqN0mH9lccbTQ9ewTLLOg3x7ueCupcTvjz1+ujXLpfo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639769527; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=/VbuytX0Q+D4LsMewdpZJiBY6pOL9LLoWZ6MNlm7AeU=; b=acWHGoec9Ohbik9eZLOlMvS1ou5Gi8WYhZjPTx6gfGGSEsksx5C0HdGmXEHdBllp1SPBa1jIt4SJpFKuC+3DXswaeJeZ85Nl5BV4xDDktK7L7dDTsJ54UPxf4fTx9vsjdu9pWwaqbgwvcmF7CyEcwtl7uh0CIA5W3BEwRZ4i+A8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@apertussolutions.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1639769527; s=zoho; d=apertussolutions.com; i=dpsmith@apertussolutions.com; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=/VbuytX0Q+D4LsMewdpZJiBY6pOL9LLoWZ6MNlm7AeU=; b=asPoXZYjr1hLb56DR0cGtZIIuASHvFviAHV2eIRSizQBKqfv6dt2v462I/kFZ/TS ZWPP8zdV2w3nbXHrvewYoT7HmxiD3mDxoC1J3LPuwWs6Lu125ss8+ThOK2KDdHPziNU ioD2dR5f7aARK0SL+M1F4z4aRVdAgRpL5BkMQoEY= From: "Daniel P. Smith" To: Wei Liu , xen-devel@lists.xenproject.org Cc: Christopher Clark , Christopher Clark , "Daniel P . Smith" , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , George Dunlap , Julien Grall , Stefano Stabellini Subject: [RFC 01/10] introduce hyperlaunch kconfig and core Date: Fri, 17 Dec 2021 18:34:27 -0500 Message-Id: <20211217233437.13791-2-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211217233437.13791-1-dpsmith@apertussolutions.com> References: <20211217233437.13791-1-dpsmith@apertussolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-ZohoMail-DKIM: pass (identity dpsmith@apertussolutions.com) X-ZM-MESSAGEID: 1639769581996100003 Content-Type: text/plain; charset="utf-8" From: Christopher Clark Add a CONFIG_HYPERLAUNCH to allow enabling/disabling the hyperlaunch code paths. Introduce an initial use of the hyperlaunch_enabled variable to supp= ress the warning about multiple initrd candidates when multiboot modules are detected when the hyperlaunch boolean is true. Added to common code since this option will apply to all architectures. Signed-off-by: Christopher Clark Signed-off-by: Daniel P. Smith --- xen/arch/x86/setup.c | 4 +++- xen/common/Kconfig | 10 ++++++++++ xen/common/Makefile | 1 + xen/common/setup.c | 8 ++++++++ xen/include/xen/setup.h | 14 ++++++++++++++ 5 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 xen/common/setup.c create mode 100644 xen/include/xen/setup.h diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index f40a9fe5d3..190d7aefb5 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #ifdef CONFIG_COMPAT #include @@ -1891,7 +1892,8 @@ void __init noreturn __start_xen(unsigned long mbi_p) cpu_has_nx ? "" : "not "); =20 initrdidx =3D find_first_bit(module_map, mbi->mods_count); - if ( bitmap_weight(module_map, mbi->mods_count) > 1 ) + if ( !hyperlaunch_enabled && + bitmap_weight(module_map, mbi->mods_count) > 1 ) printk(XENLOG_WARNING "Multiple initrd candidates, picking module #%u\n", initrdidx); diff --git a/xen/common/Kconfig b/xen/common/Kconfig index db687b1785..5e6aad644e 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -331,6 +331,16 @@ config ARGO =20 If unsure, say N. =20 +config HYPERLAUNCH + bool "Hyperlaunch support (UNSUPPORTED)" if UNSUPPORTED + ---help--- + Enables launch of multiple VMs at host boot as an alternative + method of starting a Xen system. + + This feature is currently experimental. + + If unsure, say N. + source "common/sched/Kconfig" =20 config CRYPTO diff --git a/xen/common/Makefile b/xen/common/Makefile index 141d7d40d3..a6337e065a 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -35,6 +35,7 @@ obj-y +=3D rangeset.o obj-y +=3D radix-tree.o obj-y +=3D rcupdate.o obj-y +=3D rwlock.o +obj-y +=3D setup.o obj-y +=3D shutdown.o obj-y +=3D softirq.o obj-y +=3D smp.o diff --git a/xen/common/setup.c b/xen/common/setup.c new file mode 100644 index 0000000000..e18ea14fe0 --- /dev/null +++ b/xen/common/setup.c @@ -0,0 +1,8 @@ +#include +#include + +#ifdef CONFIG_HYPERLAUNCH + +bool __initdata hyperlaunch_enabled; + +#endif diff --git a/xen/include/xen/setup.h b/xen/include/xen/setup.h new file mode 100644 index 0000000000..6fbe87860e --- /dev/null +++ b/xen/include/xen/setup.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef XEN_SETUP_H +#define XEN_SETUP_H + +#include + +#ifdef CONFIG_HYPERLAUNCH +extern bool hyperlaunch_enabled; +#else +#define hyperlaunch_enabled false +#endif + +#endif /* XEN_SETUP_H */ --=20 2.20.1 From nobody Mon Apr 29 16:16:31 2024 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 header.i=dpsmith@apertussolutions.com; 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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) ARC-Seal: i=2; a=rsa-sha256; t=1639769600; cv=pass; d=zohomail.com; s=zohoarc; b=m7YAHuESYPhyV81OWzgMaBDptJPc6mA5dcGUTQ+CCSj6WVgyyloYxgy2/Qp7oMtfUZM3Suf4xijAln5KlsoyXGSBqfBVLaZnaJ9kWe8HCL1QwDn8HCi5ubkXtneQYnU+dtOd0TjIrouQud/OpuU6qMyFCZxeATb3OWZ0KYQGY78= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639769600; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5e0WDt0b0QAR/Q3VrnOoU5NuGPw9wyZBF+wd2t/YYDo=; b=QeBk9nJd/R+oDzr7QBxOfuvPUrM938FpqVHnCOhnrZaCuSyOPv5tGWVTNKaeqO8LgwdPIXEZZ1NUKoTx2NMOg88U/SUhL62Hpj51palNnz5XQVjuzi5+fDsY4RzdjoVTo3kOjwVk8NQhpUOIyHb+3yYrGuYPwSgFYw20KNSvH9c= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dpsmith@apertussolutions.com; 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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1639769600674458.9366658413828; Fri, 17 Dec 2021 11:33:20 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.248838.429232 (Exim 4.92) (envelope-from ) id 1myIyE-0008NS-FW; Fri, 17 Dec 2021 19:32:46 +0000 Received: by outflank-mailman (output) from mailman id 248838.429232; Fri, 17 Dec 2021 19:32:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1myIyE-0008NI-Bz; Fri, 17 Dec 2021 19:32:46 +0000 Received: by outflank-mailman (input) for mailman id 248838; Fri, 17 Dec 2021 19:32:46 +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 1myIyD-0007M8-SX for xen-devel@lists.xenproject.org; Fri, 17 Dec 2021 19:32:45 +0000 Received: from sender3-of-o52.zoho.com (sender3-of-o52.zoho.com [136.143.184.52]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 1afcfdc4-5f70-11ec-9e60-abaf8a552007; Fri, 17 Dec 2021 20:32:44 +0100 (CET) Received: from sisyou.hme. (static-72-81-132-2.bltmmd.fios.verizon.net [72.81.132.2]) by mx.zohomail.com with SMTPS id 1639769526620437.16843681891885; Fri, 17 Dec 2021 11:32:06 -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: 1afcfdc4-5f70-11ec-9e60-abaf8a552007 ARC-Seal: i=1; a=rsa-sha256; t=1639769529; cv=none; d=zohomail.com; s=zohoarc; b=Bo7rv4wId/5VhflcAuS0iCH2o0c3/9MGoimLxmZKC41fY6+GNf31ArfsQuIkOu3SuV4Zo+eZXoFI8a9yKMAoehdKq239GDtVKz2kCZPgBhjZJ/8G8+pmm0X+h2lbUuZsy8yqH7clwVDYB969ZVzsQCanur7+vJaX81Wo7smmg88= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639769529; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=5e0WDt0b0QAR/Q3VrnOoU5NuGPw9wyZBF+wd2t/YYDo=; b=UIYLiIm3BrxcIojqPMcvhZ/DtO7qpVs84maSSpKBsHu4ON9OMwbUVX6mR1vO4yITL1ej/LJ/TKLzfvpMliBkrH8e/n5fW9SmfkLo+s3hAp8a4RH6t8v7LfqobWoUYBdrKPwV95XnhbfyYVCCgl9AaSGw8Kh+2vE1ZnsC5R1EcN0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@apertussolutions.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1639769529; s=zoho; d=apertussolutions.com; i=dpsmith@apertussolutions.com; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=5e0WDt0b0QAR/Q3VrnOoU5NuGPw9wyZBF+wd2t/YYDo=; b=kX0pUUiV6zJydj03YUKM73B8KyuPotHqDosj6sBAE8dh1DUc+Y1F9kjojmKlvLsF icdmqNyYo+EYHHlAueXw+Ivhckxh1Er1WxaO5zSqeVN9r5MSygS0iHcHPRtR6qZvKXn +wZpEqT5zQuj2hwjNJZ1CtmSrrzdRr6BV28BwqLw= From: "Daniel P. Smith" To: Wei Liu , xen-devel@lists.xenproject.org Cc: Christopher Clark , "Daniel P . Smith" , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , George Dunlap , Julien Grall , Stefano Stabellini , Dario Faggioli Subject: [RFC 02/10] is_system_domain: replace open-coded instances Date: Fri, 17 Dec 2021 18:34:28 -0500 Message-Id: <20211217233437.13791-3-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211217233437.13791-1-dpsmith@apertussolutions.com> References: <20211217233437.13791-1-dpsmith@apertussolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-ZohoMail-DKIM: pass (identity dpsmith@apertussolutions.com) X-ZM-MESSAGEID: 1639769602497100001 Content-Type: text/plain; charset="utf-8" From: Christopher Clark There were several instances of open-coded domid range checking. This commit replaces those with the is_system_domain inline function. Signed-off-by: Christopher Clark Signed-off-by: Daniel P. Smith Acked-by: Dario Faggioli --- xen/arch/x86/cpu/vpmu.c | 2 +- xen/common/domctl.c | 2 +- xen/common/sched/core.c | 4 ++-- xen/include/xen/sched.h | 5 +++++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c index 8ec4547bed..179f3dcc5a 100644 --- a/xen/arch/x86/cpu/vpmu.c +++ b/xen/arch/x86/cpu/vpmu.c @@ -188,7 +188,7 @@ void vpmu_do_interrupt(struct cpu_user_regs *regs) * in XENPMU_MODE_ALL, for everyone. */ if ( (vpmu_mode & XENPMU_MODE_ALL) || - (sampled->domain->domain_id >=3D DOMID_FIRST_RESERVED) ) + (is_system_domain(sampled->domain)) ) { sampling =3D choose_hwdom_vcpu(); if ( !sampling ) diff --git a/xen/common/domctl.c b/xen/common/domctl.c index 879a2adcbe..67021cc54b 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -536,7 +536,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_d= omctl) if ( !d ) { ret =3D -EINVAL; - if ( op->domain >=3D DOMID_FIRST_RESERVED ) + if ( is_system_domain_id(op->domain) ) break; =20 rcu_read_lock(&domlist_read_lock); diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index 8f4b1ca10d..6ea8bcf62f 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -821,7 +821,7 @@ int sched_init_domain(struct domain *d, unsigned int po= olid) int ret; =20 ASSERT(d->cpupool =3D=3D NULL); - ASSERT(d->domain_id < DOMID_FIRST_RESERVED); + ASSERT(!is_system_domain(d)); =20 if ( (ret =3D cpupool_add_domain(d, poolid)) ) return ret; @@ -845,7 +845,7 @@ int sched_init_domain(struct domain *d, unsigned int po= olid) =20 void sched_destroy_domain(struct domain *d) { - ASSERT(d->domain_id < DOMID_FIRST_RESERVED); + ASSERT(!is_system_domain(d)); =20 if ( d->cpupool ) { diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 28146ee404..1df09bcb77 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -613,6 +613,11 @@ extern struct vcpu *idle_vcpu[NR_CPUS]; #define is_idle_domain(d) ((d)->domain_id =3D=3D DOMID_IDLE) #define is_idle_vcpu(v) (is_idle_domain((v)->domain)) =20 +static inline bool is_system_domain_id(domid_t id) +{ + return (id >=3D DOMID_FIRST_RESERVED); +} + static inline bool is_system_domain(const struct domain *d) { return d->domain_id >=3D DOMID_FIRST_RESERVED; --=20 2.20.1 From nobody Mon Apr 29 16:16:31 2024 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 header.i=dpsmith@apertussolutions.com; 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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) ARC-Seal: i=2; a=rsa-sha256; t=1639769611; cv=pass; d=zohomail.com; s=zohoarc; b=lzcwnr2AFfhOJVipuYXEoPqMNGE9hGXN8oG+cff5kPrE3goX89nUOb/mFocbv7K9Oy3OBHWWgNqqzvcZTRr27A+aNxz0pwk2s4uUMJZBq9znOzc1tKsJkOBAq5GLtUy1eR56mlf3iF6D9YkV+E8jOwcDJHejrA2+yhDH6+Etp0I= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639769611; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=g9oPwlQgKMT2hXPARb/PayeIcKtxhGTeD4xffzn8NTM=; b=PP7kejcdrqlhAzbd1DzcN322xtXoo4Y+nXRvjG6ZW5Y8JLYCzHCvPDKYPJn86PhX9gxyl3XpmsugBlVqioJYTc0dT48X0VF6UUI0Obg/PSngNZ/n62HA//iUXDT/tNEXFISCyr2Dc8zsXuELdutGiOV2sMeNK967Q8CEB6BL6gM= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dpsmith@apertussolutions.com; 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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1639769611285901.9320983725347; Fri, 17 Dec 2021 11:33:31 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.248839.429243 (Exim 4.92) (envelope-from ) id 1myIyQ-0000Mx-OC; Fri, 17 Dec 2021 19:32:58 +0000 Received: by outflank-mailman (output) from mailman id 248839.429243; Fri, 17 Dec 2021 19:32:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1myIyQ-0000Mq-Kh; Fri, 17 Dec 2021 19:32:58 +0000 Received: by outflank-mailman (input) for mailman id 248839; Fri, 17 Dec 2021 19:32:57 +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 1myIyP-0007M8-ET for xen-devel@lists.xenproject.org; Fri, 17 Dec 2021 19:32:57 +0000 Received: from sender3-of-o50.zoho.com (sender3-of-o50.zoho.com [136.143.184.50]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 218b60b9-5f70-11ec-9e60-abaf8a552007; Fri, 17 Dec 2021 20:32:56 +0100 (CET) Received: from sisyou.hme. (static-72-81-132-2.bltmmd.fios.verizon.net [72.81.132.2]) by mx.zohomail.com with SMTPS id 1639769528258456.9306457825601; Fri, 17 Dec 2021 11:32:08 -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: 218b60b9-5f70-11ec-9e60-abaf8a552007 ARC-Seal: i=1; a=rsa-sha256; t=1639769530; cv=none; d=zohomail.com; s=zohoarc; b=I6IAsMH+jipuMqQCj76mdQ7T9EyWFmW64zRMD1bJXD7ClPf7PcMXJZ9QGGzZaAadxhBVhcFjcvTiogX2AfkRuESNdmj6y6aH7g2v2ZgvsbtEuJ1hVU3UxUjLU0x5pwlzpSlM8zPq1BZUjhYmhPFPjEwSesElfzwFvywscOSWzL0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639769530; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=g9oPwlQgKMT2hXPARb/PayeIcKtxhGTeD4xffzn8NTM=; b=hQ1/+LhqdE9UaRKlKfiz7YCM+E0fa6PSB4/dDcWWebRhbXW5Nxw9iQHq65Zwh6gt70WQisAhSZwFr6Q91bOxe/ga50Gmk1vMdwXO/So8yf5Ef28X11udIxdutVmdxAMoqSu+5VrCvtJ0Vk/P7F9cfsvWp55kq/pBNXR+rUHbKxw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@apertussolutions.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1639769530; s=zoho; d=apertussolutions.com; i=dpsmith@apertussolutions.com; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=g9oPwlQgKMT2hXPARb/PayeIcKtxhGTeD4xffzn8NTM=; b=Khcyh8d1Ra5MFSxWdiC+y3TVEtTDzTTg71udOgNLXTO2ntt5u2DeyIJnoPyQK63/ uo58/IngQ158gWI7eUfLhCtf2+y6ChkQHnjnfmCK9rhIhc9guXD9kt47q2kntshBaPp mOhFXF5YzkxX4xi4+NSQZ8BxoxN6b4tlpVVZBtgo= From: "Daniel P. Smith" To: Wei Liu , xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , Christopher Clark , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , George Dunlap , Julien Grall , Stefano Stabellini Subject: [RFC 03/10] multiboot: moving headroom to per module_t Date: Fri, 17 Dec 2021 18:34:29 -0500 Message-Id: <20211217233437.13791-4-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211217233437.13791-1-dpsmith@apertussolutions.com> References: <20211217233437.13791-1-dpsmith@apertussolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-ZohoMail-DKIM: pass (identity dpsmith@apertussolutions.com) X-ZM-MESSAGEID: 1639769612218100001 Content-Type: text/plain; charset="utf-8" Hyperlaunch will require multiple modules to be allocated headroom. Therefo= re a headroom variable has been added to module_t for tracking headroom on a per module_t basis. To provide backwards compatibility with multiboot, the reserved field was bitfield split to allow it to continue to be used to flag module was relocated and to add to track the headroom needed when being relocated. RFC Note: The approach taken here was to produce something that was accepta= ble but likely not the ultimate solution. A more complete solution would likely= be one that looked to unify a cross-architecture approach to represent the material provided by bootloaders. Signed-off-by: Daniel P. Smith Reviewed-by: Christopher Clark --- xen/arch/x86/boot/reloc.c | 1 + xen/arch/x86/setup.c | 17 ++++++++--------- xen/include/xen/multiboot.h | 3 ++- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c index 4f4039bb7c..9c68777db3 100644 --- a/xen/arch/x86/boot/reloc.c +++ b/xen/arch/x86/boot/reloc.c @@ -250,6 +250,7 @@ static multiboot_info_t *mbi2_reloc(u32 mbi_in) mbi_out_mods[mod_idx].mod_end =3D get_mb2_data(tag, module, mo= d_end); ptr =3D get_mb2_string(tag, module, cmdline); mbi_out_mods[mod_idx].string =3D copy_string(ptr); + mbi_out_mods[mod_idx].headroom =3D 0; mbi_out_mods[mod_idx].reserved =3D 0; ++mod_idx; break; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 190d7aefb5..4bf84c17e4 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -855,7 +855,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) unsigned int initrdidx, num_parked =3D 0; multiboot_info_t *mbi; module_t *mod; - unsigned long nr_pages, raw_max_page, modules_headroom, module_map[1]; + unsigned long nr_pages, raw_max_page, module_map[1]; int i, j, e820_warn =3D 0, bytes =3D 0; unsigned long eb_start, eb_end; bool acpi_boot_table_init_done =3D false, relocated =3D false; @@ -1158,7 +1158,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) mod[mbi->mods_count].mod_end =3D __2M_rwdata_end - _stext; } =20 - modules_headroom =3D bzimage_headroom(bootstrap_map(mod), mod->mod_end= ); + mod->headroom =3D bzimage_headroom(bootstrap_map(mod), mod->mod_end); bootstrap_map(NULL); =20 #ifndef highmem_start @@ -1321,8 +1321,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) /* Is the region suitable for relocating the multiboot modules? */ for ( j =3D mbi->mods_count - 1; j >=3D 0; j-- ) { - unsigned long headroom =3D j ? 0 : modules_headroom; - unsigned long size =3D PAGE_ALIGN(headroom + mod[j].mod_end); + unsigned long size =3D PAGE_ALIGN(mod[j].headroom + mod[j].mod= _end); =20 if ( mod[j].reserved ) continue; @@ -1335,14 +1334,14 @@ void __init noreturn __start_xen(unsigned long mbi_= p) continue; =20 if ( s < end && - (headroom || + (mod[j].headroom || ((end - size) >> PAGE_SHIFT) > mod[j].mod_start) ) { - move_memory(end - size + headroom, + move_memory(end - size + mod[j].headroom, (uint64_t)mod[j].mod_start << PAGE_SHIFT, mod[j].mod_end, 0); mod[j].mod_start =3D (end - size) >> PAGE_SHIFT; - mod[j].mod_end +=3D headroom; + mod[j].mod_end +=3D mod[j].headroom; mod[j].reserved =3D 1; } } @@ -1369,7 +1368,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) #endif } =20 - if ( modules_headroom && !mod->reserved ) + if ( mod->headroom && !mod->reserved ) panic("Not enough memory to relocate the dom0 kernel image\n"); for ( i =3D 0; i < mbi->mods_count; ++i ) { @@ -1902,7 +1901,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) * We're going to setup domain0 using the module(s) that we stashed sa= fely * above our heap. The second module, if present, is an initrd ramdisk. */ - dom0 =3D create_dom0(mod, modules_headroom, + dom0 =3D create_dom0(mod, mod->headroom, initrdidx < mbi->mods_count ? mod + initrdidx : NUL= L, kextra, loader); if ( !dom0 ) diff --git a/xen/include/xen/multiboot.h b/xen/include/xen/multiboot.h index d1b43e1183..0ae37dfa2b 100644 --- a/xen/include/xen/multiboot.h +++ b/xen/include/xen/multiboot.h @@ -108,7 +108,8 @@ typedef struct { u32 mod_start; u32 mod_end; u32 string; - u32 reserved; + u32 reserved:1; + u32 headroom:31; } module_t; =20 /* The memory map. Be careful that the offset 0 is base_addr_low --=20 2.20.1 From nobody Mon Apr 29 16:16:31 2024 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 header.i=dpsmith@apertussolutions.com; 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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) ARC-Seal: i=2; a=rsa-sha256; t=1639769626; cv=pass; d=zohomail.com; s=zohoarc; b=DGfnaVVhTBOaGJMSJxbe709zF7SOa2GNR7Iz3MjETyC/bhMZo1gkF5/S7AKYNzSqqDHJ0tvRGbPWgn8sNhrnIr7vU+DkzOtwiAij1rEEMZa3HQHLaEon4OskvrX4HQ9L3wGTjDKWVosbUYIxgU9ouHciqKjMXoO2yEQIgjArYsQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639769626; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=UFJoq4z4heOloPDSzW6Y95pMjws+Z0IPoCLVo0DLBwc=; b=MxBK3IHyoJPTaQt0t7utehkf9qxv4Zl1kX1NEfQ01HalpFaKln66ZafBK9M+I1f+gxbYb9Z1x9igDec46v7cnB+Hle0oKjgtanxkLpDAcfE4CF5X2HqDQyJ7k1rfWIeV+HsCpjAkRGjZX+6Qk6+ej5iRarq83Ja1TfKuzAO0w9I= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dpsmith@apertussolutions.com; 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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1639769626796762.205346628085; Fri, 17 Dec 2021 11:33:46 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.248845.429253 (Exim 4.92) (envelope-from ) id 1myIyd-0000wA-VW; Fri, 17 Dec 2021 19:33:11 +0000 Received: by outflank-mailman (output) from mailman id 248845.429253; Fri, 17 Dec 2021 19:33:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1myIyd-0000vd-SW; Fri, 17 Dec 2021 19:33:11 +0000 Received: by outflank-mailman (input) for mailman id 248845; Fri, 17 Dec 2021 19:33:10 +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 1myIyc-0007M8-JW for xen-devel@lists.xenproject.org; Fri, 17 Dec 2021 19:33:10 +0000 Received: from sender3-of-o50.zoho.com (sender3-of-o50.zoho.com [136.143.184.50]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 29af6198-5f70-11ec-9e60-abaf8a552007; Fri, 17 Dec 2021 20:33:09 +0100 (CET) Received: from sisyou.hme. (static-72-81-132-2.bltmmd.fios.verizon.net [72.81.132.2]) by mx.zohomail.com with SMTPS id 1639769529700190.38888754714014; Fri, 17 Dec 2021 11:32:09 -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: 29af6198-5f70-11ec-9e60-abaf8a552007 ARC-Seal: i=1; a=rsa-sha256; t=1639769531; cv=none; d=zohomail.com; s=zohoarc; b=FtIm41ruqTOp600k8iYbUBpQv3WAX7IwUdUHTw7zP4Z0Zwww4S0m8CW6zUfCts269WM9CieFWRUQVe3faX4y4abhxKuTRBXvqpjK9P7nEabSfs3lDZFLc4xzFCdPWwumDGXJSRIyhJIgCTR6BVOazSZZtj4OQnBca3fJIbyEhOI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639769531; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=UFJoq4z4heOloPDSzW6Y95pMjws+Z0IPoCLVo0DLBwc=; b=TknipIJcJuInWq7Qo2q68MJViEys3ao5EbmBT6NiLaUK0O4p4uVbVDdqlPLucI2CaUPc+lZLmzafA8lXZz1xh655dwNMe5TWhDnaomqJV9GXWL8UBYyGx9CHMjWMxjNGDejz0eNi+hTpmXXMbedTfLDkTPgSJjl2Ly5jU2l0C9U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@apertussolutions.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1639769531; s=zoho; d=apertussolutions.com; i=dpsmith@apertussolutions.com; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=UFJoq4z4heOloPDSzW6Y95pMjws+Z0IPoCLVo0DLBwc=; b=AfK9C+bK4+ZpY4RCIV0wq23hN8eXzLZLpn3LTPAcd5/vOsKyJ/knuJh6yOYfKNtt gnm/Bb1RFzSVY6PwuUKaFQGukqaLbXUrpGM09GOBxYUjq1XQFDsc7f5Paa5+Phtgul5 HZPG8poVOpgUNE1ZWCINdpIeFTO6KtNUChS1a5v4= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , Christopher Clark , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [RFC 04/10] device-tree: split agnostic device-tree from arm Date: Fri, 17 Dec 2021 18:34:30 -0500 Message-Id: <20211217233437.13791-5-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211217233437.13791-1-dpsmith@apertussolutions.com> References: <20211217233437.13791-1-dpsmith@apertussolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-ZohoMail-DKIM: pass (identity dpsmith@apertussolutions.com) X-ZM-MESSAGEID: 1639769628458100001 Content-Type: text/plain; charset="utf-8" This commit is purely for RFC to highlight some concerns and changes necess= ary in order for hyperlaunch to utilize device tree as the boot configuration container. Despite being in common, the core device tree support enabled through CONFIG_HAS_DEVICE_TREE will not build for an x86 configuration. This is due= to the fact that despite `struct device` appearing to be intended as a common = data structure is in fact unique on x86 and Arm. There is code in xen/common/device_tree.c and include/xen/iommu.h that uses struct members f= ound in Arm's `struct device` that are not present in x86's version. This obviou= sly ends in compilation errors when enabling CONFIG_HAS_DEVICE_TREE on x86. As a result this commit seeks to separate between requiring the ability to parse DTB files and obtaining hardware definition from those DTB files. The Kconfig parameter CORE_DEVICE_TREE was introduced for when only the former = is necessary and not the latter. It specifically allows for the inclusion of t= he device tree parsing code without enabling the areas that make use of Arm specific `struct device`. For the RFC when the Arm specific `struct device` is referenced within devi= ce tree parsing code, check for Arm has been added as an interim solution unti= l a long term solution, that is beyond the scope of the hyperlaunch patch set, = can be proposed and implemented. Signed-off-by: Daniel P. Smith Reviewed-by: Christopher Clark --- xen/common/Kconfig | 5 +++++ xen/common/Makefile | 4 ++-- xen/common/device_tree.c | 2 ++ xen/include/xen/device_tree.h | 4 ++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/xen/common/Kconfig b/xen/common/Kconfig index 5e6aad644e..aece21c9e5 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -31,8 +31,12 @@ config HAS_ALTERNATIVE config HAS_COMPAT bool =20 +config CORE_DEVICE_TREE + bool + config HAS_DEVICE_TREE bool + select CORE_DEVICE_TREE =20 config HAS_EX_TABLE bool @@ -333,6 +337,7 @@ config ARGO =20 config HYPERLAUNCH bool "Hyperlaunch support (UNSUPPORTED)" if UNSUPPORTED + select CORE_DEVICE_TREE ---help--- Enables launch of multiple VMs at host boot as an alternative method of starting a Xen system. diff --git a/xen/common/Makefile b/xen/common/Makefile index a6337e065a..f22aec72a0 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -4,7 +4,7 @@ obj-$(CONFIG_HYPFS_CONFIG) +=3D config_data.o obj-$(CONFIG_CORE_PARKING) +=3D core_parking.o obj-y +=3D cpu.o obj-$(CONFIG_DEBUG_TRACE) +=3D debugtrace.o -obj-$(CONFIG_HAS_DEVICE_TREE) +=3D device_tree.o +obj-$(CONFIG_CORE_DEVICE_TREE) +=3D device_tree.o obj-$(CONFIG_IOREQ_SERVER) +=3D dm.o obj-y +=3D domain.o obj-y +=3D event_2l.o @@ -73,7 +73,7 @@ obj-y +=3D sched/ obj-$(CONFIG_UBSAN) +=3D ubsan/ =20 obj-$(CONFIG_NEEDS_LIBELF) +=3D libelf/ -obj-$(CONFIG_HAS_DEVICE_TREE) +=3D libfdt/ +obj-$(CONFIG_CORE_DEVICE_TREE) +=3D libfdt/ =20 CONF_FILE :=3D $(if $(patsubst /%,,$(KCONFIG_CONFIG)),$(BASEDIR)/)$(KCONFI= G_CONFIG) config.gz: $(CONF_FILE) diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c index 4aae281e89..d92fad2998 100644 --- a/xen/common/device_tree.c +++ b/xen/common/device_tree.c @@ -2012,9 +2012,11 @@ static unsigned long __init unflatten_dt_node(const = void *fdt, ((char *)pp->value)[sz - 1] =3D 0; dt_dprintk("fixed up name for %s -> %s\n", pathp, (char *)pp->value); +#ifdef CONFIG_ARM /* Generic device initialization */ np->dev.type =3D DEV_DT; np->dev.of_node =3D np; +#endif } } if ( allnextpp ) diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h index fd6cd00b43..ca9f7672e9 100644 --- a/xen/include/xen/device_tree.h +++ b/xen/include/xen/device_tree.h @@ -101,9 +101,12 @@ struct dt_device_node { */ struct list_head domain_list; =20 +#ifdef CONFIG_ARM struct device dev; +#endif }; =20 +#ifdef CONFIG_ARM #define dt_to_dev(dt_node) (&(dt_node)->dev) =20 static inline struct dt_device_node *dev_to_dt(struct device *dev) @@ -112,6 +115,7 @@ static inline struct dt_device_node *dev_to_dt(struct d= evice *dev) =20 return container_of(dev, struct dt_device_node, dev); } +#endif =20 #define MAX_PHANDLE_ARGS 16 struct dt_phandle_args { --=20 2.20.1 From nobody Mon Apr 29 16:16:31 2024 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 header.i=dpsmith@apertussolutions.com; 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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) ARC-Seal: i=2; a=rsa-sha256; t=1639769639; cv=pass; d=zohomail.com; s=zohoarc; b=d9lJeZCRAx816DtTrgn8JRgYOAFpLvJxiORETy3tllK2cZg369ZMGByYxaDjSjxzMOnl9y0OQ139IjrXIS2FWqzXAOiclnbmVPcpyz5U9liH/KypyqulCRvr80NQftEWqlZWlre6g+deNh98pDPW9JI86RP3mUm9i+qlehz/kS0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639769639; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dgVuUxEl8OumX6DLPxWMvtc2xvBs3iAgOedwV7CzitI=; b=OaxOXqaY07vxQSX3ulD451Hzj/gW7vy2yGmRF7rlP61jpfAF9FbQD3RMZgRmzvwBTXEMkWJ7bxb9k23K4h1tlIPzeAyNfalpq1BXQqpW+DOWlye5ER8oNL9DARiKl91QRvjcikglfZ+o2n07hWngDqdhYwyiDsFHDzceRyTop7Y= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dpsmith@apertussolutions.com; 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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1639769639350473.04352009689126; Fri, 17 Dec 2021 11:33:59 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.248849.429265 (Exim 4.92) (envelope-from ) id 1myIys-0001XN-8E; Fri, 17 Dec 2021 19:33:26 +0000 Received: by outflank-mailman (output) from mailman id 248849.429265; Fri, 17 Dec 2021 19:33:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1myIys-0001XG-4O; Fri, 17 Dec 2021 19:33:26 +0000 Received: by outflank-mailman (input) for mailman id 248849; Fri, 17 Dec 2021 19:33:24 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1myIyq-0008Bq-GY for xen-devel@lists.xenproject.org; Fri, 17 Dec 2021 19:33:24 +0000 Received: from sender3-of-o51.zoho.com (sender3-of-o51.zoho.com [136.143.184.51]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 312618c5-5f70-11ec-85d3-df6b77346a89; Fri, 17 Dec 2021 20:33:22 +0100 (CET) Received: from sisyou.hme. (static-72-81-132-2.bltmmd.fios.verizon.net [72.81.132.2]) by mx.zohomail.com with SMTPS id 1639769531248290.15386002298237; Fri, 17 Dec 2021 11:32:11 -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: 312618c5-5f70-11ec-85d3-df6b77346a89 ARC-Seal: i=1; a=rsa-sha256; t=1639769533; cv=none; d=zohomail.com; s=zohoarc; b=S1WP2VhZWvhzFP6tk+Q1Z5DrHfDScNEbww9/HIlXTa5CjAeb6PNtM4J+00V0ci7PqedGQMgvIV/+YqNB5otjQ7kzQMvJ0TzPDfr2rVFVirsjirjjd/37j2f1xDE+805Rr16YHxtr8u4X69Z6sJYBaAWrL1Fb+anCP/E7q3+TJ3Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639769533; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=dgVuUxEl8OumX6DLPxWMvtc2xvBs3iAgOedwV7CzitI=; b=bcnGg3v25vmjbRwpoBU1bBaNh/G5WUtdbl875fx43lAfjx1o1qYGDHf+TPQgM0CkKXaeUcKpRXQr7nWh1wJCgd7Wf/SLcuSpqimrBfBhNROO3Dl+w/mOooSy2l0XkyBaRMHa0mLiznVuTvPXnsI8SuJ5YYhy+8QGQCrLqI38JPI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@apertussolutions.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1639769533; s=zoho; d=apertussolutions.com; i=dpsmith@apertussolutions.com; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=dgVuUxEl8OumX6DLPxWMvtc2xvBs3iAgOedwV7CzitI=; b=TBb79mk266UzrVZPm2hGWQiyNemQDWE9QLbBiLcbbXO4UY2VfHHSd9kUak/tI6ED A+1vNL7D1lu2Z68eqvSjZBqLilOuATlWuNtF+wItR4fnItpCtmN5DnYZuDZA/E8RLEC vjOOxLPEfecmnKNedRuOhhpi8+uvUy1HzFRmbEtc= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , Christopher Clark , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [RFC 05/10] hyperlaunch: update device tree documentation Date: Fri, 17 Dec 2021 18:34:31 -0500 Message-Id: <20211217233437.13791-6-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211217233437.13791-1-dpsmith@apertussolutions.com> References: <20211217233437.13791-1-dpsmith@apertussolutions.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-ZohoMail-DKIM: pass (identity dpsmith@apertussolutions.com) X-ZM-MESSAGEID: 1639769640667100001 This commit is to update the hyperlaunch device tree documentation to align with the DTB parsing implementation. Signed-off-by: Daniel P. Smith Reviewed-by: Christopher Clark --- .../designs/launch/hyperlaunch-devicetree.rst | 448 +++++++++++------- 1 file changed, 278 insertions(+), 170 deletions(-) diff --git a/docs/designs/launch/hyperlaunch-devicetree.rst b/docs/designs/= launch/hyperlaunch-devicetree.rst index b49c98cfbd..7be23b9e71 100644 --- a/docs/designs/launch/hyperlaunch-devicetree.rst +++ b/docs/designs/launch/hyperlaunch-devicetree.rst @@ -13,12 +13,263 @@ difference is the introduction of the ``hypervisor`` n= ode that is under the 2. Allows for the domain construction information to easily be sanitized by simple removing the ``/chosen/hypervisor`` node. =20 + +The Hypervisor node +------------------- + +The ``hypervisor`` node is a top level container for the domains that will= be built +by hypervisor on start up. The node will be named ``hypervisor`` with a `= `compatible`` +property to identify which hypervisors the configuration is intended. The = hypervisor +node will consist of one or more config nodes and one or more domain nodes. + +Properties +"""""""""" + +compatible + Identifies which hypervisors the configuration is compatible. Required. + + Format: "hypervisor,", e.g "hypervisor,xen" + +Child Nodes +""""""""""" + +* config +* domain + +Config Node +----------- + +A ``config`` node is for passing configuration data and identifying any bo= ot +modules that is of interest to the hypervisor. For example this would be = where +Xen would be informed of microcode or XSM policy locations. Each ``config`` +node will require a unique device-tree compliant name as there may be one = or +more ``config`` nodes present in a single dtb file. To identify which +hypervisor the configuration is intended, the required ``compatible`` prop= erty +must be present. + +While the config node is not meant to replace the hypervisor commandline, = there +may be cases where it is better suited for passing configuration details at +boot time. This additional information may be carried in properties assig= ned +to a ``config`` node. If there are any boot modules that are intended for = the +hypervisor, then a ``module`` child node should be provided to identify the +boot module. + +Properties +"""""""""" + +compatible + Identifies the hypervisor the confiugration is intended. Required. + + Format: ",config", e.g "xen,config" + +Child Nodes +""""""""""" + +* module + +Domain Node +----------- + +A ``domain`` node is for describing the construction of a domain. Since th= ere +may be one or more domain nodes, each one requires a unique, DTB compliant= name +and a ``compatible`` property to identify as a domain node. + +A ``domain`` node may provide a ``domid`` property which will be used as = the +requested domain id for the domain with a value of =E2=80=9C0=E2=80=9D sig= nifying to use the +next available domain id, which is the default behavior if omitted. It sho= uld +be noted that a domain configuration is not able to request a domid of =E2= =80=9C0=E2=80=9D. +Beyond that a domain node may have any of the following optional propertie= s. + +Properties +"""""""""" + +compatible + Identifies the node as a domain node and for which hypervisor. Required. + + Format: ",domain", e.g "xen,domain" + +domid + Identifies the domid requested to assign to the domain. + + Format: Integer, e.g <0> + +permissions + This sets what Discretionary Access Control permissions + a domain is assigned. Optional, default is none. + + Format: Bitfield, e.g <3> or <0x00000003> + + PERMISSION_NONE (0) + PERMISSION_CONTROL (1 << 0) + PERMISSION_HARDWARE (1 << 1) + +functions + This identifies what system functions a domain will fulfill. + Optional, the default is none. + + Format: Bitfield, e.g <3221225487> or <0xC0000007> + + FUNCTION_NONE (0) + FUNCTION_BOOT (1 << 0) + FUNCTION_CRASH (1 << 1) + FUNCTION_CONSOLE (1 << 2) + FUNCTION_XENSTORE (1 << 30) + FUNCTION_LEGACY_DOM0 (1 << 31) + +.. note:: The `functions` bits that have been selected to indicate + ``FUNCTION_XENSTORE`` and ``FUNCTION_LEGACY_DOM0`` are the last two bits + (30, 31) such that should these features ever be fully replaced or reti= red, + the flags may be dropped without leaving a gap in the flag set. + +mode + The mode the domain will be executed under. Required. + + Format: Bitfield, e.g <5> or <0x00000005> + + MODE_PARAVIRTUALIZED (1 << 0) PV | PVH/HVM + MODE_ENABLE_DEVICE_MODEL (1 << 1) HVM | PVH + MODE_LONG (1 << 2) 64 BIT | 32 BIT + +domain-uuid + A globally unique identifier for the domain. Optional, + the default is NULL. + + Format: Byte Array, e.g [B3 FB 98 FB 8F 9F 67 A3] + +cpus + The number of vCPUs to be assigned to the domain. Optional, + the default is =E2=80=9C1=E2=80=9D. + + Format: Integer, e.g <0> + +memory + The amount of memory to assign to the domain, in KBs. This field uses a = DTB + Reg which contains a start and size. For memory allocation start may or = may + not have significance but size will always be used for the amount of mem= ory + Required. + + Format: DTB Reg , [], e.g. <0x0 0x20000> + +security-id + The security identity to be assigned to the domain when XSM + is the access control mechanism being used. Optional, + the default is =E2=80=9Csystem_u:system_r:domU_t=E2=80=9D. + + Format: string, e.g. "system_u:system_r:domU_t" + +Child Nodes +""""""""""" + +* module + +Module node +----------- + +This node describes a boot module loaded by the boot loader. A ``module`` = node +will often appear repeatedly and will require a unique and DTB compliant n= ame +for each instance. The compatible property is required to identify that the +node is a ``module`` node, the type of boot module, and what it represents. + +Depending on the type of boot module, the ``module`` node will require eit= her a +``mb-index`` or ``module-addr`` property must be present. They provide the= boot +module specific way of locating the boot module in memory. + +Properties +"""""""""" + +compatible + This identifies what the module is and thus what the hypervisor + should use the module for during domain construction. Required. + + Format: "module,"[, ",module"] + module type: kernel, ramdisk, device-tree, microcode, xsm-policy, + config + + boot module type: multiboot + +mb-index + This identifies the index for this module in the multiboot module chain. + Required for multiboot environments. + + Format: Integer, e.g. <0> + +module-addr + This identifies where in memory this module is located. Required for + non-multiboot environments. + + Format: DTB Reg , e.g. <0x0 0x20000> + +bootargs + This is used to provide the boot params to kernel modules. + + Format: String, e.g. "ro quiet" + +.. note:: The bootargs property is intended for situations where the same= kernel multiboot module is used for more than one domain. + Example Configuration --------------------- =20 -Below are two example device tree definitions for the hypervisor node. The -first is an example of a multiboot-based configuration for x86 and the sec= ond -is a module-based configuration for Arm. +Below are examples device tree definitions for the hypervisor node. The fi= rst +is an example of booting a dom0 only configuration. Afterh that are a +multiboot-based configuration for x86 and a module-based configuration for= Arm. + +Multiboot x86 Configuration Dom0-only: +"""""""""""""""""""""""""""""""""""""" +The following dts file can be provided to the Device Tree compiler, ``dtc`= `, to +produce a dtb file.=20 +:: + + /dts-v1/; + + / { + chosen { + hypervisor { + compatible =3D "hypervisor,xen"; + + dom0 { + compatible =3D "xen,domain"; + + domid =3D <0>; + + permissions =3D <3>; + functions =3D <0xC000000F>; + mode =3D <5>; + + domain-uuid =3D [B3 FB 98 FB 8F 9F 67 A3 8A 6E 62 5A 09 = 13 F0 8C]; =20 + + cpus =3D <1>; + memory =3D <0x0 0x20000000>; + + kernel { + compatible =3D "module,kernel", "multiboot,module"; + mb-index =3D <1>; + }; + }; + + }; + }; + }; + +The resulting dtb file, in this case dom0-only.dtb, can then be used with a +GRUB menuentry as such, +:: + + menuentry 'Devuan GNU/Linux, with Xen hyperlaunch' { + insmod part_gpt + insmod ext2 + set root=3D'hd0,gpt2' + + echo 'Loading Xen hyperlaunch ...' + + multiboot2 /xen.gz placeholder sync_console + echo 'Loading Dom0 hyperlaunch dtb ...' + module2 --nounzip /dom0-only.dtb + echo 'Loading Linux 5.4.36+ ...' + module2 /vmlinuz-5.4.36+ placeholder root=3D/dev/mapper/test01--vg= -root ro quiet + echo 'Loading initial ramdisk ...' + module2 --nounzip /initrd.img-5.4.36+ + } + =20 Multiboot x86 Configuration: """""""""""""""""""""""""""" @@ -31,87 +282,66 @@ Multiboot x86 Configuration: compatible =3D =E2=80=9Chypervisor,xen=E2=80=9D =20 // Configuration container - config { + xen-config { compatible =3D "xen,config"; =20 - module { + microcode { compatible =3D "module,microcode", "multiboot,module"; mb-index =3D <1>; }; =20 - module { + policy { compatible =3D "module,xsm-policy", "multiboot,module"; mb-index =3D <2>; }; }; =20 // Boot Domain definition - domain { + domB { compatible =3D "xen,domain"; =20 domid =3D <0x7FF5>; =20 - // FUNCTION_NONE (0) - // FUNCTION_BOOT (1 << 0) - // FUNCTION_CRASH (1 << 1) - // FUNCTION_CONSOLE (1 << 2) - // FUNCTION_XENSTORE (1 << 30) - // FUNCTION_LEGACY_DOM0 (1 << 31) functions =3D <0x00000001>; =20 memory =3D <0x0 0x20000>; cpus =3D <1>; - module { + + kernel { compatible =3D "module,kernel", "multiboot,module"; mb-index =3D <3>; }; - - module { + initrd { compatible =3D "module,ramdisk", "multiboot,module"; mb-index =3D <4>; }; - module { + dom-config { compatible =3D "module,config", "multiboot,module"; mb-index =3D <5>; }; =20 // Classic Dom0 definition - domain { + dom0 { compatible =3D "xen,domain"; =20 domid =3D <0>; =20 - // PERMISSION_NONE (0) - // PERMISSION_CONTROL (1 << 0) - // PERMISSION_HARDWARE (1 << 1) permissions =3D <3>; - - // FUNCTION_NONE (0) - // FUNCTION_BOOT (1 << 0) - // FUNCTION_CRASH (1 << 1) - // FUNCTION_CONSOLE (1 << 2) - // FUNCTION_XENSTORE (1 << 30) - // FUNCTION_LEGACY_DOM0 (1 << 31) functions =3D <0xC0000006>; - - // MODE_PARAVIRTUALIZED (1 << 0) /* PV | PVH/HVM */ - // MODE_ENABLE_DEVICE_MODEL (1 << 1) /* HVM | PVH */ - // MODE_LONG (1 << 2) /* 64 BIT | 32 BIT */ mode =3D <5>; /* 64 BIT, PV */ =20 - // UUID domain-uuid =3D [B3 FB 98 FB 8F 9F 67 A3]; =20 cpus =3D <1>; memory =3D <0x0 0x20000>; - security-id =3D =E2=80=9Cdom0_t; + security-id =3D =E2=80=9Csystem_u:system_r:dom0_t; =20 - module { + kernel { compatible =3D "module,kernel", "multiboot,module"; mb-index =3D <6>; bootargs =3D "console=3Dhvc0"; }; - module { + initrd { compatible =3D "module,ramdisk", "multiboot,module"; mb-index =3D <7>; }; @@ -137,15 +367,15 @@ Module Arm Configuration: compatible =3D =E2=80=9Chypervisor,xen=E2=80=9D =20 // Configuration container - config { + xen-config { compatible =3D "xen,config"; =20 - module { + microcode { compatible =3D "module,microcode=E2=80=9D; module-addr =3D <0x0000ff00 0x80>; }; =20 - module { + policy { compatible =3D "module,xsm-policy"; module-addr =3D <0x0000ff00 0x80>; =20 @@ -153,72 +383,51 @@ Module Arm Configuration: }; =20 // Boot Domain definition - domain { + domB { compatible =3D "xen,domain"; =20 domid =3D <0x7FF5>; =20 - // FUNCTION_NONE (0) - // FUNCTION_BOOT (1 << 0) - // FUNCTION_CRASH (1 << 1) - // FUNCTION_CONSOLE (1 << 2) - // FUNCTION_XENSTORE (1 << 30) - // FUNCTION_LEGACY_DOM0 (1 << 31) functions =3D <0x00000001>; =20 memory =3D <0x0 0x20000>; cpus =3D <1>; - module { + + kernel { compatible =3D "module,kernel"; module-addr =3D <0x0000ff00 0x80>; }; - - module { + initrd { compatible =3D "module,ramdisk"; module-addr =3D <0x0000ff00 0x80>; }; - module { + dom-config { compatible =3D "module,config"; module-addr =3D <0x0000ff00 0x80>; }; =20 // Classic Dom0 definition - domain@0 { + dom0 { compatible =3D "xen,domain"; =20 domid =3D <0>; =20 - // PERMISSION_NONE (0) - // PERMISSION_CONTROL (1 << 0) - // PERMISSION_HARDWARE (1 << 1) permissions =3D <3>; - - // FUNCTION_NONE (0) - // FUNCTION_BOOT (1 << 0) - // FUNCTION_CRASH (1 << 1) - // FUNCTION_CONSOLE (1 << 2) - // FUNCTION_XENSTORE (1 << 30) - // FUNCTION_LEGACY_DOM0 (1 << 31) functions =3D <0xC0000006>; - - // MODE_PARAVIRTUALIZED (1 << 0) /* PV | PVH/HVM */ - // MODE_ENABLE_DEVICE_MODEL (1 << 1) /* HVM | PVH */ - // MODE_LONG (1 << 2) /* 64 BIT | 32 BIT */ mode =3D <5>; /* 64 BIT, PV */ =20 - // UUID domain-uuid =3D [B3 FB 98 FB 8F 9F 67 A3]; =20 cpus =3D <1>; memory =3D <0x0 0x20000>; - security-id =3D =E2=80=9Cdom0_t=E2=80=9D; + security-id =3D =E2=80=9Csystem_u:system_r:dom0_t=E2=80=9D; =20 - module { + kernel { compatible =3D "module,kernel"; module-addr =3D <0x0000ff00 0x80>; bootargs =3D "console=3Dhvc0"; }; - module { + intird { compatible =3D "module,ramdisk"; module-addr =3D <0x0000ff00 0x80>; }; @@ -240,104 +449,3 @@ provided to Xen using the standard method currently i= n use. The remaining modules would need to be loaded in the respective addresses specified in t= he `module-addr` property. =20 - -The Hypervisor node -------------------- - -The hypervisor node is a top level container for the domains that will be = built -by hypervisor on start up. On the ``hypervisor`` node the ``compatible`` -property is used to identify the type of hypervisor node present.. - -compatible - Identifies the type of node. Required. - -The Config node ---------------- - -A config node is for detailing any modules that are of interest to Xen its= elf. -For example this would be where Xen would be informed of microcode or XSM -policy locations. If the modules are multiboot modules and are able to be -located by index within the module chain, the ``mb-index`` property should= be -used to specify the index in the multiboot module chain.. If the module wi= ll be -located by physical memory address, then the ``module-addr`` property shou= ld be -used to identify the location and size of the module. - -compatible - Identifies the type of node. Required. - -The Domain node ---------------- - -A domain node is for describing the construction of a domain. It may provi= de a -domid property which will be used as the requested domain id for the domain -with a value of =E2=80=9C0=E2=80=9D signifying to use the next available d= omain id, which is -the default behavior if omitted. A domain configuration is not able to req= uest -a domid of =E2=80=9C0=E2=80=9D. After that a domain node may have any of t= he following -parameters, - -compatible - Identifies the type of node. Required. - -domid - Identifies the domid requested to assign to the domain. Required. - -permissions - This sets what Discretionary Access Control permissions - a domain is assigned. Optional, default is none. - -functions - This identifies what system functions a domain will fulfill. - Optional, the default is none. - -.. note:: The `functions` bits that have been selected to indicate - ``FUNCTION_XENSTORE`` and ``FUNCTION_LEGACY_DOM0`` are the last two bits - (30, 31) such that should these features ever be fully retired, the fla= gs may - be dropped without leaving a gap in the flag set. - -mode - The mode the domain will be executed under. Required. - -domain-uuid - A globally unique identifier for the domain. Optional, - the default is NULL. - -cpus - The number of vCPUs to be assigned to the domain. Optional, - the default is =E2=80=9C1=E2=80=9D. - -memory - The amount of memory to assign to the domain, in KBs. - Required. - -security-id - The security identity to be assigned to the domain when XSM - is the access control mechanism being used. Optional, - the default is =E2=80=9Cdomu_t=E2=80=9D. - -The Module node ---------------- - -This node describes a boot module loaded by the boot loader. The required -compatible property follows the format: module, where type can be -=E2=80=9Ckernel=E2=80=9D, =E2=80=9Cramdisk=E2=80=9D, =E2=80=9Cdevice-tree= =E2=80=9D, =E2=80=9Cmicrocode=E2=80=9D, =E2=80=9Cxsm-policy=E2=80=9D or =E2= =80=9Cconfig=E2=80=9D. In -the case the module is a multiboot module, the additional property string -=E2=80=9Cmultiboot,module=E2=80=9D may be present. One of two properties i= s required and -identifies how to locate the module. They are the mb-index, used for multi= boot -modules, and the module-addr for memory address based location. - -compatible - This identifies what the module is and thus what the hypervisor - should use the module for during domain construction. Required. - -mb-index - This identifies the index for this module in the multiboot module chain. - Required for multiboot environments. - -module-addr - This identifies where in memory this module is located. Required for - non-multiboot environments. - -bootargs - This is used to provide the boot params to kernel modules. - -.. note:: The bootargs property is intended for situations where the same= kernel multiboot module is used for more than one domain. --=20 2.20.1 From nobody Mon Apr 29 16:16:31 2024 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 header.i=dpsmith@apertussolutions.com; 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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) ARC-Seal: i=2; a=rsa-sha256; t=1639769654; cv=pass; d=zohomail.com; s=zohoarc; b=UxYFYqm0q0frxLngiXdRaZIf9FTl1u62qWFeC2sL0tSZoLNU4rcfbbzNMhLBIcKXLZ9kRVW4qDzKtvd2iYO0LUTy92uWebzMn4Uhd67tCIpYN4nB6MOGBuznp14wrIDLxQUGor9yXEHilHMct9LiI8gMwLPCAqlBrvo8W92yDS4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639769654; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=em6dzW9XaL2Yw7Hp9YltudsddXj7DesXGxfaC/g+vO8=; b=lvXPR8kal2U5+Cjvm6rFO71+WQtUJOllijGXHiORvd1JGEJKzluQ8I4ebLIFXijrx5kKGvDsOhdeTNlzyBPCG0pKcaHe3aSgx1Ruk9rdE+M8g7EnNh26Kp+mfCvPaz5uRiVacz5poBYYUWIbZ/BveDYhDwHFA7A8zHaOH2WnSvg= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dpsmith@apertussolutions.com; 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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 163976965420370.47384891801448; Fri, 17 Dec 2021 11:34:14 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.248853.429276 (Exim 4.92) (envelope-from ) id 1myIz5-00026N-Ly; Fri, 17 Dec 2021 19:33:39 +0000 Received: by outflank-mailman (output) from mailman id 248853.429276; Fri, 17 Dec 2021 19:33:39 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1myIz5-00026C-IS; Fri, 17 Dec 2021 19:33:39 +0000 Received: by outflank-mailman (input) for mailman id 248853; Fri, 17 Dec 2021 19:33:38 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1myIz4-0008Bq-Fr for xen-devel@lists.xenproject.org; Fri, 17 Dec 2021 19:33:38 +0000 Received: from sender3-of-o52.zoho.com (sender3-of-o52.zoho.com [136.143.184.52]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 39de5f15-5f70-11ec-85d3-df6b77346a89; Fri, 17 Dec 2021 20:33:37 +0100 (CET) Received: from sisyou.hme. (static-72-81-132-2.bltmmd.fios.verizon.net [72.81.132.2]) by mx.zohomail.com with SMTPS id 1639769532601760.2898655813524; Fri, 17 Dec 2021 11:32:12 -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: 39de5f15-5f70-11ec-85d3-df6b77346a89 ARC-Seal: i=1; a=rsa-sha256; t=1639769534; cv=none; d=zohomail.com; s=zohoarc; b=WRGpN1segHzywaEb9+PBaysX05z/rI3teEUy1Kv24Ijdp2khAt0UzmaJiy+mD70gE2HqZs2I/sqmCFfKG+iQ0CSgOqHdYpjDVWQNlNzwYRXwpxA4qQ4ALLdls31u3BLPd/SS1eithyjL/G5nTpOGGeMkDoMZ1qM678nY8KTDdDA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639769534; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=em6dzW9XaL2Yw7Hp9YltudsddXj7DesXGxfaC/g+vO8=; b=IzrMpgK7REYjo70CQH9CLdKSaYFKtU9j2yk97O8eKiBr72j3Nu+oFleaHiKLYJtmky8yHYyPMISHgqEVDr3ddNxLKFNsNGmqnCoVwdWXdNQ0jw9uaC4lrBobLrW5HUSfQG//vI5isga6JMyfTH33szAxN7yQ/5ZYLO223AKNJyY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@apertussolutions.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1639769534; s=zoho; d=apertussolutions.com; i=dpsmith@apertussolutions.com; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=em6dzW9XaL2Yw7Hp9YltudsddXj7DesXGxfaC/g+vO8=; b=VDHAS+pXWoOfkL4eBwAyLMMY4vFpQWDhabubQrg1pKDe3EYe6aABzeAhlF1bqHer CJDrV+KdjGlVq8y7mhuhB+tQf/X8LIB4e5M35X0IiWQ9m2PnWKWpuaPz7AGHnlrJcva xxgOwyGA3DhkYxwEO5z3d0HpMXti25xvauWgzE1I= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , Christopher Clark , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [RFC 06/10] hyperlaunch: add structures to hold parsed dtb Date: Fri, 17 Dec 2021 18:34:32 -0500 Message-Id: <20211217233437.13791-7-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211217233437.13791-1-dpsmith@apertussolutions.com> References: <20211217233437.13791-1-dpsmith@apertussolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-ZohoMail-DKIM: pass (identity dpsmith@apertussolutions.com) X-ZM-MESSAGEID: 1639769656136100001 Content-Type: text/plain; charset="utf-8" Hyperlaunch builds from dom0less' `struct bootmodule` as the representation= of a boot module provided by a bootloader. From there it expands to cover the representations proposed in the hyperlaunch design documentation. Signed-off-by: Daniel P. Smith Reviewed-by: Christopher Clark --- xen/include/xen/setup.h | 81 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/xen/include/xen/setup.h b/xen/include/xen/setup.h index 6fbe87860e..69ea042716 100644 --- a/xen/include/xen/setup.h +++ b/xen/include/xen/setup.h @@ -5,6 +5,87 @@ =20 #include =20 +/* Reusing Dom0less definitions */ +typedef enum { + BOOTMOD_XEN, + BOOTMOD_FDT, + BOOTMOD_KERNEL, + BOOTMOD_RAMDISK, + BOOTMOD_MICROCODE, + BOOTMOD_XSM, + BOOTMOD_GUEST_DTB, + BOOTMOD_GUEST_CONF, + BOOTMOD_UNKNOWN +} bootmodule_kind; + +struct bootmodule { + bootmodule_kind kind; + bool domU; + paddr_t start; + paddr_t size; +}; + +/* End reuse */ + +struct memrange { + paddr_t start; + paddr_t size; +}; + +/* Currently only two config modules supported, microcode and xsm policy */ +#define HL_MAX_CONFIG_MODULES 2 +struct bootconfig { + uint16_t nr_mods; + struct bootmodule mods[HL_MAX_CONFIG_MODULES]; +}; + +struct bootdomain { +#define HL_PERMISSION_NONE (0) +#define HL_PERMISSION_CONTROL (1 << 0) +#define HL_PERMISSION_HARDWARE (1 << 1) + uint32_t permissions; + +#define HL_FUNCTION_NONE (0) +#define HL_FUNCTION_BOOT (1 << 0) +#define HL_FUNCTION_CRASH (1 << 1) +#define HL_FUNCTION_CONSOLE (1 << 2) +#define HL_FUNCTION_XENSTORE (1 << 30) +#define HL_FUNCTION_LEGACY_DOM0 (1 << 31) + uint32_t functions; + +#define HL_MODE_PARAVIRTUALIZED (1 << 0) /* PV | PVH/HVM */ +#define HL_MODE_ENABLE_DEVICE_MODEL (1 << 1) /* HVM | PVH */ +#define HL_MODE_LONG (1 << 2) /* 64 BIT | 32 BIT */ + uint32_t mode; + + domid_t domid; + uint8_t uuid[16]; + + uint32_t ncpus; + bool maxmem_set; + struct memrange memrange[2]; /* 0: min; 1: max */ + +#define HL_MAX_SECID_LEN 64 + unsigned char secid[HL_MAX_SECID_LEN]; + +#define HL_MAX_DOMAIN_MODULES 3 + uint16_t nr_mods; + struct bootmodule modules[HL_MAX_DOMAIN_MODULES]; +#define HL_MAX_CMDLINE_LEN 1024 + unsigned char cmdline[HL_MAX_CMDLINE_LEN]; +}; + +struct hyperlaunch_config { + const void *fdt; +#ifdef CONFIG_MULTIBOOT + module_t *mods; +#endif + struct bootconfig config; +#define HL_MAX_BOOT_DOMAINS 64 + uint16_t nr_doms; + struct bootdomain domains[HL_MAX_BOOT_DOMAINS]; +}; + #ifdef CONFIG_HYPERLAUNCH extern bool hyperlaunch_enabled; #else --=20 2.20.1 From nobody Mon Apr 29 16:16:31 2024 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 header.i=dpsmith@apertussolutions.com; 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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) ARC-Seal: i=2; a=rsa-sha256; t=1639769664; cv=pass; d=zohomail.com; s=zohoarc; b=KvgcZokKmVJad+nfEavACSf3AoDEUHAFZwAL5pSouigegqavvhEO9lEQAzv1kzpwNbP8aGSiyUmUEsSyZFvFrAvFD0ntJv/M2+tfWZF69bIdf34cB5+/IY5n5QUNQZM1l7bfION5AcvKhPB1+djvQCZqLyU9IiM5YS7pUuuPL4w= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639769664; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7qK/q8L3Dj8oS1Z+e7fSt0NndhOrav9jTYYOlCWbcqs=; b=kg+KgbSZfqZVkahv1495NoblP7Hp/5XaJmfugU/M5ej3AAKHxSy9ZfRHZDzpS+PRKMAsra3AFLjBVhViHYFV5racvCDCv+hWXjvomSclduNLyG3A0OHM6ssPVr0IF2vHOHIJUOfujzVrF7717XSIUtx4n+ljm4vw6IqfSn6Tjoo= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dpsmith@apertussolutions.com; 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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1639769664894873.3292077249408; Fri, 17 Dec 2021 11:34:24 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.248856.429287 (Exim 4.92) (envelope-from ) id 1myIzH-0002eK-VX; Fri, 17 Dec 2021 19:33:51 +0000 Received: by outflank-mailman (output) from mailman id 248856.429287; Fri, 17 Dec 2021 19:33:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1myIzH-0002eD-RD; Fri, 17 Dec 2021 19:33:51 +0000 Received: by outflank-mailman (input) for mailman id 248856; Fri, 17 Dec 2021 19:33:51 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1myIzG-0008Bq-RP for xen-devel@lists.xenproject.org; Fri, 17 Dec 2021 19:33:51 +0000 Received: from sender3-of-o50.zoho.com (sender3-of-o50.zoho.com [136.143.184.50]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 414180b7-5f70-11ec-85d3-df6b77346a89; Fri, 17 Dec 2021 20:33:49 +0100 (CET) Received: from sisyou.hme. (static-72-81-132-2.bltmmd.fios.verizon.net [72.81.132.2]) by mx.zohomail.com with SMTPS id 1639769533980515.4791303301643; Fri, 17 Dec 2021 11:32:13 -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: 414180b7-5f70-11ec-85d3-df6b77346a89 ARC-Seal: i=1; a=rsa-sha256; t=1639769536; cv=none; d=zohomail.com; s=zohoarc; b=LRwyF7YjPUIvDIKpwNgdKqs0A5QpKDYz1hbsgNq0OlauuTnag0Juut2BDpHxuKM4N8N4vcPvpEpCAtbFSBmJfnr8ZRAz07gzKbpkhIVX9XB1+GCDWOaHKMsBm3HkZEpDmnAcHSv2v3maxU/iN2s232XcgkdpE6xMfIOwpICToQQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639769536; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=7qK/q8L3Dj8oS1Z+e7fSt0NndhOrav9jTYYOlCWbcqs=; b=NuhQmMUy4u9uhT32kbAEhrxNEG57dkBmNvi1+QIqmu2UM/mWuT0lIquTSQ8EwJ2aHTTyzgE1pSkYR7o37S/SanD9UB2ddvuwS1vYJ6/7s3xMdJx3U8z4u7s1qa4wv/xMoehiAooD8S7wbXApUb4Cnm7x0ONqi0iOBroPbDpvGB8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@apertussolutions.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1639769536; s=zoho; d=apertussolutions.com; i=dpsmith@apertussolutions.com; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=7qK/q8L3Dj8oS1Z+e7fSt0NndhOrav9jTYYOlCWbcqs=; b=WfbS9O5T4z2pvcJtWcCoS119bQSahtxTXzmbptpSuh5zuruYweQmyNdNTfcK8OEl zqLTXiQcBwomOZnX3+pBicc8JnjspQNwhGYsLYjV6qt4+32rKxReDz2xML2qDPqL2jf q2a1QKVS0AD3hzWDwO4zLWYKqgnX7DzsysmRH3m4= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , Christopher Clark , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [RFC 07/10] hyperlaunch: add parsing of dtb Date: Fri, 17 Dec 2021 18:34:33 -0500 Message-Id: <20211217233437.13791-8-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211217233437.13791-1-dpsmith@apertussolutions.com> References: <20211217233437.13791-1-dpsmith@apertussolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-ZohoMail-DKIM: pass (identity dpsmith@apertussolutions.com) X-ZM-MESSAGEID: 1639769666447100001 Content-Type: text/plain; charset="utf-8" This commit implements the parsing of a hyperlaunch device tree. It is implemented to support a device tree containing any number of Config nodes = and Domain nodes. RFC Note: Xen supports working with flattened device trees (FDT), DTB files, and unflattened device trees, in-memory structures. The library libfdt prov= ides low-level interaction with FDTs with higher order functions spread between arch/arm/bootfdt.c and a few in device_tree.c. While there are some FDT handlers in device_tree.c, it primarily provides the functionality for hand= ling unflattened device trees. For this RFC the general higher order FDT functions in bootfdt.c usable by hyperlaunch were duplicated into common/setup.c for hyperlaunch usage. Long= er term it would be desired to see all reusable FDT functions centralized in common separate from the unflattened device tree handling code in device_tree.c. Signed-off-by: Daniel P. Smith Reviewed-by: Christopher Clark --- xen/common/setup.c | 367 +++++++++++++++++++++++++++++++++++++++- xen/include/xen/setup.h | 22 ++- 2 files changed, 387 insertions(+), 2 deletions(-) diff --git a/xen/common/setup.c b/xen/common/setup.c index e18ea14fe0..af2b1a422d 100644 --- a/xen/common/setup.c +++ b/xen/common/setup.c @@ -1,8 +1,373 @@ -#include +#include /* needed by device_tree.h */ +#include #include +#include +#include +#include +#include =20 #ifdef CONFIG_HYPERLAUNCH =20 bool __initdata hyperlaunch_enabled; +static struct hyperlaunch_config __initdata hl_config; + +/* Reusing from arch/arm/bootfdt.c */ + +static bool __init device_tree_node_compatible(const void *fdt, int node, + const char *match) +{ + int len, l; + int mlen; + const void *prop; + + mlen =3D strlen(match); + + prop =3D fdt_getprop(fdt, node, "compatible", &len); + if ( prop =3D=3D NULL ) + return false; + + while ( len > 0 ) { + if ( !dt_compat_cmp(prop, match) ) + return true; + l =3D strlen(prop) + 1; + prop +=3D l; + len -=3D l; + } + + return false; +} + +static void __init device_tree_get_reg( + const __be32 **cell, uint32_t address_cells, uint32_t size_cells, + uint64_t *start, uint64_t *size) +{ + *start =3D dt_next_cell(address_cells, cell); + *size =3D dt_next_cell(size_cells, cell); +} + +static uint32_t __init device_tree_get_u32( + const void *fdt, int node, const char *prop_name, u32 dflt) +{ + const struct fdt_property *prop; + + prop =3D fdt_get_property(fdt, node, prop_name, NULL); + if ( !prop || prop->len < sizeof(u32) ) + return dflt; + + return fdt32_to_cpu(*(uint32_t*)prop->data); +} + +/** + * device_tree_for_each_node - iterate over all device tree sub-nodes + * @fdt: flat device tree. + * @node: parent node to start the search from + * @func: function to call for each sub-node. + * @data: data to pass to @func. + * + * Any nodes nested at DEVICE_TREE_MAX_DEPTH or deeper are ignored. + * + * Returns 0 if all nodes were iterated over successfully. If @func + * returns a value different from 0, that value is returned immediately. + */ +int __init device_tree_for_each_node( + const void *fdt, int node, device_tree_node_func func, void *data) +{ + /* + * We only care about relative depth increments, assume depth of + * node is 0 for simplicity. + */ + int depth =3D 0; + const int first_node =3D node; + u32 address_cells[DEVICE_TREE_MAX_DEPTH]; + u32 size_cells[DEVICE_TREE_MAX_DEPTH]; + int ret; + + do { + const char *name =3D fdt_get_name(fdt, node, NULL); + u32 as, ss; + + if ( depth >=3D DEVICE_TREE_MAX_DEPTH ) + { + printk("Warning: device tree node `%s' is nested too deep\n", + name); + continue; + } + + as =3D depth > 0 ? address_cells[depth-1] : DT_ROOT_NODE_ADDR_CELL= S_DEFAULT; + ss =3D depth > 0 ? size_cells[depth-1] : DT_ROOT_NODE_SIZE_CELLS_D= EFAULT; + + address_cells[depth] =3D device_tree_get_u32(fdt, node, + "#address-cells", as); + size_cells[depth] =3D device_tree_get_u32(fdt, node, + "#size-cells", ss); + + /* skip the first node */ + if ( node !=3D first_node ) + { + ret =3D func(fdt, node, name, depth, as, ss, data); + if ( ret !=3D 0 ) + return ret; + } + + node =3D fdt_next_node(fdt, node, &depth); + } while ( node >=3D 0 && depth > 0 ); + + return 0; +} + +/* End reuse */ + +static bool read_module( + const void *fdt, int node, uint32_t address_cells, uint32_t size_cells, + struct hyperlaunch_config *config, struct bootmodule *bm) +{ + const struct fdt_property *prop; + const __be32 *cell; + bootmodule_kind kind =3D BOOTMOD_UNKNOWN; + int len; + + if ( device_tree_node_compatible(fdt, node, "module,kernel") ) + kind =3D BOOTMOD_KERNEL; + + if ( device_tree_node_compatible(fdt, node, "module,ramdisk") ) + kind =3D BOOTMOD_RAMDISK; + + if ( device_tree_node_compatible(fdt, node, "module,microcode") ) + kind =3D BOOTMOD_MICROCODE; + + if ( device_tree_node_compatible(fdt, node, "module,xsm-policy") ) + kind =3D BOOTMOD_XSM; + + if ( device_tree_node_compatible(fdt, node, "module,config") ) + kind =3D BOOTMOD_GUEST_CONF; + + if ( device_tree_node_compatible(fdt, node, "multiboot,module") ) + { +#ifdef CONFIG_MULTIBOOT + uint32_t idx; + + idx =3D (uint32_t)device_tree_get_u32(fdt, node, "mb-index", 0); + if ( idx =3D=3D 0 ) + return false; + + bm->kind =3D kind; + /* under multiboot, start will just hold pointer to module entry */ + bm->start =3D (paddr_t)(&config->mods[idx]); + + return true; +#else + return false; +#endif + } + + prop =3D fdt_get_property(fdt, node, "module-addr", &len); + if ( !prop ) + return false; + + if ( len < dt_cells_to_size(address_cells + size_cells) ) + return false; + + cell =3D (const __be32 *)prop->data; + device_tree_get_reg( + &cell, address_cells, size_cells, &(bm->start), &(bm->size)); + bm->kind =3D kind; + + return true; +} + +static int process_config_node( + const void *fdt, int node, const char *name, int depth, + uint32_t address_cells, uint32_t size_cells, void *data) +{ + struct hyperlaunch_config *config =3D (struct hyperlaunch_config *)dat= a; + uint16_t *count; + int node_next; + + if ( !config ) + return -1; + + for ( node_next =3D fdt_first_subnode(fdt, node), + count =3D &(config->config.nr_mods); + node_next > 0; + node_next =3D fdt_next_subnode(fdt, node_next), + (*count)++ ) + { + struct bootmodule *next_bm; + + if ( *count >=3D HL_MAX_CONFIG_MODULES ) + { + printk("Warning: truncating to %d hyperlaunch config modules\n= ", + HL_MAX_CONFIG_MODULES); + return 0; + } + + next_bm =3D &config->config.mods[*count]; + read_module(fdt, node_next, address_cells, size_cells, config, nex= t_bm); + } + + return 0; +} + +static int process_domain_node( + const void *fdt, int node, const char *name, int depth, + uint32_t address_cells, uint32_t size_cells, void *data) +{ + struct hyperlaunch_config *config =3D (struct hyperlaunch_config *)dat= a; + const struct fdt_property *prop; + struct bootdomain *domain; + uint16_t *count; + const __be32 *cell; + int node_next, i, plen; + + if ( !config ) + return -1; + + domain =3D &config->domains[config->nr_doms]; + + domain->domid =3D (domid_t)device_tree_get_u32(fdt, node, "domid", 0); + domain->permissions =3D device_tree_get_u32(fdt, node, "permissions", = 0); + domain->functions =3D device_tree_get_u32(fdt, node, "functions", 0); + domain->mode =3D device_tree_get_u32(fdt, node, "mode", 0); + + prop =3D fdt_get_property(fdt, node, "domain-uuid", &plen); + if ( prop ) + for ( i=3D0; i < sizeof(domain->uuid) % sizeof(uint32_t); i++ ) + *(domain->uuid + i) =3D fdt32_to_cpu((uint32_t)prop->data[i]); + + domain->ncpus =3D device_tree_get_u32(fdt, node, "cpus", 1); + + prop =3D fdt_get_property(fdt, node, "memory", &plen); + if ( !prop ) + panic("node %s missing `memory' property\n", name); + + /* TODO: convert to support reading up to two values from mem prop, mi= n and max */ + cell =3D (const __be32 *)prop->data; + device_tree_get_reg(&cell, address_cells, size_cells, + &domain->memrange[0].start, &domain->memrange[0].s= ize); + + prop =3D fdt_get_property(fdt, node, "security-id", + &plen); + if ( prop ) + { + int size =3D fdt32_to_cpu(prop->len); + size =3D size > HL_MAX_SECID_LEN ? + HL_MAX_SECID_LEN : size; + memcpy(domain->secid, prop->data, size); + } + + for ( node_next =3D fdt_first_subnode(fdt, node), + count =3D &(domain->nr_mods); + node_next > 0; + node_next =3D fdt_next_subnode(fdt, node_next), + (*count)++ ) + { + struct bootmodule *next_bm; + + if ( name =3D=3D NULL ) + continue; + + if ( *count >=3D HL_MAX_DOMAIN_MODULES ) + { + printk("Warning: truncating to %d hyperlaunch domain modules" + " for %dth domain\n", HL_MAX_DOMAIN_MODULES, + config->nr_doms); + break; + } + + if ( device_tree_node_compatible(fdt, node_next, "module,kernel") ) + { + prop =3D fdt_get_property(fdt, node_next, "bootargs", &plen); + if ( prop ) + { + int size =3D fdt32_to_cpu(prop->len); + size =3D size > HL_MAX_CMDLINE_LEN ? HL_MAX_CMDLINE_LEN : = size; + memcpy(domain->cmdline, prop->data, size); + } + } + + next_bm =3D &domain->modules[*count]; + read_module(fdt, node_next, address_cells, size_cells, config, nex= t_bm); + } + + config->nr_doms++; + + return 0; +} + +static int __init hl_scan_node( + const void *fdt, int node, const char *name, int depth, u32 address_ce= lls, + u32 size_cells, void *data) +{ + int rc =3D -1; + + /* skip nodes that are not direct children of the hyperlaunch node */ + if ( depth > 1 ) + return 0; + + if ( device_tree_node_compatible(fdt, node, "xen,config") ) + rc =3D process_config_node(fdt, node, name, depth, + address_cells, size_cells, data); + else if ( device_tree_node_compatible(fdt, node, "xen,domain") ) + rc =3D process_domain_node(fdt, node, name, depth, + address_cells, size_cells, data); + + if ( rc < 0 ) + printk("hyperlaunch fdt: node `%s': parsing failed\n", name); + + return rc; +} + +/* hyperlaunch_init: + * Attempts to initialize hyperlaunch config + * + * Returns: + * -1: Not a valid DTB + * 0: Valid DTB but not a valid hyperlaunch device tree + * 1: Valid hyperlaunch device tree + */ +int __init hyperlaunch_init(const void *fdt) +{ + int hl_node, ret; + + ret =3D fdt_check_header(fdt); + if ( ret < 0 ) + return -1; + + hl_node =3D fdt_path_offset(fdt, "/chosen/hypervisor"); + if ( hl_node < 0 ) + return 0; + + ret =3D device_tree_for_each_node(fdt, hl_node, hl_scan_node, &hl_conf= ig); + if ( ret > 0 ) + return 0; + + hyperlaunch_enabled =3D true; + + return 1; +} + +#ifdef CONFIG_MULTIBOOT +bool __init hyperlaunch_mb_init(module_t *mods) +{ + bool ret =3D false; + /* fdt is required to be module 0 */ + void *fdt =3D _p(mods->mod_start); + + hl_config.mods =3D mods; + + switch ( hyperlaunch_init(fdt) ) + { + case 1: + ret =3D true; + case -1: + break; + case 0: + default: + panic("HYPERLAUNCH: nonrecoverable error occured processing DTB\n"= ); + } + + return ret; +} +#endif =20 #endif diff --git a/xen/include/xen/setup.h b/xen/include/xen/setup.h index 69ea042716..fd4c23c08f 100644 --- a/xen/include/xen/setup.h +++ b/xen/include/xen/setup.h @@ -88,8 +88,28 @@ struct hyperlaunch_config { =20 #ifdef CONFIG_HYPERLAUNCH extern bool hyperlaunch_enabled; -#else + +int __init hyperlaunch_init(const void *fdt); + +#ifdef CONFIG_MULTIBOOT +bool __init hyperlaunch_mb_init(module_t *mods); +#endif + +#else /* CONFIG_HYPERLAUNCH */ + #define hyperlaunch_enabled false + +static inline int __init hyperlaunch_init(const void *fdt) +{ + return 0; +} + +#ifdef CONFIG_MULTIBOOT +static inline bool __init hyperlaunch_mb_init(module_t *mods) +{ + return false; +} #endif =20 +#endif /* CONFIG_HYPERLAUNCH */ #endif /* XEN_SETUP_H */ --=20 2.20.1 From nobody Mon Apr 29 16:16:31 2024 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 header.i=dpsmith@apertussolutions.com; 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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) ARC-Seal: i=2; a=rsa-sha256; t=1639769985; cv=pass; d=zohomail.com; s=zohoarc; b=XGLz8XtiLdciwenSyEUMX2MFZNlPOPCVl73VQe5de4ISILC0vXB11B541RMWbjBS6AcMaks9b2kNozovlMGtifIYpOWVXFilgG5I1mFBOHTX3ua49TboZ8V41t+U/Nxu3Rz2hj+iuHeAL0L6UQHTjIBes2rARSaGaNceSx514+w= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639769985; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NYrY0kc0PHr/rCAcUSGijUpEU56IAIoRqii3V14eoTI=; b=GGAIRPVHOU/jA8OiNhaRrUjx7ZRy6c7h2+HPRLMLpCxQIL5h73CHsvP2ceufPXYoia0PlnQ3U3Kqmcb6ASJA6OyVD3g37JCG/w1ux5/QVGONj0WkHi7rHXK2Uh8lwGS+ZP++lEXeHtLKo0VCNLAHTpDS62rjtCHk9BrJ4zEaCh8= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dpsmith@apertussolutions.com; 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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1639769985398304.53957277208644; Fri, 17 Dec 2021 11:39:45 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.248883.429309 (Exim 4.92) (envelope-from ) id 1myJ4n-0004Gb-0I; Fri, 17 Dec 2021 19:39:33 +0000 Received: by outflank-mailman (output) from mailman id 248883.429309; Fri, 17 Dec 2021 19:39:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1myJ4m-0004GS-S6; Fri, 17 Dec 2021 19:39:32 +0000 Received: by outflank-mailman (input) for mailman id 248883; Fri, 17 Dec 2021 19:39:31 +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 1myIzT-0007M8-BN for xen-devel@lists.xenproject.org; Fri, 17 Dec 2021 19:34:03 +0000 Received: from sender3-of-o51.zoho.com (sender3-of-o51.zoho.com [136.143.184.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 4931a961-5f70-11ec-9e60-abaf8a552007; Fri, 17 Dec 2021 20:34:02 +0100 (CET) Received: from sisyou.hme. (static-72-81-132-2.bltmmd.fios.verizon.net [72.81.132.2]) by mx.zohomail.com with SMTPS id 163976953529295.99852145326895; Fri, 17 Dec 2021 11:32:15 -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: 4931a961-5f70-11ec-9e60-abaf8a552007 ARC-Seal: i=1; a=rsa-sha256; t=1639769537; cv=none; d=zohomail.com; s=zohoarc; b=OsGAQ/VNAFE26cjZThMusRRk78fqvUF8U7Et/uxu+6oyDS6nW4jHhfXr4zuhIHr0szS5SsSiR9oIXFDs6Lx5xmza2lbJKnN2DvfVqTLwxkKPAIo+Hw22Eyg6TzFayGWiyFeW3Pc3tUKpfSXhkJtA+jswn1Y8FjoplrBGM6mb7eM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639769537; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=NYrY0kc0PHr/rCAcUSGijUpEU56IAIoRqii3V14eoTI=; b=BxQlmzT/teJ8KfB46gnAETi7ncIf62r89zV6IKm5BcazW98ua2SBnQszyltqWHZ9BiNH1Gz8kVgNfF9MC0kk3SDWmmE+NiGQaFAmuS8BOsB6gfelW1w7P0pWTMrxnzJ+L4YIPLHGd816QfyOLAXJpv9Rg3k47/mXXSDYcOcipUY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@apertussolutions.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1639769537; s=zoho; d=apertussolutions.com; i=dpsmith@apertussolutions.com; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=NYrY0kc0PHr/rCAcUSGijUpEU56IAIoRqii3V14eoTI=; b=LTuaPz0JcHmplgWTnsuuMsR/I2EMgchC0q8Veq6nJgvsgTpAYeW3EtCf29KzeNze rKbfYyDgcz1fuPVO2SWg2LqYIyv/uVskEhDyJY3O+72R7bCTvMMj7qidDgxGjl8YH6m x+nJD/MhWIHB3HfH2boGizdWwmhVmVIMll3oAcL4= From: "Daniel P. Smith" To: Wei Liu , xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , Christopher Clark , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [RFC 08/10] hyperlaunch: make create_dom0 externally callable Date: Fri, 17 Dec 2021 18:34:34 -0500 Message-Id: <20211217233437.13791-9-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211217233437.13791-1-dpsmith@apertussolutions.com> References: <20211217233437.13791-1-dpsmith@apertussolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-ZohoMail-DKIM: pass (identity dpsmith@apertussolutions.com) X-ZM-MESSAGEID: 1639769987530100001 Content-Type: text/plain; charset="utf-8" This commit is for the RFC only to enable a quick demonstration of starting= Xen via hyperlaunch. Final version of hyperlaunch will have its own domain construction function that will replace the RFC usage of create_dom0. Signed-off-by: Daniel P. Smith Reviewed-by: Christopher Clark --- xen/arch/x86/include/asm/setup.h | 5 +++++ xen/arch/x86/setup.c | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/se= tup.h index 7dc03b6b8d..71f5aaa9b1 100644 --- a/xen/arch/x86/include/asm/setup.h +++ b/xen/arch/x86/include/asm/setup.h @@ -34,6 +34,11 @@ static inline void vesa_init(void) {}; static inline void vesa_mtrr_init(void) {}; #endif =20 +struct domain *__init create_dom0(const module_t *image, + unsigned long headroom, + module_t *initrd, const char *kextra, + const char *loader); + int construct_dom0( struct domain *d, const module_t *kernel, unsigned long kernel_headroom, diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 4bf84c17e4..bee221d5ee 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -755,10 +755,10 @@ static unsigned int __init copy_bios_e820(struct e820= entry *map, unsigned int li return n; } =20 -static struct domain *__init create_dom0(const module_t *image, - unsigned long headroom, - module_t *initrd, const char *kex= tra, - const char *loader) +struct domain *__init create_dom0(const module_t *image, + unsigned long headroom, + module_t *initrd, const char *kextra, + const char *loader) { struct xen_domctl_createdomain dom0_cfg =3D { .flags =3D IS_ENABLED(CONFIG_TBOOT) ? XEN_DOMCTL_CDF_s3_integrity = : 0, --=20 2.20.1 From nobody Mon Apr 29 16:16:31 2024 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 header.i=dpsmith@apertussolutions.com; 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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) ARC-Seal: i=2; a=rsa-sha256; t=1639769985; cv=pass; d=zohomail.com; s=zohoarc; b=LXpS4bxoL5XHCvqSM2TA8mtzm6l6m3yL72ESUPCICdChl0OQfyCj3Y+hsZchINr3JzHJyh/+1Eb7qqv+M11+Yt4cxB2fdk6ZTnP7dE09J24TcsUJvqZAz+76uvCIW/XBYRSVAv5bOFac/Yyn5ap0YFs+LZ/XaZ0WnsDN64SAiKw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639769985; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1+rH6E1T2X2GXGjtweKYSNPXNycy0FvEQLaaEz+oWec=; b=AT/JZtVD80vEqH7KbntVreU5ZXTQGIle8zlhqc5l1jxQBMBNf9Zd8YJM55UROXIKCCki3s4CnEgDYyN9MwfIqyy7eFADBkpQG07HAaTg6fe3/iuWfqFAS+VdASwRdTN5agd4eNJay3CENMTkVOZpBEmCp3Tx9G9V4bOqNNC/7sU= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dpsmith@apertussolutions.com; 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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1639769985480413.03072625534344; Fri, 17 Dec 2021 11:39:45 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.248881.429297 (Exim 4.92) (envelope-from ) id 1myJ4c-0003um-JH; Fri, 17 Dec 2021 19:39:22 +0000 Received: by outflank-mailman (output) from mailman id 248881.429297; Fri, 17 Dec 2021 19:39:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1myJ4c-0003uf-GI; Fri, 17 Dec 2021 19:39:22 +0000 Received: by outflank-mailman (input) for mailman id 248881; Fri, 17 Dec 2021 19:39:21 +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 1myIze-0007M8-AB for xen-devel@lists.xenproject.org; Fri, 17 Dec 2021 19:34:14 +0000 Received: from sender3-of-o51.zoho.com (sender3-of-o51.zoho.com [136.143.184.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 4fb49dad-5f70-11ec-9e60-abaf8a552007; Fri, 17 Dec 2021 20:34:13 +0100 (CET) Received: from sisyou.hme. (static-72-81-132-2.bltmmd.fios.verizon.net [72.81.132.2]) by mx.zohomail.com with SMTPS id 1639769536692979.2933938584735; Fri, 17 Dec 2021 11:32:16 -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: 4fb49dad-5f70-11ec-9e60-abaf8a552007 ARC-Seal: i=1; a=rsa-sha256; t=1639769538; cv=none; d=zohomail.com; s=zohoarc; b=RDK9IwhFyLlcrau1HLkiCLie1koVD68x2sxkYoIienDSzl0T5QeSv85CMMBq0dlzN6O4nyMS9oB8MV9CSuLp0z098cUrbpY/1IQRxdDO0AykeBgcZd5SU5uI6lP7Oc0z7D0fZnmTejPaDCcKm2uOOFnJlxX9lioZC2lmqPlSGV0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639769538; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=1+rH6E1T2X2GXGjtweKYSNPXNycy0FvEQLaaEz+oWec=; b=mS9lXSLSCN/7pBwxZs/wY+XHHQu1yfNx0xtU0jHjNWk9rx3HwqE6427IFEkhW4xa15wh2hYuh5I1dwzolT4gawqSF+J4j1v5yB79V0mgezkrTtkakD2/t2goTRUEv0CzqXOkVFi93UptEHs48PurzO1dqBjdTnvSPYTkqyPlmxg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@apertussolutions.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1639769538; s=zoho; d=apertussolutions.com; i=dpsmith@apertussolutions.com; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=1+rH6E1T2X2GXGjtweKYSNPXNycy0FvEQLaaEz+oWec=; b=D5L0hz30hKsnOfgdwYKqhAawyQ1rRzL4ODgjTMERvyW/9hGTNCrlmuJmNcI6xiYY rzo05LpNV3f66ZRmIfYW/FjYCAtZAFfWIm0N3AIGQQRY4QSsnuA7FQwZ6KAMCm/mGLQ HtW0Bln9Ut7a1TVDGIaRp4UiKZVIu4hCpEyEv4TM= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , Christopher Clark , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [RFC 09/10] hyperlaunch: add domain creation logic Date: Fri, 17 Dec 2021 18:34:35 -0500 Message-Id: <20211217233437.13791-10-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211217233437.13791-1-dpsmith@apertussolutions.com> References: <20211217233437.13791-1-dpsmith@apertussolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-ZohoMail-DKIM: pass (identity dpsmith@apertussolutions.com) X-ZM-MESSAGEID: 1639769987535100002 Content-Type: text/plain; charset="utf-8" This commit introduces the skeleton of hyperlaunch domain construction mechanics and adds the preliminary ability to construct dom0. Signed-off-by: Daniel P. Smith Reviewed-by: Christopher Clark --- xen/common/setup.c | 77 +++++++++++++++++++++++++++++++++++++++++ xen/include/xen/setup.h | 16 +++++++++ 2 files changed, 93 insertions(+) diff --git a/xen/common/setup.c b/xen/common/setup.c index af2b1a422d..cd24f60297 100644 --- a/xen/common/setup.c +++ b/xen/common/setup.c @@ -1,3 +1,4 @@ +#include /* for bzimage_headroom */ #include /* needed by device_tree.h */ #include #include @@ -368,6 +369,82 @@ bool __init hyperlaunch_mb_init(module_t *mods) =20 return ret; } + +void __init hyperlaunch_mb_headroom(void) +{ + int i,j; + + for( i =3D 0; i < hl_config.nr_doms; i++ ) + { + for ( j =3D 0; j < hl_config.domains[i].nr_mods; j++ ) + { + if ( hl_config.domains[i].modules[j].kind =3D=3D BOOTMOD_KERNE= L ) + { + module_t *kern =3D + (module_t *)_p(hl_config.domains[i].modules[j].start); + + kern->headroom =3D bzimage_headroom(bootstrap_map(kern), + kern->mod_end); + bootstrap_map(NULL); + } + } + } +} #endif =20 +uint32_t __init hyperlaunch_create_domains( + struct domain **hwdom, const char *kextra, const char *loader) +{ + uint32_t dom_count =3D 0, functions_used =3D 0; + int i; + + *hwdom =3D NULL; + + for ( i =3D 0; i < hl_config.nr_doms; i++ ) + { + struct bootdomain *d =3D &(hl_config.domains[i]); + + /* build a legacy dom0 and set it as the hwdom */ + if ( (d->functions & HL_FUNCTION_LEGACY_DOM0) && + !(functions_used & HL_FUNCTION_LEGACY_DOM0) ) + { + module_t *image =3D NULL, *initrd =3D NULL; + int j; + + for ( j =3D 0; j < d->nr_mods; j++ ) + { + if ( d->modules[j].kind =3D=3D BOOTMOD_KERNEL ) + image =3D (module_t *)_p(d->modules[j].start); + + if ( d->modules[j].kind =3D=3D BOOTMOD_RAMDISK ) + initrd =3D (module_t *)_p(d->modules[j].start); + + if ( image && initrd ) + break; + } + + if ( image =3D=3D NULL ) + return 0; + +#ifdef CONFIG_MULTIBOOT + *hwdom =3D create_dom0(image, image->headroom, initrd, kextra, + loader); +#endif + if ( *hwdom ) + { + functions_used |=3D HL_FUNCTION_LEGACY_DOM0; + dom_count++; + } + else + panic("HYPERLAUNCH: " + "Dom0 config present but dom0 construction failed\n"= ); + } + else + printk(XENLOG_WARNING "hyperlaunch: " + "currently only supports classic dom0 construction"); + } + + return dom_count; +} + #endif diff --git a/xen/include/xen/setup.h b/xen/include/xen/setup.h index fd4c23c08f..3833867470 100644 --- a/xen/include/xen/setup.h +++ b/xen/include/xen/setup.h @@ -93,8 +93,12 @@ int __init hyperlaunch_init(const void *fdt); =20 #ifdef CONFIG_MULTIBOOT bool __init hyperlaunch_mb_init(module_t *mods); +void __init hyperlaunch_mb_headroom(void); #endif =20 +uint32_t __init hyperlaunch_create_domains( + struct domain **hwdom, const char *kextra, const char *loader); + #else /* CONFIG_HYPERLAUNCH */ =20 #define hyperlaunch_enabled false @@ -109,7 +113,19 @@ static inline bool __init hyperlaunch_mb_init(module_t= *mods) { return false; } + +void __init hyperlaunch_mb_headroom(void) +{ + return; +} #endif =20 +static inline uint32_t __init hyperlaunch_create_domains( + struct domain **hwdom, const char *kextra, const char *loader) +{ + return 0; +} + #endif /* CONFIG_HYPERLAUNCH */ + #endif /* XEN_SETUP_H */ --=20 2.20.1 From nobody Mon Apr 29 16:16:31 2024 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 header.i=dpsmith@apertussolutions.com; 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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) ARC-Seal: i=2; a=rsa-sha256; t=1639769987; cv=pass; d=zohomail.com; s=zohoarc; b=HSg7wr2VvXwWlBSnmu+UrKdH8eCnsGWh38BPOGnU+cD6EGPaTXRus1eXXpGVY9pVKmjeKIm5v1RUvxPqlnmRl2Pty8TZSv5j9j8+tY1U1Qlpy7ygEIkC65+b+f+4pQnm1ZYFUG436Z4x7iDw+3gbqeWD9sw/X4MTsNL/RlQaeSQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639769987; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jwECCbUo2nQZxRvb7JqeHbk/5gA0ySBH1Pa0syLScWY=; b=U/jh2r+3FOQ8FNR586td190wwNBy8X9nEC1fiw4JiiySUkpaSip4mQyFb6iNZWf6yzqrqOp9VNRsK2QRXbSFKdwe/COKGdStFIKCA8BdHjBSn7m3d04nLsgCYpNfrRHYUPvihUq1v9XyqHFaqemjAuPMgnQFcoFbqyPTndgKVyU= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dpsmith@apertussolutions.com; 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; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1639769987910209.94098907611271; Fri, 17 Dec 2021 11:39:47 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.248885.429320 (Exim 4.92) (envelope-from ) id 1myJ4o-0004Xr-A5; Fri, 17 Dec 2021 19:39:34 +0000 Received: by outflank-mailman (output) from mailman id 248885.429320; Fri, 17 Dec 2021 19:39:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1myJ4o-0004Xj-5K; Fri, 17 Dec 2021 19:39:34 +0000 Received: by outflank-mailman (input) for mailman id 248885; Fri, 17 Dec 2021 19:39:32 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1myIzq-0008Bq-Nq for xen-devel@lists.xenproject.org; Fri, 17 Dec 2021 19:34:26 +0000 Received: from sender3-of-o50.zoho.com (sender3-of-o50.zoho.com [136.143.184.50]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 5730ecc9-5f70-11ec-85d3-df6b77346a89; Fri, 17 Dec 2021 20:34:25 +0100 (CET) Received: from sisyou.hme. (static-72-81-132-2.bltmmd.fios.verizon.net [72.81.132.2]) by mx.zohomail.com with SMTPS id 1639769537988673.3922656446274; Fri, 17 Dec 2021 11:32:17 -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: 5730ecc9-5f70-11ec-85d3-df6b77346a89 ARC-Seal: i=1; a=rsa-sha256; t=1639769539; cv=none; d=zohomail.com; s=zohoarc; b=SN9tTyT2zwY2lOr0z0ysHo/VS/72rE5opud8fZhI77td4LQ144T48gZMOuw/PnS2bJuPu0i6LPr6AmLr353q/cnvg5FQJ4dZ7EwtbDjFvYbBmu6h2S77kH2jwes5PTRscxOqmA3g8BXmtTqLqoK8IlZ9y+AbrL2xW7EiFs1/MeA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639769539; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=jwECCbUo2nQZxRvb7JqeHbk/5gA0ySBH1Pa0syLScWY=; b=CLXiw5Pjg2JnmotSAxt/N/xJsY6kXNuhQL8lxceZwp3IHFnXEkWx8PSQe5UnWhaolTtXRCnkAj1ch3rmdyEIh9smWojjI6sHWsObViLU28Cbsm4QO0d+di6rcYjQjO/L7uz5sBBlpFmfEGy3F0gVdLEIXfM7DG/ISIrWrxugm9A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@apertussolutions.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1639769539; s=zoho; d=apertussolutions.com; i=dpsmith@apertussolutions.com; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=jwECCbUo2nQZxRvb7JqeHbk/5gA0ySBH1Pa0syLScWY=; b=L258LMmqN+sntWZC+xo0y75MDFpm1U/v8NR/PlZiv3+LP0ZazyMffu3KprdcN5qF XjS/C+z4rmFYg4q/jE6ZXTUaMc3SgDxHYD6oR2uqkVYPb+YRsqRPrngK+aj8tQigM+j xawyLUYmZUj5xv8XL3Ms9aZzIR5gHQPTxltrYVA0= From: "Daniel P. Smith" To: Wei Liu , xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , Christopher Clark , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [RFC 10/10] hyperlaunch: integrate dtb parse and domain creation Date: Fri, 17 Dec 2021 18:34:36 -0500 Message-Id: <20211217233437.13791-11-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211217233437.13791-1-dpsmith@apertussolutions.com> References: <20211217233437.13791-1-dpsmith@apertussolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-ZohoMail-DKIM: pass (identity dpsmith@apertussolutions.com) X-ZM-MESSAGEID: 1639769989492100005 Content-Type: text/plain; charset="utf-8" This commit introduces into x86 start_xen the detection and parsing of a hyperlaunch DTB file and then using that information to construct the domai= ns contained in the hyperlaunch configuration. Signed-off-by: Daniel P. Smith Reviewed-by: Christopher Clark --- xen/arch/x86/setup.c | 54 ++++++++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index bee221d5ee..c007c421b0 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1020,6 +1020,9 @@ void __init noreturn __start_xen(unsigned long mbi_p) bitmap_fill(module_map, mbi->mods_count); __clear_bit(0, module_map); /* Dom0 kernel is always first */ =20 + if ( hyperlaunch_mb_init(mod) ) + printk(XENLOG_INFO "Hyperlaunch enabled\n"); + if ( pvh_boot ) { /* pvh_init() already filled in e820_raw */ @@ -1142,6 +1145,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) panic("Bootloader didn't honor module alignment request\n"); mod[i].mod_end -=3D mod[i].mod_start; mod[i].mod_start >>=3D PAGE_SHIFT; + mod[i].headroom =3D 0; mod[i].reserved =3D 0; } =20 @@ -1158,8 +1162,12 @@ void __init noreturn __start_xen(unsigned long mbi_p) mod[mbi->mods_count].mod_end =3D __2M_rwdata_end - _stext; } =20 - mod->headroom =3D bzimage_headroom(bootstrap_map(mod), mod->mod_end); - bootstrap_map(NULL); + if ( hyperlaunch_enabled ) { + hyperlaunch_mb_headroom(); + } else { + mod->headroom =3D bzimage_headroom(bootstrap_map(mod), mod->mod_en= d); + bootstrap_map(NULL); + } =20 #ifndef highmem_start /* Don't allow split below 4Gb. */ @@ -1890,22 +1898,34 @@ void __init noreturn __start_xen(unsigned long mbi_= p) cpu_has_nx ? XENLOG_INFO : XENLOG_WARNING "Warning: ", cpu_has_nx ? "" : "not "); =20 - initrdidx =3D find_first_bit(module_map, mbi->mods_count); - if ( !hyperlaunch_enabled && - bitmap_weight(module_map, mbi->mods_count) > 1 ) - printk(XENLOG_WARNING - "Multiple initrd candidates, picking module #%u\n", - initrdidx); + if ( hyperlaunch_enabled ) + { + uint32_t ndoms; =20 - /* - * We're going to setup domain0 using the module(s) that we stashed sa= fely - * above our heap. The second module, if present, is an initrd ramdisk. - */ - dom0 =3D create_dom0(mod, mod->headroom, - initrdidx < mbi->mods_count ? mod + initrdidx : NUL= L, - kextra, loader); - if ( !dom0 ) - panic("Could not set up DOM0 guest OS\n"); + printk(XENLOG_INFO "Hyperlaunch starting domain construction...\n"= ); + ndoms =3D hyperlaunch_create_domains(&dom0, kextra, loader); + if ( ndoms =3D=3D 0 ) + panic("Hyperlaunch could not set up the domains\n"); + + printk(XENLOG_INFO "Hyperlaunch created %u domains\n", ndoms); + } else { + initrdidx =3D find_first_bit(module_map, mbi->mods_count); + if ( bitmap_weight(module_map, mbi->mods_count) > 1 ) + printk(XENLOG_WARNING + "Multiple initrd candidates, picking module #%u\n", + initrdidx); + + /* + * We're going to setup domain0 using the module(s) that we stashed + * safely above our heap. The second module, if present, is an ini= trd + * ramdisk. + */ + dom0 =3D create_dom0(mod, mod->headroom, + initrdidx < mbi->mods_count ? mod + initrdidx := NULL, + kextra, loader); + if ( !dom0 ) + panic("Could not set up DOM0 guest OS\n"); + } =20 heap_init_late(); =20 --=20 2.20.1