Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dmaengine: idxd: expose IAA CAP register via sysfs knob

Add IAA (IAX) capability mask sysfs attribute to expose to applications.
The mask provides application knowledge of what capabilities this IAA
device supports. This mask is available for IAA 2.0 device or later.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Co-developed-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Link: https://lore.kernel.org/r/20230303213732.3357494-3-fenghua.yu@intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Dave Jiang and committed by
Vinod Koul
9f0d99b3 34ca0066

+58
+8
Documentation/ABI/stable/sysfs-driver-dma-idxd
··· 136 136 Also last configuration error overloaded. 137 137 Writing to it will clear the status. 138 138 139 + What: /sys/bus/dsa/devices/dsa<m>/iaa_cap 140 + Date: Sept 14, 2022 141 + KernelVersion: 6.0.0 142 + Contact: dmaengine@vger.kernel.org 143 + Description: IAA (IAX) capability mask. Exported to user space for application 144 + consumption. This attribute should only be visible on IAA devices 145 + that are version 2 or later. 146 + 139 147 What: /sys/bus/dsa/devices/wq<m>.<n>/block_on_fault 140 148 Date: Oct 27, 2020 141 149 KernelVersion: 5.11.0
+1
drivers/dma/idxd/idxd.h
··· 232 232 union engine_cap_reg engine_cap; 233 233 struct opcap opcap; 234 234 u32 cmd_cap; 235 + union iaa_cap_reg iaa_cap; 235 236 }; 236 237 237 238 enum idxd_device_state {
+4
drivers/dma/idxd/init.c
··· 460 460 dev_dbg(dev, "opcap[%d]: %#llx\n", i, idxd->hw.opcap.bits[i]); 461 461 } 462 462 multi_u64_to_bmap(idxd->opcap_bmap, &idxd->hw.opcap.bits[0], 4); 463 + 464 + /* read iaa cap */ 465 + if (idxd->data->type == IDXD_TYPE_IAX && idxd->hw.version >= DEVICE_VERSION_2) 466 + idxd->hw.iaa_cap.bits = ioread64(idxd->reg_base + IDXD_IAACAP_OFFSET); 463 467 } 464 468 465 469 static struct idxd_device *idxd_alloc(struct pci_dev *pdev, struct idxd_driver_data *data)
+21
drivers/dma/idxd/registers.h
··· 276 276 u64 bits[4]; 277 277 } __packed; 278 278 279 + union iaa_cap_reg { 280 + struct { 281 + u64 dec_aecs_format_ver:1; 282 + u64 drop_init_bits:1; 283 + u64 chaining:1; 284 + u64 force_array_output_mod:1; 285 + u64 load_part_aecs:1; 286 + u64 comp_early_abort:1; 287 + u64 nested_comp:1; 288 + u64 diction_comp:1; 289 + u64 header_gen:1; 290 + u64 crypto_gcm:1; 291 + u64 crypto_cfb:1; 292 + u64 crypto_xts:1; 293 + u64 rsvd:52; 294 + }; 295 + u64 bits; 296 + } __packed; 297 + 298 + #define IDXD_IAACAP_OFFSET 0x180 299 + 279 300 union msix_perm { 280 301 struct { 281 302 u32 rsvd:2;
+24
drivers/dma/idxd/sysfs.c
··· 1561 1561 } 1562 1562 static DEVICE_ATTR_RW(cmd_status); 1563 1563 1564 + static ssize_t iaa_cap_show(struct device *dev, 1565 + struct device_attribute *attr, char *buf) 1566 + { 1567 + struct idxd_device *idxd = confdev_to_idxd(dev); 1568 + 1569 + if (idxd->hw.version < DEVICE_VERSION_2) 1570 + return -EOPNOTSUPP; 1571 + 1572 + return sysfs_emit(buf, "%#llx\n", idxd->hw.iaa_cap.bits); 1573 + } 1574 + static DEVICE_ATTR_RO(iaa_cap); 1575 + 1564 1576 static bool idxd_device_attr_max_batch_size_invisible(struct attribute *attr, 1565 1577 struct idxd_device *idxd) 1566 1578 { ··· 1595 1583 idxd->data->type == IDXD_TYPE_IAX; 1596 1584 } 1597 1585 1586 + static bool idxd_device_attr_iaa_cap_invisible(struct attribute *attr, 1587 + struct idxd_device *idxd) 1588 + { 1589 + return attr == &dev_attr_iaa_cap.attr && 1590 + (idxd->data->type != IDXD_TYPE_IAX || 1591 + idxd->hw.version < DEVICE_VERSION_2); 1592 + } 1593 + 1598 1594 static umode_t idxd_device_attr_visible(struct kobject *kobj, 1599 1595 struct attribute *attr, int n) 1600 1596 { ··· 1613 1593 return 0; 1614 1594 1615 1595 if (idxd_device_attr_read_buffers_invisible(attr, idxd)) 1596 + return 0; 1597 + 1598 + if (idxd_device_attr_iaa_cap_invisible(attr, idxd)) 1616 1599 return 0; 1617 1600 1618 1601 return attr->mode; ··· 1643 1620 &dev_attr_read_buffer_limit.attr, 1644 1621 &dev_attr_cdev_major.attr, 1645 1622 &dev_attr_cmd_status.attr, 1623 + &dev_attr_iaa_cap.attr, 1646 1624 NULL, 1647 1625 }; 1648 1626