i2c: tegra: Fix i2c-tegra DMA config option processing
PATCH 1/1 i2c: tegra: Fix i2c-tegra DMA config option processing
This patch fixes the Tegra DMA config option processing in the i2c-tegra driver.
Tegra processors prior to Tegra186 used APB DMA for I2C requiring CONFIG_TEGRA20_APB_DMA=y while Tegra186 and later use GPC DMA requiring CONFIG_TEGRA186_GPC_DMA=y.
The check for if the processor uses APB DMA is inverted and so the wrong DMA config options are checked.
This means if CONFIG_TEGRA20_APB_DMA=y but CONFIG_TEGRA186_GPC_DMA=n with a Tegra186 or later processor the driver will incorrectly think DMA is enabled and attempt to request DMA channels that will never be availible, leaving the driver in a perpetual EPROBE_DEFER state.
--- drivers/i2c/busses/i2c-tegra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-tegra.c +1 -1
@@ -442,7 +442,7 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev)if (IS_VI (i2c_dev))return 0 ; -if (!i2c_dev->hw->has_apb_dma) { +if (i2c_dev->hw->has_apb_dma) {if (!IS_ENABLED (CONFIG_TEGRA20_APB_DMA )) {dev_dbg (i2c_dev->dev,"APB DMA support not enabled\n" );return 0 ;
Signature · 1 line
2.17.1
Andi Shyti
maintainerHi Laxman and/or Dmitry,
Quoted 26 lines · Parker Newman
This patch fixes the Tegra DMA config option processing in the i2c-tegra driver.
Tegra processors prior to Tegra186 used APB DMA for I2C requiring
CONFIG_TEGRA20_APB_DMA=ywhile Tegra186 and later use GPC DMA requiringCONFIG_TEGRA186_GPC_DMA=y.The check for if the processor uses APB DMA is inverted and so the wrong DMA config options are checked.
This means if
CONFIG_TEGRA20_APB_DMA=ybutCONFIG_TEGRA186_GPC_DMA=nwith a Tegra186 or later processor the driver will incorrectly think DMA is enabled and attempt to request DMA channels that will never be availible, leaving the driver in a perpetualEPROBE_DEFERstate.Signed-off-by Parker Newman <[email protected]>--- drivers/i2c/busses/i2c-tegra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/i2c/busses/i2c-tegra.c +0
-0
drivers/i2c/busses/i2c-tegra.c static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev) · line 448
Quoted 8 lines
drivers/i2c/busses/i2c-tegra.c +1
-1@@ -442,7 +442,7 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev)if (IS_VI (i2c_dev))return 0 ; -if (!i2c_dev->hw->has_apb_dma) { +if (i2c_dev->hw->has_apb_dma) {if (!IS_ENABLED (CONFIG_TEGRA20_APB_DMA )) {dev_dbg (i2c_dev->dev,"APB DMA support not enabled\n" );return 0 ;
Can I have your opinion here, please?
Andi
Dmitry Osipenko
reviewer05.08.2023 00:49, Andi Shyti пишет:
Quoted 32 lines
Hi Laxman and/or Dmitry,
Quoted 29 lines · Parker Newman
This patch fixes the Tegra DMA config option processing in the i2c-tegra driver.
Tegra processors prior to Tegra186 used APB DMA for I2C requiring
CONFIG_TEGRA20_APB_DMA=ywhile Tegra186 and later use GPC DMA requiringCONFIG_TEGRA186_GPC_DMA=y.The check for if the processor uses APB DMA is inverted and so the wrong DMA config options are checked.
This means if
CONFIG_TEGRA20_APB_DMA=ybutCONFIG_TEGRA186_GPC_DMA=nwith a Tegra186 or later processor the driver will incorrectly think DMA is enabled and attempt to request DMA channels that will never be availible, leaving the driver in a perpetualEPROBE_DEFERstate.Signed-off-by Parker Newman <[email protected]>--- drivers/i2c/busses/i2c-tegra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/i2c/busses/i2c-tegra.c +0
-0@@ -442,7 +442,7 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev)if (IS_VI (i2c_dev))return 0 ;
Quoted 7 lines
drivers/i2c/busses/i2c-tegra.c static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev) · line 448
Quoted 5 lines
drivers/i2c/busses/i2c-tegra.c +1
-1-if (!i2c_dev->hw->has_apb_dma) { +if (i2c_dev->hw->has_apb_dma) {if (!IS_ENABLED (CONFIG_TEGRA20_APB_DMA )) {dev_dbg (i2c_dev->dev,"APB DMA support not enabled\n" );return 0 ;Can I have your opinion here, please?
The patch looks good, thanks Parker for fixing it. I'll be able to test it only sometime later and let you all know if there will be any problem. Previously I haven't noticed any Tegra I2C regressions, maybe we should change that dev_dbg to dev_warn.
Quoted 41 lines · Dmitry Osipenko
05.08.2023 00:49, Andi Shyti пишет:
Quoted 32 lines
Hi Laxman and/or Dmitry,
Quoted 29 lines · Parker Newman
This patch fixes the Tegra DMA config option processing in the i2c-tegra driver.
Tegra processors prior to Tegra186 used APB DMA for I2C requiring
CONFIG_TEGRA20_APB_DMA=ywhile Tegra186 and later use GPC DMA requiringCONFIG_TEGRA186_GPC_DMA=y.The check for if the processor uses APB DMA is inverted and so the wrong DMA config options are checked.
This means if
CONFIG_TEGRA20_APB_DMA=ybutCONFIG_TEGRA186_GPC_DMA=nwith a Tegra186 or later processor the driver will incorrectly think DMA is enabled and attempt to request DMA channels that will never be availible, leaving the driver in a perpetualEPROBE_DEFERstate.Signed-off-by Parker Newman <[email protected]>--- drivers/i2c/busses/i2c-tegra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/i2c/busses/i2c-tegra.c +0
-0@@ -442,7 +442,7 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev)if (IS_VI (i2c_dev))return 0 ;Quoted 7 lines
drivers/i2c/busses/i2c-tegra.c static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev) · line 448
Quoted 5 lines
drivers/i2c/busses/i2c-tegra.c +1
-1-if (!i2c_dev->hw->has_apb_dma) { +if (i2c_dev->hw->has_apb_dma) {if (!IS_ENABLED (CONFIG_TEGRA20_APB_DMA )) {dev_dbg (i2c_dev->dev,"APB DMA support not enabled\n" );return 0 ;Can I have your opinion here, please?
Quoted 5 lines
The patch looks good, thanks Parker for fixing it. I'll be able to test it only sometime later and let you all know if there will be any problem. Previously I haven't noticed any Tegra I2C regressions, maybe we should change that
dev_dbgtodev_warn.
Hi Dmitry,
You will not notice any issues if both options are set (or not set) as it will fall through and configure the DMA or skip DMA setup as expected.
I only noticed the issue after I enabled CONFIG_TEGRA20_APB_DMA which is a KConfig requirement for the Tegra HS-UART driver and my I2C stopped working.
Which now as I write this I realize is possibly another "bug"... As far as I know the HS UARTs also use GPC DMA on T186 or later? I would need to look into that.
I don't think the print needs to be a warning, not having DMA enabled is a valid option, it just needed the correct CONFIG options to be checked for the DMA type (APB versus GPC).
-Parker
Andi Shyti
maintainerBTW...
Quoted 1 line · Parker Newman
you have a blank line here.
Quoted 10 lines
This patch fixes the Tegra DMA config option processing in the i2c-tegra driver.
Tegra processors prior to Tegra186 used APB DMA for I2C requiring
CONFIG_TEGRA20_APB_DMA=ywhile Tegra186 and later use GPC DMA requiringCONFIG_TEGRA186_GPC_DMA=y.The check for if the processor uses APB DMA is inverted and so the wrong DMA config options are checked.
Quoted 6 lines
This means if
CONFIG_TEGRA20_APB_DMA=ybutCONFIG_TEGRA186_GPC_DMA=nwith a Tegra186 or later processor the driver will incorrectly think DMA is enabled and attempt to request DMA channels that will never be availible, leaving the driver in a perpetualEPROBE_DEFERstate.Signed-off-by Parker Newman <[email protected]>
As this is a fix you also need to add
Cc'eing Akhil as well for his opinion on this.
Andi
Quoted 26 lines
BTW...
Quoted 1 line · Parker Newman
you have a blank line here.
Quoted 11 lines
This patch fixes the Tegra DMA config option processing in the i2c-tegra driver.
Tegra processors prior to Tegra186 used APB DMA for I2C requiring
CONFIG_TEGRA20_APB_DMA=ywhile Tegra186 and later use GPC DMA requiringCONFIG_TEGRA186_GPC_DMA=y.The check for if the processor uses APB DMA is inverted and so the wrong DMA config options are checked.
This means if
CONFIG_TEGRA20_APB_DMA=ybut
CONFIG_TEGRA186_GPC_DMA=nQuoted 5 lines
with a Tegra186 or later processor the driver will incorrectly think DMA is enabled and attempt to request DMA channels that will never be availible, leaving the driver in a perpetual
EPROBE_DEFERstate.Signed-off-by Parker Newman <[email protected]>
Quoted 7 lines
As this is a fix you also need to add
Fixes 48cb6356fae1 ("i2c: tegra: Add GPCDMA support")Cc Akhil R <[email protected]>Cc <[email protected]> # v6.1+Cc'eing Akhil as well for his opinion on this.
The fix looks valid to me. Must have been a typo there.
Regards,
Akhil
Quoted 32 lines · Akhil R
Quoted 32 lines
BTW...
Quoted 1 line · Parker Newman
you have a blank line here.
Quoted 11 lines
This patch fixes the Tegra DMA config option processing in the i2c-tegra driver.
Tegra processors prior to Tegra186 used APB DMA for I2C requiring
CONFIG_TEGRA20_APB_DMA=ywhile Tegra186 and later use GPC DMA requiringCONFIG_TEGRA186_GPC_DMA=y.The check for if the processor uses APB DMA is inverted and so the wrong DMA config options are checked.
This means if
CONFIG_TEGRA20_APB_DMA=ybut
CONFIG_TEGRA186_GPC_DMA=nQuoted 5 lines
with a Tegra186 or later processor the driver will incorrectly think DMA is enabled and attempt to request DMA channels that will never be availible, leaving the driver in a perpetual
EPROBE_DEFERstate.Signed-off-by Parker Newman <[email protected]>As this is a fix you also need to add
Fixes 48cb6356fae1 ("i2c: tegra: Add GPCDMA support")Cc Akhil R <[email protected]>Cc <[email protected]> # v6.1+
Quoted 6 lines
Quoted 1 line
Cc'eing Akhil as well for his opinion on this.
The fix looks valid to me. Must have been a typo there.
Regards,
Akhil
Yes it appears to be a simple typo and if you have both DMA Config options set the bug would get missed.
I am new to the Linux mailing list, should I send a new message to [email protected] or CC them on this one?
Thanks,
Parker
Hi Parker,
Quoted 36 lines · Parker Newman
Quoted 35 lines · Akhil R
Quoted 26 lines
BTW...
Quoted 1 line · Parker Newman
you have a blank line here.
Quoted 11 lines
This patch fixes the Tegra DMA config option processing in the i2c-tegra driver.
Tegra processors prior to Tegra186 used APB DMA for I2C requiring
CONFIG_TEGRA20_APB_DMA=ywhile Tegra186 and later use GPC DMA requiringCONFIG_TEGRA186_GPC_DMA=y.The check for if the processor uses APB DMA is inverted and so the wrong DMA config options are checked.
This means if
CONFIG_TEGRA20_APB_DMA=ybut
CONFIG_TEGRA186_GPC_DMA=nQuoted 5 lines
with a Tegra186 or later processor the driver will incorrectly think DMA is enabled and attempt to request DMA channels that will never be availible, leaving the driver in a perpetual
EPROBE_DEFERstate.Signed-off-by Parker Newman <[email protected]>Quoted 7 lines
As this is a fix you also need to add
Fixes 48cb6356fae1 ("i2c: tegra: Add GPCDMA support")Cc Akhil R <[email protected]>Cc <[email protected]> # v6.1+Cc'eing Akhil as well for his opinion on this.
The fix looks valid to me. Must have been a typo there.
Quoted 8 lines
Quoted 3 lines
Regards,
AkhilYes it appears to be a simple typo and if you have both DMA Config options set the bug would get missed.
I am new to the Linux mailing list, should I send a new message to [email protected] or CC them on this one?
First of all... welcome to the Linux mailing list :)
No need to resend, I can add it... I was hoping for an official ack, but as that's not coming, I will ack it
Thank you Parker and wishing to see more patches from you ;)
Andi
Quoted 3 lines
Quoted 2 lines
Cc'eing Akhil as well for his opinion on this.
The fix looks valid to me. Must have been a typo there.
I'll count this as an ack. Thanks!
Akhil R
Acked-byQuoted 4 lines
Quoted 2 lines
Quoted 1 line
Cc'eing Akhil as well for his opinion on this.
The fix looks valid to me. Must have been a typo there.
I'll count this as an ack. Thanks!
Oh Sorry. I just realized I didn't put an ack.
Andi Shyti
maintainerHi
Quoted 8 lines · Parker Newman
This patch fixes the Tegra DMA config option processing in the i2c-tegra driver.
Tegra processors prior to Tegra186 used APB DMA for I2C requiring
CONFIG_TEGRA20_APB_DMA=ywhile Tegra186 and later use GPC DMA requiringCONFIG_TEGRA186_GPC_DMA=y.[...]
With the Fixes tag added, applied to i2c/andi-for-current on
https://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git
Please note that this patch may still undergo further evaluation and the final decision will be made in collaboration with Wolfram.
Thank you,
Andi
Patches applied
===============
[1/1] i2c: tegra: Fix i2c-tegra DMA config option processing
commit: fc9a464f3d9a2a361e8bcb960345270a9dc46054
Wolfram Sang
AppliedQuoted 11 lines · Parker Newman
This patch fixes the Tegra DMA config option processing in the i2c-tegra driver.
Tegra processors prior to Tegra186 used APB DMA for I2C requiring
CONFIG_TEGRA20_APB_DMA=ywhile Tegra186 and later use GPC DMA requiringCONFIG_TEGRA186_GPC_DMA=y.The check for if the processor uses APB DMA is inverted and so the wrong DMA config options are checked.
Quoted 6 lines
This means if
CONFIG_TEGRA20_APB_DMA=ybutCONFIG_TEGRA186_GPC_DMA=nwith a Tegra186 or later processor the driver will incorrectly think DMA is enabled and attempt to request DMA channels that will never be availible, leaving the driver in a perpetualEPROBE_DEFERstate.Signed-off-by Parker Newman <[email protected]>
Applied to for-current, thanks!