[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC 07/16] x86: implement get hw info flow for MBA.
This patch implements get HW info flow for MBA including its callback function and sysctl interface. Signed-off-by: Yi Sun <yi.y.sun@xxxxxxxxxxxxxxx> --- xen/arch/x86/psr.c | 15 +++++++++++++++ xen/arch/x86/sysctl.c | 16 ++++++++++++++++ xen/include/asm-x86/psr.h | 3 +++ xen/include/public/sysctl.h | 8 ++++++++ 4 files changed, 42 insertions(+) diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c index e2ca6fb..52452a7 100644 --- a/xen/arch/x86/psr.c +++ b/xen/arch/x86/psr.c @@ -984,9 +984,24 @@ static unsigned int mba_get_max_cos_max(const struct feat_node *feat) return feat->info.mba_info.cos_max; } +static bool mba_get_feat_info(const struct feat_node *feat, + enum psr_val_type type, + uint32_t dat[], uint32_t array_len) +{ + if ( !dat || 3 > array_len || type != PSR_VAL_TYPE_MBA ) + return false; + + dat[THRTL_MAX] = feat->info.mba_info.thrtl_max; + dat[COS_MAX] = feat->info.mba_info.cos_max; + dat[LINEAR] = feat->info.mba_info.linear; + + return true; +} + struct feat_ops mba_ops = { .init_feature = mba_init_feature, .get_max_cos_max = mba_get_max_cos_max, + .get_feat_info = mba_get_feat_info, }; static void __init parse_psr_bool(char *s, char *value, char *feature, diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c index 739909b..3dd0aa3 100644 --- a/xen/arch/x86/sysctl.c +++ b/xen/arch/x86/sysctl.c @@ -222,6 +222,22 @@ long arch_do_sysctl( ret = -EFAULT; break; } + case XEN_SYSCTL_PSR_MBA_get_info: + { + uint32_t dat[3]; + ret = psr_get_info(sysctl->u.psr_alloc_op.target, + PSR_VAL_TYPE_MBA, dat, 3); + if ( ret ) + break; + + sysctl->u.psr_alloc_op.u.mba_info.thrtl_max = dat[THRTL_MAX]; + sysctl->u.psr_alloc_op.u.mba_info.cos_max = dat[COS_MAX]; + sysctl->u.psr_alloc_op.u.mba_info.linear = dat[LINEAR]; + + if ( !ret && __copy_field_to_guest(u_sysctl, sysctl, u.psr_alloc_op) ) + ret = -EFAULT; + break; + } default: ret = -EOPNOTSUPP; break; diff --git a/xen/include/asm-x86/psr.h b/xen/include/asm-x86/psr.h index 9dd7782..a37abdf 100644 --- a/xen/include/asm-x86/psr.h +++ b/xen/include/asm-x86/psr.h @@ -39,6 +39,8 @@ #define CBM_LEN 0 #define COS_MAX 1 #define CDP_FLAG 2 +#define THRTL_MAX 0 +#define LINEAR 2 struct psr_cmt_l3 { unsigned int features; @@ -58,6 +60,7 @@ enum psr_val_type { PSR_VAL_TYPE_L3_CODE, PSR_VAL_TYPE_L3_DATA, PSR_VAL_TYPE_L2, + PSR_VAL_TYPE_MBA, }; extern struct psr_cmt *psr_cmt; diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h index 71edcf0..f14c921 100644 --- a/xen/include/public/sysctl.h +++ b/xen/include/public/sysctl.h @@ -745,6 +745,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_sysctl_pcitopoinfo_t); #define XEN_SYSCTL_PSR_CAT_get_l3_info 0 #define XEN_SYSCTL_PSR_CAT_get_l2_info 1 +#define XEN_SYSCTL_PSR_MBA_get_info 2 struct xen_sysctl_psr_alloc_op { uint32_t cmd; /* IN: XEN_SYSCTL_PSR_* */ uint32_t target; /* IN */ @@ -760,6 +761,13 @@ struct xen_sysctl_psr_alloc_op { uint32_t cbm_len; /* OUT: CBM length */ uint32_t cos_max; /* OUT: Maximum COS */ } l2_info; + + struct { + uint32_t thrtl_max; /* OUT: Maximum throttle */ + uint32_t cos_max; /* OUT: Maximum COS */ +#define XEN_SYSCTL_PSR_MBA_LINEAR (1u << 0) + uint32_t linear; /* OUT: Linear mode */ + } mba_info; } u; }; typedef struct xen_sysctl_psr_alloc_op xen_sysctl_psr_alloc_op_t; -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |