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);
588 static struct afu_config_record *cxl_sysfs_afu_new_cr(struct cxl_afu *afu, int cr_idx)
599 rc = cxl_ops->afu_cr_read16(afu, cr_idx, PCI_DEVICE_ID, &cr->device);
602 rc = cxl_ops->afu_cr_read16(afu, cr_idx, PCI_VENDOR_ID, &cr->vendor);
605 rc = cxl_ops->afu_cr_read32(afu, cr_idx, PCI_CLASS_REVISION, &cr->class);
622 cr->config_attr.size = afu->crs_len;
626 &afu->dev.kobj, "cr%i", cr->cr);
649 void cxl_sysfs_afu_remove(struct cxl_afu *afu)
656 if (afu->eb_len)
657 device_remove_bin_file(&afu->dev, &afu->attr_eb);
663 device_remove_file(&afu->dev, &afu_attrs[i]);
666 list_for_each_entry_safe(cr, tmp, &afu->crs, list) {
672 int cxl_sysfs_afu_add(struct cxl_afu *afu)
678 INIT_LIST_HEAD(&afu->crs);
684 if ((rc = device_create_file(&afu->dev, &afu_attrs[i])))
690 if (afu->eb_len) {
691 sysfs_attr_init(&afu->attr_eb.attr);
693 afu->attr_eb.attr.name = "afu_err_buff";
694 afu->attr_eb.attr.mode = S_IRUGO;
695 afu->attr_eb.size = afu->eb_len;
696 afu->attr_eb.read = afu_eb_read;
698 rc = device_create_bin_file(&afu->dev, &afu->attr_eb);
700 dev_err(&afu->dev,
701 "Unable to create eb attr for the afu. Err(%d)\n",
707 for (i = 0; i < afu->crs_num; i++) {
708 cr = cxl_sysfs_afu_new_cr(afu, i);
713 list_add(&cr->list, &afu->crs);
719 cxl_sysfs_afu_remove(afu);
723 afu->eb_len = 0;
729 device_remove_file(&afu->dev, &afu_attrs[i]);
734 int cxl_sysfs_afu_m_add(struct cxl_afu *afu)
743 if ((rc = device_create_file(afu->chardev_m, &afu_master_attrs[i])))
755 device_remove_file(afu->chardev_m, &afu_master_attrs[i]);
760 void cxl_sysfs_afu_m_remove(struct cxl_afu *afu)
769 device_remove_file(afu->chardev_m, &afu_master_attrs[i]);