* [PATCH v2 RESEND 0/2] Add Tegra ADMA channel page support
@ 2024-12-17 7:43 Mohan Kumar D
2024-12-17 7:43 ` [PATCH v2 RESEND 1/2] dt-bindings: dma: Support channel page to nvidia,tegra210-adma Mohan Kumar D
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Mohan Kumar D @ 2024-12-17 7:43 UTC (permalink / raw)
To: vkoul, robh, krzk+dt, conor+dt
Cc: dmaengine, devicetree, linux-tegra, linux-kernel, treding,
jonathanh, spujar, Mohan Kumar D
Multiple ADMA Channel page hardware support has been added from
TEGRA186 and onwards. Add channel page handling support in the tegra
adma driver
Changelog
=========
v1 -> v2:
---------
* Removed '|' in the reg description
* Included the allof:if:then: to describe the reg and reg-names
properties to reflect exact restriction for all the Tegra platforms.
* Replaced oneOf listing with items description
* Overall approach followed is to use either legacy single reg entry
that encompasses the entire ADMA address space. This configuration
ensures that the first channel page was always used. However, for
Tegra186 and subsequent versions of platforms, opting for a more
flexible approach to configure channel page address space
Mohan Kumar D (2):
dt-bindings: dma: Support channel page to nvidia,tegra210-adma
dmaengine: tegra210-adma: Support channel page
.../bindings/dma/nvidia,tegra210-adma.yaml | 60 ++++++++++++-
drivers/dma/tegra210-adma.c | 86 ++++++++++++++++---
2 files changed, 132 insertions(+), 14 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 RESEND 1/2] dt-bindings: dma: Support channel page to nvidia,tegra210-adma
2024-12-17 7:43 [PATCH v2 RESEND 0/2] Add Tegra ADMA channel page support Mohan Kumar D
@ 2024-12-17 7:43 ` Mohan Kumar D
2024-12-17 18:22 ` Conor Dooley
2024-12-17 7:43 ` [PATCH v2 RESEND 2/2] dmaengine: tegra210-adma: Support channel page Mohan Kumar D
2024-12-24 10:42 ` [PATCH v2 RESEND 0/2] Add Tegra ADMA channel page support Vinod Koul
2 siblings, 1 reply; 7+ messages in thread
From: Mohan Kumar D @ 2024-12-17 7:43 UTC (permalink / raw)
To: vkoul, robh, krzk+dt, conor+dt
Cc: dmaengine, devicetree, linux-tegra, linux-kernel, treding,
jonathanh, spujar, Mohan Kumar D
Multiple ADMA Channel page hardware support has been added from
TEGRA186 and onwards. Update the DT binding to use any of the
ADMA channel page address space region.
Signed-off-by: Mohan Kumar D <mkumard@nvidia.com>
---
.../bindings/dma/nvidia,tegra210-adma.yaml | 60 +++++++++++++++++--
1 file changed, 56 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/dma/nvidia,tegra210-adma.yaml b/Documentation/devicetree/bindings/dma/nvidia,tegra210-adma.yaml
index 877147e95ecc..d3f8c269916c 100644
--- a/Documentation/devicetree/bindings/dma/nvidia,tegra210-adma.yaml
+++ b/Documentation/devicetree/bindings/dma/nvidia,tegra210-adma.yaml
@@ -13,9 +13,6 @@ description: |
maintainers:
- Jon Hunter <jonathanh@nvidia.com>
-allOf:
- - $ref: dma-controller.yaml#
-
properties:
compatible:
oneOf:
@@ -29,7 +26,19 @@ properties:
- const: nvidia,tegra186-adma
reg:
- maxItems: 1
+ description:
+ The 'page' region describes the address space of the page
+ used for accessing the DMA channel registers. The 'global'
+ region describes the address space of the global DMA registers.
+ In the absence of the 'reg-names' property, there must be a
+ single entry that covers the address space of the global DMA
+ registers and the DMA channel registers.
+ minItems: 1
+ maxItems: 2
+
+ reg-names:
+ minItems: 1
+ maxItems: 2
interrupts:
description: |
@@ -63,6 +72,49 @@ required:
- clocks
- clock-names
+allOf:
+ - $ref: dma-controller.yaml#
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - nvidia,tegra210-adma
+ then:
+ properties:
+ reg:
+ items:
+ - description: Full address space range of DMA registers.
+
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - nvidia,tegra186-adma
+ then:
+ anyOf:
+ - properties:
+ reg:
+ items:
+ - description: Full address space range of DMA registers.
+ - properties:
+ reg:
+ items:
+ - description: Channel Page address space range of DMA registers.
+ reg-names:
+ items:
+ - const: page
+ - properties:
+ reg:
+ items:
+ - description: Channel Page address space range of DMA registers.
+ - description: Global Page address space range of DMA registers.
+ reg-names:
+ items:
+ - const: page
+ - const: global
+
additionalProperties: false
examples:
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 RESEND 2/2] dmaengine: tegra210-adma: Support channel page
2024-12-17 7:43 [PATCH v2 RESEND 0/2] Add Tegra ADMA channel page support Mohan Kumar D
2024-12-17 7:43 ` [PATCH v2 RESEND 1/2] dt-bindings: dma: Support channel page to nvidia,tegra210-adma Mohan Kumar D
@ 2024-12-17 7:43 ` Mohan Kumar D
2025-01-18 16:33 ` Guenter Roeck
2024-12-24 10:42 ` [PATCH v2 RESEND 0/2] Add Tegra ADMA channel page support Vinod Koul
2 siblings, 1 reply; 7+ messages in thread
From: Mohan Kumar D @ 2024-12-17 7:43 UTC (permalink / raw)
To: vkoul, robh, krzk+dt, conor+dt
Cc: dmaengine, devicetree, linux-tegra, linux-kernel, treding,
jonathanh, spujar, Mohan Kumar D
Multiple ADMA Channel page hardware support has been
added from TEGRA186 and onwards.
- Add support in the tegra adma driver to handle selective
channel page usage
- Make global register programming optional
Signed-off-by: Mohan Kumar D <mkumard@nvidia.com>
---
drivers/dma/tegra210-adma.c | 86 ++++++++++++++++++++++++++++++++-----
1 file changed, 76 insertions(+), 10 deletions(-)
diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c
index 2953008d42ef..6896da8ac7ef 100644
--- a/drivers/dma/tegra210-adma.c
+++ b/drivers/dma/tegra210-adma.c
@@ -43,6 +43,10 @@
#define ADMA_CH_CONFIG_MAX_BUFS 8
#define TEGRA186_ADMA_CH_CONFIG_OUTSTANDING_REQS(reqs) (reqs << 4)
+#define TEGRA186_ADMA_GLOBAL_PAGE_CHGRP 0x30
+#define TEGRA186_ADMA_GLOBAL_PAGE_RX_REQ 0x70
+#define TEGRA186_ADMA_GLOBAL_PAGE_TX_REQ 0x84
+
#define ADMA_CH_FIFO_CTRL 0x2c
#define ADMA_CH_TX_FIFO_SIZE_SHIFT 8
#define ADMA_CH_RX_FIFO_SIZE_SHIFT 0
@@ -96,6 +100,7 @@ struct tegra_adma_chip_data {
unsigned int ch_fifo_size_mask;
unsigned int sreq_index_offset;
bool has_outstanding_reqs;
+ void (*set_global_pg_config)(struct tegra_adma *tdma);
};
/*
@@ -151,6 +156,7 @@ struct tegra_adma {
struct dma_device dma_dev;
struct device *dev;
void __iomem *base_addr;
+ void __iomem *ch_base_addr;
struct clk *ahub_clk;
unsigned int nr_channels;
unsigned long *dma_chan_mask;
@@ -159,6 +165,7 @@ struct tegra_adma {
/* Used to store global command register state when suspending */
unsigned int global_cmd;
+ unsigned int ch_page_no;
const struct tegra_adma_chip_data *cdata;
@@ -176,6 +183,11 @@ static inline u32 tdma_read(struct tegra_adma *tdma, u32 reg)
return readl(tdma->base_addr + tdma->cdata->global_reg_offset + reg);
}
+static inline void tdma_ch_global_write(struct tegra_adma *tdma, u32 reg, u32 val)
+{
+ writel(val, tdma->ch_base_addr + tdma->cdata->global_reg_offset + reg);
+}
+
static inline void tdma_ch_write(struct tegra_adma_chan *tdc, u32 reg, u32 val)
{
writel(val, tdc->chan_addr + reg);
@@ -217,13 +229,30 @@ static int tegra_adma_slave_config(struct dma_chan *dc,
return 0;
}
+static void tegra186_adma_global_page_config(struct tegra_adma *tdma)
+{
+ /*
+ * Clear the default page1 channel group configs and program
+ * the global registers based on the actual page usage
+ */
+ tdma_write(tdma, TEGRA186_ADMA_GLOBAL_PAGE_CHGRP, 0);
+ tdma_write(tdma, TEGRA186_ADMA_GLOBAL_PAGE_RX_REQ, 0);
+ tdma_write(tdma, TEGRA186_ADMA_GLOBAL_PAGE_TX_REQ, 0);
+ tdma_write(tdma, TEGRA186_ADMA_GLOBAL_PAGE_CHGRP + (tdma->ch_page_no * 0x4), 0xff);
+ tdma_write(tdma, TEGRA186_ADMA_GLOBAL_PAGE_RX_REQ + (tdma->ch_page_no * 0x4), 0x1ffffff);
+ tdma_write(tdma, TEGRA186_ADMA_GLOBAL_PAGE_TX_REQ + (tdma->ch_page_no * 0x4), 0xffffff);
+}
+
static int tegra_adma_init(struct tegra_adma *tdma)
{
u32 status;
int ret;
- /* Clear any interrupts */
- tdma_write(tdma, tdma->cdata->ch_base_offset + tdma->cdata->global_int_clear, 0x1);
+ /* Clear any channels group global interrupts */
+ tdma_ch_global_write(tdma, tdma->cdata->global_int_clear, 0x1);
+
+ if (!tdma->base_addr)
+ return 0;
/* Assert soft reset */
tdma_write(tdma, ADMA_GLOBAL_SOFT_RESET, 0x1);
@@ -237,6 +266,9 @@ static int tegra_adma_init(struct tegra_adma *tdma)
if (ret)
return ret;
+ if (tdma->cdata->set_global_pg_config)
+ tdma->cdata->set_global_pg_config(tdma);
+
/* Enable global ADMA registers */
tdma_write(tdma, ADMA_GLOBAL_CMD, 1);
@@ -736,7 +768,9 @@ static int __maybe_unused tegra_adma_runtime_suspend(struct device *dev)
struct tegra_adma_chan *tdc;
int i;
- tdma->global_cmd = tdma_read(tdma, ADMA_GLOBAL_CMD);
+ if (tdma->base_addr)
+ tdma->global_cmd = tdma_read(tdma, ADMA_GLOBAL_CMD);
+
if (!tdma->global_cmd)
goto clk_disable;
@@ -777,7 +811,11 @@ static int __maybe_unused tegra_adma_runtime_resume(struct device *dev)
dev_err(dev, "ahub clk_enable failed: %d\n", ret);
return ret;
}
- tdma_write(tdma, ADMA_GLOBAL_CMD, tdma->global_cmd);
+ if (tdma->base_addr) {
+ tdma_write(tdma, ADMA_GLOBAL_CMD, tdma->global_cmd);
+ if (tdma->cdata->set_global_pg_config)
+ tdma->cdata->set_global_pg_config(tdma);
+ }
if (!tdma->global_cmd)
return 0;
@@ -817,6 +855,7 @@ static const struct tegra_adma_chip_data tegra210_chip_data = {
.ch_fifo_size_mask = 0xf,
.sreq_index_offset = 2,
.has_outstanding_reqs = false,
+ .set_global_pg_config = NULL,
};
static const struct tegra_adma_chip_data tegra186_chip_data = {
@@ -833,6 +872,7 @@ static const struct tegra_adma_chip_data tegra186_chip_data = {
.ch_fifo_size_mask = 0x1f,
.sreq_index_offset = 4,
.has_outstanding_reqs = true,
+ .set_global_pg_config = tegra186_adma_global_page_config,
};
static const struct of_device_id tegra_adma_of_match[] = {
@@ -846,7 +886,8 @@ static int tegra_adma_probe(struct platform_device *pdev)
{
const struct tegra_adma_chip_data *cdata;
struct tegra_adma *tdma;
- int ret, i;
+ struct resource *res_page, *res_base;
+ int ret, i, page_no;
cdata = of_device_get_match_data(&pdev->dev);
if (!cdata) {
@@ -865,9 +906,35 @@ static int tegra_adma_probe(struct platform_device *pdev)
tdma->nr_channels = cdata->nr_channels;
platform_set_drvdata(pdev, tdma);
- tdma->base_addr = devm_platform_ioremap_resource(pdev, 0);
- if (IS_ERR(tdma->base_addr))
- return PTR_ERR(tdma->base_addr);
+ res_page = platform_get_resource_byname(pdev, IORESOURCE_MEM, "page");
+ if (res_page) {
+ tdma->ch_base_addr = devm_ioremap_resource(&pdev->dev, res_page);
+ if (IS_ERR(tdma->ch_base_addr))
+ return PTR_ERR(tdma->ch_base_addr);
+
+ res_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "global");
+ if (res_base) {
+ page_no = (res_page->start - res_base->start) / cdata->ch_base_offset;
+ if (page_no <= 0)
+ return -EINVAL;
+ tdma->ch_page_no = page_no - 1;
+ tdma->base_addr = devm_ioremap_resource(&pdev->dev, res_base);
+ if (IS_ERR(tdma->base_addr))
+ return PTR_ERR(tdma->base_addr);
+ }
+ } else {
+ /* If no 'page' property found, then reg DT binding would be legacy */
+ res_base = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (res_base) {
+ tdma->base_addr = devm_ioremap_resource(&pdev->dev, res_base);
+ if (IS_ERR(tdma->base_addr))
+ return PTR_ERR(tdma->base_addr);
+ } else {
+ return -ENODEV;
+ }
+
+ tdma->ch_base_addr = tdma->base_addr + cdata->ch_base_offset;
+ }
tdma->ahub_clk = devm_clk_get(&pdev->dev, "d_audio");
if (IS_ERR(tdma->ahub_clk)) {
@@ -900,8 +967,7 @@ static int tegra_adma_probe(struct platform_device *pdev)
if (!test_bit(i, tdma->dma_chan_mask))
continue;
- tdc->chan_addr = tdma->base_addr + cdata->ch_base_offset
- + (cdata->ch_reg_size * i);
+ tdc->chan_addr = tdma->ch_base_addr + (cdata->ch_reg_size * i);
tdc->irq = of_irq_get(pdev->dev.of_node, i);
if (tdc->irq <= 0) {
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 RESEND 1/2] dt-bindings: dma: Support channel page to nvidia,tegra210-adma
2024-12-17 7:43 ` [PATCH v2 RESEND 1/2] dt-bindings: dma: Support channel page to nvidia,tegra210-adma Mohan Kumar D
@ 2024-12-17 18:22 ` Conor Dooley
0 siblings, 0 replies; 7+ messages in thread
From: Conor Dooley @ 2024-12-17 18:22 UTC (permalink / raw)
To: Mohan Kumar D
Cc: vkoul, robh, krzk+dt, conor+dt, dmaengine, devicetree,
linux-tegra, linux-kernel, treding, jonathanh, spujar
[-- Attachment #1: Type: text/plain, Size: 351 bytes --]
On Tue, Dec 17, 2024 at 01:13:57PM +0530, Mohan Kumar D wrote:
> Multiple ADMA Channel page hardware support has been added from
> TEGRA186 and onwards. Update the DT binding to use any of the
> ADMA channel page address space region.
>
> Signed-off-by: Mohan Kumar D <mkumard@nvidia.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 RESEND 0/2] Add Tegra ADMA channel page support
2024-12-17 7:43 [PATCH v2 RESEND 0/2] Add Tegra ADMA channel page support Mohan Kumar D
2024-12-17 7:43 ` [PATCH v2 RESEND 1/2] dt-bindings: dma: Support channel page to nvidia,tegra210-adma Mohan Kumar D
2024-12-17 7:43 ` [PATCH v2 RESEND 2/2] dmaengine: tegra210-adma: Support channel page Mohan Kumar D
@ 2024-12-24 10:42 ` Vinod Koul
2 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2024-12-24 10:42 UTC (permalink / raw)
To: robh, krzk+dt, conor+dt, Mohan Kumar D
Cc: dmaengine, devicetree, linux-tegra, linux-kernel, treding,
jonathanh, spujar
On Tue, 17 Dec 2024 13:13:56 +0530, Mohan Kumar D wrote:
> Multiple ADMA Channel page hardware support has been added from
> TEGRA186 and onwards. Add channel page handling support in the tegra
> adma driver
>
> Changelog
> =========
>
> [...]
Applied, thanks!
[1/2] dt-bindings: dma: Support channel page to nvidia,tegra210-adma
commit: 762b37fc6ae2af0c7ddf36556fe7427575e9c759
[2/2] dmaengine: tegra210-adma: Support channel page
commit: 68811c928f88828f188656dd3c9c184eeec2ce86
Best regards,
--
~Vinod
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 RESEND 2/2] dmaengine: tegra210-adma: Support channel page
2024-12-17 7:43 ` [PATCH v2 RESEND 2/2] dmaengine: tegra210-adma: Support channel page Mohan Kumar D
@ 2025-01-18 16:33 ` Guenter Roeck
2025-01-20 3:46 ` Mohan Kumar D
0 siblings, 1 reply; 7+ messages in thread
From: Guenter Roeck @ 2025-01-18 16:33 UTC (permalink / raw)
To: Mohan Kumar D
Cc: vkoul, robh, krzk+dt, conor+dt, dmaengine, devicetree,
linux-tegra, linux-kernel, treding, jonathanh, spujar
Hi,
On Tue, Dec 17, 2024 at 01:13:58PM +0530, Mohan Kumar D wrote:
> Multiple ADMA Channel page hardware support has been
> added from TEGRA186 and onwards.
>
> - Add support in the tegra adma driver to handle selective
> channel page usage
> - Make global register programming optional
>
> Signed-off-by: Mohan Kumar D <mkumard@nvidia.com>
This patch triggers a build failure when trying to build i386:all{yes,mod}config.
x86_64-linux-ld: drivers/dma/tegra210-adma.o: in function `tegra_adma_probe':
tegra210-adma.c:(.text+0x1322): undefined reference to `__udivdi3'
Bisect log is attached for reference.
Problem is
> + if (res_base) {
> + page_no = (res_page->start - res_base->start) / cdata->ch_base_offset;
->start is phys_addr_t which can be a 64-bit pointer on 32-bit systems,
making this a 64-bit divide operation.
Bisect log and a possible fix are attached for reference. I am not sure
though if the suggested fix is correct/complete since page_no might
overflow on such systems. It should possibly be a phys_addr_t, but that
is unsigned so the subsequent negative check would not work.
Guenter
---
# bad: [0907e7fb35756464aa34c35d6abb02998418164b] Add linux-next specific files for 20250117
# good: [5bc55a333a2f7316b58edc7573e8e893f7acb532] Linux 6.13-rc7
git bisect start 'HEAD' 'v6.13-rc7'
# good: [195cedf4deacf84167c32b866ceac1cf4a16df15] Merge branch 'main' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
git bisect good 195cedf4deacf84167c32b866ceac1cf4a16df15
# good: [01c19ecf34e1713365346f932011facd7d2d2bc6] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git
git bisect good 01c19ecf34e1713365346f932011facd7d2d2bc6
# good: [7fac8eef32d7735a3b01d08f2c98d5e6eaf254da] Merge branch 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
git bisect good 7fac8eef32d7735a3b01d08f2c98d5e6eaf254da
# bad: [24c55da105e9a641fa77c8d8efbf92472a18bf4e] Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git
git bisect bad 24c55da105e9a641fa77c8d8efbf92472a18bf4e
# good: [73656a6ab6d428102eb5aaa9599b5fcba4a2501f] intel_th: core: fix kernel-doc warnings
git bisect good 73656a6ab6d428102eb5aaa9599b5fcba4a2501f
# good: [b995a104a0aa1d6b90ea4ba3110e657ae9e83213] Merge branch 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
git bisect good b995a104a0aa1d6b90ea4ba3110e657ae9e83213
# good: [002c855847f718e12879808404dc8375207012dd] Merge branch 'next' of git://github.com/awilliam/linux-vfio.git
git bisect good 002c855847f718e12879808404dc8375207012dd
# bad: [54e09c8e2d3b0b7d603a64368fa49fe2a8031dd1] dt-bindings: dma: st-stm32-dmamux: Add description for dma-cell values
git bisect bad 54e09c8e2d3b0b7d603a64368fa49fe2a8031dd1
# good: [9d880452fb3edc4645e28264381ce35606fb1b19] dmaengine: amd: qdma: make read-only arrays h2c_types and c2h_types static const
git bisect good 9d880452fb3edc4645e28264381ce35606fb1b19
# good: [775363772f5e72b984a883e22d510fec5357477a] dt-bindings: dma: ti: k3-bcdma: Add J722S CSI BCDMA
git bisect good 775363772f5e72b984a883e22d510fec5357477a
# bad: [36d8cbd661c48f4c18eeb414146ec68a71fd644f] Merge branch 'fixes' into next
git bisect bad 36d8cbd661c48f4c18eeb414146ec68a71fd644f
# good: [762b37fc6ae2af0c7ddf36556fe7427575e9c759] dt-bindings: dma: Support channel page to nvidia,tegra210-adma
git bisect good 762b37fc6ae2af0c7ddf36556fe7427575e9c759
# bad: [9602a843cb3a16df8930eb9b046aa7aeb769521b] dmaengine: bcm2835-dma: Prevent suspend if DMA channel is busy
git bisect bad 9602a843cb3a16df8930eb9b046aa7aeb769521b
# bad: [68811c928f88828f188656dd3c9c184eeec2ce86] dmaengine: tegra210-adma: Support channel page
git bisect bad 68811c928f88828f188656dd3c9c184eeec2ce86
# first bad commit: [68811c928f88828f188656dd3c9c184eeec2ce86] dmaengine: tegra210-adma: Support channel page
---
diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c
index 6896da8ac7ef..1de3d84d3b7c 100644
--- a/drivers/dma/tegra210-adma.c
+++ b/drivers/dma/tegra210-adma.c
@@ -914,7 +914,7 @@ static int tegra_adma_probe(struct platform_device *pdev)
res_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "global");
if (res_base) {
- page_no = (res_page->start - res_base->start) / cdata->ch_base_offset;
+ page_no = div_s64(res_page->start - res_base->start, cdata->ch_base_offset);
if (page_no <= 0)
return -EINVAL;
tdma->ch_page_no = page_no - 1;
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 RESEND 2/2] dmaengine: tegra210-adma: Support channel page
2025-01-18 16:33 ` Guenter Roeck
@ 2025-01-20 3:46 ` Mohan Kumar D
0 siblings, 0 replies; 7+ messages in thread
From: Mohan Kumar D @ 2025-01-20 3:46 UTC (permalink / raw)
To: Guenter Roeck
Cc: vkoul, robh, krzk+dt, conor+dt, dmaengine, devicetree,
linux-tegra, linux-kernel, treding, jonathanh, spujar
On 18-01-2025 22:03, Guenter Roeck wrote:
> External email: Use caution opening links or attachments
>
>
> Hi,
>
> On Tue, Dec 17, 2024 at 01:13:58PM +0530, Mohan Kumar D wrote:
>> Multiple ADMA Channel page hardware support has been
>> added from TEGRA186 and onwards.
>>
>> - Add support in the tegra adma driver to handle selective
>> channel page usage
>> - Make global register programming optional
>>
>> Signed-off-by: Mohan Kumar D <mkumard@nvidia.com>
> This patch triggers a build failure when trying to build i386:all{yes,mod}config.
>
> x86_64-linux-ld: drivers/dma/tegra210-adma.o: in function `tegra_adma_probe':
> tegra210-adma.c:(.text+0x1322): undefined reference to `__udivdi3'
>
> Bisect log is attached for reference.
>
> Problem is
>
>> + if (res_base) {
>> + page_no = (res_page->start - res_base->start) / cdata->ch_base_offset;
> ->start is phys_addr_t which can be a 64-bit pointer on 32-bit systems,
> making this a 64-bit divide operation.
>
> Bisect log and a possible fix are attached for reference. I am not sure
> though if the suggested fix is correct/complete since page_no might
> overflow on such systems. It should possibly be a phys_addr_t, but that
> is unsigned so the subsequent negative check would not work.
>
> Guenter
https://lore.kernel.org/lkml/20250116162033.3922252-1-mkumard@nvidia.com/T/
has been pushed recently to fix this issue. Can you please consider this
patch series.
>
> ---
> # bad: [0907e7fb35756464aa34c35d6abb02998418164b] Add linux-next specific files for 20250117
> # good: [5bc55a333a2f7316b58edc7573e8e893f7acb532] Linux 6.13-rc7
> git bisect start 'HEAD' 'v6.13-rc7'
> # good: [195cedf4deacf84167c32b866ceac1cf4a16df15] Merge branch 'main' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
> git bisect good 195cedf4deacf84167c32b866ceac1cf4a16df15
> # good: [01c19ecf34e1713365346f932011facd7d2d2bc6] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git
> git bisect good 01c19ecf34e1713365346f932011facd7d2d2bc6
> # good: [7fac8eef32d7735a3b01d08f2c98d5e6eaf254da] Merge branch 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
> git bisect good 7fac8eef32d7735a3b01d08f2c98d5e6eaf254da
> # bad: [24c55da105e9a641fa77c8d8efbf92472a18bf4e] Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git
> git bisect bad 24c55da105e9a641fa77c8d8efbf92472a18bf4e
> # good: [73656a6ab6d428102eb5aaa9599b5fcba4a2501f] intel_th: core: fix kernel-doc warnings
> git bisect good 73656a6ab6d428102eb5aaa9599b5fcba4a2501f
> # good: [b995a104a0aa1d6b90ea4ba3110e657ae9e83213] Merge branch 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
> git bisect good b995a104a0aa1d6b90ea4ba3110e657ae9e83213
> # good: [002c855847f718e12879808404dc8375207012dd] Merge branch 'next' of git://github.com/awilliam/linux-vfio.git
> git bisect good 002c855847f718e12879808404dc8375207012dd
> # bad: [54e09c8e2d3b0b7d603a64368fa49fe2a8031dd1] dt-bindings: dma: st-stm32-dmamux: Add description for dma-cell values
> git bisect bad 54e09c8e2d3b0b7d603a64368fa49fe2a8031dd1
> # good: [9d880452fb3edc4645e28264381ce35606fb1b19] dmaengine: amd: qdma: make read-only arrays h2c_types and c2h_types static const
> git bisect good 9d880452fb3edc4645e28264381ce35606fb1b19
> # good: [775363772f5e72b984a883e22d510fec5357477a] dt-bindings: dma: ti: k3-bcdma: Add J722S CSI BCDMA
> git bisect good 775363772f5e72b984a883e22d510fec5357477a
> # bad: [36d8cbd661c48f4c18eeb414146ec68a71fd644f] Merge branch 'fixes' into next
> git bisect bad 36d8cbd661c48f4c18eeb414146ec68a71fd644f
> # good: [762b37fc6ae2af0c7ddf36556fe7427575e9c759] dt-bindings: dma: Support channel page to nvidia,tegra210-adma
> git bisect good 762b37fc6ae2af0c7ddf36556fe7427575e9c759
> # bad: [9602a843cb3a16df8930eb9b046aa7aeb769521b] dmaengine: bcm2835-dma: Prevent suspend if DMA channel is busy
> git bisect bad 9602a843cb3a16df8930eb9b046aa7aeb769521b
> # bad: [68811c928f88828f188656dd3c9c184eeec2ce86] dmaengine: tegra210-adma: Support channel page
> git bisect bad 68811c928f88828f188656dd3c9c184eeec2ce86
> # first bad commit: [68811c928f88828f188656dd3c9c184eeec2ce86] dmaengine: tegra210-adma: Support channel page
>
> ---
> diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c
> index 6896da8ac7ef..1de3d84d3b7c 100644
> --- a/drivers/dma/tegra210-adma.c
> +++ b/drivers/dma/tegra210-adma.c
> @@ -914,7 +914,7 @@ static int tegra_adma_probe(struct platform_device *pdev)
>
> res_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "global");
> if (res_base) {
> - page_no = (res_page->start - res_base->start) / cdata->ch_base_offset;
> + page_no = div_s64(res_page->start - res_base->start, cdata->ch_base_offset);
> if (page_no <= 0)
> return -EINVAL;
> tdma->ch_page_no = page_no - 1;
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-01-20 3:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-17 7:43 [PATCH v2 RESEND 0/2] Add Tegra ADMA channel page support Mohan Kumar D
2024-12-17 7:43 ` [PATCH v2 RESEND 1/2] dt-bindings: dma: Support channel page to nvidia,tegra210-adma Mohan Kumar D
2024-12-17 18:22 ` Conor Dooley
2024-12-17 7:43 ` [PATCH v2 RESEND 2/2] dmaengine: tegra210-adma: Support channel page Mohan Kumar D
2025-01-18 16:33 ` Guenter Roeck
2025-01-20 3:46 ` Mohan Kumar D
2024-12-24 10:42 ` [PATCH v2 RESEND 0/2] Add Tegra ADMA channel page support Vinod Koul
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).