[PATCH 0/3][SRU Bionic][Unstable] Fixes net installs for SocioNext board

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 0/3][SRU Bionic][Unstable] Fixes net installs for SocioNext board

dann frazier-4
BugLink: https://bugs.launchpad.net/bugs/1775884

Clean cherry-picks from upstream. All 3 apply to bionic, unstable already
has one of them.

Ard Biesheuvel (1):
  net: netsec: reduce DMA mask to 40 bits

Jassi Brar (1):
  net: netsec: enable tx-irq during open callback

Masahisa KOJIMA (1):
  net: socionext: reset hardware in ndo_stop

 drivers/net/ethernet/socionext/netsec.c | 31 +++++++++++++++----------
 1 file changed, 19 insertions(+), 12 deletions(-)

--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/3][SRU Bionic][Unstable] net: netsec: enable tx-irq during open callback

dann frazier-4
From: Jassi Brar <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1775884

Enable TX-irq as well during ndo_open() as we can not count upon
RX to arrive early enough to trigger the napi. This patch is critical
for installation over network.

Fixes: 533dd11a12f6 ("net: socionext: Add Synquacer NetSec driver")
Signed-off-by: Jassi Brar <[hidden email]>
Signed-off-by: David S. Miller <[hidden email]>
(cherry picked from commit c009f413b79de526a355b6eefa4f900b6c45d5f4)
Signed-off-by: dann frazier <[hidden email]>
---
 drivers/net/ethernet/socionext/netsec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
index 6c263af86b8a..e9fc1a852446 100644
--- a/drivers/net/ethernet/socionext/netsec.c
+++ b/drivers/net/ethernet/socionext/netsec.c
@@ -1313,8 +1313,8 @@ static int netsec_netdev_open(struct net_device *ndev)
  napi_enable(&priv->napi);
  netif_start_queue(ndev);
 
- /* Enable RX intr. */
- netsec_write(priv, NETSEC_REG_INTEN_SET, NETSEC_IRQ_RX);
+ /* Enable TX+RX intr. */
+ netsec_write(priv, NETSEC_REG_INTEN_SET, NETSEC_IRQ_RX | NETSEC_IRQ_TX);
 
  return 0;
 err3:
--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[PATCH 2/3][SRU Bionic][Unstable] net: socionext: reset hardware in ndo_stop

dann frazier-4
In reply to this post by dann frazier-4
From: Masahisa KOJIMA <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1775884

When the interface is down, head/tail of the descriptor
ring address is set to 0 in netsec_netdev_stop().
But netsec hardware still keeps the previous descriptor
ring address, so there is inconsistency between driver
and hardware after interface is up at a later time.
To address this inconsistency, add netsec_reset_hardware()
when the interface is down.

In addition, to minimize the reset process,
add flag to decide whether driver loads the netsec microcode.
Even if driver resets the netsec hardware, netsec microcode
keeps resident on RAM, so it is ok we only load the microcode
at initialization.

This patch is critical for installation over network.

Signed-off-by: Masahisa KOJIMA <[hidden email]>
Fixes: 533dd11a12f6 ("net: socionext: Add Synquacer NetSec driver")
Signed-off-by: Jassi Brar <[hidden email]>
Signed-off-by: David S. Miller <[hidden email]>
(cherry picked from commit 9a00b697ce31e38c670a3042cf9f1e9cf28dabb5)
Signed-off-by: dann frazier <[hidden email]>
---
 drivers/net/ethernet/socionext/netsec.c | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
index e9fc1a852446..208beec04b5c 100644
--- a/drivers/net/ethernet/socionext/netsec.c
+++ b/drivers/net/ethernet/socionext/netsec.c
@@ -1057,7 +1057,8 @@ static int netsec_netdev_load_microcode(struct netsec_priv *priv)
  return 0;
 }
 
-static int netsec_reset_hardware(struct netsec_priv *priv)
+static int netsec_reset_hardware(struct netsec_priv *priv,
+ bool load_ucode)
 {
  u32 value;
  int err;
@@ -1102,11 +1103,14 @@ static int netsec_reset_hardware(struct netsec_priv *priv)
  netsec_write(priv, NETSEC_REG_NRM_RX_CONFIG,
      1 << NETSEC_REG_DESC_ENDIAN);
 
- err = netsec_netdev_load_microcode(priv);
- if (err) {
- netif_err(priv, probe, priv->ndev,
-  "%s: failed to load microcode (%d)\n", __func__, err);
- return err;
+ if (load_ucode) {
+ err = netsec_netdev_load_microcode(priv);
+ if (err) {
+ netif_err(priv, probe, priv->ndev,
+  "%s: failed to load microcode (%d)\n",
+  __func__, err);
+ return err;
+ }
  }
 
  /* start DMA engines */
@@ -1328,6 +1332,7 @@ static int netsec_netdev_open(struct net_device *ndev)
 
 static int netsec_netdev_stop(struct net_device *ndev)
 {
+ int ret;
  struct netsec_priv *priv = netdev_priv(ndev);
 
  netif_stop_queue(priv->ndev);
@@ -1343,12 +1348,14 @@ static int netsec_netdev_stop(struct net_device *ndev)
  netsec_uninit_pkt_dring(priv, NETSEC_RING_TX);
  netsec_uninit_pkt_dring(priv, NETSEC_RING_RX);
 
+ ret = netsec_reset_hardware(priv, false);
+
  phy_stop(ndev->phydev);
  phy_disconnect(ndev->phydev);
 
  pm_runtime_put_sync(priv->dev);
 
- return 0;
+ return ret;
 }
 
 static int netsec_netdev_init(struct net_device *ndev)
@@ -1364,7 +1371,7 @@ static int netsec_netdev_init(struct net_device *ndev)
  if (ret)
  goto err1;
 
- ret = netsec_reset_hardware(priv);
+ ret = netsec_reset_hardware(priv, true);
  if (ret)
  goto err2;
 
--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

[PATCH 3/3][SRU Bionic] net: netsec: reduce DMA mask to 40 bits

dann frazier-4
In reply to this post by dann frazier-4
From: Ard Biesheuvel <[hidden email]>

BugLink: https://bugs.launchpad.net/bugs/1775884

The netsec network controller IP can drive 64 address bits for DMA, and
the DMA mask is set accordingly in the driver. However, the SynQuacer
SoC, which is the only silicon incorporating this IP at the moment,
integrates this IP in a manner that leaves address bits [63:40]
unconnected.

Up until now, this has not resulted in any problems, given that the DDR
controller doesn't decode those bits to begin with. However, recent
firmware updates for platforms incorporating this SoC allow the IOMMU
to be enabled, which does decode address bits [47:40], and allocates
top down from the IOVA space, producing DMA addresses that have bits
set that have been left unconnected.

Both the DT and ACPI (IORT) descriptions of the platform take this into
account, and only describe a DMA address space of 40 bits (using either
dma-ranges DT properties, or DMA address limits in IORT named component
nodes). However, even though our IOMMU and bus layers may take such
limitations into account by setting a narrower DMA mask when creating
the platform device, the netsec probe() entrypoint follows the common
practice of setting the DMA mask uncondionally, according to the
capabilities of the IP block itself rather than to its integration into
the chip.

It is currently unclear what the correct fix is here. We could hack around
it by only setting the DMA mask if it deviates from its default value of
DMA_BIT_MASK(32). However, this makes it impossible for the bus layer to
use DMA_BIT_MASK(32) as the bus limit, and so it appears that a more
comprehensive approach is required to take DMA limits imposed by the
SoC as a whole into account.

In the mean time, let's limit the DMA mask to 40 bits. Given that there
is currently only one SoC that incorporates this IP, this is a reasonable
approach that can be backported to -stable and buys us some time to come
up with a proper fix going forward.

Fixes: 533dd11a12f6 ("net: socionext: Add Synquacer NetSec driver")
Cc: Robin Murphy <[hidden email]>
Cc: Jassi Brar <[hidden email]>
Cc: Masahisa Kojima <[hidden email]>
Cc: Ilias Apalodimas <[hidden email]>
Signed-off-by: Ard Biesheuvel <[hidden email]>
Reviewed-by: Robin Murphy <[hidden email]>
Acked-by: Jassi Brar <[hidden email]>
Signed-off-by: David S. Miller <[hidden email]>
(cherry picked from commit 312564269535892cc082bc80592150cd1f5e8ec3)
Signed-off-by: dann frazier <[hidden email]>
---
 drivers/net/ethernet/socionext/netsec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
index 208beec04b5c..d007228eaa29 100644
--- a/drivers/net/ethernet/socionext/netsec.c
+++ b/drivers/net/ethernet/socionext/netsec.c
@@ -1681,8 +1681,8 @@ static int netsec_probe(struct platform_device *pdev)
  if (ret)
  goto unreg_napi;
 
- if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)))
- dev_warn(&pdev->dev, "Failed to enable 64-bit DMA\n");
+ if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(40)))
+ dev_warn(&pdev->dev, "Failed to set DMA mask\n");
 
  ret = register_netdev(ndev);
  if (ret) {
--
2.17.1


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [PATCH 0/3][SRU Bionic][Unstable] Fixes net installs for SocioNext board

Stefan Bader-2
In reply to this post by dann frazier-4
On 08.06.2018 09:52, dann frazier wrote:

> BugLink: https://bugs.launchpad.net/bugs/1775884
>
> Clean cherry-picks from upstream. All 3 apply to bionic, unstable already
> has one of them.
>
> Ard Biesheuvel (1):
>   net: netsec: reduce DMA mask to 40 bits
>
> Jassi Brar (1):
>   net: netsec: enable tx-irq during open callback
>
> Masahisa KOJIMA (1):
>   net: socionext: reset hardware in ndo_stop
>
>  drivers/net/ethernet/socionext/netsec.c | 31 +++++++++++++++----------
>  1 file changed, 19 insertions(+), 12 deletions(-)
>
Acked-by: Stefan Bader <[hidden email]>



--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

ACK: [PATCH 0/3][SRU Bionic][Unstable] Fixes net installs for SocioNext board

Kleber Souza
In reply to this post by dann frazier-4
On 06/08/18 09:52, dann frazier wrote:

> BugLink: https://bugs.launchpad.net/bugs/1775884
>
> Clean cherry-picks from upstream. All 3 apply to bionic, unstable already
> has one of them.
>
> Ard Biesheuvel (1):
>   net: netsec: reduce DMA mask to 40 bits
>
> Jassi Brar (1):
>   net: netsec: enable tx-irq during open callback
>
> Masahisa KOJIMA (1):
>   net: socionext: reset hardware in ndo_stop
>
>  drivers/net/ethernet/socionext/netsec.c | 31 +++++++++++++++----------
>  1 file changed, 19 insertions(+), 12 deletions(-)
>

Acked-by: Kleber Sacilotto de Souza <[hidden email]>

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

APPLIED: [PATCH 0/3][SRU Bionic][Unstable] Fixes net installs for SocioNext board

Khalid Elmously
In reply to this post by dann frazier-4
Applied to Bionic


On 2018-06-08 10:52:17 , dann frazier wrote:

> BugLink: https://bugs.launchpad.net/bugs/1775884
>
> Clean cherry-picks from upstream. All 3 apply to bionic, unstable already
> has one of them.
>
> Ard Biesheuvel (1):
>   net: netsec: reduce DMA mask to 40 bits
>
> Jassi Brar (1):
>   net: netsec: enable tx-irq during open callback
>
> Masahisa KOJIMA (1):
>   net: socionext: reset hardware in ndo_stop
>
>  drivers/net/ethernet/socionext/netsec.c | 31 +++++++++++++++----------
>  1 file changed, 19 insertions(+), 12 deletions(-)
>
> --
> 2.17.1
>
>
> --
> kernel-team mailing list
> [hidden email]
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

APPLIED[U]: [PATCH 0/3][SRU Bionic][Unstable] Fixes net installs for SocioNext board

Thadeu Lima de Souza Cascardo-3
In reply to this post by dann frazier-4
Applied to unstable master branch.

Thanks.
Cascardo.

Applied-to: unstable/master

--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team