From nobody Mon May 6 15:05:54 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=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1638953295; cv=none; d=zohomail.com; s=zohoarc; b=eZ1e8G8KNFbWfQ3RR3mo7VrSjD4iPEAux8MzWZdY2PXqcD8y1DnmcFNqp9Lk2XQKounu4DT/Pblpz03+lKWeYm7G+9Y/s/LOn7o7nWZAUvcQVA7nMGc60rXKqQgdJZws4ehShcO0w3HJIsmBU8dNx2wyY74GVXpz5bso5zJE0H4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638953295; 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=nT3PojRsjaFLQH8p/xAS/Bo0Edytu7k5yswmTd3p+WU=; b=mtNZeAmeh5ljqkGVeTk1KcnuoBU4omH2rtmOGMkD4GZdAWcpQm1UOrM1DyWGiCtNytRo+6RT0VlfU4LwCe6yH8K18tt0MBXInyuxQEVpuryNoPGLY3XLurZAzIfTHEVJtP0oIVLYjzI4aOX7x69yBdOc8t9rSCDrdBUW4KUHFjQ= 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=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1638953295618127.13430656809783; Wed, 8 Dec 2021 00:48:15 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.242082.418758 (Exim 4.92) (envelope-from ) id 1muscC-0001q9-1X; Wed, 08 Dec 2021 08:47:52 +0000 Received: by outflank-mailman (output) from mailman id 242082.418758; Wed, 08 Dec 2021 08:47:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1muscB-0001po-TU; Wed, 08 Dec 2021 08:47:51 +0000 Received: by outflank-mailman (input) for mailman id 242082; Wed, 08 Dec 2021 08:47:50 +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 1muscA-0001K1-7I for xen-devel@lists.xenproject.org; Wed, 08 Dec 2021 08:47:50 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 8503115e-5803-11ec-a831-37629979565c; 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-out1.suse.de (Postfix) with ESMTPS id 0B6352191A; 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 D68F813F3B; Wed, 8 Dec 2021 08:47:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id AOoeMzNxsGGzdQAAMHmgww (envelope-from ); Wed, 08 Dec 2021 08:47:47 +0000 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: 8503115e-5803-11ec-a831-37629979565c 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=nT3PojRsjaFLQH8p/xAS/Bo0Edytu7k5yswmTd3p+WU=; b=UvBlVWL1x0/G7DJ4GahBrQIUwzTNp7P6vYBL61uj9csWpmzLvAgjU6q1K2PEqq5F7jKpjk oeSQqU35zbMmC3i4UhtxsDczk7qjozkgZIJyVfe9Ts6ej+AACj+iJiD6W7ODW0+jds/IH5 g7UcKdnXiarpssq735mbcS1rfVXJW/Y= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Ian Jackson , Wei Liu , Andrew Cooper Subject: [PATCH v3 1/2] tools/helpers: fix PVH xenstore-stubdom console parameters Date: Wed, 8 Dec 2021 09:47:44 +0100 Message-Id: <20211208084745.31082-2-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 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1638953297720100001 Content-Type: text/plain; charset="utf-8" When using a PVH mode xenstore-stubdom the frame number of the console should be a PFN instead of a MFN. Signed-off-by: Juergen Gross Reviewed-by: Andrew Cooper --- V2: - rename variable (Andrew Cooper) --- tools/helpers/init-xenstore-domain.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/helpers/init-xenstore-domain.c b/tools/helpers/init-xens= tore-domain.c index b205a79ee6..9457d0251b 100644 --- a/tools/helpers/init-xenstore-domain.c +++ b/tools/helpers/init-xenstore-domain.c @@ -30,7 +30,7 @@ static char *param; static char *name =3D "Xenstore"; static int memory; static int maxmem; -static xen_pfn_t console_mfn; +static xen_pfn_t console_gfn; static xc_evtchn_port_or_error_t console_evtchn; =20 static struct option options[] =3D { @@ -283,7 +283,9 @@ static int build(xc_interface *xch) } =20 rv =3D 0; - console_mfn =3D xc_dom_p2m(dom, dom->console_pfn); + console_gfn =3D (dom->container_type =3D=3D XC_DOM_PV_CONTAINER) + ? xc_dom_p2m(dom, dom->console_pfn) + : dom->console_pfn; =20 err: if ( dom ) @@ -528,7 +530,7 @@ int main(int argc, char** argv) do_xs_write_dir_node(xsh, fe_path, "tty", ""); snprintf(buf, 16, "%d", console_evtchn); do_xs_write_dir_node(xsh, fe_path, "port", buf); - snprintf(buf, 16, "%ld", console_mfn); + snprintf(buf, 16, "%ld", console_gfn); do_xs_write_dir_node(xsh, fe_path, "ring-ref", buf); xs_close(xsh); =20 --=20 2.26.2 From nobody Mon May 6 15:05:54 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=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1638953289; cv=none; d=zohomail.com; s=zohoarc; b=C1qQh1GqJ7iEHzpwg2O5DRHBP/a3u7kuGIwS+3ZvbWD7eGoGgeSD8eiu8TVOUtgk+4QI7ER+YuErVgeUe59aBemteQomtbWzNCEyrbW6e4gr2bsh0U5YeHyZ6hMjHhS8UMLGP3WNbZaz8Qu01weO5O9/ph7OMTrnJebO76/swaA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638953289; 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=S6awGi2Fwbno8QaG6NAZfKYFH8aFqnE5sERtOBDmAbA=; b=GWMQ9/sVxLauFffpoUk398FY7tJTKgTZoPhQNzyqJQVBe7Hv+GQRT2FU21DH4vXalQrs/4OKB3HrYvCzg/ybVd+thjlMhLjH8aY8T/PCjmETtfdKgcKGVnfCWk4OesVjcjmO1GmNGrv32nJmnf5VqGRd6XxyI5LZAyGe1NnLrj8= 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=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1638953289353918.9893972078353; Wed, 8 Dec 2021 00:48:09 -0800 (PST) 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 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-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: 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 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1638953290862100003 Content-Type: text/plain; charset="utf-8" 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 --- 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); } =20 + 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; } =20 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: =20 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, u= int32_t domid, =20 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_evtc= hn); =20 *store_mfn =3D str_mfn; *console_mfn =3D cons_mfn; @@ -1123,7 +1120,9 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid, dom->vga_hole_size =3D device_model ? LIBXL_VGA_HOLE_SIZE : 0; dom->device_model =3D device_model; dom->max_vcpus =3D info->max_vcpus; + dom->console_evtchn =3D state->console_port; dom->console_domid =3D state->console_domid; + dom->xenstore_evtchn =3D state->store_port; dom->xenstore_domid =3D state->store_domid; =20 rc =3D libxl__domain_device_construct_rdm(gc, d_config, @@ -1169,10 +1168,8 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid, if (rc !=3D 0) goto out; =20 - rc =3D 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 =3D hvm_build_set_params(ctx->xch, domid, info, &state->store_mfn, + &state->console_mfn); if (rc !=3D 0) { LOG(ERROR, "hvm build set params failed"); goto out; --=20 2.26.2