sysfs.c (f33ecec9bb5199c5a4dd296af604f70273d2636e) sysfs.c (b6c84ba22ff3a198eb8d5552cf9b8fda1d792e54)
1/*
2 * Copyright 2014 IBM Corp.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */

--- 64 unchanged lines hidden (view full) ---

73 adapter->psl_timebase_synced = (tb_to_ns(delta) < 16000) ? true : false;
74 pr_devel("PSL timebase %s - delta: 0x%016llx\n",
75 (tb_to_ns(delta) < 16000) ? "synchronized" :
76 "not synchronized", tb_to_ns(delta));
77 }
78 return scnprintf(buf, PAGE_SIZE, "%i\n", adapter->psl_timebase_synced);
79}
80
1/*
2 * Copyright 2014 IBM Corp.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */

--- 64 unchanged lines hidden (view full) ---

73 adapter->psl_timebase_synced = (tb_to_ns(delta) < 16000) ? true : false;
74 pr_devel("PSL timebase %s - delta: 0x%016llx\n",
75 (tb_to_ns(delta) < 16000) ? "synchronized" :
76 "not synchronized", tb_to_ns(delta));
77 }
78 return scnprintf(buf, PAGE_SIZE, "%i\n", adapter->psl_timebase_synced);
79}
80
81static ssize_t tunneled_ops_supported_show(struct device *device,
82 struct device_attribute *attr,
83 char *buf)
84{
85 struct cxl *adapter = to_cxl_adapter(device);
86
87 return scnprintf(buf, PAGE_SIZE, "%i\n", adapter->tunneled_ops_supported);
88}
89
90static ssize_t reset_adapter_store(struct device *device,
91 struct device_attribute *attr,
92 const char *buf, size_t count)
93{
94 struct cxl *adapter = to_cxl_adapter(device);
95 int rc;
96 int val;
97

--- 89 unchanged lines hidden (view full) ---

187}
188
189static struct device_attribute adapter_attrs[] = {
190 __ATTR_RO(caia_version),
191 __ATTR_RO(psl_revision),
192 __ATTR_RO(base_image),
193 __ATTR_RO(image_loaded),
194 __ATTR_RO(psl_timebase_synced),
81static ssize_t reset_adapter_store(struct device *device,
82 struct device_attribute *attr,
83 const char *buf, size_t count)
84{
85 struct cxl *adapter = to_cxl_adapter(device);
86 int rc;
87 int val;
88

--- 89 unchanged lines hidden (view full) ---

178}
179
180static struct device_attribute adapter_attrs[] = {
181 __ATTR_RO(caia_version),
182 __ATTR_RO(psl_revision),
183 __ATTR_RO(base_image),
184 __ATTR_RO(image_loaded),
185 __ATTR_RO(psl_timebase_synced),
195 __ATTR_RO(tunneled_ops_supported),
196 __ATTR_RW(load_image_on_perst),
197 __ATTR_RW(perst_reloads_same_image),
198 __ATTR(reset, S_IWUSR, NULL, reset_adapter_store),
199};
200
201
202/********* AFU master specific attributes **********************************/
203

--- 144 unchanged lines hidden (view full) ---

348
349static ssize_t prefault_mode_store(struct device *device,
350 struct device_attribute *attr,
351 const char *buf, size_t count)
352{
353 struct cxl_afu *afu = to_cxl_afu(device);
354 enum prefault_modes mode = -1;
355
186 __ATTR_RW(load_image_on_perst),
187 __ATTR_RW(perst_reloads_same_image),
188 __ATTR(reset, S_IWUSR, NULL, reset_adapter_store),
189};
190
191
192/********* AFU master specific attributes **********************************/
193

--- 144 unchanged lines hidden (view full) ---

338
339static ssize_t prefault_mode_store(struct device *device,
340 struct device_attribute *attr,
341 const char *buf, size_t count)
342{
343 struct cxl_afu *afu = to_cxl_afu(device);
344 enum prefault_modes mode = -1;
345
356 if (!strncmp(buf, "work_element_descriptor", 23))
357 mode = CXL_PREFAULT_WED;
358 if (!strncmp(buf, "all", 3))
359 mode = CXL_PREFAULT_ALL;
360 if (!strncmp(buf, "none", 4))
361 mode = CXL_PREFAULT_NONE;
346 if (!strncmp(buf, "none", 4))
347 mode = CXL_PREFAULT_NONE;
348 else {
349 if (!radix_enabled()) {
362
350
351 /* only allowed when not in radix mode */
352 if (!strncmp(buf, "work_element_descriptor", 23))
353 mode = CXL_PREFAULT_WED;
354 if (!strncmp(buf, "all", 3))
355 mode = CXL_PREFAULT_ALL;
356 } else {
357 dev_err(device, "Cannot prefault with radix enabled\n");
358 }
359 }
360
363 if (mode == -1)
364 return -EINVAL;
365
366 afu->prefault_mode = mode;
367 return count;
368}
369
370static ssize_t mode_show(struct device *device,

--- 396 unchanged lines hidden ---
361 if (mode == -1)
362 return -EINVAL;
363
364 afu->prefault_mode = mode;
365 return count;
366}
367
368static ssize_t mode_show(struct device *device,

--- 396 unchanged lines hidden ---