2023-01-03 17:22:44

by Fenghua Yu

[permalink] [raw]
Subject: [PATCH 0/2] Expose IAA 2.0 device capabilities

In-memory Analytics Accelerator (IAA) 2.0 [1] introduces General
Capabilities Register (GENCAP). Add a sysfs attribute to expose the
register to applications.

This series is applied cleanly on top of DSA 2.0 Event Log and Completion
Record Faulting series:
https://lore.kernel.org/dmaengine/[email protected]/T/#m13ba6167994f3add6446d2d7e242ecb637c54426

[1] IAA 2.0 spec: https://cdrdv2-public.intel.com/721858/350295-iaa-specification.pdf

Dave Jiang (2):
dmaengine: idxd: reformat swerror output to standard Linux bitmap
output
dmaengine: idxd: expose IAA CAP register via sysfs knob

.../ABI/stable/sysfs-driver-dma-idxd | 8 +++++
drivers/dma/idxd/idxd.h | 2 ++
drivers/dma/idxd/init.c | 6 +++-
drivers/dma/idxd/registers.h | 21 ++++++++++++
drivers/dma/idxd/sysfs.c | 34 +++++++++++++++----
5 files changed, 64 insertions(+), 7 deletions(-)

--
2.32.0


2023-01-03 17:23:26

by Fenghua Yu

[permalink] [raw]
Subject: [PATCH 1/2] dmaengine: idxd: reformat swerror output to standard Linux bitmap output

From: Dave Jiang <[email protected]>

SWERROR register is 4 64bit wide registers. Currently the sysfs attribute
just outputs 4 64bit hex integers. Covert to output with %*pb format
specifier.

Signed-off-by: Dave Jiang <[email protected]>
Co-developed-by: Fenghua Yu <[email protected]>
Signed-off-by: Fenghua Yu <[email protected]>
---
drivers/dma/idxd/idxd.h | 1 +
drivers/dma/idxd/init.c | 2 +-
drivers/dma/idxd/sysfs.c | 10 ++++------
3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/dma/idxd/idxd.h b/drivers/dma/idxd/idxd.h
index f92f8ec83722..e449d905bea3 100644
--- a/drivers/dma/idxd/idxd.h
+++ b/drivers/dma/idxd/idxd.h
@@ -654,6 +654,7 @@ int idxd_register_driver(void);
void idxd_unregister_driver(void);
void idxd_wqs_quiesce(struct idxd_device *idxd);
bool idxd_queue_int_handle_resubmit(struct idxd_desc *desc);
+void multi_u64_to_bmap(unsigned long *bmap, u64 *val, int count);

/* device interrupt control */
irqreturn_t idxd_misc_thread(int vec, void *data);
diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c
index 564c025b9b7e..996bd3e4e50f 100644
--- a/drivers/dma/idxd/init.c
+++ b/drivers/dma/idxd/init.c
@@ -425,7 +425,7 @@ static void idxd_read_table_offsets(struct idxd_device *idxd)
dev_dbg(dev, "IDXD Perfmon Offset: %#x\n", idxd->perfmon_offset);
}

-static void multi_u64_to_bmap(unsigned long *bmap, u64 *val, int count)
+void multi_u64_to_bmap(unsigned long *bmap, u64 *val, int count)
{
int i, j, nr;

diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c
index c772172d4ceb..dae28509e6ed 100644
--- a/drivers/dma/idxd/sysfs.c
+++ b/drivers/dma/idxd/sysfs.c
@@ -1506,15 +1506,13 @@ static ssize_t errors_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct idxd_device *idxd = confdev_to_idxd(dev);
- int i, out = 0;
+ DECLARE_BITMAP(swerr_bmap, 256);

+ bitmap_zero(swerr_bmap, 256);
spin_lock(&idxd->dev_lock);
- for (i = 0; i < 4; i++)
- out += sysfs_emit_at(buf, out, "%#018llx ", idxd->sw_err.bits[i]);
+ multi_u64_to_bmap(swerr_bmap, &idxd->sw_err.bits[0], 4);
spin_unlock(&idxd->dev_lock);
- out--;
- out += sysfs_emit_at(buf, out, "\n");
- return out;
+ return sysfs_emit(buf, "%*pb\n", 256, swerr_bmap);
}
static DEVICE_ATTR_RO(errors);

--
2.32.0

2023-01-18 13:11:27

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH 1/2] dmaengine: idxd: reformat swerror output to standard Linux bitmap output

On 03-01-23, 08:53, Fenghua Yu wrote:
> From: Dave Jiang <[email protected]>
>
> SWERROR register is 4 64bit wide registers. Currently the sysfs attribute
> just outputs 4 64bit hex integers. Covert to output with %*pb format

s/Covert/Convert

> specifier.
>
> Signed-off-by: Dave Jiang <[email protected]>
> Co-developed-by: Fenghua Yu <[email protected]>
> Signed-off-by: Fenghua Yu <[email protected]>
> ---
> drivers/dma/idxd/idxd.h | 1 +
> drivers/dma/idxd/init.c | 2 +-
> drivers/dma/idxd/sysfs.c | 10 ++++------
> 3 files changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/dma/idxd/idxd.h b/drivers/dma/idxd/idxd.h
> index f92f8ec83722..e449d905bea3 100644
> --- a/drivers/dma/idxd/idxd.h
> +++ b/drivers/dma/idxd/idxd.h
> @@ -654,6 +654,7 @@ int idxd_register_driver(void);
> void idxd_unregister_driver(void);
> void idxd_wqs_quiesce(struct idxd_device *idxd);
> bool idxd_queue_int_handle_resubmit(struct idxd_desc *desc);
> +void multi_u64_to_bmap(unsigned long *bmap, u64 *val, int count);

This change does not belong to this patch, I dont know why this is here

>
> /* device interrupt control */
> irqreturn_t idxd_misc_thread(int vec, void *data);
> diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c
> index 564c025b9b7e..996bd3e4e50f 100644
> --- a/drivers/dma/idxd/init.c
> +++ b/drivers/dma/idxd/init.c
> @@ -425,7 +425,7 @@ static void idxd_read_table_offsets(struct idxd_device *idxd)
> dev_dbg(dev, "IDXD Perfmon Offset: %#x\n", idxd->perfmon_offset);
> }
>
> -static void multi_u64_to_bmap(unsigned long *bmap, u64 *val, int count)
> +void multi_u64_to_bmap(unsigned long *bmap, u64 *val, int count)
> {
> int i, j, nr;
>
> diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c
> index c772172d4ceb..dae28509e6ed 100644
> --- a/drivers/dma/idxd/sysfs.c
> +++ b/drivers/dma/idxd/sysfs.c
> @@ -1506,15 +1506,13 @@ static ssize_t errors_show(struct device *dev,
> struct device_attribute *attr, char *buf)
> {
> struct idxd_device *idxd = confdev_to_idxd(dev);
> - int i, out = 0;
> + DECLARE_BITMAP(swerr_bmap, 256);
>
> + bitmap_zero(swerr_bmap, 256);
> spin_lock(&idxd->dev_lock);
> - for (i = 0; i < 4; i++)
> - out += sysfs_emit_at(buf, out, "%#018llx ", idxd->sw_err.bits[i]);
> + multi_u64_to_bmap(swerr_bmap, &idxd->sw_err.bits[0], 4);
> spin_unlock(&idxd->dev_lock);
> - out--;
> - out += sysfs_emit_at(buf, out, "\n");
> - return out;
> + return sysfs_emit(buf, "%*pb\n", 256, swerr_bmap);
> }
> static DEVICE_ATTR_RO(errors);
>
> --
> 2.32.0

--
~Vinod