Lines Matching refs:afu

157 	struct cxl_afu *afu = to_afu_chardev_m(device);  in mmio_size_show_master()  local
159 return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->adapter->ps_size); in mmio_size_show_master()
166 struct cxl_afu *afu = to_afu_chardev_m(device); in pp_mmio_off_show() local
168 return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->pp_offset); in pp_mmio_off_show()
175 struct cxl_afu *afu = to_afu_chardev_m(device); in pp_mmio_len_show() local
177 return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->pp_size); in pp_mmio_len_show()
193 struct cxl_afu *afu = to_cxl_afu(device); in mmio_size_show() local
195 if (afu->pp_size) in mmio_size_show()
196 return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->pp_size); in mmio_size_show()
197 return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->adapter->ps_size); in mmio_size_show()
204 struct cxl_afu *afu = to_cxl_afu(device); in reset_store_afu() local
208 mutex_lock(&afu->contexts_lock); in reset_store_afu()
209 if (!idr_is_empty(&afu->contexts_idr)) { in reset_store_afu()
214 if ((rc = __cxl_afu_reset(afu))) in reset_store_afu()
219 mutex_unlock(&afu->contexts_lock); in reset_store_afu()
227 struct cxl_afu *afu = to_cxl_afu(device); in irqs_min_show() local
229 return scnprintf(buf, PAGE_SIZE, "%i\n", afu->pp_irqs); in irqs_min_show()
236 struct cxl_afu *afu = to_cxl_afu(device); in irqs_max_show() local
238 return scnprintf(buf, PAGE_SIZE, "%i\n", afu->irqs_max); in irqs_max_show()
245 struct cxl_afu *afu = to_cxl_afu(device); in irqs_max_store() local
253 if (irqs_max < afu->pp_irqs) in irqs_max_store()
256 if (irqs_max > afu->adapter->user_irqs) in irqs_max_store()
259 afu->irqs_max = irqs_max; in irqs_max_store()
266 struct cxl_afu *afu = to_cxl_afu(device); in modes_supported_show() local
269 if (afu->modes_supported & CXL_MODE_DEDICATED) in modes_supported_show()
271 if (afu->modes_supported & CXL_MODE_DIRECTED) in modes_supported_show()
280 struct cxl_afu *afu = to_cxl_afu(device); in prefault_mode_show() local
282 switch (afu->prefault_mode) { in prefault_mode_show()
296 struct cxl_afu *afu = to_cxl_afu(device); in prefault_mode_store() local
309 afu->prefault_mode = mode; in prefault_mode_store()
317 struct cxl_afu *afu = to_cxl_afu(device); in mode_show() local
319 if (afu->current_mode == CXL_MODE_DEDICATED) in mode_show()
321 if (afu->current_mode == CXL_MODE_DIRECTED) in mode_show()
329 struct cxl_afu *afu = to_cxl_afu(device); in mode_store() local
334 mutex_lock(&afu->contexts_lock); in mode_store()
335 if (!idr_is_empty(&afu->contexts_idr)) in mode_store()
354 old_mode = afu->current_mode; in mode_store()
355 afu->current_mode = 0; in mode_store()
356 afu->num_procs = 0; in mode_store()
358 mutex_unlock(&afu->contexts_lock); in mode_store()
360 if ((rc = _cxl_afu_deactivate_mode(afu, old_mode))) in mode_store()
362 if ((rc = cxl_afu_activate_mode(afu, mode))) in mode_store()
367 mutex_unlock(&afu->contexts_lock); in mode_store()
389 struct cxl_afu *afu = to_cxl_afu(container_of(kobj, in afu_eb_read() local
392 return cxl_afu_read_err_buffer(afu, buf, off, count); in afu_eb_read()
470 struct cxl_afu *afu = to_cxl_afu(container_of(kobj->parent, struct device, kobj)); in afu_read_config() local
475 val = cxl_afu_cr_read64(afu, cr->cr, off & ~0x7); in afu_read_config()
510 static struct afu_config_record *cxl_sysfs_afu_new_cr(struct cxl_afu *afu, int cr_idx) in cxl_sysfs_afu_new_cr() argument
520 cr->device = cxl_afu_cr_read16(afu, cr_idx, PCI_DEVICE_ID); in cxl_sysfs_afu_new_cr()
521 cr->vendor = cxl_afu_cr_read16(afu, cr_idx, PCI_VENDOR_ID); in cxl_sysfs_afu_new_cr()
522 cr->class = cxl_afu_cr_read32(afu, cr_idx, PCI_CLASS_REVISION) >> 8; in cxl_sysfs_afu_new_cr()
536 cr->config_attr.size = afu->crs_len; in cxl_sysfs_afu_new_cr()
540 &afu->dev.kobj, "cr%i", cr->cr); in cxl_sysfs_afu_new_cr()
563 void cxl_sysfs_afu_remove(struct cxl_afu *afu) in cxl_sysfs_afu_remove() argument
569 if (afu->eb_len) in cxl_sysfs_afu_remove()
570 device_remove_bin_file(&afu->dev, &afu->attr_eb); in cxl_sysfs_afu_remove()
573 device_remove_file(&afu->dev, &afu_attrs[i]); in cxl_sysfs_afu_remove()
575 list_for_each_entry_safe(cr, tmp, &afu->crs, list) { in cxl_sysfs_afu_remove()
581 int cxl_sysfs_afu_add(struct cxl_afu *afu) in cxl_sysfs_afu_add() argument
586 INIT_LIST_HEAD(&afu->crs); in cxl_sysfs_afu_add()
589 if ((rc = device_create_file(&afu->dev, &afu_attrs[i]))) in cxl_sysfs_afu_add()
594 if (afu->eb_len) { in cxl_sysfs_afu_add()
595 sysfs_attr_init(&afu->attr_eb.attr); in cxl_sysfs_afu_add()
597 afu->attr_eb.attr.name = "afu_err_buff"; in cxl_sysfs_afu_add()
598 afu->attr_eb.attr.mode = S_IRUGO; in cxl_sysfs_afu_add()
599 afu->attr_eb.size = afu->eb_len; in cxl_sysfs_afu_add()
600 afu->attr_eb.read = afu_eb_read; in cxl_sysfs_afu_add()
602 rc = device_create_bin_file(&afu->dev, &afu->attr_eb); in cxl_sysfs_afu_add()
604 dev_err(&afu->dev, in cxl_sysfs_afu_add()
611 for (i = 0; i < afu->crs_num; i++) { in cxl_sysfs_afu_add()
612 cr = cxl_sysfs_afu_new_cr(afu, i); in cxl_sysfs_afu_add()
617 list_add(&cr->list, &afu->crs); in cxl_sysfs_afu_add()
623 cxl_sysfs_afu_remove(afu); in cxl_sysfs_afu_add()
627 afu->eb_len = 0; in cxl_sysfs_afu_add()
630 device_remove_file(&afu->dev, &afu_attrs[i]); in cxl_sysfs_afu_add()
634 int cxl_sysfs_afu_m_add(struct cxl_afu *afu) in cxl_sysfs_afu_m_add() argument
639 if ((rc = device_create_file(afu->chardev_m, &afu_master_attrs[i]))) in cxl_sysfs_afu_m_add()
647 device_remove_file(afu->chardev_m, &afu_master_attrs[i]); in cxl_sysfs_afu_m_add()
651 void cxl_sysfs_afu_m_remove(struct cxl_afu *afu) in cxl_sysfs_afu_m_remove() argument
656 device_remove_file(afu->chardev_m, &afu_master_attrs[i]); in cxl_sysfs_afu_m_remove()