[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v9 05/13] 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 v9: * Initialize 'info' explictly so that compiler would not complain. * Simplify the code and remove multiple return points. * Remove confused comment for 'target'. Changes in v7: * Copyback psr_cat_op only for XEN_SYSCTL_PSR_CAT_get_l3_info. --- xen/arch/x86/psr.c | 32 ++++++++++++++++++++++++++++++++ xen/arch/x86/sysctl.c | 18 ++++++++++++++++++ xen/include/asm-x86/psr.h | 3 +++ xen/include/public/sysctl.h | 16 ++++++++++++++++ 4 files changed, 69 insertions(+) diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c index bbb2485..10c4cdd 100644 --- a/xen/arch/x86/psr.c +++ b/xen/arch/x86/psr.c @@ -216,6 +216,38 @@ 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) ) + 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 = NULL; + int ret = get_cat_socket_info(socket, &info); + + if ( !ret ) + { + *cbm_len = info->cbm_len; + *cos_max = info->cos_max; + } + + return ret; +} + /* 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 0cf9277..cd544c0 100644 --- a/xen/include/public/sysctl.h +++ b/xen/include/public/sysctl.h @@ -694,6 +694,20 @@ struct xen_sysctl_pcitopoinfo { typedef struct xen_sysctl_pcitopoinfo xen_sysctl_pcitopoinfo_t; DEFINE_XEN_GUEST_HANDLE(xen_sysctl_pcitopoinfo_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 */ + 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 @@ -717,6 +731,7 @@ struct xen_sysctl { #define XEN_SYSCTL_coverage_op 20 #define XEN_SYSCTL_psr_cmt_op 21 #define XEN_SYSCTL_pcitopoinfo 22 +#define XEN_SYSCTL_psr_cat_op 23 uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */ union { struct xen_sysctl_readconsole readconsole; @@ -740,6 +755,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 |