| From 2b45098e749bca8ff6ad36dcc03c9d7c60373152 Mon Sep 17 00:00:00 2001 |
| From: Madalin Bucur <madalin.bucur@nxp.com> |
| Date: Wed, 4 Mar 2020 18:04:27 +0200 |
| Subject: [PATCH] fsl/fman: detect FMan erratum A050385 |
| |
| commit b281f7b93b258ce1419043bbd898a29254d5c9c7 upstream. |
| |
| Detect the presence of the A050385 erratum. |
| |
| Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com> |
| Signed-off-by: David S. Miller <davem@davemloft.net> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig |
| index 0139cb9042ec..34150182cc35 100644 |
| --- a/drivers/net/ethernet/freescale/fman/Kconfig |
| +++ b/drivers/net/ethernet/freescale/fman/Kconfig |
| @@ -8,3 +8,31 @@ config FSL_FMAN |
| help |
| Freescale Data-Path Acceleration Architecture Frame Manager |
| (FMan) support |
| + |
| +config DPAA_ERRATUM_A050385 |
| + bool |
| + depends on ARM64 && FSL_DPAA |
| + default y |
| + help |
| + DPAA FMan erratum A050385 software workaround implementation: |
| + align buffers, data start, SG fragment length to avoid FMan DMA |
| + splits. |
| + FMAN DMA read or writes under heavy traffic load may cause FMAN |
| + internal resource leak thus stopping further packet processing. |
| + The FMAN internal queue can overflow when FMAN splits single |
| + read or write transactions into multiple smaller transactions |
| + such that more than 17 AXI transactions are in flight from FMAN |
| + to interconnect. When the FMAN internal queue overflows, it can |
| + stall further packet processing. The issue can occur with any |
| + one of the following three conditions: |
| + 1. FMAN AXI transaction crosses 4K address boundary (Errata |
| + A010022) |
| + 2. FMAN DMA address for an AXI transaction is not 16 byte |
| + aligned, i.e. the last 4 bits of an address are non-zero |
| + 3. Scatter Gather (SG) frames have more than one SG buffer in |
| + the SG list and any one of the buffers, except the last |
| + buffer in the SG list has data size that is not a multiple |
| + of 16 bytes, i.e., other than 16, 32, 48, 64, etc. |
| + With any one of the above three conditions present, there is |
| + likelihood of stalled FMAN packet processing, especially under |
| + stress with multiple ports injecting line-rate traffic. |
| diff --git a/drivers/net/ethernet/freescale/fman/fman.c b/drivers/net/ethernet/freescale/fman/fman.c |
| index e80fedb27cee..21d8023535ae 100644 |
| --- a/drivers/net/ethernet/freescale/fman/fman.c |
| +++ b/drivers/net/ethernet/freescale/fman/fman.c |
| @@ -1,5 +1,6 @@ |
| /* |
| * Copyright 2008-2015 Freescale Semiconductor Inc. |
| + * Copyright 2020 NXP |
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions are met: |
| @@ -566,6 +567,10 @@ struct fman_cfg { |
| u32 qmi_def_tnums_thresh; |
| }; |
| |
| +#ifdef CONFIG_DPAA_ERRATUM_A050385 |
| +static bool fman_has_err_a050385; |
| +#endif |
| + |
| static irqreturn_t fman_exceptions(struct fman *fman, |
| enum fman_exceptions exception) |
| { |
| @@ -2517,6 +2522,14 @@ struct fman *fman_bind(struct device *fm_dev) |
| } |
| EXPORT_SYMBOL(fman_bind); |
| |
| +#ifdef CONFIG_DPAA_ERRATUM_A050385 |
| +bool fman_has_errata_a050385(void) |
| +{ |
| + return fman_has_err_a050385; |
| +} |
| +EXPORT_SYMBOL(fman_has_errata_a050385); |
| +#endif |
| + |
| static irqreturn_t fman_err_irq(int irq, void *handle) |
| { |
| struct fman *fman = (struct fman *)handle; |
| @@ -2844,6 +2857,11 @@ static struct fman *read_dts_node(struct platform_device *of_dev) |
| goto fman_free; |
| } |
| |
| +#ifdef CONFIG_DPAA_ERRATUM_A050385 |
| + fman_has_err_a050385 = |
| + of_property_read_bool(fm_node, "fsl,erratum-a050385"); |
| +#endif |
| + |
| return fman; |
| |
| fman_node_put: |
| diff --git a/drivers/net/ethernet/freescale/fman/fman.h b/drivers/net/ethernet/freescale/fman/fman.h |
| index 935c317fa696..f2ede1360f03 100644 |
| --- a/drivers/net/ethernet/freescale/fman/fman.h |
| +++ b/drivers/net/ethernet/freescale/fman/fman.h |
| @@ -1,5 +1,6 @@ |
| /* |
| * Copyright 2008-2015 Freescale Semiconductor Inc. |
| + * Copyright 2020 NXP |
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions are met: |
| @@ -398,6 +399,10 @@ u16 fman_get_max_frm(void); |
| |
| int fman_get_rx_extra_headroom(void); |
| |
| +#ifdef CONFIG_DPAA_ERRATUM_A050385 |
| +bool fman_has_errata_a050385(void); |
| +#endif |
| + |
| struct fman *fman_bind(struct device *dev); |
| |
| #endif /* __FM_H */ |
| -- |
| 2.7.4 |
| |