@@ -21,10 +21,13 @@ static u32 htmtype;
21
21
static u32 htmconfigure ;
22
22
static u32 htmstart ;
23
23
static u32 htmsetup ;
24
+ static u64 htmflags ;
24
25
25
26
static struct dentry * htmdump_debugfs_dir ;
26
27
#define HTM_ENABLE 1
27
28
#define HTM_DISABLE 0
29
+ #define HTM_NOWRAP 1
30
+ #define HTM_WRAP 0
28
31
29
32
/*
30
33
* Check the return code for H_HTM hcall.
@@ -94,7 +97,7 @@ static ssize_t htmdump_read(struct file *filp, char __user *ubuf,
94
97
* - operation as htm dump (H_HTM_OP_DUMP_DATA)
95
98
* - last three values are address, size and offset
96
99
*/
97
- rc = htm_hcall_wrapper (nodeindex , nodalchipindex , coreindexonchip ,
100
+ rc = htm_hcall_wrapper (htmflags , nodeindex , nodalchipindex , coreindexonchip ,
98
101
htmtype , H_HTM_OP_DUMP_DATA , virt_to_phys (htm_buf ),
99
102
PAGE_SIZE , page );
100
103
@@ -119,6 +122,7 @@ static const struct file_operations htmdump_fops = {
119
122
static int htmconfigure_set (void * data , u64 val )
120
123
{
121
124
long rc , ret ;
125
+ unsigned long param1 = -1 , param2 = -1 ;
122
126
123
127
/*
124
128
* value as 1 : configure HTM.
@@ -129,17 +133,25 @@ static int htmconfigure_set(void *data, u64 val)
129
133
/*
130
134
* Invoke H_HTM call with:
131
135
* - operation as htm configure (H_HTM_OP_CONFIGURE)
136
+ * - If htmflags is set, param1 and param2 will be -1
137
+ * which is an indicator to use default htm mode reg mask
138
+ * and htm mode reg value.
132
139
* - last three values are unused, hence set to zero
133
140
*/
134
- rc = htm_hcall_wrapper (nodeindex , nodalchipindex , coreindexonchip ,
135
- htmtype , H_HTM_OP_CONFIGURE , 0 , 0 , 0 );
141
+ if (!htmflags ) {
142
+ param1 = 0 ;
143
+ param2 = 0 ;
144
+ }
145
+
146
+ rc = htm_hcall_wrapper (htmflags , nodeindex , nodalchipindex , coreindexonchip ,
147
+ htmtype , H_HTM_OP_CONFIGURE , param1 , param2 , 0 );
136
148
} else if (val == HTM_DISABLE ) {
137
149
/*
138
150
* Invoke H_HTM call with:
139
151
* - operation as htm deconfigure (H_HTM_OP_DECONFIGURE)
140
152
* - last three values are unused, hence set to zero
141
153
*/
142
- rc = htm_hcall_wrapper (nodeindex , nodalchipindex , coreindexonchip ,
154
+ rc = htm_hcall_wrapper (htmflags , nodeindex , nodalchipindex , coreindexonchip ,
143
155
htmtype , H_HTM_OP_DECONFIGURE , 0 , 0 , 0 );
144
156
} else
145
157
return - EINVAL ;
@@ -177,7 +189,7 @@ static int htmstart_set(void *data, u64 val)
177
189
* - operation as htm start (H_HTM_OP_START)
178
190
* - last three values are unused, hence set to zero
179
191
*/
180
- rc = htm_hcall_wrapper (nodeindex , nodalchipindex , coreindexonchip ,
192
+ rc = htm_hcall_wrapper (htmflags , nodeindex , nodalchipindex , coreindexonchip ,
181
193
htmtype , H_HTM_OP_START , 0 , 0 , 0 );
182
194
183
195
} else if (val == HTM_DISABLE ) {
@@ -186,7 +198,7 @@ static int htmstart_set(void *data, u64 val)
186
198
* - operation as htm stop (H_HTM_OP_STOP)
187
199
* - last three values are unused, hence set to zero
188
200
*/
189
- rc = htm_hcall_wrapper (nodeindex , nodalchipindex , coreindexonchip ,
201
+ rc = htm_hcall_wrapper (htmflags , nodeindex , nodalchipindex , coreindexonchip ,
190
202
htmtype , H_HTM_OP_STOP , 0 , 0 , 0 );
191
203
} else
192
204
return - EINVAL ;
@@ -223,7 +235,7 @@ static ssize_t htmstatus_read(struct file *filp, char __user *ubuf,
223
235
* - operation as htm status (H_HTM_OP_STATUS)
224
236
* - last three values as addr, size and offset
225
237
*/
226
- rc = htm_hcall_wrapper (nodeindex , nodalchipindex , coreindexonchip ,
238
+ rc = htm_hcall_wrapper (htmflags , nodeindex , nodalchipindex , coreindexonchip ,
227
239
htmtype , H_HTM_OP_STATUS , virt_to_phys (htm_status_buf ),
228
240
PAGE_SIZE , 0 );
229
241
@@ -269,7 +281,7 @@ static ssize_t htminfo_read(struct file *filp, char __user *ubuf,
269
281
* - operation as htm status (H_HTM_OP_STATUS)
270
282
* - last three values as addr, size and offset
271
283
*/
272
- rc = htm_hcall_wrapper (nodeindex , nodalchipindex , coreindexonchip ,
284
+ rc = htm_hcall_wrapper (htmflags , nodeindex , nodalchipindex , coreindexonchip ,
273
285
htmtype , H_HTM_OP_DUMP_SYSPROC_CONF , virt_to_phys (htm_info_buf ),
274
286
PAGE_SIZE , 0 );
275
287
@@ -311,7 +323,7 @@ static int htmsetup_set(void *data, u64 val)
311
323
* - parameter 1 set to input value.
312
324
* - last two values are unused, hence set to zero
313
325
*/
314
- rc = htm_hcall_wrapper (nodeindex , nodalchipindex , coreindexonchip ,
326
+ rc = htm_hcall_wrapper (htmflags , nodeindex , nodalchipindex , coreindexonchip ,
315
327
htmtype , H_HTM_OP_SETUP , val , 0 , 0 );
316
328
317
329
ret = htm_return_check (rc );
@@ -332,9 +344,35 @@ static int htmsetup_get(void *data, u64 *val)
332
344
return 0 ;
333
345
}
334
346
347
+ static int htmflags_set (void * data , u64 val )
348
+ {
349
+ /*
350
+ * Input value:
351
+ * Currently supported flag value is to enable/disable
352
+ * HTM buffer wrap. wrap is used along with "configure"
353
+ * to prevent HTM buffer from wrapping.
354
+ * Writing 1 will set noWrap while configuring HTM
355
+ */
356
+ if (val == HTM_NOWRAP )
357
+ htmflags = H_HTM_FLAGS_NOWRAP ;
358
+ else if (val == HTM_WRAP )
359
+ htmflags = 0 ;
360
+ else
361
+ return - EINVAL ;
362
+
363
+ return 0 ;
364
+ }
365
+
366
+ static int htmflags_get (void * data , u64 * val )
367
+ {
368
+ * val = htmflags ;
369
+ return 0 ;
370
+ }
371
+
335
372
DEFINE_SIMPLE_ATTRIBUTE (htmconfigure_fops , htmconfigure_get , htmconfigure_set , "%llu\n" );
336
373
DEFINE_SIMPLE_ATTRIBUTE (htmstart_fops , htmstart_get , htmstart_set , "%llu\n" );
337
374
DEFINE_SIMPLE_ATTRIBUTE (htmsetup_fops , htmsetup_get , htmsetup_set , "%llu\n" );
375
+ DEFINE_SIMPLE_ATTRIBUTE (htmflags_fops , htmflags_get , htmflags_set , "%llu\n" );
338
376
339
377
static int htmdump_init_debugfs (void )
340
378
{
@@ -363,6 +401,7 @@ static int htmdump_init_debugfs(void)
363
401
debugfs_create_file ("htmconfigure" , 0600 , htmdump_debugfs_dir , NULL , & htmconfigure_fops );
364
402
debugfs_create_file ("htmstart" , 0600 , htmdump_debugfs_dir , NULL , & htmstart_fops );
365
403
debugfs_create_file ("htmsetup" , 0600 , htmdump_debugfs_dir , NULL , & htmsetup_fops );
404
+ debugfs_create_file ("htmflags" , 0600 , htmdump_debugfs_dir , NULL , & htmflags_fops );
366
405
367
406
/* Debugfs interface file to present status of HTM */
368
407
htm_status_buf = kmalloc (PAGE_SIZE , GFP_KERNEL );
0 commit comments