diff mbox series

net: stmmac: dwmac-qcom-ethqos: Configure host DMA width

Message ID 20240529-configure_ethernet_host_dma_width-v1-1-3f2707851adf@quicinc.com (mailing list archive)
State New, archived
Headers show
Series net: stmmac: dwmac-qcom-ethqos: Configure host DMA width | expand

Commit Message

Sagar Cheluvegowda May 29, 2024, 6:39 p.m. UTC
Fixes: 070246e4674b ("net: stmmac: Fix for mismatched host/device DMA address width")
Signed-off-by: Sagar Cheluvegowda <quic_scheluve@quicinc.com>
---
Change-Id: Ifdf3490c6f0dd55afc062974c05acce42d5fb6a7
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 4 ++++
 1 file changed, 4 insertions(+)


---
base-commit: 1b10b390d945a19747d75b34a6e01035ac7b9155
change-id: 20240515-configure_ethernet_host_dma_width-c619d552992d

Best regards,

Comments

Andrew Lunn May 29, 2024, 8:04 p.m. UTC | #1
On Wed, May 29, 2024 at 11:39:04AM -0700, Sagar Cheluvegowda wrote:
> Fixes: 070246e4674b ("net: stmmac: Fix for mismatched host/device DMA address width")
> Signed-off-by: Sagar Cheluvegowda <quic_scheluve@quicinc.com>

You need some sort of description in the commit message. How would i
know i hit this bug? What do i see as a user? You want to give a hint
to people looking at patches to know if they need this fix or
not. Also, you need to make it clear why this patch meets the stable
rules.

> ---
> Change-Id: Ifdf3490c6f0dd55afc062974c05acce42d5fb6a7

And what does this mean, in the context of mainline?

    Andrew

---
pw-bot: cr
Andrew Halaney May 29, 2024, 8:50 p.m. UTC | #2
$Subject should be have [PATCH net] since this targets the net tree:

https://docs.kernel.org/process/maintainer-netdev.html

On Wed, May 29, 2024 at 11:39:04AM GMT, Sagar Cheluvegowda wrote:
> Fixes: 070246e4674b ("net: stmmac: Fix for mismatched host/device DMA address width")
> Signed-off-by: Sagar Cheluvegowda <quic_scheluve@quicinc.com>

Please, always write a commit body, even if its simple. Just inferring
from this patch, I am guessing there is some limitation on CPU's DMA
address width that doesn't match up with the MAC's ability? Paint that
picture for us here please! We want to know the _why_ in this section.

Also, I think the Fixes: here would be for adding support for this SoC
in the driver, not what's listed? Might make more sense after you have a
proper body though.

> ---
> Change-Id: Ifdf3490c6f0dd55afc062974c05acce42d5fb6a7

I know this is under the ---, so its not actually in the commit, but I'd
not include that at all when submitting. Someone will complain about it
looking like this is from / for a downstream fork. At least checkpatch
doesn't warn about it, but a human probably will :P

> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> index e254b21fdb59..65d7370b47d5 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
> @@ -93,6 +93,7 @@ struct ethqos_emac_driver_data {
>  	bool has_emac_ge_3;
>  	const char *link_clk_name;
>  	bool has_integrated_pcs;
> +	u32 dma_addr_width;
>  	struct dwmac4_addrs dwmac4_addrs;
>  };
>  
> @@ -276,6 +277,7 @@ static const struct ethqos_emac_driver_data emac_v4_0_0_data = {
>  	.has_emac_ge_3 = true,
>  	.link_clk_name = "phyaux",
>  	.has_integrated_pcs = true,
> +	.dma_addr_width = 36,
>  	.dwmac4_addrs = {
>  		.dma_chan = 0x00008100,
>  		.dma_chan_offset = 0x1000,
> @@ -845,6 +847,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev)
>  		plat_dat->flags |= STMMAC_FLAG_RX_CLK_RUNS_IN_LPI;
>  	if (data->has_integrated_pcs)
>  		plat_dat->flags |= STMMAC_FLAG_HAS_INTEGRATED_PCS;
> +	if (data->dma_addr_width)
> +		plat_dat->host_dma_width = data->dma_addr_width;
>  
>  	if (ethqos->serdes_phy) {
>  		plat_dat->serdes_powerup = qcom_ethqos_serdes_powerup;
> 
> ---
> base-commit: 1b10b390d945a19747d75b34a6e01035ac7b9155
> change-id: 20240515-configure_ethernet_host_dma_width-c619d552992d
> 
> Best regards,
> -- 
> Sagar Cheluvegowda <quic_scheluve@quicinc.com>
> 
>
Andrew Lunn May 29, 2024, 10:22 p.m. UTC | #3
On Wed, May 29, 2024 at 03:50:28PM -0500, Andrew Halaney wrote:
> $Subject should be have [PATCH net] since this targets the net tree:
> 
> https://docs.kernel.org/process/maintainer-netdev.html
> 
> On Wed, May 29, 2024 at 11:39:04AM GMT, Sagar Cheluvegowda wrote:
> > Fixes: 070246e4674b ("net: stmmac: Fix for mismatched host/device DMA address width")
> > Signed-off-by: Sagar Cheluvegowda <quic_scheluve@quicinc.com>

> Also, I think the Fixes: here would be for adding support for this SoC
> in the driver, not what's listed? Might make more sense after you have a
> proper body though.

This is a tricky one. 

Fixes: 070246e4674b ("net: stmmac: Fix for mismatched host/device DMA
address width") is when support for different DMA address widths was
added. This fix cannot easily be back ported past that.

070246e4674b first appears in v6.3-rc4.

dwmac-qcom-ethqos.c first appears in v5.1-rc1. However, Qualcomm did
not start hacking on it until v6.7-rc6. It is unclear to me without a
deep dive when Qualcomm actually started using this driver.

We might actually be looking at this the wrong way, and should in fact
be looking at when a DT patch was added that made use of the driver,
not the driver itself. If it was not used, it cannot be broken....

	Andrew
Andrew Halaney May 30, 2024, 1 p.m. UTC | #4
On Thu, May 30, 2024 at 12:22:52AM GMT, Andrew Lunn wrote:
> On Wed, May 29, 2024 at 03:50:28PM -0500, Andrew Halaney wrote:
> > $Subject should be have [PATCH net] since this targets the net tree:
> > 
> > https://docs.kernel.org/process/maintainer-netdev.html
> > 
> > On Wed, May 29, 2024 at 11:39:04AM GMT, Sagar Cheluvegowda wrote:
> > > Fixes: 070246e4674b ("net: stmmac: Fix for mismatched host/device DMA address width")
> > > Signed-off-by: Sagar Cheluvegowda <quic_scheluve@quicinc.com>
> 
> > Also, I think the Fixes: here would be for adding support for this SoC
> > in the driver, not what's listed? Might make more sense after you have a
> > proper body though.
> 
> This is a tricky one. 
> 
> Fixes: 070246e4674b ("net: stmmac: Fix for mismatched host/device DMA
> address width") is when support for different DMA address widths was
> added. This fix cannot easily be back ported past that.
> 
> 070246e4674b first appears in v6.3-rc4.
> 
> dwmac-qcom-ethqos.c first appears in v5.1-rc1. However, Qualcomm did
> not start hacking on it until v6.7-rc6. It is unclear to me without a
> deep dive when Qualcomm actually started using this driver.
> 
> We might actually be looking at this the wrong way, and should in fact
> be looking at when a DT patch was added that made use of the driver,
> not the driver itself. If it was not used, it cannot be broken....
> 

I should have been more specific, sorry.

I think this should be:

    Fixes: 8c4d92e82d500 ("net: stmmac: dwmac-qcom-ethqos: add support for emac4 on sa8775p platforms")

Which appears after 070246e4674b ("net: stmmac: Fix for mismatched host/device DMA address width").

Reason being that specifically Sagar's patch is indicating that for the
SoC's/compatibles that currently use emac_v4_0_0_data structure, the DMA
address width needs to be specified.

If we were modifying structs that were added prior to 070246e4674b then
I agree, but at least the change as is I think could indicate the above
Fixes.

Thanks,
Andrew
diff mbox series

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
index e254b21fdb59..65d7370b47d5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
@@ -93,6 +93,7 @@  struct ethqos_emac_driver_data {
 	bool has_emac_ge_3;
 	const char *link_clk_name;
 	bool has_integrated_pcs;
+	u32 dma_addr_width;
 	struct dwmac4_addrs dwmac4_addrs;
 };
 
@@ -276,6 +277,7 @@  static const struct ethqos_emac_driver_data emac_v4_0_0_data = {
 	.has_emac_ge_3 = true,
 	.link_clk_name = "phyaux",
 	.has_integrated_pcs = true,
+	.dma_addr_width = 36,
 	.dwmac4_addrs = {
 		.dma_chan = 0x00008100,
 		.dma_chan_offset = 0x1000,
@@ -845,6 +847,8 @@  static int qcom_ethqos_probe(struct platform_device *pdev)
 		plat_dat->flags |= STMMAC_FLAG_RX_CLK_RUNS_IN_LPI;
 	if (data->has_integrated_pcs)
 		plat_dat->flags |= STMMAC_FLAG_HAS_INTEGRATED_PCS;
+	if (data->dma_addr_width)
+		plat_dat->host_dma_width = data->dma_addr_width;
 
 	if (ethqos->serdes_phy) {
 		plat_dat->serdes_powerup = qcom_ethqos_serdes_powerup;