Skip to content

Commit 7604df6

Browse files
rchatreKAGA-KOKO
authored andcommitted
x86/intel_rdt: Support flexible data to parsing callbacks
Each resource is associated with a configurable callback that should be used to parse the information provided for the particular resource from user space. In addition to the resource and domain pointers this callback is provided with just the character buffer being parsed. In support of flexible parsing the callback is modified to support a void pointer as argument. This enables resources that need more data than just the user provided data to pass its required data to the callback without affecting the signatures for the callbacks of all the other resources. Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: fenghua.yu@intel.com Cc: tony.luck@intel.com Cc: vikas.shivappa@linux.intel.com Cc: gavin.hindman@intel.com Cc: jithu.joseph@intel.com Cc: dave.hansen@intel.com Cc: hpa@zytor.com Link: https://lkml.kernel.org/r/34baacfced4d787d994ec7015e249e6c7e619053.1529706536.git.reinette.chatre@intel.com
1 parent 9af4c0a commit 7604df6

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

arch/x86/kernel/cpu/intel_rdt.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,16 +371,16 @@ struct rdt_resource {
371371
struct rdt_cache cache;
372372
struct rdt_membw membw;
373373
const char *format_str;
374-
int (*parse_ctrlval) (char *buf, struct rdt_resource *r,
374+
int (*parse_ctrlval) (void *data, struct rdt_resource *r,
375375
struct rdt_domain *d);
376376
struct list_head evt_list;
377377
int num_rmid;
378378
unsigned int mon_scale;
379379
unsigned long fflags;
380380
};
381381

382-
int parse_cbm(char *buf, struct rdt_resource *r, struct rdt_domain *d);
383-
int parse_bw(char *buf, struct rdt_resource *r, struct rdt_domain *d);
382+
int parse_cbm(void *_data, struct rdt_resource *r, struct rdt_domain *d);
383+
int parse_bw(void *_buf, struct rdt_resource *r, struct rdt_domain *d);
384384

385385
extern struct mutex rdtgroup_mutex;
386386

arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ static bool bw_validate(char *buf, unsigned long *data, struct rdt_resource *r)
6464
return true;
6565
}
6666

67-
int parse_bw(char *buf, struct rdt_resource *r, struct rdt_domain *d)
67+
int parse_bw(void *_buf, struct rdt_resource *r, struct rdt_domain *d)
6868
{
6969
unsigned long data;
70+
char *buf = _buf;
7071

7172
if (d->have_new_ctrl) {
7273
rdt_last_cmd_printf("duplicate domain %d\n", d->id);
@@ -126,8 +127,9 @@ static bool cbm_validate(char *buf, u32 *data, struct rdt_resource *r)
126127
* Read one cache bit mask (hex). Check that it is valid for the current
127128
* resource type.
128129
*/
129-
int parse_cbm(char *buf, struct rdt_resource *r, struct rdt_domain *d)
130+
int parse_cbm(void *_data, struct rdt_resource *r, struct rdt_domain *d)
130131
{
132+
char *buf = _data;
131133
u32 cbm_val;
132134

133135
if (d->have_new_ctrl) {

0 commit comments

Comments
 (0)