Skip to content

Commit 8308510

Browse files
ysunvinodkoul
authored andcommitted
dmaengine: idxd: Expose DSA3.0 capabilities through sysfs
Introduce sysfs interfaces for 3 new Data Streaming Accelerator (DSA) capability registers (dsacap0-2) to enable userspace awareness of hardware features in DSA version 3 and later devices. Userspace components (e.g. configure libraries, workload Apps) require this information to: 1. Select optimal data transfer strategies based on SGL capabilities 2. Enable hardware-specific optimizations for floating-point operations 3. Configure memory operations with proper numerical handling 4. Verify compute operation compatibility before submitting jobs The output format is <dsacap2>,<dsacap1>,<dsacap0>, where each DSA capability value is a 64-bit hexadecimal number, separated by commas. The ordering follows the DSA 3.0 specification layout: Offset: 0x190 0x188 0x180 Reg: dsacap2 dsacap1 dsacap0 Example: cat /sys/bus/dsa/devices/dsa0/dsacaps 000000000000f18d,0014000e000007aa,00fa01ff01ff03ff According to the DSA 3.0 specification, there are 15 fields defined for the three dsacap registers. However, there's no need to define all register structures unless a use case requires them. At this point, support for the Scatter-Gather List (SGL) located in dsacap0 is necessary, so only dsacap0 is defined accordingly. For reference, the DSA 3.0 specification is available at: Link: https://software.intel.com/content/www/us/en/develop/articles/intel-data-streaming-accelerator-architecture-specification.html Signed-off-by: Yi Sun <yi.sun@intel.com> Co-developed-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Tested-by: Yi Lai <yi1.lai@intel.com> Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com> Link: https://patch.msgid.link/20260107-idxd-yi-sun-dsa3-sgl-size-v2-1-dbef8f559e48@intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent e0c51fd commit 8308510

5 files changed

Lines changed: 73 additions & 0 deletions

File tree

Documentation/ABI/stable/sysfs-driver-dma-idxd

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,21 @@ Description: The last executed device administrative command's status/error.
136136
Also last configuration error overloaded.
137137
Writing to it will clear the status.
138138

139+
What: /sys/bus/dsa/devices/dsa<m>/dsacaps
140+
Date: April 5, 2026
141+
KernelVersion: 6.20.0
142+
Contact: dmaengine@vger.kernel.org
143+
Description: The DSA3 specification introduces three new capability
144+
registers: dsacap[0-2]. User components (e.g., configuration
145+
libraries and workload applications) require this information
146+
to properly utilize the DSA3 features.
147+
This includes SGL capability support, Enabling hardware-specific
148+
optimizations, Configuring memory, etc.
149+
The output format is '<dsacap2>,<dsacap1>,<dsacap0>' where each
150+
DSA cap value is a 64 bit hex value.
151+
This attribute should only be visible on DSA devices of version
152+
3 or later.
153+
139154
What: /sys/bus/dsa/devices/dsa<m>/iaa_cap
140155
Date: Sept 14, 2022
141156
KernelVersion: 6.0.0

drivers/dma/idxd/idxd.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,9 @@ struct idxd_hw {
252252
struct opcap opcap;
253253
u32 cmd_cap;
254254
union iaa_cap_reg iaa_cap;
255+
union dsacap0_reg dsacap0;
256+
union dsacap1_reg dsacap1;
257+
union dsacap2_reg dsacap2;
255258
};
256259

257260
enum idxd_device_state {

drivers/dma/idxd/init.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,12 @@ static void idxd_read_caps(struct idxd_device *idxd)
585585
}
586586
multi_u64_to_bmap(idxd->opcap_bmap, &idxd->hw.opcap.bits[0], 4);
587587

588+
if (idxd->hw.version >= DEVICE_VERSION_3) {
589+
idxd->hw.dsacap0.bits = ioread64(idxd->reg_base + IDXD_DSACAP0_OFFSET);
590+
idxd->hw.dsacap1.bits = ioread64(idxd->reg_base + IDXD_DSACAP1_OFFSET);
591+
idxd->hw.dsacap2.bits = ioread64(idxd->reg_base + IDXD_DSACAP2_OFFSET);
592+
}
593+
588594
/* read iaa cap */
589595
if (idxd->data->type == IDXD_TYPE_IAX && idxd->hw.version >= DEVICE_VERSION_2)
590596
idxd->hw.iaa_cap.bits = ioread64(idxd->reg_base + IDXD_IAACAP_OFFSET);

drivers/dma/idxd/registers.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#define DEVICE_VERSION_1 0x100
2020
#define DEVICE_VERSION_2 0x200
21+
#define DEVICE_VERSION_3 0x300
2122

2223
#define IDXD_MMIO_BAR 0
2324
#define IDXD_WQ_BAR 2
@@ -587,6 +588,30 @@ union evl_status_reg {
587588
u64 bits;
588589
};
589590

591+
#define IDXD_DSACAP0_OFFSET 0x180
592+
union dsacap0_reg {
593+
u64 bits;
594+
struct {
595+
u64 max_sgl_shift:4;
596+
u64 max_gr_block_shift:4;
597+
u64 ops_inter_domain:7;
598+
u64 rsvd1:17;
599+
u64 sgl_formats:16;
600+
u64 max_sg_process:8;
601+
u64 rsvd2:8;
602+
};
603+
};
604+
605+
#define IDXD_DSACAP1_OFFSET 0x188
606+
union dsacap1_reg {
607+
u64 bits;
608+
};
609+
610+
#define IDXD_DSACAP2_OFFSET 0x190
611+
union dsacap2_reg {
612+
u64 bits;
613+
};
614+
590615
#define IDXD_MAX_BATCH_IDENT 256
591616

592617
struct __evl_entry {

drivers/dma/idxd/sysfs.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,6 +1713,18 @@ static ssize_t event_log_size_store(struct device *dev,
17131713
}
17141714
static DEVICE_ATTR_RW(event_log_size);
17151715

1716+
static ssize_t dsacaps_show(struct device *dev,
1717+
struct device_attribute *attr, char *buf)
1718+
{
1719+
struct idxd_device *idxd = confdev_to_idxd(dev);
1720+
1721+
return sysfs_emit(buf, "%016llx,%016llx,%016llx\n",
1722+
(u64)idxd->hw.dsacap2.bits,
1723+
(u64)idxd->hw.dsacap1.bits,
1724+
(u64)idxd->hw.dsacap0.bits);
1725+
}
1726+
static DEVICE_ATTR_RO(dsacaps);
1727+
17161728
static bool idxd_device_attr_max_batch_size_invisible(struct attribute *attr,
17171729
struct idxd_device *idxd)
17181730
{
@@ -1750,6 +1762,14 @@ static bool idxd_device_attr_event_log_size_invisible(struct attribute *attr,
17501762
!idxd->hw.gen_cap.evl_support);
17511763
}
17521764

1765+
static bool idxd_device_attr_dsacaps_invisible(struct attribute *attr,
1766+
struct idxd_device *idxd)
1767+
{
1768+
return attr == &dev_attr_dsacaps.attr &&
1769+
(idxd->data->type != IDXD_TYPE_DSA ||
1770+
idxd->hw.version < DEVICE_VERSION_3);
1771+
}
1772+
17531773
static umode_t idxd_device_attr_visible(struct kobject *kobj,
17541774
struct attribute *attr, int n)
17551775
{
@@ -1768,6 +1788,9 @@ static umode_t idxd_device_attr_visible(struct kobject *kobj,
17681788
if (idxd_device_attr_event_log_size_invisible(attr, idxd))
17691789
return 0;
17701790

1791+
if (idxd_device_attr_dsacaps_invisible(attr, idxd))
1792+
return 0;
1793+
17711794
return attr->mode;
17721795
}
17731796

@@ -1795,6 +1818,7 @@ static struct attribute *idxd_device_attributes[] = {
17951818
&dev_attr_cmd_status.attr,
17961819
&dev_attr_iaa_cap.attr,
17971820
&dev_attr_event_log_size.attr,
1821+
&dev_attr_dsacaps.attr,
17981822
NULL,
17991823
};
18001824

0 commit comments

Comments
 (0)