All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel <xen-devel@lists.xensource.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: [Qemu-devel] implement support for secondary consoles in the console backend
Date: Thu, 11 Jun 2009 17:06:59 +0100	[thread overview]
Message-ID: <4A312BA3.4030301@eu.citrix.com> (raw)

This patch adds support for secondary consoles in the console backend.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

---

diff --git a/hw/xen_console.c b/hw/xen_console.c
index 27f809d..0d8f654 100644
--- a/hw/xen_console.c
+++ b/hw/xen_console.c
@@ -185,7 +185,10 @@ static int con_init(struct XenDevice *xendev)
 
     /* setup */
     dom = xs_get_domain_path(xenstore, con->xendev.dom);
-    snprintf(con->console, sizeof(con->console), "%s/console", dom);
+    if (!xendev->dev)
+        snprintf(con->console, sizeof(con->console), "%s/console", dom);
+    else
+        snprintf(con->console, sizeof(con->console), "%s/device/console/%d", dom, xendev->dev);
     free(dom);
 
     type = xenstore_read_str(con->console, "type");
@@ -215,10 +218,15 @@ static int con_connect(struct XenDevice *xendev)
     if (xenstore_read_int(con->console, "limit", &limit) == 0)
 	con->buffer.max_capacity = limit;
 
-    con->sring = xc_map_foreign_range(xen_xc, con->xendev.dom,
-				      XC_PAGE_SIZE,
-				      PROT_READ|PROT_WRITE,
-				      con->ring_ref);
+    if (!xendev->dev)
+        con->sring = xc_map_foreign_range(xen_xc, con->xendev.dom,
+                                          XC_PAGE_SIZE,
+                                          PROT_READ|PROT_WRITE,
+                                          con->ring_ref);
+    else
+        con->sring = xc_gnttab_map_grant_ref(xendev->gnttabdev, con->xendev.dom,
+                                             con->ring_ref,
+                                             PROT_READ|PROT_WRITE);
     if (!con->sring)
 	return -1;
 
@@ -244,7 +252,10 @@ static void con_disconnect(struct XenDevice *xendev)
     xen_be_unbind_evtchn(&con->xendev);
 
     if (con->sring) {
-	munmap(con->sring, XC_PAGE_SIZE);
+        if (!xendev->dev)
+            munmap(con->sring, XC_PAGE_SIZE);
+        else
+            xc_gnttab_munmap(xendev->gnttabdev, con->sring, 1);
 	con->sring = NULL;
     }
 }
@@ -262,9 +273,10 @@ static void con_event(struct XenDevice *xendev)
 
 struct XenDevOps xen_console_ops = {
     .size       = sizeof(struct XenConsole),
-    .flags      = DEVOPS_FLAG_IGNORE_STATE,
+    .flags      = DEVOPS_FLAG_IGNORE_STATE|DEVOPS_FLAG_NEED_GNTDEV,
     .init       = con_init,
     .connect    = con_connect,
     .event      = con_event,
     .disconnect = con_disconnect,
 };
+

WARNING: multiple messages have this Message-ID (diff)
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel <xen-devel@lists.xensource.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: implement support for secondary consoles in the console backend
Date: Thu, 11 Jun 2009 17:06:59 +0100	[thread overview]
Message-ID: <4A312BA3.4030301@eu.citrix.com> (raw)

This patch adds support for secondary consoles in the console backend.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

---

diff --git a/hw/xen_console.c b/hw/xen_console.c
index 27f809d..0d8f654 100644
--- a/hw/xen_console.c
+++ b/hw/xen_console.c
@@ -185,7 +185,10 @@ static int con_init(struct XenDevice *xendev)
 
     /* setup */
     dom = xs_get_domain_path(xenstore, con->xendev.dom);
-    snprintf(con->console, sizeof(con->console), "%s/console", dom);
+    if (!xendev->dev)
+        snprintf(con->console, sizeof(con->console), "%s/console", dom);
+    else
+        snprintf(con->console, sizeof(con->console), "%s/device/console/%d", dom, xendev->dev);
     free(dom);
 
     type = xenstore_read_str(con->console, "type");
@@ -215,10 +218,15 @@ static int con_connect(struct XenDevice *xendev)
     if (xenstore_read_int(con->console, "limit", &limit) == 0)
 	con->buffer.max_capacity = limit;
 
-    con->sring = xc_map_foreign_range(xen_xc, con->xendev.dom,
-				      XC_PAGE_SIZE,
-				      PROT_READ|PROT_WRITE,
-				      con->ring_ref);
+    if (!xendev->dev)
+        con->sring = xc_map_foreign_range(xen_xc, con->xendev.dom,
+                                          XC_PAGE_SIZE,
+                                          PROT_READ|PROT_WRITE,
+                                          con->ring_ref);
+    else
+        con->sring = xc_gnttab_map_grant_ref(xendev->gnttabdev, con->xendev.dom,
+                                             con->ring_ref,
+                                             PROT_READ|PROT_WRITE);
     if (!con->sring)
 	return -1;
 
@@ -244,7 +252,10 @@ static void con_disconnect(struct XenDevice *xendev)
     xen_be_unbind_evtchn(&con->xendev);
 
     if (con->sring) {
-	munmap(con->sring, XC_PAGE_SIZE);
+        if (!xendev->dev)
+            munmap(con->sring, XC_PAGE_SIZE);
+        else
+            xc_gnttab_munmap(xendev->gnttabdev, con->sring, 1);
 	con->sring = NULL;
     }
 }
@@ -262,9 +273,10 @@ static void con_event(struct XenDevice *xendev)
 
 struct XenDevOps xen_console_ops = {
     .size       = sizeof(struct XenConsole),
-    .flags      = DEVOPS_FLAG_IGNORE_STATE,
+    .flags      = DEVOPS_FLAG_IGNORE_STATE|DEVOPS_FLAG_NEED_GNTDEV,
     .init       = con_init,
     .connect    = con_connect,
     .event      = con_event,
     .disconnect = con_disconnect,
 };
+

             reply	other threads:[~2009-06-11 16:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-11 16:06 Stefano Stabellini [this message]
2009-06-11 16:06 ` implement support for secondary consoles in the console backend Stefano Stabellini
2009-06-12  8:33 ` [Qemu-devel] " Gerd Hoffmann

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=4A312BA3.4030301@eu.citrix.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xen-devel@lists.xensource.com \
    /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.