Lines Matching refs:afu
186 struct cxl_afu *afu = to_afu_chardev_m(device); in mmio_size_show_master() local
188 return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->adapter->ps_size); in mmio_size_show_master()
195 struct cxl_afu *afu = to_afu_chardev_m(device); in pp_mmio_off_show() local
197 return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->native->pp_offset); in pp_mmio_off_show()
204 struct cxl_afu *afu = to_afu_chardev_m(device); in pp_mmio_len_show() local
206 return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->pp_size); in pp_mmio_len_show()
222 struct cxl_afu *afu = to_cxl_afu(device); in mmio_size_show() local
224 if (afu->pp_size) in mmio_size_show()
225 return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->pp_size); in mmio_size_show()
226 return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->adapter->ps_size); in mmio_size_show()
233 struct cxl_afu *afu = to_cxl_afu(device); in reset_store_afu() local
237 mutex_lock(&afu->contexts_lock); in reset_store_afu()
238 if (!idr_is_empty(&afu->contexts_idr)) { in reset_store_afu()
243 if ((rc = cxl_ops->afu_reset(afu))) in reset_store_afu()
248 mutex_unlock(&afu->contexts_lock); in reset_store_afu()
256 struct cxl_afu *afu = to_cxl_afu(device); in irqs_min_show() local
258 return scnprintf(buf, PAGE_SIZE, "%i\n", afu->pp_irqs); in irqs_min_show()
265 struct cxl_afu *afu = to_cxl_afu(device); in irqs_max_show() local
267 return scnprintf(buf, PAGE_SIZE, "%i\n", afu->irqs_max); in irqs_max_show()
274 struct cxl_afu *afu = to_cxl_afu(device); in irqs_max_store() local
282 if (irqs_max < afu->pp_irqs) in irqs_max_store()
286 if (irqs_max > afu->adapter->user_irqs) in irqs_max_store()
290 if (irqs_max > afu->guest->max_ints) in irqs_max_store()
294 afu->irqs_max = irqs_max; in irqs_max_store()
301 struct cxl_afu *afu = to_cxl_afu(device); in modes_supported_show() local
304 if (afu->modes_supported & CXL_MODE_DEDICATED) in modes_supported_show()
306 if (afu->modes_supported & CXL_MODE_DIRECTED) in modes_supported_show()
315 struct cxl_afu *afu = to_cxl_afu(device); in prefault_mode_show() local
317 switch (afu->prefault_mode) { in prefault_mode_show()
331 struct cxl_afu *afu = to_cxl_afu(device); in prefault_mode_store() local
344 afu->prefault_mode = mode; in prefault_mode_store()
352 struct cxl_afu *afu = to_cxl_afu(device); in mode_show() local
354 if (afu->current_mode == CXL_MODE_DEDICATED) in mode_show()
356 if (afu->current_mode == CXL_MODE_DIRECTED) in mode_show()
364 struct cxl_afu *afu = to_cxl_afu(device); in mode_store() local
369 mutex_lock(&afu->contexts_lock); in mode_store()
370 if (!idr_is_empty(&afu->contexts_idr)) in mode_store()
389 old_mode = afu->current_mode; in mode_store()
390 afu->current_mode = 0; in mode_store()
391 afu->num_procs = 0; in mode_store()
393 mutex_unlock(&afu->contexts_lock); in mode_store()
395 if ((rc = cxl_ops->afu_deactivate_mode(afu, old_mode))) in mode_store()
397 if ((rc = cxl_ops->afu_activate_mode(afu, mode))) in mode_store()
402 mutex_unlock(&afu->contexts_lock); in mode_store()
424 struct cxl_afu *afu = to_cxl_afu(kobj_to_dev(kobj)); in afu_eb_read() local
426 return cxl_ops->afu_read_err_buffer(afu, buf, off, count); in afu_eb_read()
519 struct cxl_afu *afu = to_cxl_afu(kobj_to_dev(kobj->parent)); in afu_read_config() local
524 rc = cxl_ops->afu_cr_read64(afu, cr->cr, off & ~0x7, &val); in afu_read_config()
561 static struct afu_config_record *cxl_sysfs_afu_new_cr(struct cxl_afu *afu, int cr_idx) in cxl_sysfs_afu_new_cr() argument
572 rc = cxl_ops->afu_cr_read16(afu, cr_idx, PCI_DEVICE_ID, &cr->device); in cxl_sysfs_afu_new_cr()
575 rc = cxl_ops->afu_cr_read16(afu, cr_idx, PCI_VENDOR_ID, &cr->vendor); in cxl_sysfs_afu_new_cr()
578 rc = cxl_ops->afu_cr_read32(afu, cr_idx, PCI_CLASS_REVISION, &cr->class); in cxl_sysfs_afu_new_cr()
595 cr->config_attr.size = afu->crs_len; in cxl_sysfs_afu_new_cr()
599 &afu->dev.kobj, "cr%i", cr->cr); in cxl_sysfs_afu_new_cr()
622 void cxl_sysfs_afu_remove(struct cxl_afu *afu) in cxl_sysfs_afu_remove() argument
629 if (afu->eb_len) in cxl_sysfs_afu_remove()
630 device_remove_bin_file(&afu->dev, &afu->attr_eb); in cxl_sysfs_afu_remove()
636 device_remove_file(&afu->dev, &afu_attrs[i]); in cxl_sysfs_afu_remove()
639 list_for_each_entry_safe(cr, tmp, &afu->crs, list) { in cxl_sysfs_afu_remove()
645 int cxl_sysfs_afu_add(struct cxl_afu *afu) in cxl_sysfs_afu_add() argument
651 INIT_LIST_HEAD(&afu->crs); in cxl_sysfs_afu_add()
657 if ((rc = device_create_file(&afu->dev, &afu_attrs[i]))) in cxl_sysfs_afu_add()
663 if (afu->eb_len) { in cxl_sysfs_afu_add()
664 sysfs_attr_init(&afu->attr_eb.attr); in cxl_sysfs_afu_add()
666 afu->attr_eb.attr.name = "afu_err_buff"; in cxl_sysfs_afu_add()
667 afu->attr_eb.attr.mode = S_IRUGO; in cxl_sysfs_afu_add()
668 afu->attr_eb.size = afu->eb_len; in cxl_sysfs_afu_add()
669 afu->attr_eb.read = afu_eb_read; in cxl_sysfs_afu_add()
671 rc = device_create_bin_file(&afu->dev, &afu->attr_eb); in cxl_sysfs_afu_add()
673 dev_err(&afu->dev, in cxl_sysfs_afu_add()
680 for (i = 0; i < afu->crs_num; i++) { in cxl_sysfs_afu_add()
681 cr = cxl_sysfs_afu_new_cr(afu, i); in cxl_sysfs_afu_add()
686 list_add(&cr->list, &afu->crs); in cxl_sysfs_afu_add()
692 cxl_sysfs_afu_remove(afu); in cxl_sysfs_afu_add()
696 afu->eb_len = 0; in cxl_sysfs_afu_add()
702 device_remove_file(&afu->dev, &afu_attrs[i]); in cxl_sysfs_afu_add()
707 int cxl_sysfs_afu_m_add(struct cxl_afu *afu) in cxl_sysfs_afu_m_add() argument
716 if ((rc = device_create_file(afu->chardev_m, &afu_master_attrs[i]))) in cxl_sysfs_afu_m_add()
728 device_remove_file(afu->chardev_m, &afu_master_attrs[i]); in cxl_sysfs_afu_m_add()
733 void cxl_sysfs_afu_m_remove(struct cxl_afu *afu) in cxl_sysfs_afu_m_remove() argument
742 device_remove_file(afu->chardev_m, &afu_master_attrs[i]); in cxl_sysfs_afu_m_remove()