* [PATCH v5 0/3] Add RZ/G2L DMAC support
@ 2021-07-29 8:25 Biju Das
2021-07-29 8:25 ` [PATCH v5 1/3] dt-bindings: dma: Document RZ/G2L bindings Biju Das
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Biju Das @ 2021-07-29 8:25 UTC (permalink / raw)
To: Vinod Koul, Rob Herring
Cc: Biju Das, Chris Brandt, dmaengine, devicetree,
Geert Uytterhoeven, Chris Paterson, Prabhakar Mahadev Lad,
linux-renesas-soc
This patch series aims to add DMAC support on RZ/G2L SoC's.
It is based on the work done by Chris Brandt for RZ/A DMA driver.
v4->v5:
* Passing legacy slave channel configuration parameters using dmaengine_slave_config is prohibited.
So started passing this parameters in DT instead, by encoding MID/RID values with channel parameters
in the #dma-cells.
* Removed Rb tag's of Geert and Rob since there is a modification in binding patch
* Added 128 byte slave bus width support
* Removed SoC dtsi and Defconfig patch from this series. Will send as separate patch.
Ref:-
https://lore.kernel.org/linux-renesas-soc/20210719092535.4474-1-biju.das.jz@bp.renesas.com/T/#ma0b261df6d4400882204aaaaa014ddb59c479db4
v3->v4:
* Added Rob's Rb tag for binding patch.
* Incorporated Vinod and Geert's review comments.
v2->v3:
* Described clocks and resets in binding file as per Rob's feedback.
v1->v2
* Started using virtual DMAC
* Added Geert's Rb tag for binding patch.
Biju Das (3):
dt-bindings: dma: Document RZ/G2L bindings
dmaengine: Extend the dma_slave_width for 128 bytes
drivers: dma: sh: Add DMAC driver for RZ/G2L SoC
.../bindings/dma/renesas,rz-dmac.yaml | 130 +++
drivers/dma/sh/Kconfig | 9 +
drivers/dma/sh/Makefile | 1 +
drivers/dma/sh/rz-dmac.c | 971 ++++++++++++++++++
include/linux/dmaengine.h | 3 +-
5 files changed, 1113 insertions(+), 1 deletion(-)
create mode 100644 Documentation/devicetree/bindings/dma/renesas,rz-dmac.yaml
create mode 100644 drivers/dma/sh/rz-dmac.c
--
2.17.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v5 1/3] dt-bindings: dma: Document RZ/G2L bindings
2021-07-29 8:25 [PATCH v5 0/3] Add RZ/G2L DMAC support Biju Das
@ 2021-07-29 8:25 ` Biju Das
2021-07-29 18:00 ` Rob Herring
2021-07-29 8:25 ` [PATCH v5 2/3] dmaengine: Extend the dma_slave_width for 128 bytes Biju Das
2021-07-29 8:25 ` [PATCH v5 3/3] drivers: dma: sh: Add DMAC driver for RZ/G2L SoC Biju Das
2 siblings, 1 reply; 9+ messages in thread
From: Biju Das @ 2021-07-29 8:25 UTC (permalink / raw)
To: Vinod Koul, Rob Herring
Cc: Biju Das, Chris Brandt, dmaengine, devicetree,
Geert Uytterhoeven, Chris Paterson, Prabhakar Mahadev Lad,
linux-renesas-soc
Document RZ/G2L DMAC bindings.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
Note:-
This base series for this patch is Linux 5.14-rc2(or +) otherwise bots would
complain about check failures
v4->v5:
* Passing legacy slave channel configuration parameters using dmaengine_slave_config is prohibited.
So started passing this parameters in DT instead, by encoding MID/RID values with channel parameters
in the #dma-cells.
* Updated the description for #dma-cells
* Removed Rb tag's of Geert and Rob since there is a modification in binding patch
v3->v4:
* Added Rob's Rb tag
* Described clocks and reset properties
v2->v3:
* Added error interrupt first.
* Updated clock and reset maxitems.
* Added Geert's Rb tag.
v1->v2:
* Made interrupt names in defined order
* Removed src address and channel configuration from dma-cells.
* Changed the compatibele string to "renesas,r9a07g044-dmac".
v1:-
* https://patchwork.kernel.org/project/linux-renesas-soc/patch/20210611113642.18457-2-biju.das.jz@bp.renesas.com/
---
---
.../bindings/dma/renesas,rz-dmac.yaml | 130 ++++++++++++++++++
1 file changed, 130 insertions(+)
create mode 100644 Documentation/devicetree/bindings/dma/renesas,rz-dmac.yaml
diff --git a/Documentation/devicetree/bindings/dma/renesas,rz-dmac.yaml b/Documentation/devicetree/bindings/dma/renesas,rz-dmac.yaml
new file mode 100644
index 000000000000..7a4f415d74dc
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/renesas,rz-dmac.yaml
@@ -0,0 +1,130 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/dma/renesas,rz-dmac.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas RZ/G2L DMA Controller
+
+maintainers:
+ - Biju Das <biju.das.jz@bp.renesas.com>
+
+allOf:
+ - $ref: "dma-controller.yaml#"
+
+properties:
+ compatible:
+ items:
+ - enum:
+ - renesas,r9a07g044-dmac # RZ/G2{L,LC}
+ - const: renesas,rz-dmac
+
+ reg:
+ items:
+ - description: Control and channel register block
+ - description: DMA extended resource selector block
+
+ interrupts:
+ maxItems: 17
+
+ interrupt-names:
+ items:
+ - const: error
+ - const: ch0
+ - const: ch1
+ - const: ch2
+ - const: ch3
+ - const: ch4
+ - const: ch5
+ - const: ch6
+ - const: ch7
+ - const: ch8
+ - const: ch9
+ - const: ch10
+ - const: ch11
+ - const: ch12
+ - const: ch13
+ - const: ch14
+ - const: ch15
+
+ clocks:
+ items:
+ - description: DMA main clock
+ - description: DMA register access clock
+
+ '#dma-cells':
+ const: 1
+ description:
+ The cell specifies the encoded MID/RID values of the DMAC port
+ connected to the DMA client and the slave channel configuration
+ parameters.
+ bits[0:9] - Specifies MID/RID value
+ bit[10] - Specifies DMA request high enable (HIEN)
+ bit[11] - Specifies DMA request detection type (LVL)
+ bits[12:14] - Specifies DMAACK output mode (AM)
+ bit[15] - Specifies Transfer Mode (TM)
+
+ dma-channels:
+ const: 16
+
+ power-domains:
+ maxItems: 1
+
+ resets:
+ items:
+ - description: Reset for DMA ARESETN reset terminal
+ - description: Reset for DMA RST_ASYNC reset terminal
+
+required:
+ - compatible
+ - reg
+ - interrupts
+ - interrupt-names
+ - clocks
+ - '#dma-cells'
+ - dma-channels
+ - power-domains
+ - resets
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+ #include <dt-bindings/clock/r9a07g044-cpg.h>
+
+ dmac: dma-controller@11820000 {
+ compatible = "renesas,r9a07g044-dmac",
+ "renesas,rz-dmac";
+ reg = <0x11820000 0x10000>,
+ <0x11830000 0x10000>;
+ interrupts = <GIC_SPI 141 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 125 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 126 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 127 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 128 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 129 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 130 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 131 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 132 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 133 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 134 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 135 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 136 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 137 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 138 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 139 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 140 IRQ_TYPE_EDGE_RISING>;
+ interrupt-names = "error",
+ "ch0", "ch1", "ch2", "ch3",
+ "ch4", "ch5", "ch6", "ch7",
+ "ch8", "ch9", "ch10", "ch11",
+ "ch12", "ch13", "ch14", "ch15";
+ clocks = <&cpg CPG_MOD R9A07G044_DMAC_ACLK>,
+ <&cpg CPG_MOD R9A07G044_DMAC_PCLK>;
+ power-domains = <&cpg>;
+ resets = <&cpg R9A07G044_DMAC_ARESETN>,
+ <&cpg R9A07G044_DMAC_RST_ASYNC>;
+ #dma-cells = <1>;
+ dma-channels = <16>;
+ };
--
2.17.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v5 2/3] dmaengine: Extend the dma_slave_width for 128 bytes
2021-07-29 8:25 [PATCH v5 0/3] Add RZ/G2L DMAC support Biju Das
2021-07-29 8:25 ` [PATCH v5 1/3] dt-bindings: dma: Document RZ/G2L bindings Biju Das
@ 2021-07-29 8:25 ` Biju Das
2021-07-29 8:25 ` [PATCH v5 3/3] drivers: dma: sh: Add DMAC driver for RZ/G2L SoC Biju Das
2 siblings, 0 replies; 9+ messages in thread
From: Biju Das @ 2021-07-29 8:25 UTC (permalink / raw)
To: Vinod Koul
Cc: Biju Das, dmaengine, Geert Uytterhoeven, Chris Paterson,
Biju Das, Prabhakar Mahadev Lad, linux-renesas-soc
Add DMA_SLAVE_BUSWIDTH_128_BYTES to dma_slave_width for DMA engines
and users to select 128 bytes as bus width.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v1:-
* New patch
---
include/linux/dmaengine.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 93c3ca5fdafd..e5c2c9e71bf1 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -380,6 +380,7 @@ enum dma_slave_buswidth {
DMA_SLAVE_BUSWIDTH_16_BYTES = 16,
DMA_SLAVE_BUSWIDTH_32_BYTES = 32,
DMA_SLAVE_BUSWIDTH_64_BYTES = 64,
+ DMA_SLAVE_BUSWIDTH_128_BYTES = 128,
};
/**
@@ -398,7 +399,7 @@ enum dma_slave_buswidth {
* @src_addr_width: this is the width in bytes of the source (RX)
* register where DMA data shall be read. If the source
* is memory this may be ignored depending on architecture.
- * Legal values: 1, 2, 3, 4, 8, 16, 32, 64.
+ * Legal values: 1, 2, 3, 4, 8, 16, 32, 64, 128.
* @dst_addr_width: same as src_addr_width but for destination
* target (TX) mutatis mutandis.
* @src_maxburst: the maximum number of words (note: words, as in
--
2.17.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v5 3/3] drivers: dma: sh: Add DMAC driver for RZ/G2L SoC
2021-07-29 8:25 [PATCH v5 0/3] Add RZ/G2L DMAC support Biju Das
2021-07-29 8:25 ` [PATCH v5 1/3] dt-bindings: dma: Document RZ/G2L bindings Biju Das
2021-07-29 8:25 ` [PATCH v5 2/3] dmaengine: Extend the dma_slave_width for 128 bytes Biju Das
@ 2021-07-29 8:25 ` Biju Das
2021-07-29 11:33 ` kernel test robot
2 siblings, 1 reply; 9+ messages in thread
From: Biju Das @ 2021-07-29 8:25 UTC (permalink / raw)
To: Vinod Koul
Cc: Biju Das, Lad Prabhakar, Chris Paterson, Geert Uytterhoeven,
dmaengine, Chris Brandt, linux-renesas-soc
Add DMA Controller driver for RZ/G2L SoC.
Based on the work done by Chris Brandt for RZ/A DMA driver.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v4->v5:
* Passing legacy slave channel configuration parameter using dmaengine_slave_config is prohibited
so passing this parameters(TM,ACK,LVL,HIEN) through DT instead.
* Other parameters like source(SDS) and destination(DDS) data size is derived from slave_config
* Introduced an api for mapping dma_slave_buswidth to SoC register value.
* Request direction(REQD) from transaction properties.
* Updated the driver header RZ/G2L Controller Driver -> RZ/G2L DMA Controller Driver.
* Removed unused field 'valid' from lmdesc.
v3->v4:
* Incorporated Vinod and Geert's review comments.
v2->v3:
* No change
v1->v2:
* Started using virtual DMAC.
v1:
* https://patchwork.kernel.org/project/linux-renesas-soc/patch/20210611113642.18457-4-biju.das.jz@bp.renesas.com/
---
drivers/dma/sh/Kconfig | 9 +
drivers/dma/sh/Makefile | 1 +
drivers/dma/sh/rz-dmac.c | 971 +++++++++++++++++++++++++++++++++++++++
3 files changed, 981 insertions(+)
create mode 100644 drivers/dma/sh/rz-dmac.c
diff --git a/drivers/dma/sh/Kconfig b/drivers/dma/sh/Kconfig
index 13437323a85b..a46296285307 100644
--- a/drivers/dma/sh/Kconfig
+++ b/drivers/dma/sh/Kconfig
@@ -47,3 +47,12 @@ config RENESAS_USB_DMAC
help
This driver supports the USB-DMA controller found in the Renesas
SoCs.
+
+config RZ_DMAC
+ tristate "Renesas RZ/G2L DMA Controller"
+ depends on ARCH_R9A07G044 || COMPILE_TEST
+ select RENESAS_DMA
+ select DMA_VIRTUAL_CHANNELS
+ help
+ This driver supports the general purpose DMA controller found in the
+ Renesas RZ/G2L SoC variants.
diff --git a/drivers/dma/sh/Makefile b/drivers/dma/sh/Makefile
index abdf10341725..360ab6d25e76 100644
--- a/drivers/dma/sh/Makefile
+++ b/drivers/dma/sh/Makefile
@@ -15,3 +15,4 @@ obj-$(CONFIG_SH_DMAE) += shdma.o
obj-$(CONFIG_RCAR_DMAC) += rcar-dmac.o
obj-$(CONFIG_RENESAS_USB_DMAC) += usb-dmac.o
+obj-$(CONFIG_RZ_DMAC) += rz-dmac.o
diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c
new file mode 100644
index 000000000000..db4e0a539906
--- /dev/null
+++ b/drivers/dma/sh/rz-dmac.c
@@ -0,0 +1,971 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Renesas RZ/G2L DMA Controller Driver
+ *
+ * Based on imx-dma.c
+ *
+ * Copyright (C) 2021 Renesas Electronics Corp.
+ * Copyright 2010 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>
+ * Copyright 2012 Javier Martin, Vista Silicon <javier.martin@vista-silicon.com>
+ */
+
+#include <linux/dma-mapping.h>
+#include <linux/dmaengine.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_dma.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+
+#include "../dmaengine.h"
+#include "../virt-dma.h"
+
+enum rz_dmac_prep_type {
+ RZ_DMAC_DESC_MEMCPY,
+ RZ_DMAC_DESC_SLAVE_SG,
+};
+
+struct rz_lmdesc {
+ u32 header;
+ u32 sa;
+ u32 da;
+ u32 tb;
+ u32 chcfg;
+ u32 chitvl;
+ u32 chext;
+ u32 nxla;
+};
+
+struct rz_dmac_desc {
+ struct virt_dma_desc vd;
+ dma_addr_t src;
+ dma_addr_t dest;
+ size_t len;
+ struct list_head node;
+ enum dma_transfer_direction direction;
+ enum rz_dmac_prep_type type;
+ /* For slave sg */
+ struct scatterlist *sg;
+ unsigned int sgcount;
+};
+
+#define to_rz_dmac_desc(d) container_of(d, struct rz_dmac_desc, vd)
+
+struct rz_dmac_chan {
+ struct virt_dma_chan vc;
+ void __iomem *ch_base;
+ void __iomem *ch_cmn_base;
+ unsigned int index;
+ int irq;
+ struct rz_dmac_desc *desc;
+ int descs_allocated;
+
+ enum dma_slave_buswidth src_word_size;
+ enum dma_slave_buswidth dst_word_size;
+ dma_addr_t src_per_address;
+ dma_addr_t dst_per_address;
+
+ u32 chcfg;
+ u32 chctrl;
+ int mid_rid;
+
+ struct list_head ld_free;
+ struct list_head ld_queue;
+ struct list_head ld_active;
+
+ struct {
+ struct rz_lmdesc *base;
+ struct rz_lmdesc *head;
+ struct rz_lmdesc *tail;
+ dma_addr_t base_dma;
+ } lmdesc;
+};
+
+#define to_rz_dmac_chan(c) container_of(c, struct rz_dmac_chan, vc.chan)
+
+struct rz_dmac {
+ struct dma_device engine;
+ struct device *dev;
+ void __iomem *base;
+ void __iomem *ext_base;
+
+ unsigned int n_channels;
+ struct rz_dmac_chan *channels;
+
+ DECLARE_BITMAP(modules, 1024);
+};
+
+#define to_rz_dmac(d) container_of(d, struct rz_dmac, engine)
+
+/*
+ * -----------------------------------------------------------------------------
+ * Registers
+ */
+
+#define CHSTAT 0x0024
+#define CHCTRL 0x0028
+#define CHCFG 0x002c
+#define NXLA 0x0038
+
+#define DCTRL 0x0000
+
+#define EACH_CHANNEL_OFFSET 0x0040
+#define CHANNEL_0_7_OFFSET 0x0000
+#define CHANNEL_0_7_COMMON_BASE 0x0300
+#define CHANNEL_8_15_OFFSET 0x0400
+#define CHANNEL_8_15_COMMON_BASE 0x0700
+
+#define CHSTAT_ER BIT(4)
+#define CHSTAT_EN BIT(0)
+
+#define CHCTRL_CLRINTMSK BIT(17)
+#define CHCTRL_CLRSUS BIT(9)
+#define CHCTRL_CLRTC BIT(6)
+#define CHCTRL_CLREND BIT(5)
+#define CHCTRL_CLRRQ BIT(4)
+#define CHCTRL_SWRST BIT(3)
+#define CHCTRL_STG BIT(2)
+#define CHCTRL_CLREN BIT(1)
+#define CHCTRL_SETEN BIT(0)
+#define CHCTRL_DEFAULT (CHCTRL_CLRINTMSK | CHCTRL_CLRSUS | \
+ CHCTRL_CLRTC | CHCTRL_CLREND | \
+ CHCTRL_CLRRQ | CHCTRL_SWRST | \
+ CHCTRL_CLREN)
+
+#define CHCFG_DMS BIT(31)
+#define CHCFG_DEM BIT(24)
+#define CHCFG_DAD BIT(21)
+#define CHCFG_SAD BIT(20)
+#define CHCFG_REQD BIT(3)
+#define CHCFG_SEL(bits) ((bits) & 0x07)
+#define CHCFG_MEM_COPY (0x80400008)
+#define CHCFG_FILL_DDS(a) (((a) << 16) & GENMASK(19, 16))
+#define CHCFG_FILL_SDS(a) (((a) << 12) & GENMASK(15, 12))
+#define CHCFG_FILL_TM(a) (((a) & BIT(5)) << 22)
+#define CHCFG_FILL_AM(a) (((a) & GENMASK(4, 2)) << 6)
+#define CHCFG_FILL_LVL(a) (((a) & BIT(1)) << 5)
+#define CHCFG_FILL_HIEN(a) (((a) & BIT(0)) << 5)
+
+#define MID_RID_MASK GENMASK(9, 0)
+#define CHCFG_MASK GENMASK(15, 10)
+#define CHCFG_DS_INVALID 0xFF
+#define DCTRL_LVINT BIT(1)
+#define DCTRL_PR BIT(0)
+#define DCTRL_DEFAULT (DCTRL_LVINT | DCTRL_PR)
+
+/* LINK MODE DESCRIPTOR */
+#define HEADER_LV BIT(0)
+
+#define RZ_DMAC_MAX_CHAN_DESCRIPTORS 16
+#define RZ_DMAC_MAX_CHANNELS 16
+#define DMAC_NR_LMDESC 64
+
+/*
+ * -----------------------------------------------------------------------------
+ * Device access
+ */
+
+static void rz_dmac_writel(struct rz_dmac *dmac, unsigned int val,
+ unsigned int offset)
+{
+ writel(val, dmac->base + offset);
+}
+
+static void rz_dmac_ext_writel(struct rz_dmac *dmac, unsigned int val,
+ unsigned int offset)
+{
+ writel(val, dmac->ext_base + offset);
+}
+
+static u32 rz_dmac_ext_readl(struct rz_dmac *dmac, unsigned int offset)
+{
+ return readl(dmac->ext_base + offset);
+}
+
+static void rz_dmac_ch_writel(struct rz_dmac_chan *channel, unsigned int val,
+ unsigned int offset, int which)
+{
+ if (which)
+ writel(val, channel->ch_base + offset);
+ else
+ writel(val, channel->ch_cmn_base + offset);
+}
+
+static u32 rz_dmac_ch_readl(struct rz_dmac_chan *channel,
+ unsigned int offset, int which)
+{
+ if (which)
+ return readl(channel->ch_base + offset);
+ else
+ return readl(channel->ch_cmn_base + offset);
+}
+
+/*
+ * -----------------------------------------------------------------------------
+ * Initialization
+ */
+
+static void rz_lmdesc_setup(struct rz_dmac_chan *channel,
+ struct rz_lmdesc *lmdesc)
+{
+ u32 nxla;
+
+ channel->lmdesc.base = lmdesc;
+ channel->lmdesc.head = lmdesc;
+ channel->lmdesc.tail = lmdesc;
+ nxla = channel->lmdesc.base_dma;
+ while (lmdesc < (channel->lmdesc.base + (DMAC_NR_LMDESC - 1))) {
+ lmdesc->header = 0;
+ nxla += sizeof(*lmdesc);
+ lmdesc->nxla = nxla;
+ lmdesc++;
+ }
+
+ lmdesc->header = 0;
+ lmdesc->nxla = channel->lmdesc.base_dma;
+}
+
+/*
+ * -----------------------------------------------------------------------------
+ * Descriptors preparation
+ */
+
+static void rz_dmac_lmdesc_recycle(struct rz_dmac_chan *channel)
+{
+ struct rz_lmdesc *lmdesc = channel->lmdesc.head;
+
+ while (!(lmdesc->header & HEADER_LV)) {
+ lmdesc->header = 0;
+ lmdesc++;
+ if (lmdesc >= (channel->lmdesc.base + DMAC_NR_LMDESC))
+ lmdesc = channel->lmdesc.base;
+ }
+ channel->lmdesc.head = lmdesc;
+}
+
+static void rz_dmac_enable_hw(struct rz_dmac_chan *channel)
+{
+ struct dma_chan *chan = &channel->vc.chan;
+ struct rz_dmac *dmac = to_rz_dmac(chan->device);
+ unsigned long flags;
+ u32 nxla;
+ u32 chctrl;
+ u32 chstat;
+
+ dev_dbg(dmac->dev, "%s channel %d\n", __func__, channel->index);
+
+ local_irq_save(flags);
+
+ rz_dmac_lmdesc_recycle(channel);
+
+ nxla = channel->lmdesc.base_dma +
+ (sizeof(struct rz_lmdesc) * (channel->lmdesc.head -
+ channel->lmdesc.base));
+
+ chstat = rz_dmac_ch_readl(channel, CHSTAT, 1);
+ if (!(chstat & CHSTAT_EN)) {
+ chctrl = (channel->chctrl | CHCTRL_SETEN);
+ rz_dmac_ch_writel(channel, nxla, NXLA, 1);
+ rz_dmac_ch_writel(channel, channel->chcfg, CHCFG, 1);
+ rz_dmac_ch_writel(channel, CHCTRL_SWRST, CHCTRL, 1);
+ rz_dmac_ch_writel(channel, chctrl, CHCTRL, 1);
+ }
+
+ local_irq_restore(flags);
+}
+
+static void rz_dmac_disable_hw(struct rz_dmac_chan *channel)
+{
+ struct dma_chan *chan = &channel->vc.chan;
+ struct rz_dmac *dmac = to_rz_dmac(chan->device);
+ unsigned long flags;
+
+ dev_dbg(dmac->dev, "%s channel %d\n", __func__, channel->index);
+
+ local_irq_save(flags);
+ rz_dmac_ch_writel(channel, CHCTRL_DEFAULT, CHCTRL, 1);
+ local_irq_restore(flags);
+}
+
+static void rz_dmac_set_dmars_register(struct rz_dmac *dmac, int nr, u32 dmars)
+{
+ u32 dmars_offset = (nr / 2) * 4;
+ u32 shift = (nr % 2) * 16;
+ u32 dmars32;
+
+ dmars32 = rz_dmac_ext_readl(dmac, dmars_offset);
+ dmars32 &= ~(0xffff << shift);
+ dmars32 |= dmars << shift;
+
+ rz_dmac_ext_writel(dmac, dmars32, dmars_offset);
+}
+
+static void rz_dmac_prepare_desc_for_memcpy(struct rz_dmac_chan *channel)
+{
+ struct dma_chan *chan = &channel->vc.chan;
+ struct rz_dmac *dmac = to_rz_dmac(chan->device);
+ struct rz_lmdesc *lmdesc = channel->lmdesc.base;
+ struct rz_dmac_desc *d = channel->desc;
+ u32 chcfg = CHCFG_MEM_COPY;
+
+ lmdesc = channel->lmdesc.tail;
+
+ /* prepare descriptor */
+ lmdesc->sa = d->src;
+ lmdesc->da = d->dest;
+ lmdesc->tb = d->len;
+ lmdesc->chcfg = chcfg;
+ lmdesc->chitvl = 0;
+ lmdesc->chext = 0;
+ lmdesc->header = HEADER_LV;
+
+ rz_dmac_set_dmars_register(dmac, channel->index, 0);
+
+ channel->chcfg = chcfg;
+ channel->chctrl = CHCTRL_STG | CHCTRL_SETEN;
+}
+
+static void rz_dmac_prepare_descs_for_slave_sg(struct rz_dmac_chan *channel)
+{
+ struct dma_chan *chan = &channel->vc.chan;
+ struct rz_dmac *dmac = to_rz_dmac(chan->device);
+ struct rz_dmac_desc *d = channel->desc;
+ struct scatterlist *sg, *sgl = d->sg;
+ struct rz_lmdesc *lmdesc;
+ unsigned int i, sg_len = d->sgcount;
+
+ channel->chcfg |= CHCFG_SEL(channel->index) | CHCFG_DEM | CHCFG_DMS;
+
+ if (d->direction == DMA_DEV_TO_MEM) {
+ channel->chcfg |= CHCFG_SAD;
+ channel->chcfg &= ~CHCFG_REQD;
+ } else {
+ channel->chcfg |= CHCFG_DAD | CHCFG_REQD;
+ }
+
+ lmdesc = channel->lmdesc.tail;
+
+ for (i = 0, sg = sgl; i < sg_len; i++, sg = sg_next(sg)) {
+ if (d->direction == DMA_DEV_TO_MEM) {
+ lmdesc->sa = channel->src_per_address;
+ lmdesc->da = sg_dma_address(sg);
+ } else {
+ lmdesc->sa = sg_dma_address(sg);
+ lmdesc->da = channel->dst_per_address;
+ }
+
+ lmdesc->tb = sg_dma_len(sg);
+ lmdesc->chitvl = 0;
+ lmdesc->chext = 0;
+ if (i == (sg_len - 1)) {
+ lmdesc->chcfg = (channel->chcfg & ~CHCFG_DEM);
+ lmdesc->header = HEADER_LV;
+ } else {
+ lmdesc->chcfg = channel->chcfg;
+ lmdesc->header = HEADER_LV;
+ }
+ if (++lmdesc >= (channel->lmdesc.base + DMAC_NR_LMDESC))
+ lmdesc = channel->lmdesc.base;
+ }
+
+ channel->lmdesc.tail = lmdesc;
+
+ rz_dmac_set_dmars_register(dmac, channel->index, channel->mid_rid);
+ channel->chctrl = CHCTRL_SETEN;
+}
+
+static int rz_dmac_xfer_desc(struct rz_dmac_chan *chan)
+{
+ struct rz_dmac_desc *d = chan->desc;
+ struct virt_dma_desc *vd;
+
+ vd = vchan_next_desc(&chan->vc);
+ if (!vd)
+ return 0;
+
+ list_del(&vd->node);
+
+ switch (d->type) {
+ case RZ_DMAC_DESC_MEMCPY:
+ rz_dmac_prepare_desc_for_memcpy(chan);
+ break;
+
+ case RZ_DMAC_DESC_SLAVE_SG:
+ rz_dmac_prepare_descs_for_slave_sg(chan);
+ break;
+
+ default:
+ return -EINVAL;
+ }
+
+ rz_dmac_enable_hw(chan);
+
+ return 0;
+}
+
+/*
+ * -----------------------------------------------------------------------------
+ * DMA engine operations
+ */
+
+static int rz_dmac_alloc_chan_resources(struct dma_chan *chan)
+{
+ struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
+
+ while (channel->descs_allocated < RZ_DMAC_MAX_CHAN_DESCRIPTORS) {
+ struct rz_dmac_desc *desc;
+
+ desc = kzalloc(sizeof(*desc), GFP_KERNEL);
+ if (!desc)
+ break;
+
+ list_add_tail(&desc->node, &channel->ld_free);
+ channel->descs_allocated++;
+ }
+
+ if (!channel->descs_allocated)
+ return -ENOMEM;
+
+ return channel->descs_allocated;
+}
+
+static void rz_dmac_free_chan_resources(struct dma_chan *chan)
+{
+ struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
+ struct rz_dmac *dmac = to_rz_dmac(chan->device);
+ struct rz_lmdesc *lmdesc = channel->lmdesc.base;
+ struct rz_dmac_desc *desc, *_desc;
+ unsigned long flags;
+ unsigned int i;
+
+ spin_lock_irqsave(&channel->vc.lock, flags);
+
+ for (i = 0; i < DMAC_NR_LMDESC; i++)
+ lmdesc[i].header = 0;
+
+ rz_dmac_disable_hw(channel);
+ list_splice_tail_init(&channel->ld_active, &channel->ld_free);
+ list_splice_tail_init(&channel->ld_queue, &channel->ld_free);
+
+ if (channel->mid_rid >= 0) {
+ clear_bit(channel->mid_rid, dmac->modules);
+ channel->mid_rid = -EINVAL;
+ }
+
+ spin_unlock_irqrestore(&channel->vc.lock, flags);
+
+ list_for_each_entry_safe(desc, _desc, &channel->ld_free, node) {
+ kfree(desc);
+ channel->descs_allocated--;
+ }
+
+ INIT_LIST_HEAD(&channel->ld_free);
+ vchan_free_chan_resources(&channel->vc);
+}
+
+static struct dma_async_tx_descriptor *
+rz_dmac_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
+ size_t len, unsigned long flags)
+{
+ struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
+ struct rz_dmac *dmac = to_rz_dmac(chan->device);
+ struct rz_dmac_desc *desc;
+
+ dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx len=%ld\n",
+ __func__, channel->index, src, dest, len);
+
+ if (list_empty(&channel->ld_free))
+ return NULL;
+
+ desc = list_first_entry(&channel->ld_free, struct rz_dmac_desc, node);
+
+ desc->type = RZ_DMAC_DESC_MEMCPY;
+ desc->src = src;
+ desc->dest = dest;
+ desc->len = len;
+ desc->direction = DMA_MEM_TO_MEM;
+
+ list_move_tail(channel->ld_free.next, &channel->ld_queue);
+ return vchan_tx_prep(&channel->vc, &desc->vd, flags);
+}
+
+static struct dma_async_tx_descriptor *
+rz_dmac_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
+ unsigned int sg_len,
+ enum dma_transfer_direction direction,
+ unsigned long flags, void *context)
+{
+ struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
+ struct scatterlist *sg;
+ int i, dma_length = 0;
+ struct rz_dmac_desc *desc;
+
+ if (list_empty(&channel->ld_free))
+ return NULL;
+
+ desc = list_first_entry(&channel->ld_free, struct rz_dmac_desc, node);
+
+ for_each_sg(sgl, sg, sg_len, i) {
+ dma_length += sg_dma_len(sg);
+ }
+
+ desc->type = RZ_DMAC_DESC_SLAVE_SG;
+ desc->sg = sgl;
+ desc->sgcount = sg_len;
+ desc->len = dma_length;
+ desc->direction = direction;
+
+ if (direction == DMA_DEV_TO_MEM)
+ desc->src = channel->src_per_address;
+ else
+ desc->dest = channel->dst_per_address;
+
+ list_move_tail(channel->ld_free.next, &channel->ld_queue);
+ return vchan_tx_prep(&channel->vc, &desc->vd, flags);
+}
+
+static int rz_dmac_terminate_all(struct dma_chan *chan)
+{
+ struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
+ LIST_HEAD(head);
+
+ rz_dmac_disable_hw(channel);
+ list_splice_tail_init(&channel->ld_active, &channel->ld_free);
+ list_splice_tail_init(&channel->ld_queue, &channel->ld_free);
+ vchan_get_all_descriptors(&channel->vc, &head);
+ vchan_dma_desc_free_list(&channel->vc, &head);
+
+ return 0;
+}
+
+static void rz_dmac_issue_pending(struct dma_chan *chan)
+{
+ struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
+ struct rz_dmac *dmac = to_rz_dmac(chan->device);
+ struct rz_dmac_desc *desc;
+ unsigned long flags;
+
+ spin_lock_irqsave(&channel->vc.lock, flags);
+
+ if (!list_empty(&channel->ld_queue)) {
+ desc = list_first_entry(&channel->ld_queue,
+ struct rz_dmac_desc, node);
+ channel->desc = desc;
+ if (vchan_issue_pending(&channel->vc)) {
+ if (rz_dmac_xfer_desc(channel) < 0)
+ dev_warn(dmac->dev, "ch: %d couldn't issue DMA xfer\n",
+ channel->index);
+ else
+ list_move_tail(channel->ld_queue.next,
+ &channel->ld_active);
+ }
+ }
+
+ spin_unlock_irqrestore(&channel->vc.lock, flags);
+}
+
+static u8 rz_dmac_ds_to_val_mapping(enum dma_slave_buswidth ds)
+{
+ u8 i;
+ const enum dma_slave_buswidth ds_lut[] = {
+ DMA_SLAVE_BUSWIDTH_1_BYTE,
+ DMA_SLAVE_BUSWIDTH_2_BYTES,
+ DMA_SLAVE_BUSWIDTH_4_BYTES,
+ DMA_SLAVE_BUSWIDTH_8_BYTES,
+ DMA_SLAVE_BUSWIDTH_16_BYTES,
+ DMA_SLAVE_BUSWIDTH_32_BYTES,
+ DMA_SLAVE_BUSWIDTH_64_BYTES,
+ DMA_SLAVE_BUSWIDTH_128_BYTES,
+ };
+
+ for (i = 0; i < 8; i++) {
+ if (ds_lut[i] == ds)
+ return i;
+ }
+
+ return CHCFG_DS_INVALID;
+}
+
+static int rz_dmac_config(struct dma_chan *chan,
+ struct dma_slave_config *config)
+{
+ struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
+ u32 val;
+
+ channel->src_per_address = config->src_addr;
+ channel->src_word_size = config->src_addr_width;
+ channel->dst_per_address = config->dst_addr;
+ channel->dst_word_size = config->dst_addr_width;
+
+ val = rz_dmac_ds_to_val_mapping(config->dst_addr_width);
+ if (val == CHCFG_DS_INVALID)
+ return -EINVAL;
+
+ channel->chcfg |= CHCFG_FILL_DDS(val);
+
+ val = rz_dmac_ds_to_val_mapping(config->src_addr_width);
+ if (val == CHCFG_DS_INVALID)
+ return -EINVAL;
+
+ channel->chcfg |= CHCFG_FILL_SDS(val);
+
+ return 0;
+}
+
+static void rz_dmac_virt_desc_free(struct virt_dma_desc *vd)
+{
+ /*
+ * Place holder
+ * Descriptor allocation is done during alloc_chan_resources and
+ * get freed during free_chan_resources.
+ * list is used to manage the descriptors and avoid any memory
+ * allocation/free during DMA read/write.
+ */
+}
+
+/*
+ * -----------------------------------------------------------------------------
+ * IRQ handling
+ */
+
+static void rz_dmac_irq_handle_channel(struct rz_dmac_chan *channel)
+{
+ struct dma_chan *chan = &channel->vc.chan;
+ struct rz_dmac *dmac = to_rz_dmac(chan->device);
+ u32 chstat, chctrl;
+
+ chstat = rz_dmac_ch_readl(channel, CHSTAT, 1);
+ if (chstat & CHSTAT_ER) {
+ dev_err(dmac->dev, "DMAC err CHSTAT_%d = %08X\n",
+ channel->index, chstat);
+ rz_dmac_ch_writel(channel, CHCTRL_DEFAULT, CHCTRL, 1);
+ goto done;
+ }
+
+ chctrl = rz_dmac_ch_readl(channel, CHCTRL, 1);
+ rz_dmac_ch_writel(channel, chctrl | CHCTRL_CLREND, CHCTRL, 1);
+done:
+ return;
+}
+
+static irqreturn_t rz_dmac_irq_handler(int irq, void *dev_id)
+{
+ struct rz_dmac_chan *channel = dev_id;
+
+ if (channel) {
+ rz_dmac_irq_handle_channel(channel);
+ return IRQ_WAKE_THREAD;
+ }
+ /* handle DMAERR irq */
+ return IRQ_HANDLED;
+}
+
+static irqreturn_t rz_dmac_irq_handler_thread(int irq, void *dev_id)
+{
+ struct rz_dmac_chan *channel = dev_id;
+ struct rz_dmac_desc *desc = NULL;
+ unsigned long flags;
+
+ spin_lock_irqsave(&channel->vc.lock, flags);
+
+ if (list_empty(&channel->ld_active)) {
+ /* Someone might have called terminate all */
+ goto out;
+ }
+
+ desc = list_first_entry(&channel->ld_active, struct rz_dmac_desc, node);
+ spin_unlock_irqrestore(&channel->vc.lock, flags);
+ vchan_cookie_complete(&desc->vd);
+
+ spin_lock_irqsave(&channel->vc.lock, flags);
+ list_move_tail(channel->ld_active.next, &channel->ld_free);
+
+ if (!list_empty(&channel->ld_queue)) {
+ desc = list_first_entry(&channel->ld_queue, struct rz_dmac_desc,
+ node);
+ channel->desc = desc;
+ if (rz_dmac_xfer_desc(channel) == 0)
+ list_move_tail(channel->ld_queue.next, &channel->ld_active);
+ }
+out:
+ spin_unlock_irqrestore(&channel->vc.lock, flags);
+
+ return IRQ_HANDLED;
+}
+
+/*
+ * -----------------------------------------------------------------------------
+ * OF xlate and channel filter
+ */
+
+static bool rz_dmac_chan_filter(struct dma_chan *chan, void *arg)
+{
+ struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
+ struct rz_dmac *dmac = to_rz_dmac(chan->device);
+ struct of_phandle_args *dma_spec = arg;
+ u32 ch_cfg;
+
+ channel->mid_rid = dma_spec->args[0] & MID_RID_MASK;
+ ch_cfg = (dma_spec->args[0] & CHCFG_MASK) >> 10;
+ channel->chcfg = CHCFG_FILL_TM(ch_cfg) | CHCFG_FILL_AM(ch_cfg) |
+ CHCFG_FILL_LVL(ch_cfg) | CHCFG_FILL_HIEN(ch_cfg);
+
+ return !test_and_set_bit(channel->mid_rid, dmac->modules);
+}
+
+static struct dma_chan *rz_dmac_of_xlate(struct of_phandle_args *dma_spec,
+ struct of_dma *ofdma)
+{
+ dma_cap_mask_t mask;
+
+ if (dma_spec->args_count != 1)
+ return NULL;
+
+ /* Only slave DMA channels can be allocated via DT */
+ dma_cap_zero(mask);
+ dma_cap_set(DMA_SLAVE, mask);
+
+ return dma_request_channel(mask, rz_dmac_chan_filter, dma_spec);
+}
+
+/*
+ * -----------------------------------------------------------------------------
+ * Probe and remove
+ */
+
+static int rz_dmac_chan_probe(struct rz_dmac *dmac,
+ struct rz_dmac_chan *channel,
+ unsigned int index)
+{
+ struct platform_device *pdev = to_platform_device(dmac->dev);
+ struct rz_lmdesc *lmdesc;
+ char pdev_irqname[5];
+ char *irqname;
+ int ret;
+
+ channel->index = index;
+ channel->mid_rid = -EINVAL;
+
+ /* Request the channel interrupt. */
+ sprintf(pdev_irqname, "ch%u", index);
+ channel->irq = platform_get_irq_byname(pdev, pdev_irqname);
+ if (channel->irq < 0)
+ return channel->irq;
+
+ irqname = devm_kasprintf(dmac->dev, GFP_KERNEL, "%s:%u",
+ dev_name(dmac->dev), index);
+ if (!irqname)
+ return -ENOMEM;
+
+ ret = devm_request_threaded_irq(dmac->dev, channel->irq,
+ rz_dmac_irq_handler,
+ rz_dmac_irq_handler_thread, 0,
+ irqname, channel);
+ if (ret) {
+ dev_err(dmac->dev, "failed to request IRQ %u (%d)\n",
+ channel->irq, ret);
+ return ret;
+ }
+
+ /* Set io base address for each channel */
+ if (index < 8) {
+ channel->ch_base = dmac->base + CHANNEL_0_7_OFFSET +
+ EACH_CHANNEL_OFFSET * index;
+ channel->ch_cmn_base = dmac->base + CHANNEL_0_7_COMMON_BASE;
+ } else {
+ channel->ch_base = dmac->base + CHANNEL_8_15_OFFSET +
+ EACH_CHANNEL_OFFSET * (index - 8);
+ channel->ch_cmn_base = dmac->base + CHANNEL_8_15_COMMON_BASE;
+ }
+
+ /* Allocate descriptors */
+ lmdesc = dma_alloc_coherent(&pdev->dev,
+ sizeof(struct rz_lmdesc) * DMAC_NR_LMDESC,
+ &channel->lmdesc.base_dma, GFP_KERNEL);
+ if (!lmdesc) {
+ dev_err(&pdev->dev, "Can't allocate memory (lmdesc)\n");
+ return -ENOMEM;
+ }
+ rz_lmdesc_setup(channel, lmdesc);
+
+ /* Initialize register for each channel */
+ rz_dmac_ch_writel(channel, CHCTRL_DEFAULT, CHCTRL, 1);
+
+ channel->vc.desc_free = rz_dmac_virt_desc_free;
+ vchan_init(&channel->vc, &dmac->engine);
+ INIT_LIST_HEAD(&channel->ld_queue);
+ INIT_LIST_HEAD(&channel->ld_free);
+ INIT_LIST_HEAD(&channel->ld_active);
+
+ return 0;
+}
+
+static int rz_dmac_parse_of(struct device *dev, struct rz_dmac *dmac)
+{
+ struct device_node *np = dev->of_node;
+ int ret;
+
+ ret = of_property_read_u32(np, "dma-channels", &dmac->n_channels);
+ if (ret < 0) {
+ dev_err(dev, "unable to read dma-channels property\n");
+ return ret;
+ }
+
+ if (!dmac->n_channels || dmac->n_channels > RZ_DMAC_MAX_CHANNELS) {
+ dev_err(dev, "invalid number of channels %u\n", dmac->n_channels);
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static int rz_dmac_probe(struct platform_device *pdev)
+{
+ const char *irqname = "error";
+ struct dma_device *engine;
+ struct rz_dmac *dmac;
+ int channel_num;
+ unsigned int i;
+ int ret;
+ int irq;
+
+ dmac = devm_kzalloc(&pdev->dev, sizeof(*dmac), GFP_KERNEL);
+ if (!dmac)
+ return -ENOMEM;
+
+ dmac->dev = &pdev->dev;
+ platform_set_drvdata(pdev, dmac);
+
+ ret = rz_dmac_parse_of(&pdev->dev, dmac);
+ if (ret < 0)
+ return ret;
+
+ dmac->channels = devm_kcalloc(&pdev->dev, dmac->n_channels,
+ sizeof(*dmac->channels), GFP_KERNEL);
+ if (!dmac->channels)
+ return -ENOMEM;
+
+ /* Request resources */
+ dmac->base = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(dmac->base))
+ return PTR_ERR(dmac->base);
+
+ dmac->ext_base = devm_platform_ioremap_resource(pdev, 1);
+ if (IS_ERR(dmac->ext_base))
+ return PTR_ERR(dmac->ext_base);
+
+ /* Register interrupt handler for error */
+ irq = platform_get_irq_byname(pdev, irqname);
+ if (irq < 0)
+ return irq;
+
+ ret = devm_request_irq(&pdev->dev, irq, rz_dmac_irq_handler, 0,
+ irqname, NULL);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to request IRQ %u (%d)\n",
+ irq, ret);
+ return ret;
+ }
+
+ /* Initialize the channels. */
+ INIT_LIST_HEAD(&dmac->engine.channels);
+
+ for (i = 0; i < dmac->n_channels; i++) {
+ ret = rz_dmac_chan_probe(dmac, &dmac->channels[i], i);
+ if (ret < 0)
+ goto err;
+ }
+
+ /* Register the DMAC as a DMA provider for DT. */
+ ret = of_dma_controller_register(pdev->dev.of_node, rz_dmac_of_xlate,
+ NULL);
+ if (ret < 0)
+ goto err;
+
+ /* Register the DMA engine device. */
+ engine = &dmac->engine;
+ dma_cap_set(DMA_SLAVE, engine->cap_mask);
+ dma_cap_set(DMA_MEMCPY, engine->cap_mask);
+ rz_dmac_writel(dmac, DCTRL_DEFAULT, CHANNEL_0_7_COMMON_BASE + DCTRL);
+ rz_dmac_writel(dmac, DCTRL_DEFAULT, CHANNEL_8_15_COMMON_BASE + DCTRL);
+
+ engine->dev = &pdev->dev;
+
+ engine->device_alloc_chan_resources = rz_dmac_alloc_chan_resources;
+ engine->device_free_chan_resources = rz_dmac_free_chan_resources;
+ engine->device_tx_status = dma_cookie_status;
+ engine->device_prep_slave_sg = rz_dmac_prep_slave_sg;
+ engine->device_prep_dma_memcpy = rz_dmac_prep_dma_memcpy;
+ engine->device_config = rz_dmac_config;
+ engine->device_terminate_all = rz_dmac_terminate_all;
+ engine->device_issue_pending = rz_dmac_issue_pending;
+
+ engine->copy_align = DMAENGINE_ALIGN_1_BYTE;
+ dma_set_max_seg_size(engine->dev, U32_MAX);
+
+ ret = dma_async_device_register(engine);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "unable to register\n");
+ goto dma_register_err;
+ }
+ return 0;
+
+dma_register_err:
+ of_dma_controller_free(pdev->dev.of_node);
+err:
+ channel_num = i ? i - 1 : 0;
+ for (i = 0; i < channel_num; i++) {
+ struct rz_dmac_chan *channel = &dmac->channels[i];
+
+ dma_free_coherent(NULL,
+ sizeof(struct rz_lmdesc) * DMAC_NR_LMDESC,
+ channel->lmdesc.base,
+ channel->lmdesc.base_dma);
+ }
+
+ return ret;
+}
+
+static int rz_dmac_remove(struct platform_device *pdev)
+{
+ struct rz_dmac *dmac = platform_get_drvdata(pdev);
+ unsigned int i;
+
+ for (i = 0; i < dmac->n_channels; i++) {
+ struct rz_dmac_chan *channel = &dmac->channels[i];
+
+ dma_free_coherent(NULL,
+ sizeof(struct rz_lmdesc) * DMAC_NR_LMDESC,
+ channel->lmdesc.base,
+ channel->lmdesc.base_dma);
+ }
+ of_dma_controller_free(pdev->dev.of_node);
+ dma_async_device_unregister(&dmac->engine);
+
+ return 0;
+}
+
+static const struct of_device_id of_rz_dmac_match[] = {
+ { .compatible = "renesas,rz-dmac", },
+ { /* Sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, of_rz_dmac_match);
+
+static struct platform_driver rz_dmac_driver = {
+ .driver = {
+ .name = "rz-dmac",
+ .of_match_table = of_rz_dmac_match,
+ },
+ .probe = rz_dmac_probe,
+ .remove = rz_dmac_remove,
+};
+
+module_platform_driver(rz_dmac_driver);
+
+MODULE_DESCRIPTION("Renesas RZ/G2L DMA Controller Driver");
+MODULE_AUTHOR("Biju Das <biju.das.jz@bp.renesas.com>");
+MODULE_LICENSE("GPL v2");
--
2.17.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v5 3/3] drivers: dma: sh: Add DMAC driver for RZ/G2L SoC
2021-07-29 8:25 ` [PATCH v5 3/3] drivers: dma: sh: Add DMAC driver for RZ/G2L SoC Biju Das
@ 2021-07-29 11:33 ` kernel test robot
2021-07-29 13:26 ` Biju Das
0 siblings, 1 reply; 9+ messages in thread
From: kernel test robot @ 2021-07-29 11:33 UTC (permalink / raw)
To: Biju Das, Vinod Koul
Cc: kbuild-all, Biju Das, Lad Prabhakar, Chris Paterson,
Geert Uytterhoeven, dmaengine, Chris Brandt, linux-renesas-soc
[-- Attachment #1: Type: text/plain, Size: 9757 bytes --]
Hi Biju,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on vkoul-dmaengine/next]
[also build test WARNING on robh/for-next v5.14-rc3 next-20210728]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Biju-Das/Add-RZ-G2L-DMAC-support/20210729-162632
base: https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git next
config: nios2-allyesconfig (attached as .config)
compiler: nios2-linux-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/cfd03e1dedb6793c62ca9acb9642dd314d44ac8e
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Biju-Das/Add-RZ-G2L-DMAC-support/20210729-162632
git checkout cfd03e1dedb6793c62ca9acb9642dd314d44ac8e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=nios2
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from include/linux/printk.h:456,
from include/asm-generic/bug.h:22,
from ./arch/nios2/include/generated/asm/bug.h:1,
from include/linux/bug.h:5,
from include/linux/thread_info.h:13,
from include/asm-generic/current.h:5,
from ./arch/nios2/include/generated/asm/current.h:1,
from include/linux/sched.h:12,
from include/linux/ratelimit.h:6,
from include/linux/dev_printk.h:16,
from include/linux/device.h:15,
from include/linux/dma-mapping.h:7,
from drivers/dma/sh/rz-dmac.c:12:
drivers/dma/sh/rz-dmac.c: In function 'rz_dmac_prep_dma_memcpy':
>> drivers/dma/sh/rz-dmac.c:478:21: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 6 has type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx len=%ld\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:134:15: note: in definition of macro '__dynamic_func_call'
134 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:166:2: note: in expansion of macro '_dynamic_func_call'
166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:123:2: note: in expansion of macro 'dynamic_dev_dbg'
123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:123:23: note: in expansion of macro 'dev_fmt'
123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/dma/sh/rz-dmac.c:478:2: note: in expansion of macro 'dev_dbg'
478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx len=%ld\n",
| ^~~~~~~
drivers/dma/sh/rz-dmac.c:478:46: note: format string is defined here
478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx len=%ld\n",
| ~~~^
| |
| long long unsigned int
| %x
In file included from include/linux/printk.h:456,
from include/asm-generic/bug.h:22,
from ./arch/nios2/include/generated/asm/bug.h:1,
from include/linux/bug.h:5,
from include/linux/thread_info.h:13,
from include/asm-generic/current.h:5,
from ./arch/nios2/include/generated/asm/current.h:1,
from include/linux/sched.h:12,
from include/linux/ratelimit.h:6,
from include/linux/dev_printk.h:16,
from include/linux/device.h:15,
from include/linux/dma-mapping.h:7,
from drivers/dma/sh/rz-dmac.c:12:
drivers/dma/sh/rz-dmac.c:478:21: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 7 has type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx len=%ld\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:134:15: note: in definition of macro '__dynamic_func_call'
134 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:166:2: note: in expansion of macro '_dynamic_func_call'
166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:123:2: note: in expansion of macro 'dynamic_dev_dbg'
123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:123:23: note: in expansion of macro 'dev_fmt'
123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/dma/sh/rz-dmac.c:478:2: note: in expansion of macro 'dev_dbg'
478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx len=%ld\n",
| ^~~~~~~
drivers/dma/sh/rz-dmac.c:478:57: note: format string is defined here
478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx len=%ld\n",
| ~~~^
| |
| long long unsigned int
| %x
In file included from include/linux/printk.h:456,
from include/asm-generic/bug.h:22,
from ./arch/nios2/include/generated/asm/bug.h:1,
from include/linux/bug.h:5,
from include/linux/thread_info.h:13,
from include/asm-generic/current.h:5,
from ./arch/nios2/include/generated/asm/current.h:1,
from include/linux/sched.h:12,
from include/linux/ratelimit.h:6,
from include/linux/dev_printk.h:16,
from include/linux/device.h:15,
from include/linux/dma-mapping.h:7,
from drivers/dma/sh/rz-dmac.c:12:
>> drivers/dma/sh/rz-dmac.c:478:21: warning: format '%ld' expects argument of type 'long int', but argument 8 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx len=%ld\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:134:15: note: in definition of macro '__dynamic_func_call'
134 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:166:2: note: in expansion of macro '_dynamic_func_call'
166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:123:2: note: in expansion of macro 'dynamic_dev_dbg'
123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:123:23: note: in expansion of macro 'dev_fmt'
123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/dma/sh/rz-dmac.c:478:2: note: in expansion of macro 'dev_dbg'
478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx len=%ld\n",
| ^~~~~~~
drivers/dma/sh/rz-dmac.c:478:65: note: format string is defined here
478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx len=%ld\n",
| ~~^
| |
| long int
| %d
vim +478 drivers/dma/sh/rz-dmac.c
469
470 static struct dma_async_tx_descriptor *
471 rz_dmac_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
472 size_t len, unsigned long flags)
473 {
474 struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
475 struct rz_dmac *dmac = to_rz_dmac(chan->device);
476 struct rz_dmac_desc *desc;
477
> 478 dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx len=%ld\n",
479 __func__, channel->index, src, dest, len);
480
481 if (list_empty(&channel->ld_free))
482 return NULL;
483
484 desc = list_first_entry(&channel->ld_free, struct rz_dmac_desc, node);
485
486 desc->type = RZ_DMAC_DESC_MEMCPY;
487 desc->src = src;
488 desc->dest = dest;
489 desc->len = len;
490 desc->direction = DMA_MEM_TO_MEM;
491
492 list_move_tail(channel->ld_free.next, &channel->ld_queue);
493 return vchan_tx_prep(&channel->vc, &desc->vd, flags);
494 }
495
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 60015 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH v5 3/3] drivers: dma: sh: Add DMAC driver for RZ/G2L SoC
2021-07-29 11:33 ` kernel test robot
@ 2021-07-29 13:26 ` Biju Das
2021-07-29 13:50 ` Biju Das
0 siblings, 1 reply; 9+ messages in thread
From: Biju Das @ 2021-07-29 13:26 UTC (permalink / raw)
To: kernel test robot, Vinod Koul
Cc: kbuild-all, Prabhakar Mahadev Lad, Chris Paterson,
Geert Uytterhoeven, dmaengine, Chris Brandt, linux-renesas-soc
Hi All,
Looks like there is compiler issue with nios2 cross compilation toolchain.
As per the kernel documentation %pad is the format specifier for dma_addr_t.
This toolchain does not like it. Please let me know if I am missing any thing here.
The changes I made to fix the issue reported by bot:-
-------------------
+++ b/drivers/dma/sh/rz-dmac.c
@@ -475,7 +475,7 @@ rz_dmac_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
struct rz_dmac *dmac = to_rz_dmac(chan->device);
struct rz_dmac_desc *desc;
- dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx len=%ld\n",
+ dev_dbg(dmac->dev, "%s channel: %d src=%pad dst=%pad len=%zx\n",
__func__, channel->index, src, dest, len);
if (list_empty(&channel->ld_free))
compilation logs:-
------------------
dasb@ree-du1sdd5:~/dmaengine$ COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 ~/bin/make.cross ARCH=nios2
Compiler will be installed in /data/dasb/0day
make --keep-going CONFIG_OF_ALL_DTBS=y CONFIG_DTC=y CROSS_COMPILE=/data/dasb/0day/gcc-10.3.0-nolibc/nios2-linux/bin/nios2-linux- --jobs=48 ARCH=nios2
CALL scripts/atomic/check-atomics.sh
CALL scripts/checksyscalls.sh
<stdin>:1515:2: warning: #warning syscall clone3 not implemented [-Wcpp]
CHK include/generated/compile.h
make[1]: *** No rule to make target 'arch/nios2/boot/dts/""', needed by 'arch/nios2/boot/dts/built-in.a'.
make[1]: Target '__build' not remade because of errors.
make: *** [Makefile:1842: arch/nios2/boot/dts] Error 2
CC drivers/dma/sh/rz-dmac.o
In file included from ./include/linux/printk.h:456,
from ./include/asm-generic/bug.h:22,
from ./arch/nios2/include/generated/asm/bug.h:1,
from ./include/linux/bug.h:5,
from ./include/linux/thread_info.h:13,
from ./include/asm-generic/current.h:5,
from ./arch/nios2/include/generated/asm/current.h:1,
from ./include/linux/sched.h:12,
from ./include/linux/ratelimit.h:6,
from ./include/linux/dev_printk.h:16,
from ./include/linux/device.h:15,
from ./include/linux/dma-mapping.h:7,
from drivers/dma/sh/rz-dmac.c:12:
drivers/dma/sh/rz-dmac.c: In function 'rz_dmac_prep_dma_memcpy':
drivers/dma/sh/rz-dmac.c:478:21: warning: format '%p' expects argument of type 'void *', but argument 6 has type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
478 | dev_dbg(dmac->dev, "%s channel: %d src=%pad dst=%pad len=%zx\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/dynamic_debug.h:134:15: note: in definition of macro '__dynamic_func_call'
134 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
./include/linux/dynamic_debug.h:166:2: note: in expansion of macro '_dynamic_func_call'
166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
./include/linux/dev_printk.h:123:2: note: in expansion of macro 'dynamic_dev_dbg'
123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
./include/linux/dev_printk.h:123:23: note: in expansion of macro 'dev_fmt'
123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/dma/sh/rz-dmac.c:478:2: note: in expansion of macro 'dev_dbg'
478 | dev_dbg(dmac->dev, "%s channel: %d src=%pad dst=%pad len=%zx\n",
| ^~~~~~~
drivers/dma/sh/rz-dmac.c:478:42: note: format string is defined here
478 | dev_dbg(dmac->dev, "%s channel: %d src=%pad dst=%pad len=%zx\n",
| ~^
| |
| void *
| %d
In file included from ./include/linux/printk.h:456,
from ./include/asm-generic/bug.h:22,
from ./arch/nios2/include/generated/asm/bug.h:1,
from ./include/linux/bug.h:5,
from ./include/linux/thread_info.h:13,
from ./include/asm-generic/current.h:5,
from ./arch/nios2/include/generated/asm/current.h:1,
from ./include/linux/sched.h:12,
from ./include/linux/ratelimit.h:6,
from ./include/linux/dev_printk.h:16,
from ./include/linux/device.h:15,
from ./include/linux/dma-mapping.h:7,
from drivers/dma/sh/rz-dmac.c:12:
drivers/dma/sh/rz-dmac.c:478:21: warning: format '%p' expects argument of type 'void *', but argument 7 has type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
478 | dev_dbg(dmac->dev, "%s channel: %d src=%pad dst=%pad len=%zx\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/linux/dynamic_debug.h:134:15: note: in definition of macro '__dynamic_func_call'
134 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
./include/linux/dynamic_debug.h:166:2: note: in expansion of macro '_dynamic_func_call'
166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
./include/linux/dev_printk.h:123:2: note: in expansion of macro 'dynamic_dev_dbg'
123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
./include/linux/dev_printk.h:123:23: note: in expansion of macro 'dev_fmt'
123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/dma/sh/rz-dmac.c:478:2: note: in expansion of macro 'dev_dbg'
478 | dev_dbg(dmac->dev, "%s channel: %d src=%pad dst=%pad len=%zx\n",
| ^~~~~~~
drivers/dma/sh/rz-dmac.c:478:51: note: format string is defined here
478 | dev_dbg(dmac->dev, "%s channel: %d src=%pad dst=%pad len=%zx\n",
| ~^
| |
| void *
| %d
CHK kernel/kheaders_data.tar.xz
AR drivers/dma/sh/built-in.a
AR drivers/dma/built-in.a
AR drivers/built-in.a
make: Target '__all' not remade because of errors.
Regards,
Biju
> -----Original Message-----
> From: kernel test robot <lkp@intel.com>
> Sent: 29 July 2021 12:34
> To: Biju Das <biju.das.jz@bp.renesas.com>; Vinod Koul <vkoul@kernel.org>
> Cc: kbuild-all@lists.01.org; Biju Das <biju.das.jz@bp.renesas.com>;
> Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>; Chris
> Paterson <Chris.Paterson2@renesas.com>; Geert Uytterhoeven
> <geert+renesas@glider.be>; dmaengine@vger.kernel.org; Chris Brandt
> <Chris.Brandt@renesas.com>; linux-renesas-soc@vger.kernel.org
> Subject: Re: [PATCH v5 3/3] drivers: dma: sh: Add DMAC driver for RZ/G2L
> SoC
>
> Hi Biju,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on vkoul-dmaengine/next] [also build test WARNING
> on robh/for-next v5.14-rc3 next-20210728] [If your patch is applied to the
> wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit-
> scm.com%2Fdocs%2Fgit-format-
> patch&data=04%7C01%7Cbiju.das.jz%40bp.renesas.com%7C542bfff2887f488c2f
> ef08d95284c66f%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C63763155516672
> 5253%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6I
> k1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=TJFcD19oJIJ3tWbNwldGo4xy2aaAouJnopP
> yZQ2tixo%3D&reserved=0]
>
> url:
> https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.c
> om%2F0day-ci%2Flinux%2Fcommits%2FBiju-Das%2FAdd-RZ-G2L-DMAC-
> support%2F20210729-
> 162632&data=04%7C01%7Cbiju.das.jz%40bp.renesas.com%7C542bfff2887f488c2
> fef08d95284c66f%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C6376315551667
> 25253%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6
> Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2Bg8o5Ec95AfQ5n39E6cJ6lnsziARXpVw
> g%2BRoQgBYQks%3D&reserved=0
> base:
> https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kern
> el.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Fvkoul%2Fdmaengine.git&data
> =04%7C01%7Cbiju.das.jz%40bp.renesas.com%7C542bfff2887f488c2fef08d95284c66f
> %7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C637631555166725253%7CUnknown
> %7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI
> 6Mn0%3D%7C1000&sdata=PLRxI4C7cMH0H4QS6Dv045x8zx%2BIlFeb0mV0QLwfNbQ%3D&
> amp;reserved=0 next
> config: nios2-allyesconfig (attached as .config)
> compiler: nios2-linux-gcc (GCC) 10.3.0
> reproduce (this is a W=1 build):
> wget
> https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fraw.gith
> ubusercontent.com%2Fintel%2Flkp-
> tests%2Fmaster%2Fsbin%2Fmake.cross&data=04%7C01%7Cbiju.das.jz%40bp.ren
> esas.com%7C542bfff2887f488c2fef08d95284c66f%7C53d82571da1947e49cb4625a166a
> 4a2a%7C0%7C0%7C637631555166725253%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw
> MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=mRWtzY
> YmV9%2B8br%2BnBcClZz1roSj4GAxaesZbrtMNjYw%3D&reserved=0 -O
> ~/bin/make.cross
> chmod +x ~/bin/make.cross
> #
> https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.c
> om%2F0day-
> ci%2Flinux%2Fcommit%2Fcfd03e1dedb6793c62ca9acb9642dd314d44ac8e&data=04
> %7C01%7Cbiju.das.jz%40bp.renesas.com%7C542bfff2887f488c2fef08d95284c66f%7C
> 53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C637631555166725253%7CUnknown%7C
> TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn
> 0%3D%7C1000&sdata=rVtsa8DjyZ4TY2hpwlKz%2F6e3kBSubO6VM58rh8ioiNA%3D&
> ;reserved=0
> git remote add linux-review
> https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.c
> om%2F0day-
> ci%2Flinux&data=04%7C01%7Cbiju.das.jz%40bp.renesas.com%7C542bfff2887f4
> 88c2fef08d95284c66f%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C637631555
> 166735210%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJB
> TiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Jb9197GDbxvSzKoZHxgDzTAXnLAqPL
> 8KrH%2Bp7xJHu1A%3D&reserved=0
> git fetch --no-tags linux-review Biju-Das/Add-RZ-G2L-DMAC-
> support/20210729-162632
> git checkout cfd03e1dedb6793c62ca9acb9642dd314d44ac8e
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross
> ARCH=nios2
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>):
>
> In file included from include/linux/printk.h:456,
> from include/asm-generic/bug.h:22,
> from ./arch/nios2/include/generated/asm/bug.h:1,
> from include/linux/bug.h:5,
> from include/linux/thread_info.h:13,
> from include/asm-generic/current.h:5,
> from ./arch/nios2/include/generated/asm/current.h:1,
> from include/linux/sched.h:12,
> from include/linux/ratelimit.h:6,
> from include/linux/dev_printk.h:16,
> from include/linux/device.h:15,
> from include/linux/dma-mapping.h:7,
> from drivers/dma/sh/rz-dmac.c:12:
> drivers/dma/sh/rz-dmac.c: In function 'rz_dmac_prep_dma_memcpy':
> >> drivers/dma/sh/rz-dmac.c:478:21: warning: format '%llx' expects
> >> argument of type 'long long unsigned int', but argument 6 has type
> >> 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
> 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> len=%ld\n",
> |
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/dynamic_debug.h:134:15: note: in definition of macro
> '__dynamic_func_call'
> 134 | func(&id, ##__VA_ARGS__); \
> | ^~~~~~~~~~~
> include/linux/dynamic_debug.h:166:2: note: in expansion of macro
> '_dynamic_func_call'
> 166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
> | ^~~~~~~~~~~~~~~~~~
> include/linux/dev_printk.h:123:2: note: in expansion of macro
> 'dynamic_dev_dbg'
> 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> | ^~~~~~~~~~~~~~~
> include/linux/dev_printk.h:123:23: note: in expansion of macro
> 'dev_fmt'
> 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> | ^~~~~~~
> drivers/dma/sh/rz-dmac.c:478:2: note: in expansion of macro 'dev_dbg'
> 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> len=%ld\n",
> | ^~~~~~~
> drivers/dma/sh/rz-dmac.c:478:46: note: format string is defined here
> 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> len=%ld\n",
> | ~~~^
> | |
> | long long unsigned
> int
> | %x
> In file included from include/linux/printk.h:456,
> from include/asm-generic/bug.h:22,
> from ./arch/nios2/include/generated/asm/bug.h:1,
> from include/linux/bug.h:5,
> from include/linux/thread_info.h:13,
> from include/asm-generic/current.h:5,
> from ./arch/nios2/include/generated/asm/current.h:1,
> from include/linux/sched.h:12,
> from include/linux/ratelimit.h:6,
> from include/linux/dev_printk.h:16,
> from include/linux/device.h:15,
> from include/linux/dma-mapping.h:7,
> from drivers/dma/sh/rz-dmac.c:12:
> drivers/dma/sh/rz-dmac.c:478:21: warning: format '%llx' expects
> argument of type 'long long unsigned int', but argument 7 has type
> 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
> 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> len=%ld\n",
> |
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/dynamic_debug.h:134:15: note: in definition of macro
> '__dynamic_func_call'
> 134 | func(&id, ##__VA_ARGS__); \
> | ^~~~~~~~~~~
> include/linux/dynamic_debug.h:166:2: note: in expansion of macro
> '_dynamic_func_call'
> 166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
> | ^~~~~~~~~~~~~~~~~~
> include/linux/dev_printk.h:123:2: note: in expansion of macro
> 'dynamic_dev_dbg'
> 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> | ^~~~~~~~~~~~~~~
> include/linux/dev_printk.h:123:23: note: in expansion of macro
> 'dev_fmt'
> 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> | ^~~~~~~
> drivers/dma/sh/rz-dmac.c:478:2: note: in expansion of macro 'dev_dbg'
> 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> len=%ld\n",
> | ^~~~~~~
> drivers/dma/sh/rz-dmac.c:478:57: note: format string is defined here
> 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> len=%ld\n",
> | ~~~^
> | |
> | long
> long unsigned int
> | %x
> In file included from include/linux/printk.h:456,
> from include/asm-generic/bug.h:22,
> from ./arch/nios2/include/generated/asm/bug.h:1,
> from include/linux/bug.h:5,
> from include/linux/thread_info.h:13,
> from include/asm-generic/current.h:5,
> from ./arch/nios2/include/generated/asm/current.h:1,
> from include/linux/sched.h:12,
> from include/linux/ratelimit.h:6,
> from include/linux/dev_printk.h:16,
> from include/linux/device.h:15,
> from include/linux/dma-mapping.h:7,
> from drivers/dma/sh/rz-dmac.c:12:
> >> drivers/dma/sh/rz-dmac.c:478:21: warning: format '%ld' expects
> >> argument of type 'long int', but argument 8 has type 'size_t' {aka
> >> 'unsigned int'} [-Wformat=]
> 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> len=%ld\n",
> |
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/dynamic_debug.h:134:15: note: in definition of macro
> '__dynamic_func_call'
> 134 | func(&id, ##__VA_ARGS__); \
> | ^~~~~~~~~~~
> include/linux/dynamic_debug.h:166:2: note: in expansion of macro
> '_dynamic_func_call'
> 166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
> | ^~~~~~~~~~~~~~~~~~
> include/linux/dev_printk.h:123:2: note: in expansion of macro
> 'dynamic_dev_dbg'
> 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> | ^~~~~~~~~~~~~~~
> include/linux/dev_printk.h:123:23: note: in expansion of macro
> 'dev_fmt'
> 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> | ^~~~~~~
> drivers/dma/sh/rz-dmac.c:478:2: note: in expansion of macro 'dev_dbg'
> 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> len=%ld\n",
> | ^~~~~~~
> drivers/dma/sh/rz-dmac.c:478:65: note: format string is defined here
> 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> len=%ld\n",
> |
> ~~^
> |
> |
> |
> long int
> |
> %d
>
>
> vim +478 drivers/dma/sh/rz-dmac.c
>
> 469
> 470 static struct dma_async_tx_descriptor *
> 471 rz_dmac_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t
> dest, dma_addr_t src,
> 472 size_t len, unsigned long flags)
> 473 {
> 474 struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
> 475 struct rz_dmac *dmac = to_rz_dmac(chan->device);
> 476 struct rz_dmac_desc *desc;
> 477
> > 478 dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> len=%ld\n",
> 479 __func__, channel->index, src, dest, len);
> 480
> 481 if (list_empty(&channel->ld_free))
> 482 return NULL;
> 483
> 484 desc = list_first_entry(&channel->ld_free, struct
> rz_dmac_desc, node);
> 485
> 486 desc->type = RZ_DMAC_DESC_MEMCPY;
> 487 desc->src = src;
> 488 desc->dest = dest;
> 489 desc->len = len;
> 490 desc->direction = DMA_MEM_TO_MEM;
> 491
> 492 list_move_tail(channel->ld_free.next, &channel-
> >ld_queue);
> 493 return vchan_tx_prep(&channel->vc, &desc->vd, flags);
> 494 }
> 495
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01
> .org%2Fhyperkitty%2Flist%2Fkbuild-
> all%40lists.01.org&data=04%7C01%7Cbiju.das.jz%40bp.renesas.com%7C542bf
> ff2887f488c2fef08d95284c66f%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C6
> 37631555166735210%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2lu
> MzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Iaa%2FyiTehgWr7ygHm6xV
> 0xspg7HWa79nPlkqUH0HVj0%3D&reserved=0
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH v5 3/3] drivers: dma: sh: Add DMAC driver for RZ/G2L SoC
2021-07-29 13:26 ` Biju Das
@ 2021-07-29 13:50 ` Biju Das
2021-07-29 14:08 ` Biju Das
0 siblings, 1 reply; 9+ messages in thread
From: Biju Das @ 2021-07-29 13:50 UTC (permalink / raw)
To: kernel test robot, Vinod Koul
Cc: kbuild-all, Prabhakar Mahadev Lad, Chris Paterson,
Geert Uytterhoeven, dmaengine, Chris Brandt, linux-renesas-soc
If I make format specifier %lld for dma_addr_t then ARM64 compiler is happy, but nios compiler complains
If I make format specifier %d for dma_addr_t then ARM compiler complains, but nios2 is happy
So what is the best way to handle format specifier for dma_addr_t for all architectures?
Regards,
Biju
> Subject: RE: [PATCH v5 3/3] drivers: dma: sh: Add DMAC driver for RZ/G2L
> SoC
>
> Hi All,
>
> Looks like there is compiler issue with nios2 cross compilation toolchain.
>
> As per the kernel documentation %pad is the format specifier for
> dma_addr_t.
>
> This toolchain does not like it. Please let me know if I am missing any
> thing here.
>
> The changes I made to fix the issue reported by bot:-
> -------------------
> +++ b/drivers/dma/sh/rz-dmac.c
> @@ -475,7 +475,7 @@ rz_dmac_prep_dma_memcpy(struct dma_chan *chan,
> dma_addr_t dest, dma_addr_t src,
> struct rz_dmac *dmac = to_rz_dmac(chan->device);
> struct rz_dmac_desc *desc;
>
> - dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> len=%ld\n",
> + dev_dbg(dmac->dev, "%s channel: %d src=%lld dst=%lld len=%zx\n",
> __func__, channel->index, src, dest, len);
>
> if (list_empty(&channel->ld_free))
>
> compilation logs:-
> ------------------
> dasb@ree-du1sdd5:~/dmaengine$ COMPILER_INSTALL_PATH=$HOME/0day
> COMPILER=gcc-10.3.0 ~/bin/make.cross ARCH=nios2 Compiler will be installed
> in /data/dasb/0day make --keep-going CONFIG_OF_ALL_DTBS=y CONFIG_DTC=y
> CROSS_COMPILE=/data/dasb/0day/gcc-10.3.0-nolibc/nios2-linux/bin/nios2-
> linux- --jobs=48 ARCH=nios2
> CALL scripts/atomic/check-atomics.sh
> CALL scripts/checksyscalls.sh
> <stdin>:1515:2: warning: #warning syscall clone3 not implemented [-Wcpp]
> CHK include/generated/compile.h
> make[1]: *** No rule to make target 'arch/nios2/boot/dts/""', needed by
> 'arch/nios2/boot/dts/built-in.a'.
> make[1]: Target '__build' not remade because of errors.
> make: *** [Makefile:1842: arch/nios2/boot/dts] Error 2
> CC drivers/dma/sh/rz-dmac.o
> In file included from ./include/linux/printk.h:456,
> from ./include/asm-generic/bug.h:22,
> from ./arch/nios2/include/generated/asm/bug.h:1,
> from ./include/linux/bug.h:5,
> from ./include/linux/thread_info.h:13,
> from ./include/asm-generic/current.h:5,
> from ./arch/nios2/include/generated/asm/current.h:1,
> from ./include/linux/sched.h:12,
> from ./include/linux/ratelimit.h:6,
> from ./include/linux/dev_printk.h:16,
> from ./include/linux/device.h:15,
> from ./include/linux/dma-mapping.h:7,
> from drivers/dma/sh/rz-dmac.c:12:
> drivers/dma/sh/rz-dmac.c: In function 'rz_dmac_prep_dma_memcpy':
> drivers/dma/sh/rz-dmac.c:478:21: warning: format '%p' expects argument of
> type 'void *', but argument 6 has type 'dma_addr_t' {aka 'unsigned int'}
> [-Wformat=]
> 478 | dev_dbg(dmac->dev, "%s channel: %d src=%pad dst=%pad len=%zx\n",
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ./include/linux/dynamic_debug.h:134:15: note: in definition of macro
> '__dynamic_func_call'
> 134 | func(&id, ##__VA_ARGS__); \
> | ^~~~~~~~~~~
> ./include/linux/dynamic_debug.h:166:2: note: in expansion of macro
> '_dynamic_func_call'
> 166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
> | ^~~~~~~~~~~~~~~~~~
> ./include/linux/dev_printk.h:123:2: note: in expansion of macro
> 'dynamic_dev_dbg'
> 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> | ^~~~~~~~~~~~~~~
> ./include/linux/dev_printk.h:123:23: note: in expansion of macro 'dev_fmt'
> 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> | ^~~~~~~
> drivers/dma/sh/rz-dmac.c:478:2: note: in expansion of macro 'dev_dbg'
> 478 | dev_dbg(dmac->dev, "%s channel: %d src=%pad dst=%pad len=%zx\n",
> | ^~~~~~~
> drivers/dma/sh/rz-dmac.c:478:42: note: format string is defined here
> 478 | dev_dbg(dmac->dev, "%s channel: %d src=%pad dst=%pad len=%zx\n",
> | ~^
> | |
> | void *
> | %d
> In file included from ./include/linux/printk.h:456,
> from ./include/asm-generic/bug.h:22,
> from ./arch/nios2/include/generated/asm/bug.h:1,
> from ./include/linux/bug.h:5,
> from ./include/linux/thread_info.h:13,
> from ./include/asm-generic/current.h:5,
> from ./arch/nios2/include/generated/asm/current.h:1,
> from ./include/linux/sched.h:12,
> from ./include/linux/ratelimit.h:6,
> from ./include/linux/dev_printk.h:16,
> from ./include/linux/device.h:15,
> from ./include/linux/dma-mapping.h:7,
> from drivers/dma/sh/rz-dmac.c:12:
> drivers/dma/sh/rz-dmac.c:478:21: warning: format '%p' expects argument of
> type 'void *', but argument 7 has type 'dma_addr_t' {aka 'unsigned int'}
> [-Wformat=]
> 478 | dev_dbg(dmac->dev, "%s channel: %d src=%pad dst=%pad len=%zx\n",
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ./include/linux/dynamic_debug.h:134:15: note: in definition of macro
> '__dynamic_func_call'
> 134 | func(&id, ##__VA_ARGS__); \
> | ^~~~~~~~~~~
> ./include/linux/dynamic_debug.h:166:2: note: in expansion of macro
> '_dynamic_func_call'
> 166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
> | ^~~~~~~~~~~~~~~~~~
> ./include/linux/dev_printk.h:123:2: note: in expansion of macro
> 'dynamic_dev_dbg'
> 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> | ^~~~~~~~~~~~~~~
> ./include/linux/dev_printk.h:123:23: note: in expansion of macro 'dev_fmt'
> 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> | ^~~~~~~
> drivers/dma/sh/rz-dmac.c:478:2: note: in expansion of macro 'dev_dbg'
> 478 | dev_dbg(dmac->dev, "%s channel: %d src=%pad dst=%pad len=%zx\n",
> | ^~~~~~~
> drivers/dma/sh/rz-dmac.c:478:51: note: format string is defined here
> 478 | dev_dbg(dmac->dev, "%s channel: %d src=%pad dst=%pad len=%zx\n",
> | ~^
> | |
> | void *
> | %d
> CHK kernel/kheaders_data.tar.xz
> AR drivers/dma/sh/built-in.a
> AR drivers/dma/built-in.a
> AR drivers/built-in.a
> make: Target '__all' not remade because of errors.
>
> Regards,
> Biju
>
> > -----Original Message-----
> > From: kernel test robot <lkp@intel.com>
> > Sent: 29 July 2021 12:34
> > To: Biju Das <biju.das.jz@bp.renesas.com>; Vinod Koul
> > <vkoul@kernel.org>
> > Cc: kbuild-all@lists.01.org; Biju Das <biju.das.jz@bp.renesas.com>;
> > Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>; Chris
> > Paterson <Chris.Paterson2@renesas.com>; Geert Uytterhoeven
> > <geert+renesas@glider.be>; dmaengine@vger.kernel.org; Chris Brandt
> > <Chris.Brandt@renesas.com>; linux-renesas-soc@vger.kernel.org
> > Subject: Re: [PATCH v5 3/3] drivers: dma: sh: Add DMAC driver for
> > RZ/G2L SoC
> >
> > Hi Biju,
> >
> > Thank you for the patch! Perhaps something to improve:
> >
> > [auto build test WARNING on vkoul-dmaengine/next] [also build test
> > WARNING on robh/for-next v5.14-rc3 next-20210728] [If your patch is
> > applied to the wrong git tree, kindly drop us a note.
> > And when submitting patch, we suggest to use '--base' as documented in
> > https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit-
> > scm.com%2Fdocs%2Fgit-format-
> > patch&data=04%7C01%7Cbiju.das.jz%40bp.renesas.com%7C542bfff2887f48
> > 8c2f
> > ef08d95284c66f%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C6376315551
> > 6672
> > 5253%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBT
> > iI6I
> > k1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=TJFcD19oJIJ3tWbNwldGo4xy2aaAouJ
> > nopP
> > yZQ2tixo%3D&reserved=0]
> >
> > url:
> > https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
> > ub.c
> > om%2F0day-ci%2Flinux%2Fcommits%2FBiju-Das%2FAdd-RZ-G2L-DMAC-
> > support%2F20210729-
> > 162632&data=04%7C01%7Cbiju.das.jz%40bp.renesas.com%7C542bfff2887f4
> > 88c2
> > fef08d95284c66f%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C637631555
> > 1667
> > 25253%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJB
> > TiI6
> > Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2Bg8o5Ec95AfQ5n39E6cJ6lnsziAR
> > XpVw
> > g%2BRoQgBYQks%3D&reserved=0
> > base:
> > https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.
> > kern
> > el.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Fvkoul%2Fdmaengine.git&
> > data
> > =04%7C01%7Cbiju.das.jz%40bp.renesas.com%7C542bfff2887f488c2fef08d95284
> > c66f
> > %7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C637631555166725253%7CUnk
> > nown
> > %7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJ
> > XVCI
> > 6Mn0%3D%7C1000&sdata=PLRxI4C7cMH0H4QS6Dv045x8zx%2BIlFeb0mV0QLwfNbQ
> > %3D&
> > amp;reserved=0 next
> > config: nios2-allyesconfig (attached as .config)
> > compiler: nios2-linux-gcc (GCC) 10.3.0 reproduce (this is a W=1
> > build):
> > wget
> > https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fraw.
> > gith
> > ubusercontent.com%2Fintel%2Flkp-
> > tests%2Fmaster%2Fsbin%2Fmake.cross&data=04%7C01%7Cbiju.das.jz%40bp
> > .ren
> > esas.com%7C542bfff2887f488c2fef08d95284c66f%7C53d82571da1947e49cb4625a
> > 166a
> > 4a2a%7C0%7C0%7C637631555166725253%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4w
> > LjAw
> > MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=mR
> > WtzY
> > YmV9%2B8br%2BnBcClZz1roSj4GAxaesZbrtMNjYw%3D&reserved=0 -O
> > ~/bin/make.cross
> > chmod +x ~/bin/make.cross
> > #
> > https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
> > ub.c
> > om%2F0day-
> > ci%2Flinux%2Fcommit%2Fcfd03e1dedb6793c62ca9acb9642dd314d44ac8e&dat
> > a=04
> > %7C01%7Cbiju.das.jz%40bp.renesas.com%7C542bfff2887f488c2fef08d95284c66
> > f%7C
> > 53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C637631555166725253%7CUnknow
> > n%7C
> > TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVC
> > I6Mn
> > 0%3D%7C1000&sdata=rVtsa8DjyZ4TY2hpwlKz%2F6e3kBSubO6VM58rh8ioiNA%3D
> > &
> > ;reserved=0
> > git remote add linux-review
> > https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
> > ub.c
> > om%2F0day-
> > ci%2Flinux&data=04%7C01%7Cbiju.das.jz%40bp.renesas.com%7C542bfff28
> > 87f4
> > 88c2fef08d95284c66f%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C63763
> > 1555
> > 166735210%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIi
> > LCJB
> > TiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Jb9197GDbxvSzKoZHxgDzTAXnL
> > AqPL
> > 8KrH%2Bp7xJHu1A%3D&reserved=0
> > git fetch --no-tags linux-review Biju-Das/Add-RZ-G2L-DMAC-
> > support/20210729-162632
> > git checkout cfd03e1dedb6793c62ca9acb9642dd314d44ac8e
> > # save the attached .config to linux build tree
> > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0
> > make.cross
> > ARCH=nios2
> >
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> >
> > All warnings (new ones prefixed by >>):
> >
> > In file included from include/linux/printk.h:456,
> > from include/asm-generic/bug.h:22,
> > from ./arch/nios2/include/generated/asm/bug.h:1,
> > from include/linux/bug.h:5,
> > from include/linux/thread_info.h:13,
> > from include/asm-generic/current.h:5,
> > from ./arch/nios2/include/generated/asm/current.h:1,
> > from include/linux/sched.h:12,
> > from include/linux/ratelimit.h:6,
> > from include/linux/dev_printk.h:16,
> > from include/linux/device.h:15,
> > from include/linux/dma-mapping.h:7,
> > from drivers/dma/sh/rz-dmac.c:12:
> > drivers/dma/sh/rz-dmac.c: In function 'rz_dmac_prep_dma_memcpy':
> > >> drivers/dma/sh/rz-dmac.c:478:21: warning: format '%llx' expects
> > >> argument of type 'long long unsigned int', but argument 6 has type
> > >> 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
> > 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> > len=%ld\n",
> > |
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > include/linux/dynamic_debug.h:134:15: note: in definition of macro
> > '__dynamic_func_call'
> > 134 | func(&id, ##__VA_ARGS__); \
> > | ^~~~~~~~~~~
> > include/linux/dynamic_debug.h:166:2: note: in expansion of macro
> > '_dynamic_func_call'
> > 166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
> > | ^~~~~~~~~~~~~~~~~~
> > include/linux/dev_printk.h:123:2: note: in expansion of macro
> > 'dynamic_dev_dbg'
> > 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> > | ^~~~~~~~~~~~~~~
> > include/linux/dev_printk.h:123:23: note: in expansion of macro
> > 'dev_fmt'
> > 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> > | ^~~~~~~
> > drivers/dma/sh/rz-dmac.c:478:2: note: in expansion of macro 'dev_dbg'
> > 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> > len=%ld\n",
> > | ^~~~~~~
> > drivers/dma/sh/rz-dmac.c:478:46: note: format string is defined here
> > 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> > len=%ld\n",
> > | ~~~^
> > | |
> > | long long
> unsigned
> > int
> > | %x
> > In file included from include/linux/printk.h:456,
> > from include/asm-generic/bug.h:22,
> > from ./arch/nios2/include/generated/asm/bug.h:1,
> > from include/linux/bug.h:5,
> > from include/linux/thread_info.h:13,
> > from include/asm-generic/current.h:5,
> > from ./arch/nios2/include/generated/asm/current.h:1,
> > from include/linux/sched.h:12,
> > from include/linux/ratelimit.h:6,
> > from include/linux/dev_printk.h:16,
> > from include/linux/device.h:15,
> > from include/linux/dma-mapping.h:7,
> > from drivers/dma/sh/rz-dmac.c:12:
> > drivers/dma/sh/rz-dmac.c:478:21: warning: format '%llx' expects
> > argument of type 'long long unsigned int', but argument 7 has type
> > 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
> > 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> > len=%ld\n",
> > |
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > include/linux/dynamic_debug.h:134:15: note: in definition of macro
> > '__dynamic_func_call'
> > 134 | func(&id, ##__VA_ARGS__); \
> > | ^~~~~~~~~~~
> > include/linux/dynamic_debug.h:166:2: note: in expansion of macro
> > '_dynamic_func_call'
> > 166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
> > | ^~~~~~~~~~~~~~~~~~
> > include/linux/dev_printk.h:123:2: note: in expansion of macro
> > 'dynamic_dev_dbg'
> > 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> > | ^~~~~~~~~~~~~~~
> > include/linux/dev_printk.h:123:23: note: in expansion of macro
> > 'dev_fmt'
> > 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> > | ^~~~~~~
> > drivers/dma/sh/rz-dmac.c:478:2: note: in expansion of macro 'dev_dbg'
> > 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> > len=%ld\n",
> > | ^~~~~~~
> > drivers/dma/sh/rz-dmac.c:478:57: note: format string is defined here
> > 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> > len=%ld\n",
> > | ~~~^
> > | |
> > | long
> > long unsigned int
> > | %x
> > In file included from include/linux/printk.h:456,
> > from include/asm-generic/bug.h:22,
> > from ./arch/nios2/include/generated/asm/bug.h:1,
> > from include/linux/bug.h:5,
> > from include/linux/thread_info.h:13,
> > from include/asm-generic/current.h:5,
> > from ./arch/nios2/include/generated/asm/current.h:1,
> > from include/linux/sched.h:12,
> > from include/linux/ratelimit.h:6,
> > from include/linux/dev_printk.h:16,
> > from include/linux/device.h:15,
> > from include/linux/dma-mapping.h:7,
> > from drivers/dma/sh/rz-dmac.c:12:
> > >> drivers/dma/sh/rz-dmac.c:478:21: warning: format '%ld' expects
> > >> argument of type 'long int', but argument 8 has type 'size_t' {aka
> > >> 'unsigned int'} [-Wformat=]
> > 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> > len=%ld\n",
> > |
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > include/linux/dynamic_debug.h:134:15: note: in definition of macro
> > '__dynamic_func_call'
> > 134 | func(&id, ##__VA_ARGS__); \
> > | ^~~~~~~~~~~
> > include/linux/dynamic_debug.h:166:2: note: in expansion of macro
> > '_dynamic_func_call'
> > 166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
> > | ^~~~~~~~~~~~~~~~~~
> > include/linux/dev_printk.h:123:2: note: in expansion of macro
> > 'dynamic_dev_dbg'
> > 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> > | ^~~~~~~~~~~~~~~
> > include/linux/dev_printk.h:123:23: note: in expansion of macro
> > 'dev_fmt'
> > 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> > | ^~~~~~~
> > drivers/dma/sh/rz-dmac.c:478:2: note: in expansion of macro 'dev_dbg'
> > 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> > len=%ld\n",
> > | ^~~~~~~
> > drivers/dma/sh/rz-dmac.c:478:65: note: format string is defined here
> > 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> > len=%ld\n",
> > |
> > ~~^
> > |
> > |
> > |
> > long int
> > |
> > %d
> >
> >
> > vim +478 drivers/dma/sh/rz-dmac.c
> >
> > 469
> > 470 static struct dma_async_tx_descriptor *
> > 471 rz_dmac_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t
> > dest, dma_addr_t src,
> > 472 size_t len, unsigned long flags)
> > 473 {
> > 474 struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
> > 475 struct rz_dmac *dmac = to_rz_dmac(chan->device);
> > 476 struct rz_dmac_desc *desc;
> > 477
> > > 478 dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> > len=%ld\n",
> > 479 __func__, channel->index, src, dest, len);
> > 480
> > 481 if (list_empty(&channel->ld_free))
> > 482 return NULL;
> > 483
> > 484 desc = list_first_entry(&channel->ld_free, struct
> > rz_dmac_desc, node);
> > 485
> > 486 desc->type = RZ_DMAC_DESC_MEMCPY;
> > 487 desc->src = src;
> > 488 desc->dest = dest;
> > 489 desc->len = len;
> > 490 desc->direction = DMA_MEM_TO_MEM;
> > 491
> > 492 list_move_tail(channel->ld_free.next, &channel-
> > >ld_queue);
> > 493 return vchan_tx_prep(&channel->vc, &desc->vd, flags);
> > 494 }
> > 495
> >
> > ---
> > 0-DAY CI Kernel Test Service, Intel Corporation
> > https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
> > s.01
> > .org%2Fhyperkitty%2Flist%2Fkbuild-
> > all%40lists.01.org&data=04%7C01%7Cbiju.das.jz%40bp.renesas.com%7C5
> > 42bf
> > ff2887f488c2fef08d95284c66f%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0
> > %7C6
> > 37631555166735210%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoi
> > V2lu
> > MzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Iaa%2FyiTehgWr7ygH
> > m6xV
> > 0xspg7HWa79nPlkqUH0HVj0%3D&reserved=0
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH v5 3/3] drivers: dma: sh: Add DMAC driver for RZ/G2L SoC
2021-07-29 13:50 ` Biju Das
@ 2021-07-29 14:08 ` Biju Das
0 siblings, 0 replies; 9+ messages in thread
From: Biju Das @ 2021-07-29 14:08 UTC (permalink / raw)
To: Biju Das, kernel test robot, Vinod Koul
Cc: kbuild-all, Prabhakar Mahadev Lad, Chris Paterson,
Geert Uytterhoeven, dmaengine, Chris Brandt, linux-renesas-soc
Hi All,
Sorry for the noise. Please ignore my previous mails. %pad with reference to dma_addr_t type fixed the issue.
Tested with aarch64 and nios2 tool chain.
diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c
index db4e0a539906..ef82af06a3f3 100644
--- a/drivers/dma/sh/rz-dmac.c
+++ b/drivers/dma/sh/rz-dmac.c
@@ -475,8 +475,8 @@ rz_dmac_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
struct rz_dmac *dmac = to_rz_dmac(chan->device);
struct rz_dmac_desc *desc;
- dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx len=%ld\n",
- __func__, channel->index, src, dest, len);
+ dev_dbg(dmac->dev, "%s channel: %d src=%pad dst=%pad len=%zx\n",
+ __func__, channel->index, &src, &dest, len);
if (list_empty(&channel->ld_free))
return NULL;
Regards,
Biju
> -----Original Message-----
> From: Biju Das <biju.das.jz@bp.renesas.com>
> Sent: 29 July 2021 14:51
> To: kernel test robot <lkp@intel.com>; Vinod Koul <vkoul@kernel.org>
> Cc: kbuild-all@lists.01.org; Prabhakar Mahadev Lad <prabhakar.mahadev-
> lad.rj@bp.renesas.com>; Chris Paterson <Chris.Paterson2@renesas.com>;
> Geert Uytterhoeven <geert+renesas@glider.be>; dmaengine@vger.kernel.org;
> Chris Brandt <Chris.Brandt@renesas.com>; linux-renesas-soc@vger.kernel.org
> Subject: RE: [PATCH v5 3/3] drivers: dma: sh: Add DMAC driver for RZ/G2L
> SoC
>
> If I make format specifier %lld for dma_addr_t then ARM64 compiler is
> happy, but nios compiler complains
>
> If I make format specifier %d for dma_addr_t then ARM compiler complains,
> but nios2 is happy
>
> So what is the best way to handle format specifier for dma_addr_t for all
> architectures?
>
> Regards,
> Biju
>
> > Subject: RE: [PATCH v5 3/3] drivers: dma: sh: Add DMAC driver for
> > RZ/G2L SoC
> >
> > Hi All,
> >
> > Looks like there is compiler issue with nios2 cross compilation
> toolchain.
> >
> > As per the kernel documentation %pad is the format specifier for
> > dma_addr_t.
> >
> > This toolchain does not like it. Please let me know if I am missing
> > any thing here.
> >
> > The changes I made to fix the issue reported by bot:-
> > -------------------
> > +++ b/drivers/dma/sh/rz-dmac.c
> > @@ -475,7 +475,7 @@ rz_dmac_prep_dma_memcpy(struct dma_chan *chan,
> > dma_addr_t dest, dma_addr_t src,
> > struct rz_dmac *dmac = to_rz_dmac(chan->device);
> > struct rz_dmac_desc *desc;
> >
> > - dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> > len=%ld\n",
> > + dev_dbg(dmac->dev, "%s channel: %d src=%lld dst=%lld
> > + len=%zx\n",
> > __func__, channel->index, src, dest, len);
> >
> > if (list_empty(&channel->ld_free))
> >
> > compilation logs:-
> > ------------------
> > dasb@ree-du1sdd5:~/dmaengine$ COMPILER_INSTALL_PATH=$HOME/0day
> > COMPILER=gcc-10.3.0 ~/bin/make.cross ARCH=nios2 Compiler will be
> > installed in /data/dasb/0day make --keep-going CONFIG_OF_ALL_DTBS=y
> > CONFIG_DTC=y
> > CROSS_COMPILE=/data/dasb/0day/gcc-10.3.0-nolibc/nios2-linux/bin/nios2-
> > linux- --jobs=48 ARCH=nios2
> > CALL scripts/atomic/check-atomics.sh
> > CALL scripts/checksyscalls.sh
> > <stdin>:1515:2: warning: #warning syscall clone3 not implemented [-Wcpp]
> > CHK include/generated/compile.h
> > make[1]: *** No rule to make target 'arch/nios2/boot/dts/""', needed
> > by 'arch/nios2/boot/dts/built-in.a'.
> > make[1]: Target '__build' not remade because of errors.
> > make: *** [Makefile:1842: arch/nios2/boot/dts] Error 2
> > CC drivers/dma/sh/rz-dmac.o
> > In file included from ./include/linux/printk.h:456,
> > from ./include/asm-generic/bug.h:22,
> > from ./arch/nios2/include/generated/asm/bug.h:1,
> > from ./include/linux/bug.h:5,
> > from ./include/linux/thread_info.h:13,
> > from ./include/asm-generic/current.h:5,
> > from ./arch/nios2/include/generated/asm/current.h:1,
> > from ./include/linux/sched.h:12,
> > from ./include/linux/ratelimit.h:6,
> > from ./include/linux/dev_printk.h:16,
> > from ./include/linux/device.h:15,
> > from ./include/linux/dma-mapping.h:7,
> > from drivers/dma/sh/rz-dmac.c:12:
> > drivers/dma/sh/rz-dmac.c: In function 'rz_dmac_prep_dma_memcpy':
> > drivers/dma/sh/rz-dmac.c:478:21: warning: format '%p' expects argument
> > of type 'void *', but argument 6 has type 'dma_addr_t' {aka 'unsigned
> > int'} [-Wformat=]
> > 478 | dev_dbg(dmac->dev, "%s channel: %d src=%pad dst=%pad
> len=%zx\n",
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > ./include/linux/dynamic_debug.h:134:15: note: in definition of macro
> > '__dynamic_func_call'
> > 134 | func(&id, ##__VA_ARGS__); \
> > | ^~~~~~~~~~~
> > ./include/linux/dynamic_debug.h:166:2: note: in expansion of macro
> > '_dynamic_func_call'
> > 166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
> > | ^~~~~~~~~~~~~~~~~~
> > ./include/linux/dev_printk.h:123:2: note: in expansion of macro
> > 'dynamic_dev_dbg'
> > 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> > | ^~~~~~~~~~~~~~~
> > ./include/linux/dev_printk.h:123:23: note: in expansion of macro
> 'dev_fmt'
> > 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> > | ^~~~~~~
> > drivers/dma/sh/rz-dmac.c:478:2: note: in expansion of macro 'dev_dbg'
> > 478 | dev_dbg(dmac->dev, "%s channel: %d src=%pad dst=%pad
> len=%zx\n",
> > | ^~~~~~~
> > drivers/dma/sh/rz-dmac.c:478:42: note: format string is defined here
> > 478 | dev_dbg(dmac->dev, "%s channel: %d src=%pad dst=%pad
> len=%zx\n",
> > | ~^
> > | |
> > | void *
> > | %d
> > In file included from ./include/linux/printk.h:456,
> > from ./include/asm-generic/bug.h:22,
> > from ./arch/nios2/include/generated/asm/bug.h:1,
> > from ./include/linux/bug.h:5,
> > from ./include/linux/thread_info.h:13,
> > from ./include/asm-generic/current.h:5,
> > from ./arch/nios2/include/generated/asm/current.h:1,
> > from ./include/linux/sched.h:12,
> > from ./include/linux/ratelimit.h:6,
> > from ./include/linux/dev_printk.h:16,
> > from ./include/linux/device.h:15,
> > from ./include/linux/dma-mapping.h:7,
> > from drivers/dma/sh/rz-dmac.c:12:
> > drivers/dma/sh/rz-dmac.c:478:21: warning: format '%p' expects argument
> > of type 'void *', but argument 7 has type 'dma_addr_t' {aka 'unsigned
> > int'} [-Wformat=]
> > 478 | dev_dbg(dmac->dev, "%s channel: %d src=%pad dst=%pad
> len=%zx\n",
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > ./include/linux/dynamic_debug.h:134:15: note: in definition of macro
> > '__dynamic_func_call'
> > 134 | func(&id, ##__VA_ARGS__); \
> > | ^~~~~~~~~~~
> > ./include/linux/dynamic_debug.h:166:2: note: in expansion of macro
> > '_dynamic_func_call'
> > 166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
> > | ^~~~~~~~~~~~~~~~~~
> > ./include/linux/dev_printk.h:123:2: note: in expansion of macro
> > 'dynamic_dev_dbg'
> > 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> > | ^~~~~~~~~~~~~~~
> > ./include/linux/dev_printk.h:123:23: note: in expansion of macro
> 'dev_fmt'
> > 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> > | ^~~~~~~
> > drivers/dma/sh/rz-dmac.c:478:2: note: in expansion of macro 'dev_dbg'
> > 478 | dev_dbg(dmac->dev, "%s channel: %d src=%pad dst=%pad
> len=%zx\n",
> > | ^~~~~~~
> > drivers/dma/sh/rz-dmac.c:478:51: note: format string is defined here
> > 478 | dev_dbg(dmac->dev, "%s channel: %d src=%pad dst=%pad
> len=%zx\n",
> > | ~^
> > | |
> > | void *
> > | %d
> > CHK kernel/kheaders_data.tar.xz
> > AR drivers/dma/sh/built-in.a
> > AR drivers/dma/built-in.a
> > AR drivers/built-in.a
> > make: Target '__all' not remade because of errors.
> >
> > Regards,
> > Biju
> >
> > > -----Original Message-----
> > > From: kernel test robot <lkp@intel.com>
> > > Sent: 29 July 2021 12:34
> > > To: Biju Das <biju.das.jz@bp.renesas.com>; Vinod Koul
> > > <vkoul@kernel.org>
> > > Cc: kbuild-all@lists.01.org; Biju Das <biju.das.jz@bp.renesas.com>;
> > > Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>;
> > > Chris Paterson <Chris.Paterson2@renesas.com>; Geert Uytterhoeven
> > > <geert+renesas@glider.be>; dmaengine@vger.kernel.org; Chris Brandt
> > > <Chris.Brandt@renesas.com>; linux-renesas-soc@vger.kernel.org
> > > Subject: Re: [PATCH v5 3/3] drivers: dma: sh: Add DMAC driver for
> > > RZ/G2L SoC
> > >
> > > Hi Biju,
> > >
> > > Thank you for the patch! Perhaps something to improve:
> > >
> > > [auto build test WARNING on vkoul-dmaengine/next] [also build test
> > > WARNING on robh/for-next v5.14-rc3 next-20210728] [If your patch is
> > > applied to the wrong git tree, kindly drop us a note.
> > > And when submitting patch, we suggest to use '--base' as documented
> > > in
> > > https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgi
> > > t-
> > > scm.com%2Fdocs%2Fgit-format-
> > > patch&data=04%7C01%7Cbiju.das.jz%40bp.renesas.com%7C542bfff2887f
> > > 48
> > > 8c2f
> > > ef08d95284c66f%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C63763155
> > > 51
> > > 6672
> > > 5253%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJ
> > > BT
> > > iI6I
> > > k1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=TJFcD19oJIJ3tWbNwldGo4xy2aaAo
> > > uJ
> > > nopP
> > > yZQ2tixo%3D&reserved=0]
> > >
> > > url:
> > > https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgi
> > > th
> > > ub.c
> > > om%2F0day-ci%2Flinux%2Fcommits%2FBiju-Das%2FAdd-RZ-G2L-DMAC-
> > > support%2F20210729-
> > > 162632&data=04%7C01%7Cbiju.das.jz%40bp.renesas.com%7C542bfff2887
> > > f4
> > > 88c2
> > > fef08d95284c66f%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C6376315
> > > 55
> > > 1667
> > > 25253%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLC
> > > JB
> > > TiI6
> > > Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2Bg8o5Ec95AfQ5n39E6cJ6lnszi
> > > AR
> > > XpVw
> > > g%2BRoQgBYQks%3D&reserved=0
> > > base:
> > > https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.
> > > kern
> > > el.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Fvkoul%2Fdmaengine.git&am
> > > p;
> > > data
> > > =04%7C01%7Cbiju.das.jz%40bp.renesas.com%7C542bfff2887f488c2fef08d952
> > > 84
> > > c66f
> > > %7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C637631555166725253%7CU
> > > nk
> > > nown
> > > %7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiL
> > > CJ
> > > XVCI
> > > 6Mn0%3D%7C1000&sdata=PLRxI4C7cMH0H4QS6Dv045x8zx%2BIlFeb0mV0QLwfN
> > > bQ
> > > %3D&
> > > amp;reserved=0 next
> > > config: nios2-allyesconfig (attached as .config)
> > > compiler: nios2-linux-gcc (GCC) 10.3.0 reproduce (this is a W=1
> > > build):
> > > wget
> > > https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fraw.
> > > gith
> > > ubusercontent.com%2Fintel%2Flkp-
> > > tests%2Fmaster%2Fsbin%2Fmake.cross&data=04%7C01%7Cbiju.das.jz%40
> > > bp
> > > .ren
> > > esas.com%7C542bfff2887f488c2fef08d95284c66f%7C53d82571da1947e49cb462
> > > 5a
> > > 166a
> > > 4a2a%7C0%7C0%7C637631555166725253%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC
> > > 4w
> > > LjAw
> > > MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=
> > > mR
> > > WtzY
> > > YmV9%2B8br%2BnBcClZz1roSj4GAxaesZbrtMNjYw%3D&reserved=0 -O
> > > ~/bin/make.cross
> > > chmod +x ~/bin/make.cross
> > > #
> > > https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgi
> > > th
> > > ub.c
> > > om%2F0day-
> > > ci%2Flinux%2Fcommit%2Fcfd03e1dedb6793c62ca9acb9642dd314d44ac8e&d
> > > at
> > > a=04
> > > %7C01%7Cbiju.das.jz%40bp.renesas.com%7C542bfff2887f488c2fef08d95284c
> > > 66
> > > f%7C
> > > 53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C637631555166725253%7CUnkn
> > > ow
> > > n%7C
> > > TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJX
> > > VC
> > > I6Mn
> > > 0%3D%7C1000&sdata=rVtsa8DjyZ4TY2hpwlKz%2F6e3kBSubO6VM58rh8ioiNA%
> > > 3D
> > > &
> > > ;reserved=0
> > > git remote add linux-review
> > > https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgi
> > > th
> > > ub.c
> > > om%2F0day-
> > > ci%2Flinux&data=04%7C01%7Cbiju.das.jz%40bp.renesas.com%7C542bfff
> > > 28
> > > 87f4
> > > 88c2fef08d95284c66f%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C637
> > > 63
> > > 1555
> > > 166735210%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMz
> > > Ii
> > > LCJB
> > > TiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Jb9197GDbxvSzKoZHxgDzTAX
> > > nL
> > > AqPL
> > > 8KrH%2Bp7xJHu1A%3D&reserved=0
> > > git fetch --no-tags linux-review Biju-Das/Add-RZ-G2L-DMAC-
> > > support/20210729-162632
> > > git checkout cfd03e1dedb6793c62ca9acb9642dd314d44ac8e
> > > # save the attached .config to linux build tree
> > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0
> > > make.cross
> > > ARCH=nios2
> > >
> > > If you fix the issue, kindly add following tag as appropriate
> > > Reported-by: kernel test robot <lkp@intel.com>
> > >
> > > All warnings (new ones prefixed by >>):
> > >
> > > In file included from include/linux/printk.h:456,
> > > from include/asm-generic/bug.h:22,
> > > from ./arch/nios2/include/generated/asm/bug.h:1,
> > > from include/linux/bug.h:5,
> > > from include/linux/thread_info.h:13,
> > > from include/asm-generic/current.h:5,
> > > from
> ./arch/nios2/include/generated/asm/current.h:1,
> > > from include/linux/sched.h:12,
> > > from include/linux/ratelimit.h:6,
> > > from include/linux/dev_printk.h:16,
> > > from include/linux/device.h:15,
> > > from include/linux/dma-mapping.h:7,
> > > from drivers/dma/sh/rz-dmac.c:12:
> > > drivers/dma/sh/rz-dmac.c: In function 'rz_dmac_prep_dma_memcpy':
> > > >> drivers/dma/sh/rz-dmac.c:478:21: warning: format '%llx' expects
> > > >> argument of type 'long long unsigned int', but argument 6 has
> > > >> type 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
> > > 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> > > len=%ld\n",
> > > |
> > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > include/linux/dynamic_debug.h:134:15: note: in definition of
> > > macro '__dynamic_func_call'
> > > 134 | func(&id, ##__VA_ARGS__); \
> > > | ^~~~~~~~~~~
> > > include/linux/dynamic_debug.h:166:2: note: in expansion of macro
> > > '_dynamic_func_call'
> > > 166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
> > > | ^~~~~~~~~~~~~~~~~~
> > > include/linux/dev_printk.h:123:2: note: in expansion of macro
> > > 'dynamic_dev_dbg'
> > > 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> > > | ^~~~~~~~~~~~~~~
> > > include/linux/dev_printk.h:123:23: note: in expansion of macro
> > > 'dev_fmt'
> > > 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> > > | ^~~~~~~
> > > drivers/dma/sh/rz-dmac.c:478:2: note: in expansion of macro
> 'dev_dbg'
> > > 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> > > len=%ld\n",
> > > | ^~~~~~~
> > > drivers/dma/sh/rz-dmac.c:478:46: note: format string is defined
> here
> > > 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> > > len=%ld\n",
> > > | ~~~^
> > > | |
> > > | long long
> > unsigned
> > > int
> > > | %x
> > > In file included from include/linux/printk.h:456,
> > > from include/asm-generic/bug.h:22,
> > > from ./arch/nios2/include/generated/asm/bug.h:1,
> > > from include/linux/bug.h:5,
> > > from include/linux/thread_info.h:13,
> > > from include/asm-generic/current.h:5,
> > > from
> ./arch/nios2/include/generated/asm/current.h:1,
> > > from include/linux/sched.h:12,
> > > from include/linux/ratelimit.h:6,
> > > from include/linux/dev_printk.h:16,
> > > from include/linux/device.h:15,
> > > from include/linux/dma-mapping.h:7,
> > > from drivers/dma/sh/rz-dmac.c:12:
> > > drivers/dma/sh/rz-dmac.c:478:21: warning: format '%llx' expects
> > > argument of type 'long long unsigned int', but argument 7 has type
> > > 'dma_addr_t' {aka 'unsigned int'} [-Wformat=]
> > > 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> > > len=%ld\n",
> > > |
> > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > include/linux/dynamic_debug.h:134:15: note: in definition of
> > > macro '__dynamic_func_call'
> > > 134 | func(&id, ##__VA_ARGS__); \
> > > | ^~~~~~~~~~~
> > > include/linux/dynamic_debug.h:166:2: note: in expansion of macro
> > > '_dynamic_func_call'
> > > 166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
> > > | ^~~~~~~~~~~~~~~~~~
> > > include/linux/dev_printk.h:123:2: note: in expansion of macro
> > > 'dynamic_dev_dbg'
> > > 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> > > | ^~~~~~~~~~~~~~~
> > > include/linux/dev_printk.h:123:23: note: in expansion of macro
> > > 'dev_fmt'
> > > 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> > > | ^~~~~~~
> > > drivers/dma/sh/rz-dmac.c:478:2: note: in expansion of macro
> 'dev_dbg'
> > > 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> > > len=%ld\n",
> > > | ^~~~~~~
> > > drivers/dma/sh/rz-dmac.c:478:57: note: format string is defined
> here
> > > 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> > > len=%ld\n",
> > > | ~~~^
> > > | |
> > > |
> long
> > > long unsigned int
> > > | %x
> > > In file included from include/linux/printk.h:456,
> > > from include/asm-generic/bug.h:22,
> > > from ./arch/nios2/include/generated/asm/bug.h:1,
> > > from include/linux/bug.h:5,
> > > from include/linux/thread_info.h:13,
> > > from include/asm-generic/current.h:5,
> > > from
> ./arch/nios2/include/generated/asm/current.h:1,
> > > from include/linux/sched.h:12,
> > > from include/linux/ratelimit.h:6,
> > > from include/linux/dev_printk.h:16,
> > > from include/linux/device.h:15,
> > > from include/linux/dma-mapping.h:7,
> > > from drivers/dma/sh/rz-dmac.c:12:
> > > >> drivers/dma/sh/rz-dmac.c:478:21: warning: format '%ld' expects
> > > >> argument of type 'long int', but argument 8 has type 'size_t'
> > > >> {aka 'unsigned int'} [-Wformat=]
> > > 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> > > len=%ld\n",
> > > |
> > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > include/linux/dynamic_debug.h:134:15: note: in definition of
> > > macro '__dynamic_func_call'
> > > 134 | func(&id, ##__VA_ARGS__); \
> > > | ^~~~~~~~~~~
> > > include/linux/dynamic_debug.h:166:2: note: in expansion of macro
> > > '_dynamic_func_call'
> > > 166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
> > > | ^~~~~~~~~~~~~~~~~~
> > > include/linux/dev_printk.h:123:2: note: in expansion of macro
> > > 'dynamic_dev_dbg'
> > > 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> > > | ^~~~~~~~~~~~~~~
> > > include/linux/dev_printk.h:123:23: note: in expansion of macro
> > > 'dev_fmt'
> > > 123 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
> > > | ^~~~~~~
> > > drivers/dma/sh/rz-dmac.c:478:2: note: in expansion of macro
> 'dev_dbg'
> > > 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> > > len=%ld\n",
> > > | ^~~~~~~
> > > drivers/dma/sh/rz-dmac.c:478:65: note: format string is defined
> here
> > > 478 | dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> > > len=%ld\n",
> > > |
> > > ~~^
> > > |
> > > |
> > > |
> > > long int
> > > |
> > > %d
> > >
> > >
> > > vim +478 drivers/dma/sh/rz-dmac.c
> > >
> > > 469
> > > 470 static struct dma_async_tx_descriptor *
> > > 471 rz_dmac_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t
> > > dest, dma_addr_t src,
> > > 472 size_t len, unsigned long flags)
> > > 473 {
> > > 474 struct rz_dmac_chan *channel = to_rz_dmac_chan(chan);
> > > 475 struct rz_dmac *dmac = to_rz_dmac(chan->device);
> > > 476 struct rz_dmac_desc *desc;
> > > 477
> > > > 478 dev_dbg(dmac->dev, "%s channel: %d src=0x%llx dst=0x%llx
> > > len=%ld\n",
> > > 479 __func__, channel->index, src, dest, len);
> > > 480
> > > 481 if (list_empty(&channel->ld_free))
> > > 482 return NULL;
> > > 483
> > > 484 desc = list_first_entry(&channel->ld_free, struct
> > > rz_dmac_desc, node);
> > > 485
> > > 486 desc->type = RZ_DMAC_DESC_MEMCPY;
> > > 487 desc->src = src;
> > > 488 desc->dest = dest;
> > > 489 desc->len = len;
> > > 490 desc->direction = DMA_MEM_TO_MEM;
> > > 491
> > > 492 list_move_tail(channel->ld_free.next, &channel-
> > > >ld_queue);
> > > 493 return vchan_tx_prep(&channel->vc, &desc->vd, flags);
> > > 494 }
> > > 495
> > >
> > > ---
> > > 0-DAY CI Kernel Test Service, Intel Corporation
> > > https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fli
> > > st
> > > s.01
> > > .org%2Fhyperkitty%2Flist%2Fkbuild-
> > > all%40lists.01.org&data=04%7C01%7Cbiju.das.jz%40bp.renesas.com%7
> > > C5
> > > 42bf
> > > ff2887f488c2fef08d95284c66f%7C53d82571da1947e49cb4625a166a4a2a%7C0%7
> > > C0
> > > %7C6
> > > 37631555166735210%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIj
> > > oi
> > > V2lu
> > > MzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Iaa%2FyiTehgWr7y
> > > gH
> > > m6xV
> > > 0xspg7HWa79nPlkqUH0HVj0%3D&reserved=0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v5 1/3] dt-bindings: dma: Document RZ/G2L bindings
2021-07-29 8:25 ` [PATCH v5 1/3] dt-bindings: dma: Document RZ/G2L bindings Biju Das
@ 2021-07-29 18:00 ` Rob Herring
0 siblings, 0 replies; 9+ messages in thread
From: Rob Herring @ 2021-07-29 18:00 UTC (permalink / raw)
To: Biju Das
Cc: Chris Brandt, dmaengine, devicetree, Prabhakar Mahadev Lad,
Geert Uytterhoeven, Vinod Koul, Rob Herring, Chris Paterson,
linux-renesas-soc
On Thu, 29 Jul 2021 09:25:18 +0100, Biju Das wrote:
> Document RZ/G2L DMAC bindings.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
> Note:-
> This base series for this patch is Linux 5.14-rc2(or +) otherwise bots would
> complain about check failures
>
> v4->v5:
> * Passing legacy slave channel configuration parameters using dmaengine_slave_config is prohibited.
> So started passing this parameters in DT instead, by encoding MID/RID values with channel parameters
> in the #dma-cells.
> * Updated the description for #dma-cells
> * Removed Rb tag's of Geert and Rob since there is a modification in binding patch
> v3->v4:
> * Added Rob's Rb tag
> * Described clocks and reset properties
> v2->v3:
> * Added error interrupt first.
> * Updated clock and reset maxitems.
> * Added Geert's Rb tag.
> v1->v2:
> * Made interrupt names in defined order
> * Removed src address and channel configuration from dma-cells.
> * Changed the compatibele string to "renesas,r9a07g044-dmac".
> v1:-
> * https://patchwork.kernel.org/project/linux-renesas-soc/patch/20210611113642.18457-2-biju.das.jz@bp.renesas.com/
> ---
> ---
> .../bindings/dma/renesas,rz-dmac.yaml | 130 ++++++++++++++++++
> 1 file changed, 130 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/dma/renesas,rz-dmac.yaml
>
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-07-29 18:00 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29 8:25 [PATCH v5 0/3] Add RZ/G2L DMAC support Biju Das
2021-07-29 8:25 ` [PATCH v5 1/3] dt-bindings: dma: Document RZ/G2L bindings Biju Das
2021-07-29 18:00 ` Rob Herring
2021-07-29 8:25 ` [PATCH v5 2/3] dmaengine: Extend the dma_slave_width for 128 bytes Biju Das
2021-07-29 8:25 ` [PATCH v5 3/3] drivers: dma: sh: Add DMAC driver for RZ/G2L SoC Biju Das
2021-07-29 11:33 ` kernel test robot
2021-07-29 13:26 ` Biju Das
2021-07-29 13:50 ` Biju Das
2021-07-29 14:08 ` Biju Das
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).