diff mbox series

[Xen-devel,06/10] xen/arm: vpl011: Add new parameters to xenstore for the virtual console

Message ID 1491212673-13476-7-git-send-email-bhupinder.thakur@linaro.org
State New
Headers show
Series pl011 emulation support in Xen | expand

Commit Message

Bhupinder Thakur April 3, 2017, 9:44 a.m. UTC
Add two new parameters to the xen store:
    - newly allocated PFN to be used as IN/OUT ring buffer by xenconsoled
    - a new event channel read from Xen using a hvm call to be used by xenconsoled

Signed-off-by: Bhupinder Thakur <bhupinder.thakur@linaro.org>
---
 tools/libxl/libxl.c     | 10 ++++++++++
 tools/libxl/libxl_dom.c | 13 ++++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

Comments

Wei Liu April 12, 2017, 4:32 p.m. UTC | #1
On Mon, Apr 03, 2017 at 03:14:29PM +0530, Bhupinder Thakur wrote:
> Add two new parameters to the xen store:
>     - newly allocated PFN to be used as IN/OUT ring buffer by xenconsoled
>     - a new event channel read from Xen using a hvm call to be used by xenconsoled
> 
> Signed-off-by: Bhupinder Thakur <bhupinder.thakur@linaro.org>
> ---
>  tools/libxl/libxl.c     | 10 ++++++++++
>  tools/libxl/libxl_dom.c | 13 ++++++++++++-
>  2 files changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index d400fa2..5fa1e41 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -1791,6 +1791,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_VCON:
> +        cons_type_s = "vcon";
> +        break;
>      default:
>          goto out;
>      }
> @@ -3159,6 +3162,13 @@ int libxl__device_console_add(libxl__gc *gc, uint32_t domid,
>          flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->console_port));
>          flexarray_append(ro_front, "ring-ref");
>          flexarray_append(ro_front, GCSPRINTF("%lu", state->console_mfn));
> +        if (state->vconsole_enabled)
> +        {
> +            flexarray_append(ro_front, "vcon-port");
> +            flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->vconsole_port));
> +            flexarray_append(ro_front, "vcon-ring-ref");
> +            flexarray_append(ro_front, GCSPRINTF("%lu", state->vconsole_mfn));
> +        }

Please try to document these new xenstore paths. See
docs/misc/xenstore-paths.md.

Wei.
Stefano Stabellini April 19, 2017, 6:58 p.m. UTC | #2
On Mon, 3 Apr 2017, Bhupinder Thakur wrote:
> Add two new parameters to the xen store:
>     - newly allocated PFN to be used as IN/OUT ring buffer by xenconsoled
>     - a new event channel read from Xen using a hvm call to be used by xenconsoled
> 
> Signed-off-by: Bhupinder Thakur <bhupinder.thakur@linaro.org>

please use vuart instead of vcon


> ---
>  tools/libxl/libxl.c     | 10 ++++++++++
>  tools/libxl/libxl_dom.c | 13 ++++++++++++-
>  2 files changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index d400fa2..5fa1e41 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -1791,6 +1791,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_VCON:
> +        cons_type_s = "vcon";
> +        break;
>      default:
>          goto out;
>      }
> @@ -3159,6 +3162,13 @@ int libxl__device_console_add(libxl__gc *gc, uint32_t domid,
>          flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->console_port));
>          flexarray_append(ro_front, "ring-ref");
>          flexarray_append(ro_front, GCSPRINTF("%lu", state->console_mfn));
> +        if (state->vconsole_enabled)
> +        {
> +            flexarray_append(ro_front, "vcon-port");
> +            flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->vconsole_port));
> +            flexarray_append(ro_front, "vcon-ring-ref");
> +            flexarray_append(ro_front, GCSPRINTF("%lu", state->vconsole_mfn));

it makes more sense to add a new sub-directory such as:

  ro_front/vuart/port
  ro_front/vuart/ring-ref

Even better, with the idea of supporting more than one in the future:

  ro_front/vuart/0/port
  ro_front/vuart/0/ring-ref


> +        }
>      } else {
>          flexarray_append(front, "state");
>          flexarray_append(front, GCSPRINTF("%d", XenbusStateInitialising));
> diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
> index d519c8d..8df1e10 100644
> --- a/tools/libxl/libxl_dom.c
> +++ b/tools/libxl/libxl_dom.c
> @@ -302,7 +302,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
>      libxl_ctx *ctx = libxl__gc_owner(gc);
>      char *xs_domid, *con_domid;
>      int rc;
> -    uint64_t size;
> +    uint64_t size, val;
>  
>      if (xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus) != 0) {
>          LOG(ERROR, "Couldn't set max vcpu count");
> @@ -432,6 +432,16 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
>      state->store_port = xc_evtchn_alloc_unbound(ctx->xch, domid, state->store_domid);
>      state->console_port = xc_evtchn_alloc_unbound(ctx->xch, domid, state->console_domid);
>  
> +    state->vconsole_port = -1;
> +
> +    if (state->vconsole_enabled)
> +    {
> +        rc = xc_hvm_param_get(ctx->xch, domid, HVM_PARAM_VCONSOLE_EVTCHN,
> +                              &val);
> +        if ( !rc )
> +            state->vconsole_port = val;
> +    }
> +
>      if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
>          hvm_set_conf_params(ctx->xch, domid, info);
>  #if defined(__i386__) || defined(__x86_64__)
> @@ -771,6 +781,7 @@ int libxl__build_pv(libxl__gc *gc, uint32_t domid,
>      if (xc_dom_feature_translated(dom)) {
>          state->console_mfn = dom->console_pfn;
>          state->store_mfn = dom->xenstore_pfn;
> +        state->vconsole_mfn = dom->vconsole_pfn;
>      } else {
>          state->console_mfn = xc_dom_p2m(dom, dom->console_pfn);
>          state->store_mfn = xc_dom_p2m(dom, dom->xenstore_pfn);
> -- 
> 2.7.4
>
Bhupinder Thakur April 25, 2017, 10:18 a.m. UTC | #3
Hi Wei,


>>      }
>> @@ -3159,6 +3162,13 @@ int libxl__device_console_add(libxl__gc *gc, uint32_t domid,
>>          flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->console_port));
>>          flexarray_append(ro_front, "ring-ref");
>>          flexarray_append(ro_front, GCSPRINTF("%lu", state->console_mfn));
>> +        if (state->vconsole_enabled)
>> +        {
>> +            flexarray_append(ro_front, "vcon-port");
>> +            flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->vconsole_port));
>> +            flexarray_append(ro_front, "vcon-ring-ref");
>> +            flexarray_append(ro_front, GCSPRINTF("%lu", state->vconsole_mfn));
>> +        }
>
> Please try to document these new xenstore paths. See
> docs/misc/xenstore-paths.md.

I will add the vuart console details in console.txt which is
referenced in xenstore-paths.md.

Regards,
Bhupinder
Wei Liu April 25, 2017, 11:55 a.m. UTC | #4
On Tue, Apr 25, 2017 at 03:48:47PM +0530, Bhupinder Thakur wrote:
> Hi Wei,
> 
> 
> >>      }
> >> @@ -3159,6 +3162,13 @@ int libxl__device_console_add(libxl__gc *gc, uint32_t domid,
> >>          flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->console_port));
> >>          flexarray_append(ro_front, "ring-ref");
> >>          flexarray_append(ro_front, GCSPRINTF("%lu", state->console_mfn));
> >> +        if (state->vconsole_enabled)
> >> +        {
> >> +            flexarray_append(ro_front, "vcon-port");
> >> +            flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->vconsole_port));
> >> +            flexarray_append(ro_front, "vcon-ring-ref");
> >> +            flexarray_append(ro_front, GCSPRINTF("%lu", state->vconsole_mfn));
> >> +        }
> >
> > Please try to document these new xenstore paths. See
> > docs/misc/xenstore-paths.md.
> 
> I will add the vuart console details in console.txt which is
> referenced in xenstore-paths.md.
> 

Yes that's good.

> Regards,
> Bhupinder
diff mbox series

Patch

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index d400fa2..5fa1e41 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -1791,6 +1791,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_VCON:
+        cons_type_s = "vcon";
+        break;
     default:
         goto out;
     }
@@ -3159,6 +3162,13 @@  int libxl__device_console_add(libxl__gc *gc, uint32_t domid,
         flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->console_port));
         flexarray_append(ro_front, "ring-ref");
         flexarray_append(ro_front, GCSPRINTF("%lu", state->console_mfn));
+        if (state->vconsole_enabled)
+        {
+            flexarray_append(ro_front, "vcon-port");
+            flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->vconsole_port));
+            flexarray_append(ro_front, "vcon-ring-ref");
+            flexarray_append(ro_front, GCSPRINTF("%lu", state->vconsole_mfn));
+        }
     } else {
         flexarray_append(front, "state");
         flexarray_append(front, GCSPRINTF("%d", XenbusStateInitialising));
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index d519c8d..8df1e10 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -302,7 +302,7 @@  int libxl__build_pre(libxl__gc *gc, uint32_t domid,
     libxl_ctx *ctx = libxl__gc_owner(gc);
     char *xs_domid, *con_domid;
     int rc;
-    uint64_t size;
+    uint64_t size, val;
 
     if (xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus) != 0) {
         LOG(ERROR, "Couldn't set max vcpu count");
@@ -432,6 +432,16 @@  int libxl__build_pre(libxl__gc *gc, uint32_t domid,
     state->store_port = xc_evtchn_alloc_unbound(ctx->xch, domid, state->store_domid);
     state->console_port = xc_evtchn_alloc_unbound(ctx->xch, domid, state->console_domid);
 
+    state->vconsole_port = -1;
+
+    if (state->vconsole_enabled)
+    {
+        rc = xc_hvm_param_get(ctx->xch, domid, HVM_PARAM_VCONSOLE_EVTCHN,
+                              &val);
+        if ( !rc )
+            state->vconsole_port = val;
+    }
+
     if (info->type == LIBXL_DOMAIN_TYPE_HVM) {
         hvm_set_conf_params(ctx->xch, domid, info);
 #if defined(__i386__) || defined(__x86_64__)
@@ -771,6 +781,7 @@  int libxl__build_pv(libxl__gc *gc, uint32_t domid,
     if (xc_dom_feature_translated(dom)) {
         state->console_mfn = dom->console_pfn;
         state->store_mfn = dom->xenstore_pfn;
+        state->vconsole_mfn = dom->vconsole_pfn;
     } else {
         state->console_mfn = xc_dom_p2m(dom, dom->console_pfn);
         state->store_mfn = xc_dom_p2m(dom, dom->xenstore_pfn);