From nobody Fri Nov 29 12:33:08 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; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1641602991; cv=none; d=zohomail.com; s=zohoarc; b=hV8FaKPgg3skUASYjCwULNTqf91kEFvlpg4MgK4kBhOQNauZ2/Aq6xgGEQv4MmwPoo5zDjMpBuIMN4739GF9+iAGm9alT8SowS3xM9KwtsyQnuclGLZbsBnnGr2A1giUqMF4GFIHnaYtD7fQ/cmv4n5gDuVQo2Cgt5+eunGm0lY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641602991; 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=gqR0xw/C57xWJN5gNpipHSKTTaTcqvE89XlLWiicR30=; b=LIO8TdCvmX/oSO9uE1UVuPJgr/HG+AmSVBklZhIOysB8/Q7qtq/M6H20meM5J6ZyTQRgVBaZpnJF0GS6sVhwNYjcRV1o1kKlMOFkontRxmoev/RmcQrfLFQGxz+kE0reapFuT73htFIR2OyXsYOIZmwtyIFcopOo/LuIBT/INY4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1641602991809327.91974543815604; Fri, 7 Jan 2022 16:49:51 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.254712.436522 (Exim 4.92) (envelope-from ) id 1n5zv7-0007Bp-7u; Sat, 08 Jan 2022 00:49:21 +0000 Received: by outflank-mailman (output) from mailman id 254712.436522; Sat, 08 Jan 2022 00:49:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1n5zv7-0007Ap-1r; Sat, 08 Jan 2022 00:49:21 +0000 Received: by outflank-mailman (input) for mailman id 254712; Sat, 08 Jan 2022 00:49:19 +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 1n5zv5-0006ZD-8T for xen-devel@lists.xenproject.org; Sat, 08 Jan 2022 00:49:19 +0000 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ce942e4f-701c-11ec-9ce5-af14b9085ebd; Sat, 08 Jan 2022 01:49:17 +0100 (CET) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 952C362051; Sat, 8 Jan 2022 00:49:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21B41C36AE5; Sat, 8 Jan 2022 00:49:16 +0000 (UTC) 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: ce942e4f-701c-11ec-9ce5-af14b9085ebd DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641602956; bh=EGPEVLXhWQH12aVdIUkqLBGXZpzA81egp2OEZ8dJ6zc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HxHAQ4ErTsDgZTJVOsdvzFyply9bIp/SE/doo34v6kN8UKl56zqHxHibiShim1DCc eBQpyhrRJuJm/gUm9SMcDbT/A3js3eECbvhVfFRyrBwm5OV6VEqH6U7XDuCP5Qo2kT wBua1BMGnNrlpJPtWqlRm1IzynYf2bC0S7Zkx+VxVvgi3DRzO2iozqOoLgq/hqRceA zgA4XAQ1R0Vs++rCzsX5KEj34miWSUbjdZGdqLVGvjNSQibghoVj9Sf7Z1/U77Z8Pa 29ZcCso8tfkE1QFCrRxpQpYHHc25J1bsnR+30DiIvnIodDTESBNRkQMlgEXqP55qyE F3huguX6N8eKA== From: Stefano Stabellini To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, julien@xen.org, Bertrand.Marquis@arm.com, Luca Miccio , Stefano Stabellini , Volodymyr Babchuk , Bertrand Marquis Subject: [XEN PATCH 5/7] xen/arm: configure dom0less domain for enabling xenstore after boot Date: Fri, 7 Jan 2022 16:49:10 -0800 Message-Id: <20220108004912.3820176-5-sstabellini@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1641602993121100001 Content-Type: text/plain; charset="utf-8" From: Luca Miccio If "xen,enhanced" is enabled, then add to dom0less domains: - the hypervisor node in device tree - the xenstore event channel The xenstore event channel is also used for the first notification to let the guest know that xenstore has become available. Signed-off-by: Luca Miccio Signed-off-by: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis --- xen/arch/arm/domain_build.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 96a94fa434..fafa921aa8 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -27,6 +27,7 @@ #include #include #include +#include =20 #include #include @@ -2619,6 +2620,8 @@ static int __init prepare_dtb_domU(struct domain *d, = struct kernel_info *kinfo) int ret; =20 kinfo->phandle_gic =3D GUEST_PHANDLE_GIC; + kinfo->gnttab_start =3D GUEST_GNTTAB_BASE; + kinfo->gnttab_size =3D GUEST_GNTTAB_SIZE; =20 addrcells =3D GUEST_ROOT_ADDRESS_CELLS; sizecells =3D GUEST_ROOT_SIZE_CELLS; @@ -2693,6 +2696,13 @@ static int __init prepare_dtb_domU(struct domain *d,= struct kernel_info *kinfo) goto err; } =20 + if ( kinfo->enhanced ) + { + ret =3D make_hypervisor_node(d, kinfo, addrcells, sizecells); + if ( ret ) + goto err; + } + ret =3D fdt_end_node(kinfo->fdt); if ( ret < 0 ) goto err; @@ -2959,6 +2969,22 @@ static int __init construct_domain(struct domain *d,= struct kernel_info *kinfo) return 0; } =20 +static int alloc_xenstore_evtchn(struct domain *d) +{ + struct evtchn *chn; + + chn =3D _evtchn_alloc_unbound(d, hardware_domain->domain_id); + if ( !chn ) + { + printk("Failed allocating event channel for domain\n"); + return -ENOMEM; + } + + d->arch.hvm.params[HVM_PARAM_STORE_EVTCHN] =3D chn->port; + + return 0; +} + static int __init construct_domU(struct domain *d, const struct dt_device_node *node) { @@ -3012,7 +3038,14 @@ static int __init construct_domU(struct domain *d, return rc; =20 if ( kinfo.vpl011 ) + { rc =3D domain_vpl011_init(d, NULL); + if ( rc < 0 ) + return rc; + } + + if ( kinfo.enhanced ) + rc =3D alloc_xenstore_evtchn(d); =20 return rc; } @@ -3068,6 +3101,7 @@ void __init create_domUs(void) panic("Error creating domain %s\n", dt_node_name(node)); =20 d->is_console =3D true; + d->arch.is_dom0less =3D true; =20 if ( construct_domU(d, node) !=3D 0 ) panic("Could not set up domain %s\n", dt_node_name(node)); --=20 2.25.1