Linux Tegra architecture development
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Mohan Kumar D <mkumard@nvidia.com>
Cc: vkoul@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, dmaengine@vger.kernel.org,
	devicetree@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org, treding@nvidia.com,
	jonathanh@nvidia.com, spujar@nvidia.com
Subject: Re: [PATCH v2 RESEND 2/2] dmaengine: tegra210-adma: Support channel page
Date: Sat, 18 Jan 2025 08:33:17 -0800	[thread overview]
Message-ID: <77e9f23a-60e2-442c-9981-319fc650979a@roeck-us.net> (raw)
In-Reply-To: <20241217074358.340180-3-mkumard@nvidia.com>

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;

  reply	other threads:[~2025-01-18 16:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=77e9f23a-60e2-442c-9981-319fc650979a@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mkumard@nvidia.com \
    --cc=robh@kernel.org \
    --cc=spujar@nvidia.com \
    --cc=treding@nvidia.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox