All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>, Wei Liu <wl@xen.org>
Subject: [Xen-devel] [PATCH v2 1/3] xenstore: setup xenstore stubdom console interface properly
Date: Wed, 12 Feb 2020 08:41:52 +0100	[thread overview]
Message-ID: <20200212074154.23755-2-jgross@suse.com> (raw)
In-Reply-To: <20200212074154.23755-1-jgross@suse.com>

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 <jgross@suse.com>
---
 tools/helpers/init-xenstore-domain.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/tools/helpers/init-xenstore-domain.c b/tools/helpers/init-xenstore-domain.c
index adb8408b63..3a8ca64741 100644
--- a/tools/helpers/init-xenstore-domain.c
+++ b/tools/helpers/init-xenstore-domain.c
@@ -24,6 +24,7 @@ static char *param;
 static char *name = "Xenstore";
 static int memory;
 static int maxmem;
+static xc_evtchn_port_or_error_t console_evtchn;
 
 static struct option options[] = {
     { "kernel", 1, NULL, 'k' },
@@ -113,6 +114,12 @@ static int build(xc_interface *xch)
         fprintf(stderr, "xc_domain_setmaxmem failed\n");
         goto err;
     }
+    console_evtchn = xc_evtchn_alloc_unbound(xch, domid, 0);
+    if ( console_evtchn < 0 )
+    {
+        fprintf(stderr, "xc_evtchn_alloc_unbound failed\n");
+        goto err;
+    }
     rv = xc_domain_set_memmap_limit(xch, domid, limit_kb);
     if ( rv )
     {
@@ -133,6 +140,15 @@ static int build(xc_interface *xch)
         snprintf(cmdline, 512, "--event %d --internal-db", rv);
 
     dom = xc_dom_allocate(xch, cmdline, NULL);
+    if ( !dom )
+    {
+        fprintf(stderr, "xc_dom_allocate failed\n");
+        goto err;
+    }
+    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 +202,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 )
-- 
2.16.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2020-02-12  7:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-12  7:41 [Xen-devel] [PATCH v2 0/3] tools/xenstore Juergen Gross
2020-02-12  7:41 ` Juergen Gross [this message]
2020-02-13 12:01   ` [Xen-devel] [PATCH v2 1/3] xenstore: setup xenstore stubdom console interface properly Wei Liu
2020-02-12  7:41 ` [Xen-devel] [PATCH v2 2/3] xenstore: add console xenstore entries for xenstore stubdom Juergen Gross
2020-02-13 12:03   ` Wei Liu
2020-02-12  7:41 ` [Xen-devel] [PATCH v2 3/3] xenstore: remove not applicable control commands in stubdom Juergen Gross
2020-02-13 12:04   ` Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200212074154.23755-2-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.