From patchwork Wed Dec 8 08:47:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 12663913 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 57CC1C43217 for ; Wed, 8 Dec 2021 08:48:02 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.242081.418741 (Exim 4.92) (envelope-from ) id 1muscA-0001Nu-Oo; Wed, 08 Dec 2021 08:47:50 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 242081.418741; Wed, 08 Dec 2021 08:47:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1muscA-0001N7-JB; Wed, 08 Dec 2021 08:47:50 +0000 Received: by outflank-mailman (input) for mailman id 242081; Wed, 08 Dec 2021 08:47:49 +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 1musc9-0001K2-M0 for xen-devel@lists.xenproject.org; Wed, 08 Dec 2021 08:47:49 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 851f2b1c-5803-11ec-9d12-4777fae47e2b; Wed, 08 Dec 2021 09:47:48 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 418F21FD3E; Wed, 8 Dec 2021 08:47:48 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 122CE13BE9; Wed, 8 Dec 2021 08:47:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id UKkcAzRxsGGzdQAAMHmgww (envelope-from ); Wed, 08 Dec 2021 08:47:48 +0000 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: 851f2b1c-5803-11ec-9d12-4777fae47e2b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1638953268; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S6awGi2Fwbno8QaG6NAZfKYFH8aFqnE5sERtOBDmAbA=; b=hxJ9yWCE8Yc8x0BugzwO/+upHnZi4yk5OAzREbFkbpMlrE0oIUc6OjwJgD50qbcBzzl8Ii kGl8pifEYkWN8NhaTuDtI1ifXedaRLoBouf3P5chq1HOWTBnzeWP+z+0T+lOqKh9SvDMSd 0c/5LiOYGfgzKIX/ypcnA8XQGk9i3LA= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Ian Jackson , Wei Liu , Anthony PERARD , Andrew Cooper Subject: [PATCH v3 2/2] tools: set event channel HVM parameters in libxenguest Date: Wed, 8 Dec 2021 09:47:45 +0100 Message-Id: <20211208084745.31082-3-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20211208084745.31082-1-jgross@suse.com> References: <20211208084745.31082-1-jgross@suse.com> MIME-Version: 1.0 The HVM parameters for pre-allocated event channels should be set in libxenguest, like it is done for PV guests and for the pre-allocated ring pages. Suggested-by: Andrew Cooper Signed-off-by: Juergen Gross Acked-by: Anthony PERARD --- V3: - replacement for former patch 2 (Andrew Cooper) --- tools/libs/guest/xg_dom_x86.c | 6 ++++++ tools/libs/light/libxl_dom.c | 15 ++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/tools/libs/guest/xg_dom_x86.c b/tools/libs/guest/xg_dom_x86.c index b6e75afba2..9328fbf804 100644 --- a/tools/libs/guest/xg_dom_x86.c +++ b/tools/libs/guest/xg_dom_x86.c @@ -1866,6 +1866,12 @@ static int bootlate_hvm(struct xc_dom_image *dom) munmap(hvm_info_page, PAGE_SIZE); } + if ( xc_hvm_param_set(xch, domid, HVM_PARAM_CONSOLE_EVTCHN, + dom->console_evtchn) || + xc_hvm_param_set(xch, domid, HVM_PARAM_STORE_EVTCHN, + dom->xenstore_evtchn) ) + return -1; + return 0; } diff --git a/tools/libs/light/libxl_dom.c b/tools/libs/light/libxl_dom.c index fe9f760f71..c9c24666cd 100644 --- a/tools/libs/light/libxl_dom.c +++ b/tools/libs/light/libxl_dom.c @@ -723,9 +723,8 @@ out: static int hvm_build_set_params(xc_interface *handle, uint32_t domid, libxl_domain_build_info *info, - int store_evtchn, unsigned long *store_mfn, - int console_evtchn, unsigned long *console_mfn, - domid_t store_domid, domid_t console_domid) + unsigned long *store_mfn, + unsigned long *console_mfn) { struct hvm_info_table *va_hvm; uint8_t *va_map, sum; @@ -752,8 +751,6 @@ static int hvm_build_set_params(xc_interface *handle, uint32_t domid, xc_hvm_param_get(handle, domid, HVM_PARAM_STORE_PFN, &str_mfn); xc_hvm_param_get(handle, domid, HVM_PARAM_CONSOLE_PFN, &cons_mfn); - xc_hvm_param_set(handle, domid, HVM_PARAM_STORE_EVTCHN, store_evtchn); - xc_hvm_param_set(handle, domid, HVM_PARAM_CONSOLE_EVTCHN, console_evtchn); *store_mfn = str_mfn; *console_mfn = cons_mfn; @@ -1123,7 +1120,9 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid, dom->vga_hole_size = device_model ? LIBXL_VGA_HOLE_SIZE : 0; dom->device_model = device_model; dom->max_vcpus = info->max_vcpus; + dom->console_evtchn = state->console_port; dom->console_domid = state->console_domid; + dom->xenstore_evtchn = state->store_port; dom->xenstore_domid = state->store_domid; rc = libxl__domain_device_construct_rdm(gc, d_config, @@ -1169,10 +1168,8 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid, if (rc != 0) goto out; - rc = hvm_build_set_params(ctx->xch, domid, info, state->store_port, - &state->store_mfn, state->console_port, - &state->console_mfn, state->store_domid, - state->console_domid); + rc = hvm_build_set_params(ctx->xch, domid, info, &state->store_mfn, + &state->console_mfn); if (rc != 0) { LOG(ERROR, "hvm build set params failed"); goto out;