[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v7 06/14] x86: expose CBM length and COS number information
General CAT information such as maximum COS and CBM length are exposed to user space by a SYSCTL hypercall, to help user space to construct the CBM. Signed-off-by: Chao Peng <chao.p.peng@xxxxxxxxxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- Changes in v7: * Copyback psr_cat_op only for XEN_SYSCTL_PSR_CAT_get_l3_info. --- xen/arch/x86/psr.c | 31 +++++++++++++++++++++++++++++++ xen/arch/x86/sysctl.c | 18 ++++++++++++++++++ xen/include/asm-x86/psr.h | 3 +++ xen/include/public/sysctl.h | 16 ++++++++++++++++ 4 files changed, 68 insertions(+) diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c index 752499b..1feb2f6 100644 --- a/xen/arch/x86/psr.c +++ b/xen/arch/x86/psr.c @@ -217,6 +217,37 @@ void psr_ctxt_switch_to(struct domain *d) } } +static int get_cat_socket_info(unsigned int socket, + struct psr_cat_socket_info **info) +{ + if ( !cat_socket_info ) + return -ENODEV; + + if ( socket >= nr_sockets ) + return -EBADSLT; + + if ( !test_bit(socket, cat_socket_enable_bitmap) ) + return -ENOENT; + + *info = cat_socket_info + socket; + return 0; +} + +int psr_get_cat_l3_info(unsigned int socket, uint32_t *cbm_len, + uint32_t *cos_max) +{ + struct psr_cat_socket_info *info; + int ret = get_cat_socket_info(socket, &info); + + if ( ret ) + return ret; + + *cbm_len = info->cbm_len; + *cos_max = info->cos_max; + + return 0; +} + /* Called with domain lock held, no extra lock needed for 'psr_cos_ids' */ static void psr_free_cos(struct domain *d) { diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c index 611a291..f36b52f 100644 --- a/xen/arch/x86/sysctl.c +++ b/xen/arch/x86/sysctl.c @@ -171,6 +171,24 @@ long arch_do_sysctl( break; + case XEN_SYSCTL_psr_cat_op: + switch ( sysctl->u.psr_cat_op.cmd ) + { + case XEN_SYSCTL_PSR_CAT_get_l3_info: + ret = psr_get_cat_l3_info(sysctl->u.psr_cat_op.target, + &sysctl->u.psr_cat_op.u.l3_info.cbm_len, + &sysctl->u.psr_cat_op.u.l3_info.cos_max); + + if ( !ret && __copy_field_to_guest(u_sysctl, sysctl, u.psr_cat_op) ) + ret = -EFAULT; + + break; + default: + ret = -EOPNOTSUPP; + break; + } + break; + default: ret = -ENOSYS; break; diff --git a/xen/include/asm-x86/psr.h b/xen/include/asm-x86/psr.h index 1023d5f..d364e8c 100644 --- a/xen/include/asm-x86/psr.h +++ b/xen/include/asm-x86/psr.h @@ -51,6 +51,9 @@ int psr_alloc_rmid(struct domain *d); void psr_free_rmid(struct domain *d); void psr_ctxt_switch_to(struct domain *d); +int psr_get_cat_l3_info(unsigned int socket, uint32_t *cbm_len, + uint32_t *cos_max); + int psr_domain_init(struct domain *d); void psr_domain_free(struct domain *d); diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h index 711441f..f28e460 100644 --- a/xen/include/public/sysctl.h +++ b/xen/include/public/sysctl.h @@ -661,6 +661,20 @@ struct xen_sysctl_psr_cmt_op { typedef struct xen_sysctl_psr_cmt_op xen_sysctl_psr_cmt_op_t; DEFINE_XEN_GUEST_HANDLE(xen_sysctl_psr_cmt_op_t); +#define XEN_SYSCTL_PSR_CAT_get_l3_info 0 +struct xen_sysctl_psr_cat_op { + uint32_t cmd; /* IN: XEN_SYSCTL_PSR_CAT_* */ + uint32_t target; /* IN: socket to be operated on */ + union { + struct { + uint32_t cbm_len; /* OUT: CBM length */ + uint32_t cos_max; /* OUT: Maximum COS */ + } l3_info; + } u; +}; +typedef struct xen_sysctl_psr_cat_op xen_sysctl_psr_cat_op_t; +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_psr_cat_op_t); + struct xen_sysctl { uint32_t cmd; #define XEN_SYSCTL_readconsole 1 @@ -683,6 +697,7 @@ struct xen_sysctl { #define XEN_SYSCTL_scheduler_op 19 #define XEN_SYSCTL_coverage_op 20 #define XEN_SYSCTL_psr_cmt_op 21 +#define XEN_SYSCTL_psr_cat_op 22 uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */ union { struct xen_sysctl_readconsole readconsole; @@ -705,6 +720,7 @@ struct xen_sysctl { struct xen_sysctl_scheduler_op scheduler_op; struct xen_sysctl_coverage_op coverage_op; struct xen_sysctl_psr_cmt_op psr_cmt_op; + struct xen_sysctl_psr_cat_op psr_cat_op; uint8_t pad[128]; } u; }; -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |