Lines Matching refs:afu

204 	struct cxl_afu *afu = to_afu_chardev_m(device);  in mmio_size_show_master()  local
206 return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->adapter->ps_size); in mmio_size_show_master()
213 struct cxl_afu *afu = to_afu_chardev_m(device); in pp_mmio_off_show() local
215 return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->native->pp_offset); in pp_mmio_off_show()
222 struct cxl_afu *afu = to_afu_chardev_m(device); in pp_mmio_len_show() local
224 return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->pp_size); in pp_mmio_len_show()
240 struct cxl_afu *afu = to_cxl_afu(device); in mmio_size_show() local
242 if (afu->pp_size) in mmio_size_show()
243 return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->pp_size); in mmio_size_show()
244 return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->adapter->ps_size); in mmio_size_show()
251 struct cxl_afu *afu = to_cxl_afu(device); in reset_store_afu() local
255 mutex_lock(&afu->contexts_lock); in reset_store_afu()
256 if (!idr_is_empty(&afu->contexts_idr)) { in reset_store_afu()
261 if ((rc = cxl_ops->afu_reset(afu))) in reset_store_afu()
266 mutex_unlock(&afu->contexts_lock); in reset_store_afu()
274 struct cxl_afu *afu = to_cxl_afu(device); in irqs_min_show() local
276 return scnprintf(buf, PAGE_SIZE, "%i\n", afu->pp_irqs); in irqs_min_show()
283 struct cxl_afu *afu = to_cxl_afu(device); in irqs_max_show() local
285 return scnprintf(buf, PAGE_SIZE, "%i\n", afu->irqs_max); in irqs_max_show()
292 struct cxl_afu *afu = to_cxl_afu(device); in irqs_max_store() local
300 if (irqs_max < afu->pp_irqs) in irqs_max_store()
304 if (irqs_max > afu->adapter->user_irqs) in irqs_max_store()
308 if (irqs_max > afu->guest->max_ints) in irqs_max_store()
312 afu->irqs_max = irqs_max; in irqs_max_store()
319 struct cxl_afu *afu = to_cxl_afu(device); in modes_supported_show() local
322 if (afu->modes_supported & CXL_MODE_DEDICATED) in modes_supported_show()
324 if (afu->modes_supported & CXL_MODE_DIRECTED) in modes_supported_show()
333 struct cxl_afu *afu = to_cxl_afu(device); in prefault_mode_show() local
335 switch (afu->prefault_mode) { in prefault_mode_show()
349 struct cxl_afu *afu = to_cxl_afu(device); in prefault_mode_store() local
370 afu->prefault_mode = mode; in prefault_mode_store()
378 struct cxl_afu *afu = to_cxl_afu(device); in mode_show() local
380 if (afu->current_mode == CXL_MODE_DEDICATED) in mode_show()
382 if (afu->current_mode == CXL_MODE_DIRECTED) in mode_show()
390 struct cxl_afu *afu = to_cxl_afu(device); in mode_store() local
395 mutex_lock(&afu->contexts_lock); in mode_store()
396 if (!idr_is_empty(&afu->contexts_idr)) in mode_store()
415 old_mode = afu->current_mode; in mode_store()
416 afu->current_mode = 0; in mode_store()
417 afu->num_procs = 0; in mode_store()
419 mutex_unlock(&afu->contexts_lock); in mode_store()
421 if ((rc = cxl_ops->afu_deactivate_mode(afu, old_mode))) in mode_store()
423 if ((rc = cxl_ops->afu_activate_mode(afu, mode))) in mode_store()
428 mutex_unlock(&afu->contexts_lock); in mode_store()
450 struct cxl_afu *afu = to_cxl_afu(kobj_to_dev(kobj)); in afu_eb_read() local
452 return cxl_ops->afu_read_err_buffer(afu, buf, off, count); in afu_eb_read()
545 struct cxl_afu *afu = to_cxl_afu(kobj_to_dev(kobj->parent)); in afu_read_config() local
550 rc = cxl_ops->afu_cr_read64(afu, cr->cr, off & ~0x7, &val); in afu_read_config()
588 static struct afu_config_record *cxl_sysfs_afu_new_cr(struct cxl_afu *afu, int cr_idx) in cxl_sysfs_afu_new_cr() argument
599 rc = cxl_ops->afu_cr_read16(afu, cr_idx, PCI_DEVICE_ID, &cr->device); in cxl_sysfs_afu_new_cr()
602 rc = cxl_ops->afu_cr_read16(afu, cr_idx, PCI_VENDOR_ID, &cr->vendor); in cxl_sysfs_afu_new_cr()
605 rc = cxl_ops->afu_cr_read32(afu, cr_idx, PCI_CLASS_REVISION, &cr->class); in cxl_sysfs_afu_new_cr()
622 cr->config_attr.size = afu->crs_len; in cxl_sysfs_afu_new_cr()
626 &afu->dev.kobj, "cr%i", cr->cr); in cxl_sysfs_afu_new_cr()
649 void cxl_sysfs_afu_remove(struct cxl_afu *afu) in cxl_sysfs_afu_remove() argument
656 if (afu->eb_len) in cxl_sysfs_afu_remove()
657 device_remove_bin_file(&afu->dev, &afu->attr_eb); in cxl_sysfs_afu_remove()
663 device_remove_file(&afu->dev, &afu_attrs[i]); in cxl_sysfs_afu_remove()
666 list_for_each_entry_safe(cr, tmp, &afu->crs, list) { in cxl_sysfs_afu_remove()
672 int cxl_sysfs_afu_add(struct cxl_afu *afu) in cxl_sysfs_afu_add() argument
678 INIT_LIST_HEAD(&afu->crs); in cxl_sysfs_afu_add()
684 if ((rc = device_create_file(&afu->dev, &afu_attrs[i]))) in cxl_sysfs_afu_add()
690 if (afu->eb_len) { in cxl_sysfs_afu_add()
691 sysfs_attr_init(&afu->attr_eb.attr); in cxl_sysfs_afu_add()
693 afu->attr_eb.attr.name = "afu_err_buff"; in cxl_sysfs_afu_add()
694 afu->attr_eb.attr.mode = S_IRUGO; in cxl_sysfs_afu_add()
695 afu->attr_eb.size = afu->eb_len; in cxl_sysfs_afu_add()
696 afu->attr_eb.read = afu_eb_read; in cxl_sysfs_afu_add()
698 rc = device_create_bin_file(&afu->dev, &afu->attr_eb); in cxl_sysfs_afu_add()
700 dev_err(&afu->dev, in cxl_sysfs_afu_add()
707 for (i = 0; i < afu->crs_num; i++) { in cxl_sysfs_afu_add()
708 cr = cxl_sysfs_afu_new_cr(afu, i); in cxl_sysfs_afu_add()
713 list_add(&cr->list, &afu->crs); in cxl_sysfs_afu_add()
719 cxl_sysfs_afu_remove(afu); in cxl_sysfs_afu_add()
723 afu->eb_len = 0; in cxl_sysfs_afu_add()
729 device_remove_file(&afu->dev, &afu_attrs[i]); in cxl_sysfs_afu_add()
734 int cxl_sysfs_afu_m_add(struct cxl_afu *afu) in cxl_sysfs_afu_m_add() argument
743 if ((rc = device_create_file(afu->chardev_m, &afu_master_attrs[i]))) in cxl_sysfs_afu_m_add()
755 device_remove_file(afu->chardev_m, &afu_master_attrs[i]); in cxl_sysfs_afu_m_add()
760 void cxl_sysfs_afu_m_remove(struct cxl_afu *afu) in cxl_sysfs_afu_m_remove() argument
769 device_remove_file(afu->chardev_m, &afu_master_attrs[i]); in cxl_sysfs_afu_m_remove()