Lines Matching refs:afu

204 	struct cxl_afu *afu = to_afu_chardev_m(device);
206 return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->adapter->ps_size);
213 struct cxl_afu *afu = to_afu_chardev_m(device);
215 return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->native->pp_offset);
222 struct cxl_afu *afu = to_afu_chardev_m(device);
224 return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->pp_size);
240 struct cxl_afu *afu = to_cxl_afu(device);
242 if (afu->pp_size)
243 return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->pp_size);
244 return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->adapter->ps_size);
251 struct cxl_afu *afu = to_cxl_afu(device);
255 mutex_lock(&afu->contexts_lock);
256 if (!idr_is_empty(&afu->contexts_idr)) {
261 if ((rc = cxl_ops->afu_reset(afu)))
266 mutex_unlock(&afu->contexts_lock);
274 struct cxl_afu *afu = to_cxl_afu(device);
276 return scnprintf(buf, PAGE_SIZE, "%i\n", afu->pp_irqs);
283 struct cxl_afu *afu = to_cxl_afu(device);
285 return scnprintf(buf, PAGE_SIZE, "%i\n", afu->irqs_max);
292 struct cxl_afu *afu = to_cxl_afu(device);
300 if (irqs_max < afu->pp_irqs)
304 if (irqs_max > afu->adapter->user_irqs)
308 if (irqs_max > afu->guest->max_ints)
312 afu->irqs_max = irqs_max;
319 struct cxl_afu *afu = to_cxl_afu(device);
322 if (afu->modes_supported & CXL_MODE_DEDICATED)
324 if (afu->modes_supported & CXL_MODE_DIRECTED)
333 struct cxl_afu *afu = to_cxl_afu(device);
335 switch (afu->prefault_mode) {
349 struct cxl_afu *afu = to_cxl_afu(device);
370 afu->prefault_mode = mode;
378 struct cxl_afu *afu = to_cxl_afu(device);
380 if (afu->current_mode == CXL_MODE_DEDICATED)
382 if (afu->current_mode == CXL_MODE_DIRECTED)
390 struct cxl_afu *afu = to_cxl_afu(device);
395 mutex_lock(&afu->contexts_lock);
396 if (!idr_is_empty(&afu->contexts_idr))
415 old_mode = afu->current_mode;
416 afu->current_mode = 0;
417 afu->num_procs = 0;
419 mutex_unlock(&afu->contexts_lock);
421 if ((rc = cxl_ops->afu_deactivate_mode(afu, old_mode)))
423 if ((rc = cxl_ops->afu_activate_mode(afu, mode)))
428 mutex_unlock(&afu->contexts_lock);
450 struct cxl_afu *afu = to_cxl_afu(kobj_to_dev(kobj));
452 return cxl_ops->afu_read_err_buffer(afu, buf, off, count);
545 struct cxl_afu *afu = to_cxl_afu(kobj_to_dev(kobj->parent));
550 rc = cxl_ops->afu_cr_read64(afu, cr->cr, off & ~0x7, &val);
587 static struct afu_config_record *cxl_sysfs_afu_new_cr(struct cxl_afu *afu, int cr_idx)
598 rc = cxl_ops->afu_cr_read16(afu, cr_idx, PCI_DEVICE_ID, &cr->device);
601 rc = cxl_ops->afu_cr_read16(afu, cr_idx, PCI_VENDOR_ID, &cr->vendor);
604 rc = cxl_ops->afu_cr_read32(afu, cr_idx, PCI_CLASS_REVISION, &cr->class);
621 cr->config_attr.size = afu->crs_len;
625 &afu->dev.kobj, "cr%i", cr->cr);
648 void cxl_sysfs_afu_remove(struct cxl_afu *afu)
655 if (afu->eb_len)
656 device_remove_bin_file(&afu->dev, &afu->attr_eb);
662 device_remove_file(&afu->dev, &afu_attrs[i]);
665 list_for_each_entry_safe(cr, tmp, &afu->crs, list) {
671 int cxl_sysfs_afu_add(struct cxl_afu *afu)
677 INIT_LIST_HEAD(&afu->crs);
683 if ((rc = device_create_file(&afu->dev, &afu_attrs[i])))
689 if (afu->eb_len) {
690 sysfs_attr_init(&afu->attr_eb.attr);
692 afu->attr_eb.attr.name = "afu_err_buff";
693 afu->attr_eb.attr.mode = S_IRUGO;
694 afu->attr_eb.size = afu->eb_len;
695 afu->attr_eb.read = afu_eb_read;
697 rc = device_create_bin_file(&afu->dev, &afu->attr_eb);
699 dev_err(&afu->dev,
700 "Unable to create eb attr for the afu. Err(%d)\n",
706 for (i = 0; i < afu->crs_num; i++) {
707 cr = cxl_sysfs_afu_new_cr(afu, i);
712 list_add(&cr->list, &afu->crs);
718 cxl_sysfs_afu_remove(afu);
722 afu->eb_len = 0;
728 device_remove_file(&afu->dev, &afu_attrs[i]);
733 int cxl_sysfs_afu_m_add(struct cxl_afu *afu)
742 if ((rc = device_create_file(afu->chardev_m, &afu_master_attrs[i])))
754 device_remove_file(afu->chardev_m, &afu_master_attrs[i]);
759 void cxl_sysfs_afu_m_remove(struct cxl_afu *afu)
768 device_remove_file(afu->chardev_m, &afu_master_attrs[i]);