layerscape: add patches-5.4
[openwrt/staging/stintel.git] / target / linux / layerscape / patches-5.4 / 701-net-0361-sdk_dpaa-sdk_fman-ls1034a-errata-update-number-to-A0.patch
1 From 512bb2bd0555a8e78713dfdc109d87723a9da5c1 Mon Sep 17 00:00:00 2001
2 From: Camelia Groza <camelia.groza@nxp.com>
3 Date: Fri, 13 Dec 2019 14:49:16 +0200
4 Subject: [PATCH] sdk_dpaa: sdk_fman: ls1034a errata: update number to A050385
5
6 The A050385 erratum extends the A010022 erratum by defining additional
7 FMan lock-up conditions and suggests new w/a restrictions.
8
9 Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
10 ---
11 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.h | 14 +++----
12 .../net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c | 44 +++++++++++-----------
13 .../inc/integrations/LS1043/dpaa_integration_ext.h | 2 +-
14 .../sdk_fman/src/inc/wrapper/lnxwrp_fsl_fman.h | 8 ++--
15 .../freescale/sdk_fman/src/wrapper/lnxwrp_fm.c | 16 ++++----
16 5 files changed, 42 insertions(+), 42 deletions(-)
17
18 --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.h
19 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.h
20 @@ -99,15 +99,15 @@ struct dpa_buffer_layout_s {
21 * space to account for further alignments.
22 */
23 #define DPA_MAX_FRM_SIZE 9600
24 -#ifndef FM_ERRATUM_A010022
25 +#ifndef FM_ERRATUM_A050385
26 #define DPA_BP_RAW_SIZE \
27 ((DPA_MAX_FRM_SIZE + DPA_MAX_FD_OFFSET + \
28 sizeof(struct skb_shared_info) + 128) & ~(SMP_CACHE_BYTES - 1))
29 -#else /* FM_ERRATUM_A010022 */
30 -#define DPA_BP_RAW_SIZE ((unlikely(fm_has_errata_a010022())) ? 2048 : \
31 +#else /* FM_ERRATUM_A050385 */
32 +#define DPA_BP_RAW_SIZE ((unlikely(fm_has_errata_a050385())) ? 2048 : \
33 ((DPA_MAX_FRM_SIZE + DPA_MAX_FD_OFFSET + \
34 sizeof(struct skb_shared_info) + 128) & ~(SMP_CACHE_BYTES - 1)))
35 -#endif /* FM_ERRATUM_A010022 */
36 +#endif /* FM_ERRATUM_A050385 */
37 #endif /* CONFIG_FSL_DPAA_ETH_JUMBO_FRAME */
38
39 /* This is what FMan is ever allowed to use.
40 @@ -660,14 +660,14 @@ static inline void _dpa_bp_free_pf(void
41 * on egress.
42 */
43
44 -#ifdef FM_ERRATUM_A010022
45 +#ifdef FM_ERRATUM_A050385
46 #define CROSS_4K(start, size) \
47 (((uintptr_t)(start) + (size)) > \
48 (((uintptr_t)(start) + 0x1000) & ~0xFFF))
49 /* The headroom needs to accommodate our private data (64 bytes) but
50 * we reserve 256 bytes instead to guarantee 256 data alignment.
51 */
52 -#define DPAA_A010022_HEADROOM 256
53 -#endif /* FM_ERRATUM_A010022 */
54 +#define DPAA_A050385_HEADROOM 256
55 +#endif /* FM_ERRATUM_A050385 */
56
57 #endif /* __DPA_H */
58 --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c
59 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_sg.c
60 @@ -101,8 +101,8 @@ static int _dpa_bp_add_8_bufs(const stru
61 * We only need enough space to store a pointer, but allocate
62 * an entire cacheline for performance reasons.
63 */
64 -#ifdef FM_ERRATUM_A010022
65 - if (unlikely(fm_has_errata_a010022())) {
66 +#ifdef FM_ERRATUM_A050385
67 + if (unlikely(fm_has_errata_a050385())) {
68 struct page *new_page = alloc_page(GFP_ATOMIC);
69 if (unlikely(!new_page))
70 goto netdev_alloc_failed;
71 @@ -765,15 +765,15 @@ int __hot skb_to_contig_fd(struct dpa_pr
72 }
73 EXPORT_SYMBOL(skb_to_contig_fd);
74
75 -#ifdef FM_ERRATUM_A010022
76 -/* Verify the conditions that trigger the A010022 errata:
77 +#ifdef FM_ERRATUM_A050385
78 +/* Verify the conditions that trigger the A050385 errata:
79 * - 4K memory address boundary crossings when the data/SG fragments aren't
80 * aligned to 256 bytes
81 * - data and SG fragments that aren't aligned to 16 bytes
82 * - SG fragments that aren't mod 16 bytes in size (except for the last
83 * fragment)
84 */
85 -static bool a010022_check_skb(struct sk_buff *skb, struct dpa_priv_s *priv)
86 +static bool a050385_check_skb(struct sk_buff *skb, struct dpa_priv_s *priv)
87 {
88 skb_frag_t *frag;
89 int i, nr_frags;
90 @@ -840,7 +840,7 @@ static bool a010022_check_skb(struct sk_
91 * page. Build a new skb around the new buffer and release the old one.
92 * A performance drop should be expected.
93 */
94 -static struct sk_buff *a010022_realign_skb(struct sk_buff *skb,
95 +static struct sk_buff *a050385_realign_skb(struct sk_buff *skb,
96 struct dpa_priv_s *priv)
97 {
98 int trans_offset = skb_transport_offset(skb);
99 @@ -850,7 +850,7 @@ static struct sk_buff *a010022_realign_s
100 struct page *npage;
101 void *npage_addr;
102
103 - headroom = DPAA_A010022_HEADROOM;
104 + headroom = DPAA_A050385_HEADROOM;
105
106 /* For the new skb we only need the old one's data (both non-paged and
107 * paged). We can skip the old tailroom.
108 @@ -941,8 +941,8 @@ int __hot skb_to_sg_fd(struct dpa_priv_s
109 /* Get a page frag to store the SGTable, or a full page if the errata
110 * is in place and we need to avoid crossing a 4k boundary.
111 */
112 -#ifdef FM_ERRATUM_A010022
113 - if (unlikely(fm_has_errata_a010022())) {
114 +#ifdef FM_ERRATUM_A050385
115 + if (unlikely(fm_has_errata_a050385())) {
116 struct page *new_page = alloc_page(GFP_ATOMIC);
117
118 if (unlikely(!new_page))
119 @@ -1099,9 +1099,9 @@ int __hot dpa_tx_extended(struct sk_buff
120 int *countptr, offset = 0;
121 struct sk_buff *nskb;
122
123 - /* Flags to help optimize the A010022 errata restriction checks.
124 + /* Flags to help optimize the A050385 errata restriction checks.
125 *
126 - * First flag marks if the skb changed between the first A010022 check
127 + * First flag marks if the skb changed between the first A050385 check
128 * and the moment it's converted to an FD.
129 *
130 * The second flag marks if the skb needs to be realigned in order to
131 @@ -1121,8 +1121,8 @@ int __hot dpa_tx_extended(struct sk_buff
132
133 clear_fd(&fd);
134
135 -#ifdef FM_ERRATUM_A010022
136 - if (unlikely(fm_has_errata_a010022()) && a010022_check_skb(skb, priv))
137 +#ifdef FM_ERRATUM_A050385
138 + if (unlikely(fm_has_errata_a050385()) && a050385_check_skb(skb, priv))
139 skb_need_wa = true;
140 #endif
141
142 @@ -1176,7 +1176,7 @@ int __hot dpa_tx_extended(struct sk_buff
143 /* We're going to store the skb backpointer at the beginning
144 * of the data buffer, so we need a privately owned skb
145 *
146 - * Under the A010022 errata, we are going to have a privately
147 + * Under the A050385 errata, we are going to have a privately
148 * owned skb after realigning the current one, so no point in
149 * copying it here in that case.
150 */
151 @@ -1194,12 +1194,12 @@ int __hot dpa_tx_extended(struct sk_buff
152 * more fragments than we support. In this case,
153 * we have no choice but to linearize it ourselves.
154 */
155 -#ifdef FM_ERRATUM_A010022
156 +#ifdef FM_ERRATUM_A050385
157 /* No point in linearizing the skb now if we are going
158 * to realign and linearize it again further down due
159 - * to the A010022 errata
160 + * to the A050385 errata
161 */
162 - if (unlikely(fm_has_errata_a010022()))
163 + if (unlikely(fm_has_errata_a050385()))
164 skb_need_wa = true;
165 else
166 #endif
167 @@ -1209,16 +1209,16 @@ int __hot dpa_tx_extended(struct sk_buff
168 /* Common out-of-memory error path */
169 goto enomem;
170
171 -#ifdef FM_ERRATUM_A010022
172 +#ifdef FM_ERRATUM_A050385
173 /* Verify the skb a second time if it has been updated since
174 * the previous check
175 */
176 - if (unlikely(fm_has_errata_a010022()) && skb_changed &&
177 - a010022_check_skb(skb, priv))
178 + if (unlikely(fm_has_errata_a050385()) && skb_changed &&
179 + a050385_check_skb(skb, priv))
180 skb_need_wa = true;
181
182 - if (unlikely(fm_has_errata_a010022()) && skb_need_wa) {
183 - nskb = a010022_realign_skb(skb, priv);
184 + if (unlikely(fm_has_errata_a050385()) && skb_need_wa) {
185 + nskb = a050385_realign_skb(skb, priv);
186 if (!nskb)
187 goto skb_to_fd_failed;
188 dev_kfree_skb(skb);
189 --- a/drivers/net/ethernet/freescale/sdk_fman/inc/integrations/LS1043/dpaa_integration_ext.h
190 +++ b/drivers/net/ethernet/freescale/sdk_fman/inc/integrations/LS1043/dpaa_integration_ext.h
191 @@ -271,7 +271,7 @@ typedef enum
192 #define FM_AID_MODE_NO_TNUM_SW005 /* refer to pdm TKT068794 - only support of port_id on aid */
193 #define FM_ERROR_VSP_NO_MATCH_SW006 /* refer to pdm TKT174304 - no match between errorQ and VSP */
194
195 -#define FM_ERRATUM_A010022
196 +#define FM_ERRATUM_A050385
197
198 /*****************************************************************************
199 RMan INTEGRATION-SPECIFIC DEFINITIONS
200 --- a/drivers/net/ethernet/freescale/sdk_fman/src/inc/wrapper/lnxwrp_fsl_fman.h
201 +++ b/drivers/net/ethernet/freescale/sdk_fman/src/inc/wrapper/lnxwrp_fsl_fman.h
202 @@ -490,12 +490,12 @@ int fm_get_max_frm(void);
203 int fm_get_rx_extra_headroom(void);
204
205 /**************************************************************************//**
206 - @Function fm_has_errata_a010022
207 + @Function fm_has_errata_a050385
208
209 - @Description Detect if the SoC is vulnerable to the A010022 errata
210 + @Description Detect if the SoC is vulnerable to the A050385 errata
211 *//***************************************************************************/
212 -#ifdef FM_ERRATUM_A010022
213 -bool fm_has_errata_a010022(void);
214 +#ifdef FM_ERRATUM_A050385
215 +bool fm_has_errata_a050385(void);
216 #endif
217
218 /**************************************************************************//**
219 --- a/drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_fm.c
220 +++ b/drivers/net/ethernet/freescale/sdk_fman/src/wrapper/lnxwrp_fm.c
221 @@ -156,8 +156,8 @@ static int fsl_fm_pfc_quanta[] = {
222
223 static t_LnxWrpFm lnxWrpFm;
224
225 -#ifdef FM_ERRATUM_A010022
226 -static bool fm_has_err_a010022;
227 +#ifdef FM_ERRATUM_A050385
228 +static bool fm_has_err_a050385;
229 #endif
230
231 int fm_get_max_frm()
232 @@ -172,12 +172,12 @@ int fm_get_rx_extra_headroom()
233 }
234 EXPORT_SYMBOL(fm_get_rx_extra_headroom);
235
236 -#ifdef FM_ERRATUM_A010022
237 -bool fm_has_errata_a010022(void)
238 +#ifdef FM_ERRATUM_A050385
239 +bool fm_has_errata_a050385(void)
240 {
241 - return fm_has_err_a010022;
242 + return fm_has_err_a050385;
243 }
244 -EXPORT_SYMBOL(fm_has_errata_a010022);
245 +EXPORT_SYMBOL(fm_has_errata_a050385);
246 #endif
247
248 static int __init fm_set_max_frm(char *str)
249 @@ -762,8 +762,8 @@ static t_LnxWrpFmDev * ReadFmDevTreeNode
250 p_LnxWrpFmDev->defPcd = e_NO_PCD;
251 }
252
253 -#ifdef FM_ERRATUM_A010022
254 - fm_has_err_a010022 = of_property_read_bool(fm_node, "fsl,erratum-a010022");
255 +#ifdef FM_ERRATUM_A050385
256 + fm_has_err_a050385 = of_property_read_bool(fm_node, "fsl,erratum-a050385");
257 #endif
258
259 of_node_put(fm_node);