@@ -1372,52 +1372,52 @@ long arch_do_domctl(
case XEN_DOMCTL_PSR_CAT_OP_SET_L3_CBM:
ret = psr_set_val(d, domctl->u.psr_alloc_op.target,
domctl->u.psr_alloc_op.data,
- PSR_CBM_TYPE_L3);
+ PSR_VAL_TYPE_L3);
break;
case XEN_DOMCTL_PSR_CAT_OP_SET_L3_CODE:
ret = psr_set_val(d, domctl->u.psr_alloc_op.target,
domctl->u.psr_alloc_op.data,
- PSR_CBM_TYPE_L3_CODE);
+ PSR_VAL_TYPE_L3_CODE);
break;
case XEN_DOMCTL_PSR_CAT_OP_SET_L3_DATA:
ret = psr_set_val(d, domctl->u.psr_alloc_op.target,
domctl->u.psr_alloc_op.data,
- PSR_CBM_TYPE_L3_DATA);
+ PSR_VAL_TYPE_L3_DATA);
break;
case XEN_DOMCTL_PSR_CAT_OP_SET_L2_CBM:
ret = psr_set_val(d, domctl->u.psr_alloc_op.target,
domctl->u.psr_alloc_op.data,
- PSR_CBM_TYPE_L2);
+ PSR_VAL_TYPE_L2);
break;
case XEN_DOMCTL_PSR_CAT_OP_GET_L3_CBM:
ret = psr_get_val(d, domctl->u.psr_alloc_op.target,
&domctl->u.psr_alloc_op.data,
- PSR_CBM_TYPE_L3);
+ PSR_VAL_TYPE_L3);
copyback = 1;
break;
case XEN_DOMCTL_PSR_CAT_OP_GET_L3_CODE:
ret = psr_get_val(d, domctl->u.psr_alloc_op.target,
&domctl->u.psr_alloc_op.data,
- PSR_CBM_TYPE_L3_CODE);
+ PSR_VAL_TYPE_L3_CODE);
copyback = 1;
break;
case XEN_DOMCTL_PSR_CAT_OP_GET_L3_DATA:
ret = psr_get_val(d, domctl->u.psr_alloc_op.target,
&domctl->u.psr_alloc_op.data,
- PSR_CBM_TYPE_L3_DATA);
+ PSR_VAL_TYPE_L3_DATA);
copyback = 1;
break;
case XEN_DOMCTL_PSR_CAT_OP_GET_L2_CBM:
ret = psr_get_val(d, domctl->u.psr_alloc_op.target,
&domctl->u.psr_alloc_op.data,
- PSR_CBM_TYPE_L2);
+ PSR_VAL_TYPE_L2);
copyback = 1;
break;
@@ -118,11 +118,11 @@ struct feat_ops {
/* get_max_cos_max is used to get feature's cos_max. */
unsigned int (*get_max_cos_max)(const struct feat_node *feat);
/* get_feat_info is used to get feature HW info. */
- bool (*get_feat_info)(const struct feat_node *feat, enum cbm_type type,
+ bool (*get_feat_info)(const struct feat_node *feat, enum psr_val_type type,
uint32_t dat[], uint32_t array_len);
/* get_val is used to get feature COS register value. */
bool (*get_val)(const struct feat_node *feat, unsigned int cos,
- enum cbm_type type, uint64_t *val);
+ enum psr_val_type type, uint64_t *val);
/*
* get_cos_num is used to get the COS registers amount used by the
* feature for one setting, e.g. CDP uses 2 COSs but CAT uses 1.
@@ -150,14 +150,14 @@ struct feat_ops {
int (*set_new_val)(uint64_t val[],
const struct feat_node *feat,
unsigned int old_cos,
- enum cbm_type type,
+ enum psr_val_type type,
uint64_t m);
/*
* get_cos_max_from_type is used to get the cos_max value of the feature
* according to input type.
*/
unsigned int (*get_cos_max_from_type)(const struct feat_node *feat,
- enum cbm_type type);
+ enum psr_val_type type);
/*
* compare_val is used in set value process to compare if the
* input value array can match all the features' COS registers values
@@ -350,10 +350,10 @@ static unsigned int l3_cat_get_max_cos_max(const struct feat_node *feat)
}
static bool l3_cat_get_feat_info(const struct feat_node *feat,
- enum cbm_type type,
+ enum psr_val_type type,
uint32_t dat[], uint32_t array_len)
{
- if ( !dat || 3 > array_len || type != PSR_CBM_TYPE_L3 )
+ if ( !dat || 3 > array_len || type != PSR_VAL_TYPE_L3 )
return false;
dat[CBM_LEN] = feat->info.l3_cat_info.cbm_len;
@@ -364,9 +364,9 @@ static bool l3_cat_get_feat_info(const struct feat_node *feat,
}
static bool l3_cat_get_val(const struct feat_node *feat, unsigned int cos,
- enum cbm_type type, uint64_t *val)
+ enum psr_val_type type, uint64_t *val)
{
- if ( type != PSR_CBM_TYPE_L3 )
+ if ( type != PSR_VAL_TYPE_L3 )
return false;
if ( cos > feat->info.l3_cat_info.cos_max )
@@ -401,10 +401,10 @@ static int l3_cat_get_old_val(uint64_t val[],
static int l3_cat_set_new_val(uint64_t val[],
const struct feat_node *feat,
unsigned int old_cos,
- enum cbm_type type,
+ enum psr_val_type type,
uint64_t m)
{
- if ( type != PSR_CBM_TYPE_L3 )
+ if ( type != PSR_VAL_TYPE_L3 )
/* L3 CAT uses one COS. Skip it. */
return 1;
@@ -418,9 +418,9 @@ static int l3_cat_set_new_val(uint64_t val[],
}
static unsigned int l3_cat_get_cos_max_from_type(const struct feat_node *feat,
- enum cbm_type type)
+ enum psr_val_type type)
{
- if ( type != PSR_CBM_TYPE_L3 )
+ if ( type != PSR_VAL_TYPE_L3 )
return 0;
return feat->info.l3_cat_info.cos_max;
@@ -557,11 +557,11 @@ static unsigned int l3_cdp_get_max_cos_max(const struct feat_node *feat)
}
static bool l3_cdp_get_feat_info(const struct feat_node *feat,
- enum cbm_type type,
+ enum psr_val_type type,
uint32_t dat[], uint32_t array_len)
{
if ( !dat || 3 > array_len ||
- ( type != PSR_CBM_TYPE_L3_DATA && type != PSR_CBM_TYPE_L3_CODE) )
+ ( type != PSR_VAL_TYPE_L3_DATA && type != PSR_VAL_TYPE_L3_CODE) )
return false;
dat[CBM_LEN] = feat->info.l3_cdp_info.cbm_len;
@@ -572,16 +572,16 @@ static bool l3_cdp_get_feat_info(const struct feat_node *feat,
}
static bool l3_cdp_get_val(const struct feat_node *feat, unsigned int cos,
- enum cbm_type type, uint64_t *val)
+ enum psr_val_type type, uint64_t *val)
{
- if ( type != PSR_CBM_TYPE_L3_DATA && type != PSR_CBM_TYPE_L3_CODE )
+ if ( type != PSR_VAL_TYPE_L3_DATA && type != PSR_VAL_TYPE_L3_CODE )
return false;
if ( cos > feat->info.l3_cdp_info.cos_max )
/* Use default value. */
cos = 0;
- if ( type == PSR_CBM_TYPE_L3_DATA )
+ if ( type == PSR_VAL_TYPE_L3_DATA )
*val = get_cdp_data(feat, cos);
else
*val = get_cdp_code(feat, cos);
@@ -614,17 +614,17 @@ static int l3_cdp_get_old_val(uint64_t val[],
static int l3_cdp_set_new_val(uint64_t val[],
const struct feat_node *feat,
unsigned int old_cos,
- enum cbm_type type,
+ enum psr_val_type type,
uint64_t m)
{
- if ( type != PSR_CBM_TYPE_L3_DATA && type != PSR_CBM_TYPE_L3_CODE )
+ if ( type != PSR_VAL_TYPE_L3_DATA && type != PSR_VAL_TYPE_L3_CODE )
/* CDP uses two COSs. Skip them outside. */
return 2;
if ( !psr_check_cbm(feat->info.l3_cdp_info.cbm_len, m) )
return -EINVAL;
- if ( type == PSR_CBM_TYPE_L3_DATA )
+ if ( type == PSR_VAL_TYPE_L3_DATA )
val[0] = m;
else
val[1] = m;
@@ -634,9 +634,9 @@ static int l3_cdp_set_new_val(uint64_t val[],
}
static unsigned int l3_cdp_get_cos_max_from_type(const struct feat_node *feat,
- enum cbm_type type)
+ enum psr_val_type type)
{
- if ( type != PSR_CBM_TYPE_L3_DATA && type != PSR_CBM_TYPE_L3_CODE )
+ if ( type != PSR_VAL_TYPE_L3_DATA && type != PSR_VAL_TYPE_L3_CODE )
return 0;
return feat->info.l3_cdp_info.cos_max;
@@ -775,10 +775,10 @@ static unsigned int l2_cat_get_max_cos_max(const struct feat_node *feat)
}
static bool l2_cat_get_feat_info(const struct feat_node *feat,
- enum cbm_type type,
+ enum psr_val_type type,
uint32_t dat[], uint32_t array_len)
{
- if ( !dat || 2 > array_len || type != PSR_CBM_TYPE_L2 )
+ if ( !dat || 2 > array_len || type != PSR_VAL_TYPE_L2 )
return false;
dat[CBM_LEN] = feat->info.l2_cat_info.cbm_len;
@@ -788,9 +788,9 @@ static bool l2_cat_get_feat_info(const struct feat_node *feat,
}
static bool l2_cat_get_val(const struct feat_node *feat, unsigned int cos,
- enum cbm_type type, uint64_t *val)
+ enum psr_val_type type, uint64_t *val)
{
- if ( type != PSR_CBM_TYPE_L2 )
+ if ( type != PSR_VAL_TYPE_L2 )
return false;
if ( cos > feat->info.l2_cat_info.cos_max )
@@ -824,10 +824,10 @@ static int l2_cat_get_old_val(uint64_t val[],
static int l2_cat_set_new_val(uint64_t val[],
const struct feat_node *feat,
unsigned int old_cos,
- enum cbm_type type,
+ enum psr_val_type type,
uint64_t m)
{
- if ( type != PSR_CBM_TYPE_L2 )
+ if ( type != PSR_VAL_TYPE_L2 )
return 1;
if ( !psr_check_cbm(feat->info.l2_cat_info.cbm_len, m) )
@@ -840,9 +840,9 @@ static int l2_cat_set_new_val(uint64_t val[],
}
static unsigned int l2_cat_get_cos_max_from_type(const struct feat_node *feat,
- enum cbm_type type)
+ enum psr_val_type type)
{
- if ( type != PSR_CBM_TYPE_L2 )
+ if ( type != PSR_VAL_TYPE_L2 )
return 0;
return feat->info.l2_cat_info.cos_max;
@@ -1134,7 +1134,7 @@ static struct psr_socket_info *get_socket_info(unsigned int socket)
return socket_info + socket;
}
-int psr_get_info(unsigned int socket, enum cbm_type type,
+int psr_get_info(unsigned int socket, enum psr_val_type type,
uint32_t dat[], uint32_t array_len)
{
struct psr_socket_info *info = get_socket_info(socket);
@@ -1151,7 +1151,7 @@ int psr_get_info(unsigned int socket, enum cbm_type type,
}
int psr_get_val(struct domain *d, unsigned int socket,
- uint64_t *val, enum cbm_type type)
+ uint64_t *val, enum psr_val_type type)
{
const struct psr_socket_info *info = get_socket_info(socket);
unsigned int cos = d->arch.psr_cos_ids[socket];
@@ -1187,7 +1187,7 @@ static int get_old_set_new(uint64_t *val,
uint32_t array_len,
const struct psr_socket_info *info,
unsigned int old_cos,
- enum cbm_type type,
+ enum psr_val_type type,
uint64_t m)
{
const struct feat_node *feat_tmp;
@@ -1226,7 +1226,7 @@ static int get_old_set_new(uint64_t *val,
}
static int find_cos(const uint64_t *val, uint32_t array_len,
- enum cbm_type type,
+ enum psr_val_type type,
const struct psr_socket_info *info)
{
unsigned int cos;
@@ -1309,7 +1309,7 @@ static bool exceeds_cos_max(const uint64_t *val,
static int alloc_new_cos(const struct psr_socket_info *info,
const uint64_t *val, uint32_t array_len,
unsigned int old_cos,
- enum cbm_type type)
+ enum psr_val_type type)
{
unsigned int cos;
unsigned int cos_max = 0;
@@ -1419,7 +1419,7 @@ static int write_psr_msr(unsigned int socket, unsigned int cos,
}
int psr_set_val(struct domain *d, unsigned int socket,
- uint64_t val, enum cbm_type type)
+ uint64_t val, enum psr_val_type type)
{
unsigned int old_cos;
int cos, ret;
@@ -1434,14 +1434,14 @@ int psr_set_val(struct domain *d, unsigned int socket,
/* Judge if feature is enabled. */
switch ( type ) {
- case PSR_CBM_TYPE_L3:
+ case PSR_VAL_TYPE_L3:
flag = PSR_SOCKET_L3_CAT;
break;
- case PSR_CBM_TYPE_L3_DATA:
- case PSR_CBM_TYPE_L3_CODE:
+ case PSR_VAL_TYPE_L3_DATA:
+ case PSR_VAL_TYPE_L3_CODE:
flag = PSR_SOCKET_L3_CDP;
break;
- case PSR_CBM_TYPE_L2:
+ case PSR_VAL_TYPE_L2:
flag = PSR_SOCKET_L2_CAT;
break;
default:
@@ -179,7 +179,7 @@ long arch_do_sysctl(
{
uint32_t dat[3];
ret = psr_get_info(sysctl->u.psr_alloc_op.target,
- PSR_CBM_TYPE_L3, dat, 3);
+ PSR_VAL_TYPE_L3, dat, 3);
if ( !ret )
{
@@ -194,7 +194,7 @@ long arch_do_sysctl(
* output values to CDP's if it is enabled.
*/
ret = psr_get_info(sysctl->u.psr_alloc_op.target,
- PSR_CBM_TYPE_L3_CODE, dat, 3);
+ PSR_VAL_TYPE_L3_CODE, dat, 3);
if ( !ret )
{
sysctl->u.psr_alloc_op.u.l3_info.cbm_len = dat[CBM_LEN];
@@ -211,7 +211,7 @@ long arch_do_sysctl(
{
uint32_t dat[2];
ret = psr_get_info(sysctl->u.psr_alloc_op.target,
- PSR_CBM_TYPE_L2, dat, 2);
+ PSR_VAL_TYPE_L2, dat, 2);
if ( ret )
break;
@@ -52,11 +52,11 @@ struct psr_cmt {
struct psr_cmt_l3 l3;
};
-enum cbm_type {
- PSR_CBM_TYPE_L3,
- PSR_CBM_TYPE_L3_CODE,
- PSR_CBM_TYPE_L3_DATA,
- PSR_CBM_TYPE_L2,
+enum psr_val_type {
+ PSR_VAL_TYPE_L3,
+ PSR_VAL_TYPE_L3_CODE,
+ PSR_VAL_TYPE_L3_DATA,
+ PSR_VAL_TYPE_L2,
};
extern struct psr_cmt *psr_cmt;
@@ -70,12 +70,12 @@ 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_info(unsigned int socket, enum cbm_type type,
+int psr_get_info(unsigned int socket, enum psr_val_type type,
uint32_t dat[], uint32_t array_len);
int psr_get_val(struct domain *d, unsigned int socket,
- uint64_t *val, enum cbm_type type);
+ uint64_t *val, enum psr_val_type type);
int psr_set_val(struct domain *d, unsigned int socket,
- uint64_t val, enum cbm_type type);
+ uint64_t val, enum psr_val_type type);
int psr_domain_init(struct domain *d);
void psr_domain_free(struct domain *d);
This patch changes 'cbm_type' to 'psr_val_type' to make it general. Then, we can reuse this for every psr allocation feature. Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com> --- xen/arch/x86/domctl.c | 16 +++++----- xen/arch/x86/psr.c | 80 +++++++++++++++++++++++------------------------ xen/arch/x86/sysctl.c | 6 ++-- xen/include/asm-x86/psr.h | 16 +++++----- 4 files changed, 59 insertions(+), 59 deletions(-)