]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
xen/arm: vpl011: Add support for vuart in libxl
authorBhupinder Thakur <bhupinder.thakur@linaro.org>
Wed, 27 Sep 2017 06:13:13 +0000 (11:43 +0530)
committerStefano Stabellini <sstabellini@kernel.org>
Tue, 3 Oct 2017 22:17:15 +0000 (15:17 -0700)
An option is provided in libxl to enable/disable SBSA vuart while
creating a guest domain.

Libxl now supports a generic vuart console and SBSA uart is a specific type.
In future support can be added for multiple vuart of different types.

User can enable SBSA vuart by adding the following line in the guest
configuration file:

vuart = "sbsa_uart"

Signed-off-by: Bhupinder Thakur <bhupinder.thakur@linaro.org>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
tools/libxl/libxl.h
tools/libxl/libxl_console.c
tools/libxl/libxl_dom.c
tools/libxl/libxl_internal.h
tools/libxl/libxl_types.idl
tools/xl/xl_cmdtable.c
tools/xl/xl_console.c
tools/xl/xl_parse.c

index 827272e8403149c2a58b392fc3d3807daffae35a..e5ef92074333adfb5a5431c7ec22123b65d0cf34 100644 (file)
  */
 #define LIBXL_HAVE_P9S 1
 
+/*
+ * LIBXL_HAVE_BUILDINFO_ARM_VUART indicates that the toolstack supports virtual UART
+ * for ARM.
+ */
+#define LIBXL_HAVE_BUILDINFO_ARM_VUART 1
+
 /*
  * LIBXL_HAVE_BUILDINFO_GRANT_LIMITS indicates that libxl_domain_build_info
  * has the max_grant_frames and max_maptrack_frames fields.
index 32c3ec7d7b2d418479f88800e2b61a5d1e45cc8e..f3122588272946648713694b8490a80c4f1837fa 100644 (file)
@@ -67,6 +67,9 @@ int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num,
     case LIBXL_CONSOLE_TYPE_SERIAL:
         cons_type_s = "serial";
         break;
+    case LIBXL_CONSOLE_TYPE_VUART:
+        cons_type_s = "vuart";
+        break;
     default:
         goto out;
     }
index 1bd43780464ec2dbf58d7209c30a6b7d943e76f3..397f394ca79e88a30926c96373d0cfcb15da7cc4 100644 (file)
@@ -850,6 +850,7 @@ int libxl__build_pv(libxl__gc *gc, uint32_t domid,
     if (xc_dom_translated(dom)) {
         state->console_mfn = dom->console_pfn;
         state->store_mfn = dom->xenstore_pfn;
+        state->vuart_gfn = dom->vuart_gfn;
     } else {
         state->console_mfn = xc_dom_p2m(dom, dom->console_pfn);
         state->store_mfn = xc_dom_p2m(dom, dom->xenstore_pfn);
index e4c3c8853e625d8fa6a9195e05adbb9e5c1c7b37..5b6ebfa892250181fb5b4331090ca795b9d368c8 100644 (file)
@@ -1139,6 +1139,9 @@ typedef struct {
     uint32_t num_vmemranges;
 
     xc_domain_configuration_t config;
+
+    xen_pfn_t vuart_gfn;
+    evtchn_port_t vuart_port;
 } libxl__domain_build_state;
 
 _hidden int libxl__build_pre(libxl__gc *gc, uint32_t domid,
index c2a1141e6f49280fedb058f2d85546918b968d4d..ade359e38714419124ea1285de707d7ef02d68f8 100644 (file)
@@ -105,6 +105,7 @@ libxl_console_type = Enumeration("console_type", [
     (0, "UNKNOWN"),
     (1, "SERIAL"),
     (2, "PV"),
+    (3, "VUART"),
     ])
 
 libxl_disk_format = Enumeration("disk_format", [
@@ -241,6 +242,11 @@ libxl_checkpointed_stream = Enumeration("checkpointed_stream", [
     (2, "COLO"),
     ])
 
+libxl_vuart_type = Enumeration("vuart_type", [
+    (0, "unknown"),
+    (1, "sbsa_uart"),
+    ])
+
 #
 # Complex libxl types
 #
@@ -591,6 +597,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
 
 
     ("arch_arm", Struct(None, [("gic_version", libxl_gic_version),
+                               ("vuart", libxl_vuart_type),
                               ])),
     # Alternate p2m is not bound to any architecture or guest type, as it is
     # supported by x86 HVM and ARM support is planned.
index c304a8542624766161ab1c4bcc58fb10c99d14a2..68a8a72887f1bb846905fa5cf171ca733a700805 100644 (file)
@@ -133,7 +133,7 @@ struct cmd_spec cmd_table[] = {
       &main_console, 0, 0,
       "Attach to domain's console",
       "[options] <Domain>\n"
-      "-t <type>       console type, pv or serial\n"
+      "-t <type>       console type, pv , serial or vuart\n"
       "-n <number>     console number"
     },
     { "vncviewer",
index 0508ddaa3282a53996273f197360775ca51afb84..4e65d738673387066184e5894a4dbb1406de71f8 100644 (file)
@@ -27,6 +27,7 @@ int main_console(int argc, char **argv)
     uint32_t domid;
     int opt = 0, num = 0;
     libxl_console_type type = 0;
+    char *console_names = "pv, serial, vuart";
 
     SWITCH_FOREACH_OPT(opt, "n:t:", NULL, "console", 1) {
     case 't':
@@ -34,8 +35,10 @@ int main_console(int argc, char **argv)
             type = LIBXL_CONSOLE_TYPE_PV;
         else if (!strcmp(optarg, "serial"))
             type = LIBXL_CONSOLE_TYPE_SERIAL;
+        else if (!strcmp(optarg, "vuart"))
+            type = LIBXL_CONSOLE_TYPE_VUART;
         else {
-            fprintf(stderr, "console type supported are: pv, serial\n");
+            fprintf(stderr, "console type supported are: %s\n", console_names);
             return EXIT_FAILURE;
         }
         break;
index e6e3ba09f3add6ddaf0a3410fc33083e5158ec0a..d0106f4830dad09198619e8ff322eadf62c8c7a4 100644 (file)
@@ -1002,6 +1002,14 @@ void parse_config_data(const char *config_source,
     if (!xlu_cfg_get_long (config, "maxvcpus", &l, 0))
         b_info->max_vcpus = l;
 
+    if (!xlu_cfg_get_string(config, "vuart", &buf, 0)) {
+        if (libxl_vuart_type_from_string(buf, &b_info->arch_arm.vuart)) {
+            fprintf(stderr, "ERROR: invalid value \"%s\" for \"vuart\"\n",
+                    buf);
+            exit(1);
+        }
+    }
+
     parse_vnuma_config(config, b_info);
 
     /* Set max_memkb to target_memkb and max_vcpus to avail_vcpus if