From patchwork Tue Jan 28 14:28:16 2020 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: 11354395 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E7CA11398 for ; Tue, 28 Jan 2020 14:29:20 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id CE18E2468F for ; Tue, 28 Jan 2020 14:29:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE18E2468F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iwRqp-0002WG-UN; Tue, 28 Jan 2020 14:28:23 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iwRqo-0002W5-Q0 for xen-devel@lists.xenproject.org; Tue, 28 Jan 2020 14:28:22 +0000 X-Inumbo-ID: 6f78e764-41da-11ea-b211-bc764e2007e4 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 6f78e764-41da-11ea-b211-bc764e2007e4; Tue, 28 Jan 2020 14:28:22 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4C281AC88; Tue, 28 Jan 2020 14:28:21 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Tue, 28 Jan 2020 15:28:16 +0100 Message-Id: <20200128142818.27200-2-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200128142818.27200-1-jgross@suse.com> References: <20200128142818.27200-1-jgross@suse.com> Subject: [Xen-devel] [PATCH 1/3] xenstore: setup xenstore stubdom console interface properly X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Ian Jackson , Wei Liu MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" In order to be able to get access to the console of Xenstore stubdom we need an appropriate granttab entry. So call xc_dom_gnttab_init() when constructing the domain and preset some information needed for that function in the dom structure. We need to create the event channel for the console, too. Do that and store all necessary data locally. Signed-off-by: Juergen Gross --- tools/helpers/init-xenstore-domain.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tools/helpers/init-xenstore-domain.c b/tools/helpers/init-xenstore-domain.c index adb8408b63..a312bc38b8 100644 --- a/tools/helpers/init-xenstore-domain.c +++ b/tools/helpers/init-xenstore-domain.c @@ -24,6 +24,8 @@ static char *param; static char *name = "Xenstore"; static int memory; static int maxmem; +static xen_pfn_t console_mfn; +static unsigned int console_evtchn; static struct option options[] = { { "kernel", 1, NULL, 'k' }, @@ -113,6 +115,7 @@ static int build(xc_interface *xch) fprintf(stderr, "xc_domain_setmaxmem failed\n"); goto err; } + console_evtchn = xc_evtchn_alloc_unbound(xch, domid, 0); rv = xc_domain_set_memmap_limit(xch, domid, limit_kb); if ( rv ) { @@ -133,6 +136,9 @@ static int build(xc_interface *xch) snprintf(cmdline, 512, "--event %d --internal-db", rv); dom = xc_dom_allocate(xch, cmdline, NULL); + dom->container_type = XC_DOM_PV_CONTAINER; + dom->xenstore_domid = domid; + dom->console_evtchn = console_evtchn; rv = xc_dom_kernel_file(dom, kernel); if ( rv ) { @@ -186,6 +192,12 @@ static int build(xc_interface *xch) fprintf(stderr, "xc_dom_boot_image failed\n"); goto err; } + rv = xc_dom_gnttab_init(dom); + if ( rv ) + { + fprintf(stderr, "xc_dom_gnttab_init failed\n"); + goto err; + } rv = xc_domain_set_virq_handler(xch, domid, VIRQ_DOM_EXC); if ( rv ) @@ -201,6 +213,7 @@ static int build(xc_interface *xch) } rv = 0; + console_mfn = xc_dom_p2m(dom, dom->console_pfn); err: if ( dom )