[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCHv1 1/5] domctl: Add op to get/set generic numeric parameters
Add XEN_DOMCTL_param to get/set generic numeric parameters for a domain. This should reduce the number of specialized domctls that need to be added. Signed-off-by: David Vrabel <david.vrabel@xxxxxxxxxx> --- xen/arch/x86/domctl.c | 14 ++++++++++++++ xen/common/domctl.c | 11 +++++++++++ xen/include/public/domctl.h | 21 +++++++++++++++++++++ xen/include/xen/domain.h | 3 +++ 4 files changed, 49 insertions(+) diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index 55aecdc..3a3ebbf 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -1408,6 +1408,20 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c) #undef c } +int arch_domctl_param(struct domain *d, uint32_t param, bool_t set, + uint64_t *value) +{ + uint64_t new_value = *value; + + switch ( param ) + { + default: + return -EINVAL; + } + + return 0; +} + /* * Local variables: * mode: C diff --git a/xen/common/domctl.c b/xen/common/domctl.c index 22fa5d5..54c51ba 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -1186,6 +1186,17 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) copyback = 1; break; + case XEN_DOMCTL_param: + { + uint32_t param = op->u.param.param & ~XEN_DOMCTL_PARAM_SET; + bool_t set = !!(op->u.param.param & XEN_DOMCTL_PARAM_SET); + + ret = arch_domctl_param(d, param, set, &op->u.param.value); + if ( ret == 0 ) + copyback = 1; + break; + } + default: ret = arch_do_domctl(op, d, u_domctl); break; diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index a934318..330b3e7 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -1092,6 +1092,25 @@ struct xen_domctl_psr_cat_op { typedef struct xen_domctl_psr_cat_op xen_domctl_psr_cat_op_t; DEFINE_XEN_GUEST_HANDLE(xen_domctl_psr_cat_op_t); +/* + * Get/set a per-domain numeric parameter. + * + * If bit 31 of @param is set, the original value is returned and the + * new value is written. If bit 31 is clear, the value is returned. + * + * Not all parameters are valid for all architectures or domain types. + */ +#define XEN_DOMCTL_PARAM_SET (1u << 31) + +struct xen_domctl_param { + /* IN */ + uint32_t param; + /* IN/OUT */ + uint64_t value; +}; +typedef struct xen_domctl_param xen_domctl_param; +DEFINE_XEN_GUEST_HANDLE(xen_domctl_param); + struct xen_domctl { uint32_t cmd; #define XEN_DOMCTL_createdomain 1 @@ -1169,6 +1188,7 @@ struct xen_domctl { #define XEN_DOMCTL_monitor_op 77 #define XEN_DOMCTL_psr_cat_op 78 #define XEN_DOMCTL_soft_reset 79 +#define XEN_DOMCTL_param 80 #define XEN_DOMCTL_gdbsx_guestmemio 1000 #define XEN_DOMCTL_gdbsx_pausevcpu 1001 #define XEN_DOMCTL_gdbsx_unpausevcpu 1002 @@ -1231,6 +1251,7 @@ struct xen_domctl { struct xen_domctl_psr_cmt_op psr_cmt_op; struct xen_domctl_monitor_op monitor_op; struct xen_domctl_psr_cat_op psr_cat_op; + struct xen_domctl_param param; uint8_t pad[128]; } u; }; diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h index a1a6f25..a8a6d7d 100644 --- a/xen/include/xen/domain.h +++ b/xen/include/xen/domain.h @@ -77,6 +77,9 @@ void arch_dump_domain_info(struct domain *d); int arch_vcpu_reset(struct vcpu *); +int arch_domctl_param(struct domain *d, uint32_t param, bool_t set, + uint64_t *value); + extern spinlock_t vcpu_alloc_lock; bool_t domctl_lock_acquire(void); void domctl_lock_release(void); -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |