@@ -1179,6 +1179,12 @@ int xc_readconsolering(xc_interface *xch,
int xc_send_debug_keys(xc_interface *xch, char *keys);
+int xc_get_log_level(xc_interface *xch, bool guest,
+ char *lower_thresh, unsigned int *lower_thresh_len,
+ char *upper_thresh, unsigned int *upper_thresh_len);
+int xc_set_log_level(xc_interface *xch, bool guest,
+ char *lower_thresh, char *upper_thresh);
+
typedef xen_sysctl_physinfo_t xc_physinfo_t;
typedef xen_sysctl_cputopo_t xc_cputopo_t;
typedef xen_sysctl_numainfo_t xc_numainfo_t;
@@ -187,6 +187,149 @@ int xc_send_debug_keys(xc_interface *xch, char *keys)
return ret;
}
+int xc_get_log_level(xc_interface *xch, bool guest,
+ char *lower_thresh, unsigned int *lower_thresh_len,
+ char *upper_thresh, unsigned int *upper_thresh_len)
+{
+ int ret;
+ DECLARE_SYSCTL;
+ DECLARE_HYPERCALL_BOUNCE(lower_thresh, *lower_thresh_len,
+ XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
+ DECLARE_HYPERCALL_BOUNCE(upper_thresh, *upper_thresh_len,
+ XC_HYPERCALL_BUFFER_BOUNCE_BOTH);
+
+ if ( (ret = xc_hypercall_bounce_pre(xch, lower_thresh)) )
+ goto out;
+ if ( (ret = xc_hypercall_bounce_pre(xch, upper_thresh)) )
+ goto out;
+
+ sysctl.cmd = XEN_SYSCTL_loglvl_op;
+ sysctl.u.loglvl.cmd = XEN_SYSCTL_LOGLVL_get;
+
+ if ( guest )
+ {
+ set_xen_guest_handle(sysctl.u.loglvl.host.lower_thresh,
+ HYPERCALL_BUFFER_NULL);
+ sysctl.u.loglvl.host.lower_thresh_len = 0;
+ set_xen_guest_handle(sysctl.u.loglvl.host.upper_thresh,
+ HYPERCALL_BUFFER_NULL);
+ sysctl.u.loglvl.host.upper_thresh_len = 0;
+
+ set_xen_guest_handle(sysctl.u.loglvl.guest.lower_thresh,
+ lower_thresh);
+ sysctl.u.loglvl.guest.lower_thresh_len = *lower_thresh_len;
+ set_xen_guest_handle(sysctl.u.loglvl.guest.upper_thresh,
+ upper_thresh);
+ sysctl.u.loglvl.guest.upper_thresh_len = *upper_thresh_len;
+ }
+ else
+ {
+ set_xen_guest_handle(sysctl.u.loglvl.host.lower_thresh,
+ lower_thresh);
+ sysctl.u.loglvl.host.lower_thresh_len = *lower_thresh_len;
+ set_xen_guest_handle(sysctl.u.loglvl.host.upper_thresh,
+ upper_thresh);
+ sysctl.u.loglvl.host.upper_thresh_len = *upper_thresh_len;
+
+ set_xen_guest_handle(sysctl.u.loglvl.guest.lower_thresh,
+ HYPERCALL_BUFFER_NULL);
+ sysctl.u.loglvl.guest.lower_thresh_len = 0;
+ set_xen_guest_handle(sysctl.u.loglvl.guest.upper_thresh,
+ HYPERCALL_BUFFER_NULL);
+ sysctl.u.loglvl.guest.upper_thresh_len = 0;
+ }
+
+ ret = do_sysctl(xch, &sysctl);
+
+ if ( guest )
+ {
+ *lower_thresh_len = sysctl.u.loglvl.guest.lower_thresh_len;
+ *upper_thresh_len = sysctl.u.loglvl.guest.upper_thresh_len;
+ }
+ else
+ {
+ *lower_thresh_len = sysctl.u.loglvl.host.lower_thresh_len;
+ *upper_thresh_len = sysctl.u.loglvl.host.upper_thresh_len;
+ }
+
+out:
+ xc_hypercall_bounce_post(xch, lower_thresh);
+ xc_hypercall_bounce_post(xch, upper_thresh);
+ return ret;
+}
+
+int xc_set_log_level(xc_interface *xch, bool guest,
+ char *lower_thresh, char *upper_thresh)
+{
+ int ret;
+ unsigned int lower_thresh_len = 0, upper_thresh_len = 0;
+ DECLARE_SYSCTL;
+ DECLARE_HYPERCALL_BOUNCE(lower_thresh, 0 /* later */,
+ XC_HYPERCALL_BUFFER_BOUNCE_IN);
+ DECLARE_HYPERCALL_BOUNCE(upper_thresh, 0 /* later */,
+ XC_HYPERCALL_BUFFER_BOUNCE_IN);
+
+ if (!lower_thresh && !upper_thresh)
+ return 0;
+
+ sysctl.cmd = XEN_SYSCTL_loglvl_op;
+ sysctl.u.loglvl.cmd = XEN_SYSCTL_LOGLVL_set;
+
+ if (lower_thresh) {
+ lower_thresh_len = strlen(lower_thresh) + 1;
+ HYPERCALL_BOUNCE_SET_SIZE(lower_thresh, lower_thresh_len);
+ }
+
+ if (upper_thresh) {
+ upper_thresh_len = strlen(upper_thresh) + 1;
+ HYPERCALL_BOUNCE_SET_SIZE(upper_thresh, upper_thresh_len);
+ }
+
+ if ( (ret = xc_hypercall_bounce_pre(xch, lower_thresh)) )
+ goto out;
+ if ( (ret = xc_hypercall_bounce_pre(xch, upper_thresh)) )
+ goto out;
+
+ if ( guest )
+ {
+ set_xen_guest_handle(sysctl.u.loglvl.host.lower_thresh,
+ HYPERCALL_BUFFER_NULL);
+ sysctl.u.loglvl.host.lower_thresh_len = 0;
+ set_xen_guest_handle(sysctl.u.loglvl.host.upper_thresh,
+ HYPERCALL_BUFFER_NULL);
+ sysctl.u.loglvl.host.upper_thresh_len = 0;
+ set_xen_guest_handle(sysctl.u.loglvl.guest.lower_thresh,
+ lower_thresh);
+ sysctl.u.loglvl.guest.lower_thresh_len = lower_thresh_len;
+ set_xen_guest_handle(sysctl.u.loglvl.guest.upper_thresh,
+ upper_thresh);
+ sysctl.u.loglvl.guest.upper_thresh_len = upper_thresh_len;
+ }
+ else
+ {
+ set_xen_guest_handle(sysctl.u.loglvl.host.lower_thresh,
+ lower_thresh);
+ sysctl.u.loglvl.host.lower_thresh_len = lower_thresh_len;
+ set_xen_guest_handle(sysctl.u.loglvl.host.upper_thresh,
+ upper_thresh);
+ sysctl.u.loglvl.host.upper_thresh_len = upper_thresh_len;
+
+ set_xen_guest_handle(sysctl.u.loglvl.guest.lower_thresh,
+ HYPERCALL_BUFFER_NULL);
+ sysctl.u.loglvl.guest.lower_thresh_len = 0;
+ set_xen_guest_handle(sysctl.u.loglvl.guest.upper_thresh,
+ HYPERCALL_BUFFER_NULL);
+ sysctl.u.loglvl.guest.upper_thresh_len = 0;
+ }
+
+ ret = do_sysctl(xch, &sysctl);
+
+out:
+ xc_hypercall_bounce_post(xch, lower_thresh);
+ xc_hypercall_bounce_post(xch, upper_thresh);
+ return ret;
+}
+
int xc_physinfo(xc_interface *xch,
xc_physinfo_t *put_info)
{
Signed-off-by: Wei Liu <wei.liu2@citrix.com> --- Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Jan Beulich <JBeulich@suse.com> --- tools/libxc/include/xenctrl.h | 6 ++ tools/libxc/xc_misc.c | 143 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 149 insertions(+)