@@ -231,6 +231,10 @@ static enum psr_feat_type psr_cbm_type_to_feat_type(
feat_type = PSR_SOCKET_L3_CDP;
break;
+ case PSR_CBM_TYPE_L2:
+ feat_type = PSR_SOCKET_L2_CAT;
+ break;
+
default:
ASSERT_UNREACHABLE();
}
@@ -375,6 +379,7 @@ static struct feat_props l3_cdp_props = {
/* L2 CAT props */
static struct feat_props l2_cat_props = {
.cos_num = 1,
+ .get_feat_info = cat_get_feat_info,
};
static void __init parse_psr_bool(char *s, char *value, char *feature,
@@ -174,10 +174,10 @@ long arch_do_sysctl(
case XEN_SYSCTL_psr_cat_op:
switch ( sysctl->u.psr_cat_op.cmd )
{
- case XEN_SYSCTL_PSR_CAT_get_l3_info:
- {
uint32_t data[PSR_INFO_ARRAY_SIZE];
+ case XEN_SYSCTL_PSR_CAT_get_l3_info:
+ {
ret = psr_get_info(sysctl->u.psr_cat_op.target,
PSR_CBM_TYPE_L3, data, ARRAY_SIZE(data));
if ( ret )
@@ -195,6 +195,25 @@ long arch_do_sysctl(
break;
}
+ case XEN_SYSCTL_PSR_CAT_get_l2_info:
+ {
+ ret = psr_get_info(sysctl->u.psr_cat_op.target,
+ PSR_CBM_TYPE_L2, data, ARRAY_SIZE(data));
+ if ( ret )
+ break;
+
+ sysctl->u.psr_cat_op.u.l3_info.cos_max =
+ data[PSR_INFO_IDX_COS_MAX];
+ sysctl->u.psr_cat_op.u.l3_info.cbm_len =
+ data[PSR_INFO_IDX_CAT_CBM_LEN];
+ sysctl->u.psr_cat_op.u.l3_info.flags =
+ data[PSR_INFO_IDX_CAT_FLAG];
+
+ if ( !ret && __copy_field_to_guest(u_sysctl, sysctl, u.psr_cat_op) )
+ ret = -EFAULT;
+ break;
+ }
+
default:
ret = -EOPNOTSUPP;
break;
@@ -744,6 +744,7 @@ 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
+#define XEN_SYSCTL_PSR_CAT_get_l2_info 1
struct xen_sysctl_psr_cat_op {
uint32_t cmd; /* IN: XEN_SYSCTL_PSR_CAT_* */
uint32_t target; /* IN */
This patch implements L2 CAT get HW info flow and interface in sysctl. Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com> --- v10: - modify macro name according to previous patch change. (suggested by Jan Beulich) - modify commit message. v9: - reuse 'cat_get_feat_info' for L2 CAT to reduce redundant codes. (suggested by Roger Pau) - modify sysctl implementation of L2 CAT to input data[3] to use 'cat_get_feat_info'. (suggested by Roger Pau) - modify macros names to newly defined ones. (suggested by Jan Beulich) - remove 'l2_info' to reuse 'l3_info'. (suggested by Jan Beulich) - modify macro name according to previous patch change. (suggested by Jan Beulich) v5: - rename 'dat[]' to 'data[]' (suggested by Jan Beulich) - remove type check in callback function. (suggested by Jan Beulich) v4: - create this patch because of codes architecture change. (suggested by Jan Beulich) --- xen/arch/x86/psr.c | 5 +++++ xen/arch/x86/sysctl.c | 23 +++++++++++++++++++++-- xen/include/public/sysctl.h | 1 + 3 files changed, 27 insertions(+), 2 deletions(-)