From nobody Fri Nov 29 11:34:00 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=1643405615; cv=none; d=zohomail.com; s=zohoarc; b=Hbxt5QCkxBXDpNusx078P7mImMyp36rC+4KIlpRNyFNVdFjVaXcMMI9hNki8++n/HWh8KL76mdfORj84ZRdwi1QOMI4B+FYR0LS8WMtuewOa7ckh5PtAfGFxE34OLXWfmb8ML/6c5PW0OIOSJNvQJblwUdFPuUa7WG0Kx/J5ugc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643405615; 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=m/QexUybqJbqEihbNoz8F2WgZTbHGUbquiWzmT6EX6Y=; b=Nf5GdVULC3vdT4thbt9xorRkJhBd49BIN46eqX5WEzYZGiTzTOoHpuIIkQHxD8MXt+3/CmSSj9gEd8CTS2cglkxcPlBM4U9FpIJ5bfmNGthUS1uA7KYfmXSY76ya4NJlxfHiY6pmj7nIeNmSkQ2VbCGAcZgDcv24K77tJ78YeeM= 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 1643405615724400.15357877915187; Fri, 28 Jan 2022 13:33:35 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.262148.454300 (Exim 4.92) (envelope-from ) id 1nDYrs-0001rL-1j; Fri, 28 Jan 2022 21:33:16 +0000 Received: by outflank-mailman (output) from mailman id 262148.454300; Fri, 28 Jan 2022 21:33:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nDYrr-0001oM-SN; Fri, 28 Jan 2022 21:33:15 +0000 Received: by outflank-mailman (input) for mailman id 262148; Fri, 28 Jan 2022 21:33:15 +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 1nDYrq-0001M8-RU for xen-devel@lists.xenproject.org; Fri, 28 Jan 2022 21:33:14 +0000 Received: from ams.source.kernel.org (ams.source.kernel.org [2604:1380:4601:e00::1]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e579ac03-8081-11ec-8f75-fffcc8bd4f1a; Fri, 28 Jan 2022 22:33:14 +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 ams.source.kernel.org (Postfix) with ESMTPS id 89CCCB82697; Fri, 28 Jan 2022 21:33:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD8F4C340EC; Fri, 28 Jan 2022 21:33:10 +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: e579ac03-8081-11ec-8f75-fffcc8bd4f1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643405591; bh=7u5+Xn46ET2Kq+hchW4hiMSc7HY0HUOJ2bLjmmIyZt8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l4nD26LstxRti4Jvl8qKqfGLBIdjuVDo0UkmTz6mTyCa/PFnxmnJmsGCHz94YKyd2 5ZRJaPrHAnrrdYC+etQB8+qmMmwTNz5StdQzP9gldgF1xfqqLMPt6/3GnUtIi2Y3gs lh4OUyf+WB3Fu9ZbyfYG0L7BZLOLduX9BFbdgEVen9kV5i170q7cyTzWSUfqpEIPQC Vjq1aV5JprTAYs/chDfIsT0VeD4MddnLPv55KD49XLgpahwiYIsnMfCxxUFAP9PzcR CuCrKz14k4DyC9TaHNdmOfullJx/Qtyqi0QiyqpfY4TptdB2mc7a9QRomuIlRs6cn1 f/vW1KKEKZ+gw== From: Stefano Stabellini To: xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, jgross@suse.com, Bertrand.Marquis@arm.com, julien@xen.org, Volodymyr_Babchuk@epam.com, Luca Miccio , Stefano Stabellini , Bertrand Marquis , Andrew Cooper , George Dunlap , Jan Beulich , Wei Liu Subject: [PATCH v3 2/5] xen: make evtchn_alloc_unbound public Date: Fri, 28 Jan 2022 13:33:03 -0800 Message-Id: <20220128213307.2822078-2-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: 1643405618491100004 Content-Type: text/plain; charset="utf-8" From: Luca Miccio The xenstore event channel will be allocated for dom0less domains. It is necessary to have access to the evtchn_alloc_unbound function to do that, so make evtchn_alloc_unbound public. Add a skip_xsm parameter to allow disabling the XSM check in evtchn_alloc_unbound (xsm_evtchn_unbound wouldn't work for a call originated from Xen before running any domains.) Signed-off-by: Luca Miccio Signed-off-by: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Andrew Cooper CC: George Dunlap CC: Jan Beulich CC: Wei Liu --- Changes v3: - expose evtchn_alloc_unbound, assing a skip_xsm parameter --- xen/common/event_channel.c | 13 ++++++++----- xen/include/xen/event.h | 3 +++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c index da88ad141a..be57d00a15 100644 --- a/xen/common/event_channel.c +++ b/xen/common/event_channel.c @@ -284,7 +284,7 @@ void evtchn_free(struct domain *d, struct evtchn *chn) xsm_evtchn_close_post(chn); } =20 -static int evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc) +int evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc, bool skip_xsm) { struct evtchn *chn; struct domain *d; @@ -301,9 +301,12 @@ static int evtchn_alloc_unbound(evtchn_alloc_unbound_t= *alloc) ERROR_EXIT_DOM(port, d); chn =3D evtchn_from_port(d, port); =20 - rc =3D xsm_evtchn_unbound(XSM_TARGET, d, chn, alloc->remote_dom); - if ( rc ) - goto out; + if ( !skip_xsm ) + { + rc =3D xsm_evtchn_unbound(XSM_TARGET, d, chn, alloc->remote_dom); + if ( rc ) + goto out; + } =20 evtchn_write_lock(chn); =20 @@ -1195,7 +1198,7 @@ long do_event_channel_op(int cmd, XEN_GUEST_HANDLE_PA= RAM(void) arg) struct evtchn_alloc_unbound alloc_unbound; if ( copy_from_guest(&alloc_unbound, arg, 1) !=3D 0 ) return -EFAULT; - rc =3D evtchn_alloc_unbound(&alloc_unbound); + rc =3D evtchn_alloc_unbound(&alloc_unbound, false); if ( !rc && __copy_to_guest(arg, &alloc_unbound, 1) ) rc =3D -EFAULT; /* Cleaning up here would be a mess! */ break; diff --git a/xen/include/xen/event.h b/xen/include/xen/event.h index 21c95e14fd..0a2cdedf7d 100644 --- a/xen/include/xen/event.h +++ b/xen/include/xen/event.h @@ -68,6 +68,9 @@ int evtchn_close(struct domain *d1, int port1, bool guest= ); /* Free an event channel. */ void evtchn_free(struct domain *d, struct evtchn *chn); =20 +/* Create a new event channel port */ +int evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc, bool skip_xsm); + /* Allocate a specific event channel port. */ int evtchn_allocate_port(struct domain *d, unsigned int port); =20 --=20 2.25.1