]> git.pld-linux.org Git - packages/kernel.git/blob - gcc13.patch
5.4.243
[packages/kernel.git] / gcc13.patch
1 From e6a71160cc145e18ab45195abf89884112e02dfb Mon Sep 17 00:00:00 2001
2 From: Kees Cook <keescook@chromium.org>
3 Date: Wed, 18 Jan 2023 12:21:35 -0800
4 Subject: gcc-plugins: Reorganize gimple includes for GCC 13
5
6 The gimple-iterator.h header must be included before gimple-fold.h
7 starting with GCC 13. Reorganize gimple headers to work for all GCC
8 versions.
9
10 Reported-by: Palmer Dabbelt <palmer@rivosinc.com>
11 Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
12 Link: https://lore.kernel.org/all/20230113173033.4380-1-palmer@rivosinc.com/
13 Cc: linux-hardening@vger.kernel.org
14 Signed-off-by: Kees Cook <keescook@chromium.org>
15 ---
16  scripts/gcc-plugins/gcc-common.h | 4 ++--
17  1 file changed, 2 insertions(+), 2 deletions(-)
18
19 diff --git a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h
20 index 9a1895747b153..84c730da36dd3 100644
21 --- a/scripts/gcc-plugins/gcc-common.h
22 +++ b/scripts/gcc-plugins/gcc-common.h
23 @@ -71,7 +71,9 @@
24  #include "varasm.h"
25  #include "stor-layout.h"
26  #include "internal-fn.h"
27 +#include "gimple.h"
28  #include "gimple-expr.h"
29 +#include "gimple-iterator.h"
30  #include "gimple-fold.h"
31  #include "context.h"
32  #include "tree-ssa-alias.h"
33 @@ -124,13 +126,10 @@
34  #include "gimplify.h"
35  #endif
36  
37 -#include "gimple.h"
38 -
39  #if BUILDING_GCC_VERSION >= 4009
40  #include "tree-ssa-operands.h"
41  #include "tree-phinodes.h"
42  #include "tree-cfg.h"
43 -#include "gimple-iterator.h"
44  #include "gimple-ssa.h"
45  #include "ssa-iterators.h"
46  #endif
47 -- 
48 cgit 
49
50 From f07788079f515ca4a681c5f595bdad19cfbd7b1d Mon Sep 17 00:00:00 2001
51 From: Arnd Bergmann <arnd@arndb.de>
52 Date: Sat, 3 Dec 2022 11:54:25 +0100
53 Subject: ata: ahci: fix enum constants for gcc-13
54
55 gcc-13 slightly changes the type of constant expressions that are defined
56 in an enum, which triggers a compile time sanity check in libata:
57
58 linux/drivers/ata/libahci.c: In function 'ahci_led_store':
59 linux/include/linux/compiler_types.h:357:45: error: call to '__compiletime_assert_302' declared with attribute error: BUILD_BUG_ON failed: sizeof(_s) > sizeof(long)
60 357 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
61
62 The new behavior is that sizeof() returns the same value for the
63 constant as it does for the enum type, which is generally more sensible
64 and consistent.
65
66 The problem in libata is that it contains a single enum definition for
67 lots of unrelated constants, some of which are large positive (unsigned)
68 integers like 0xffffffff, while others like (1<<31) are interpreted as
69 negative integers, and this forces the enum type to become 64 bit wide
70 even though most constants would still fit into a signed 32-bit 'int'.
71
72 Fix this by changing the entire enum definition to use BIT(x) in place
73 of (1<<x), which results in all values being seen as 'unsigned' and
74 fitting into an unsigned 32-bit type.
75
76 Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107917
77 Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107405
78 Reported-by: Luis Machado <luis.machado@arm.com>
79 Cc: linux-ide@vger.kernel.org
80 Cc: Damien Le Moal <damien.lemoal@opensource.wdc.com>
81 Cc: stable@vger.kernel.org
82 Cc: Randy Dunlap <rdunlap@infradead.org>
83 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
84 Tested-by: Luis Machado <luis.machado@arm.com>
85 Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
86 ---
87  drivers/ata/ahci.h | 245 +++++++++++++++++++++++++++--------------------------
88  1 file changed, 123 insertions(+), 122 deletions(-)
89
90 (limited to 'drivers/ata')
91
92 diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
93 index da7ee8bec165a..4cec725cf30a2 100644
94 --- a/drivers/ata/ahci.h
95 +++ b/drivers/ata/ahci.h
96 @@ -24,6 +24,7 @@
97  #include <linux/libata.h>
98  #include <linux/phy/phy.h>
99  #include <linux/regulator/consumer.h>
100 +#include <linux/bits.h>
101  
102  /* Enclosure Management Control */
103  #define EM_CTRL_MSG_TYPE              0x000f0000
104 @@ -53,12 +54,12 @@ enum {
105         AHCI_PORT_PRIV_FBS_DMA_SZ       = AHCI_CMD_SLOT_SZ +
106                                           AHCI_CMD_TBL_AR_SZ +
107                                           (AHCI_RX_FIS_SZ * 16),
108 -       AHCI_IRQ_ON_SG          = (1 << 31),
109 -       AHCI_CMD_ATAPI          = (1 << 5),
110 -       AHCI_CMD_WRITE          = (1 << 6),
111 -       AHCI_CMD_PREFETCH       = (1 << 7),
112 -       AHCI_CMD_RESET          = (1 << 8),
113 -       AHCI_CMD_CLR_BUSY       = (1 << 10),
114 +       AHCI_IRQ_ON_SG          = BIT(31),
115 +       AHCI_CMD_ATAPI          = BIT(5),
116 +       AHCI_CMD_WRITE          = BIT(6),
117 +       AHCI_CMD_PREFETCH       = BIT(7),
118 +       AHCI_CMD_RESET          = BIT(8),
119 +       AHCI_CMD_CLR_BUSY       = BIT(10),
120  
121         RX_FIS_PIO_SETUP        = 0x20, /* offset of PIO Setup FIS data */
122         RX_FIS_D2H_REG          = 0x40, /* offset of D2H Register FIS data */
123 @@ -76,37 +77,37 @@ enum {
124         HOST_CAP2               = 0x24, /* host capabilities, extended */
125  
126         /* HOST_CTL bits */
127 -       HOST_RESET              = (1 << 0),  /* reset controller; self-clear */
128 -       HOST_IRQ_EN             = (1 << 1),  /* global IRQ enable */
129 -       HOST_MRSM               = (1 << 2),  /* MSI Revert to Single Message */
130 -       HOST_AHCI_EN            = (1 << 31), /* AHCI enabled */
131 +       HOST_RESET              = BIT(0),  /* reset controller; self-clear */
132 +       HOST_IRQ_EN             = BIT(1),  /* global IRQ enable */
133 +       HOST_MRSM               = BIT(2),  /* MSI Revert to Single Message */
134 +       HOST_AHCI_EN            = BIT(31), /* AHCI enabled */
135  
136         /* HOST_CAP bits */
137 -       HOST_CAP_SXS            = (1 << 5),  /* Supports External SATA */
138 -       HOST_CAP_EMS            = (1 << 6),  /* Enclosure Management support */
139 -       HOST_CAP_CCC            = (1 << 7),  /* Command Completion Coalescing */
140 -       HOST_CAP_PART           = (1 << 13), /* Partial state capable */
141 -       HOST_CAP_SSC            = (1 << 14), /* Slumber state capable */
142 -       HOST_CAP_PIO_MULTI      = (1 << 15), /* PIO multiple DRQ support */
143 -       HOST_CAP_FBS            = (1 << 16), /* FIS-based switching support */
144 -       HOST_CAP_PMP            = (1 << 17), /* Port Multiplier support */
145 -       HOST_CAP_ONLY           = (1 << 18), /* Supports AHCI mode only */
146 -       HOST_CAP_CLO            = (1 << 24), /* Command List Override support */
147 -       HOST_CAP_LED            = (1 << 25), /* Supports activity LED */
148 -       HOST_CAP_ALPM           = (1 << 26), /* Aggressive Link PM support */
149 -       HOST_CAP_SSS            = (1 << 27), /* Staggered Spin-up */
150 -       HOST_CAP_MPS            = (1 << 28), /* Mechanical presence switch */
151 -       HOST_CAP_SNTF           = (1 << 29), /* SNotification register */
152 -       HOST_CAP_NCQ            = (1 << 30), /* Native Command Queueing */
153 -       HOST_CAP_64             = (1 << 31), /* PCI DAC (64-bit DMA) support */
154 +       HOST_CAP_SXS            = BIT(5),  /* Supports External SATA */
155 +       HOST_CAP_EMS            = BIT(6),  /* Enclosure Management support */
156 +       HOST_CAP_CCC            = BIT(7),  /* Command Completion Coalescing */
157 +       HOST_CAP_PART           = BIT(13), /* Partial state capable */
158 +       HOST_CAP_SSC            = BIT(14), /* Slumber state capable */
159 +       HOST_CAP_PIO_MULTI      = BIT(15), /* PIO multiple DRQ support */
160 +       HOST_CAP_FBS            = BIT(16), /* FIS-based switching support */
161 +       HOST_CAP_PMP            = BIT(17), /* Port Multiplier support */
162 +       HOST_CAP_ONLY           = BIT(18), /* Supports AHCI mode only */
163 +       HOST_CAP_CLO            = BIT(24), /* Command List Override support */
164 +       HOST_CAP_LED            = BIT(25), /* Supports activity LED */
165 +       HOST_CAP_ALPM           = BIT(26), /* Aggressive Link PM support */
166 +       HOST_CAP_SSS            = BIT(27), /* Staggered Spin-up */
167 +       HOST_CAP_MPS            = BIT(28), /* Mechanical presence switch */
168 +       HOST_CAP_SNTF           = BIT(29), /* SNotification register */
169 +       HOST_CAP_NCQ            = BIT(30), /* Native Command Queueing */
170 +       HOST_CAP_64             = BIT(31), /* PCI DAC (64-bit DMA) support */
171  
172         /* HOST_CAP2 bits */
173 -       HOST_CAP2_BOH           = (1 << 0),  /* BIOS/OS handoff supported */
174 -       HOST_CAP2_NVMHCI        = (1 << 1),  /* NVMHCI supported */
175 -       HOST_CAP2_APST          = (1 << 2),  /* Automatic partial to slumber */
176 -       HOST_CAP2_SDS           = (1 << 3),  /* Support device sleep */
177 -       HOST_CAP2_SADM          = (1 << 4),  /* Support aggressive DevSlp */
178 -       HOST_CAP2_DESO          = (1 << 5),  /* DevSlp from slumber only */
179 +       HOST_CAP2_BOH           = BIT(0),  /* BIOS/OS handoff supported */
180 +       HOST_CAP2_NVMHCI        = BIT(1),  /* NVMHCI supported */
181 +       HOST_CAP2_APST          = BIT(2),  /* Automatic partial to slumber */
182 +       HOST_CAP2_SDS           = BIT(3),  /* Support device sleep */
183 +       HOST_CAP2_SADM          = BIT(4),  /* Support aggressive DevSlp */
184 +       HOST_CAP2_DESO          = BIT(5),  /* DevSlp from slumber only */
185  
186         /* registers for each SATA port */
187         PORT_LST_ADDR           = 0x00, /* command list DMA addr */
188 @@ -128,24 +129,24 @@ enum {
189         PORT_DEVSLP             = 0x44, /* device sleep */
190  
191         /* PORT_IRQ_{STAT,MASK} bits */
192 -       PORT_IRQ_COLD_PRES      = (1 << 31), /* cold presence detect */
193 -       PORT_IRQ_TF_ERR         = (1 << 30), /* task file error */
194 -       PORT_IRQ_HBUS_ERR       = (1 << 29), /* host bus fatal error */
195 -       PORT_IRQ_HBUS_DATA_ERR  = (1 << 28), /* host bus data error */
196 -       PORT_IRQ_IF_ERR         = (1 << 27), /* interface fatal error */
197 -       PORT_IRQ_IF_NONFATAL    = (1 << 26), /* interface non-fatal error */
198 -       PORT_IRQ_OVERFLOW       = (1 << 24), /* xfer exhausted available S/G */
199 -       PORT_IRQ_BAD_PMP        = (1 << 23), /* incorrect port multiplier */
200 -
201 -       PORT_IRQ_PHYRDY         = (1 << 22), /* PhyRdy changed */
202 -       PORT_IRQ_DEV_ILCK       = (1 << 7), /* device interlock */
203 -       PORT_IRQ_CONNECT        = (1 << 6), /* port connect change status */
204 -       PORT_IRQ_SG_DONE        = (1 << 5), /* descriptor processed */
205 -       PORT_IRQ_UNK_FIS        = (1 << 4), /* unknown FIS rx'd */
206 -       PORT_IRQ_SDB_FIS        = (1 << 3), /* Set Device Bits FIS rx'd */
207 -       PORT_IRQ_DMAS_FIS       = (1 << 2), /* DMA Setup FIS rx'd */
208 -       PORT_IRQ_PIOS_FIS       = (1 << 1), /* PIO Setup FIS rx'd */
209 -       PORT_IRQ_D2H_REG_FIS    = (1 << 0), /* D2H Register FIS rx'd */
210 +       PORT_IRQ_COLD_PRES      = BIT(31), /* cold presence detect */
211 +       PORT_IRQ_TF_ERR         = BIT(30), /* task file error */
212 +       PORT_IRQ_HBUS_ERR       = BIT(29), /* host bus fatal error */
213 +       PORT_IRQ_HBUS_DATA_ERR  = BIT(28), /* host bus data error */
214 +       PORT_IRQ_IF_ERR         = BIT(27), /* interface fatal error */
215 +       PORT_IRQ_IF_NONFATAL    = BIT(26), /* interface non-fatal error */
216 +       PORT_IRQ_OVERFLOW       = BIT(24), /* xfer exhausted available S/G */
217 +       PORT_IRQ_BAD_PMP        = BIT(23), /* incorrect port multiplier */
218 +
219 +       PORT_IRQ_PHYRDY         = BIT(22), /* PhyRdy changed */
220 +       PORT_IRQ_DEV_ILCK       = BIT(7),  /* device interlock */
221 +       PORT_IRQ_CONNECT        = BIT(6),  /* port connect change status */
222 +       PORT_IRQ_SG_DONE        = BIT(5),  /* descriptor processed */
223 +       PORT_IRQ_UNK_FIS        = BIT(4),  /* unknown FIS rx'd */
224 +       PORT_IRQ_SDB_FIS        = BIT(3),  /* Set Device Bits FIS rx'd */
225 +       PORT_IRQ_DMAS_FIS       = BIT(2),  /* DMA Setup FIS rx'd */
226 +       PORT_IRQ_PIOS_FIS       = BIT(1),  /* PIO Setup FIS rx'd */
227 +       PORT_IRQ_D2H_REG_FIS    = BIT(0),  /* D2H Register FIS rx'd */
228  
229         PORT_IRQ_FREEZE         = PORT_IRQ_HBUS_ERR |
230                                   PORT_IRQ_IF_ERR |
231 @@ -161,25 +162,25 @@ enum {
232                                   PORT_IRQ_PIOS_FIS | PORT_IRQ_D2H_REG_FIS,
233  
234         /* PORT_CMD bits */
235 -       PORT_CMD_ASP            = (1 << 27), /* Aggressive Slumber/Partial */
236 -       PORT_CMD_ALPE           = (1 << 26), /* Aggressive Link PM enable */
237 -       PORT_CMD_ATAPI          = (1 << 24), /* Device is ATAPI */
238 -       PORT_CMD_FBSCP          = (1 << 22), /* FBS Capable Port */
239 -       PORT_CMD_ESP            = (1 << 21), /* External Sata Port */
240 -       PORT_CMD_HPCP           = (1 << 18), /* HotPlug Capable Port */
241 -       PORT_CMD_PMP            = (1 << 17), /* PMP attached */
242 -       PORT_CMD_LIST_ON        = (1 << 15), /* cmd list DMA engine running */
243 -       PORT_CMD_FIS_ON         = (1 << 14), /* FIS DMA engine running */
244 -       PORT_CMD_FIS_RX         = (1 << 4), /* Enable FIS receive DMA engine */
245 -       PORT_CMD_CLO            = (1 << 3), /* Command list override */
246 -       PORT_CMD_POWER_ON       = (1 << 2), /* Power up device */
247 -       PORT_CMD_SPIN_UP        = (1 << 1), /* Spin up device */
248 -       PORT_CMD_START          = (1 << 0), /* Enable port DMA engine */
249 -
250 -       PORT_CMD_ICC_MASK       = (0xf << 28), /* i/f ICC state mask */
251 -       PORT_CMD_ICC_ACTIVE     = (0x1 << 28), /* Put i/f in active state */
252 -       PORT_CMD_ICC_PARTIAL    = (0x2 << 28), /* Put i/f in partial state */
253 -       PORT_CMD_ICC_SLUMBER    = (0x6 << 28), /* Put i/f in slumber state */
254 +       PORT_CMD_ASP            = BIT(27), /* Aggressive Slumber/Partial */
255 +       PORT_CMD_ALPE           = BIT(26), /* Aggressive Link PM enable */
256 +       PORT_CMD_ATAPI          = BIT(24), /* Device is ATAPI */
257 +       PORT_CMD_FBSCP          = BIT(22), /* FBS Capable Port */
258 +       PORT_CMD_ESP            = BIT(21), /* External Sata Port */
259 +       PORT_CMD_HPCP           = BIT(18), /* HotPlug Capable Port */
260 +       PORT_CMD_PMP            = BIT(17), /* PMP attached */
261 +       PORT_CMD_LIST_ON        = BIT(15), /* cmd list DMA engine running */
262 +       PORT_CMD_FIS_ON         = BIT(14), /* FIS DMA engine running */
263 +       PORT_CMD_FIS_RX         = BIT(4),  /* Enable FIS receive DMA engine */
264 +       PORT_CMD_CLO            = BIT(3),  /* Command list override */
265 +       PORT_CMD_POWER_ON       = BIT(2),  /* Power up device */
266 +       PORT_CMD_SPIN_UP        = BIT(1),  /* Spin up device */
267 +       PORT_CMD_START          = BIT(0),  /* Enable port DMA engine */
268 +
269 +       PORT_CMD_ICC_MASK       = (0xfu << 28), /* i/f ICC state mask */
270 +       PORT_CMD_ICC_ACTIVE     = (0x1u << 28), /* Put i/f in active state */
271 +       PORT_CMD_ICC_PARTIAL    = (0x2u << 28), /* Put i/f in partial state */
272 +       PORT_CMD_ICC_SLUMBER    = (0x6u << 28), /* Put i/f in slumber state */
273  
274         /* PORT_FBS bits */
275         PORT_FBS_DWE_OFFSET     = 16, /* FBS device with error offset */
276 @@ -192,9 +193,9 @@ enum {
277         PORT_FBS_ADO_OFFSET     = 12, /* FBS active dev optimization offset */
278         PORT_FBS_DEV_OFFSET     = 8,  /* FBS device to issue offset */
279         PORT_FBS_DEV_MASK       = (0xf << PORT_FBS_DEV_OFFSET),  /* FBS.DEV */
280 -       PORT_FBS_SDE            = (1 << 2), /* FBS single device error */
281 -       PORT_FBS_DEC            = (1 << 1), /* FBS device error clear */
282 -       PORT_FBS_EN             = (1 << 0), /* Enable FBS */
283 +       PORT_FBS_SDE            = BIT(2), /* FBS single device error */
284 +       PORT_FBS_DEC            = BIT(1), /* FBS device error clear */
285 +       PORT_FBS_EN             = BIT(0), /* Enable FBS */
286  
287         /* PORT_DEVSLP bits */
288         PORT_DEVSLP_DM_OFFSET   = 25,             /* DITO multiplier offset */
289 @@ -202,52 +203,52 @@ enum {
290         PORT_DEVSLP_DITO_OFFSET = 15,             /* DITO offset */
291         PORT_DEVSLP_MDAT_OFFSET = 10,             /* Minimum assertion time */
292         PORT_DEVSLP_DETO_OFFSET = 2,              /* DevSlp exit timeout */
293 -       PORT_DEVSLP_DSP         = (1 << 1),       /* DevSlp present */
294 -       PORT_DEVSLP_ADSE        = (1 << 0),       /* Aggressive DevSlp enable */
295 +       PORT_DEVSLP_DSP         = BIT(1),         /* DevSlp present */
296 +       PORT_DEVSLP_ADSE        = BIT(0),         /* Aggressive DevSlp enable */
297  
298         /* hpriv->flags bits */
299  
300  #define AHCI_HFLAGS(flags)             .private_data   = (void *)(flags)
301  
302 -       AHCI_HFLAG_NO_NCQ               = (1 << 0),
303 -       AHCI_HFLAG_IGN_IRQ_IF_ERR       = (1 << 1), /* ignore IRQ_IF_ERR */
304 -       AHCI_HFLAG_IGN_SERR_INTERNAL    = (1 << 2), /* ignore SERR_INTERNAL */
305 -       AHCI_HFLAG_32BIT_ONLY           = (1 << 3), /* force 32bit */
306 -       AHCI_HFLAG_MV_PATA              = (1 << 4), /* PATA port */
307 -       AHCI_HFLAG_NO_MSI               = (1 << 5), /* no PCI MSI */
308 -       AHCI_HFLAG_NO_PMP               = (1 << 6), /* no PMP */
309 -       AHCI_HFLAG_SECT255              = (1 << 8), /* max 255 sectors */
310 -       AHCI_HFLAG_YES_NCQ              = (1 << 9), /* force NCQ cap on */
311 -       AHCI_HFLAG_NO_SUSPEND           = (1 << 10), /* don't suspend */
312 -       AHCI_HFLAG_SRST_TOUT_IS_OFFLINE = (1 << 11), /* treat SRST timeout as
313 -                                                       link offline */
314 -       AHCI_HFLAG_NO_SNTF              = (1 << 12), /* no sntf */
315 -       AHCI_HFLAG_NO_FPDMA_AA          = (1 << 13), /* no FPDMA AA */
316 -       AHCI_HFLAG_YES_FBS              = (1 << 14), /* force FBS cap on */
317 -       AHCI_HFLAG_DELAY_ENGINE         = (1 << 15), /* do not start engine on
318 -                                                       port start (wait until
319 -                                                       error-handling stage) */
320 -       AHCI_HFLAG_NO_DEVSLP            = (1 << 17), /* no device sleep */
321 -       AHCI_HFLAG_NO_FBS               = (1 << 18), /* no FBS */
322 +       AHCI_HFLAG_NO_NCQ               = BIT(0),
323 +       AHCI_HFLAG_IGN_IRQ_IF_ERR       = BIT(1), /* ignore IRQ_IF_ERR */
324 +       AHCI_HFLAG_IGN_SERR_INTERNAL    = BIT(2), /* ignore SERR_INTERNAL */
325 +       AHCI_HFLAG_32BIT_ONLY           = BIT(3), /* force 32bit */
326 +       AHCI_HFLAG_MV_PATA              = BIT(4), /* PATA port */
327 +       AHCI_HFLAG_NO_MSI               = BIT(5), /* no PCI MSI */
328 +       AHCI_HFLAG_NO_PMP               = BIT(6), /* no PMP */
329 +       AHCI_HFLAG_SECT255              = BIT(8), /* max 255 sectors */
330 +       AHCI_HFLAG_YES_NCQ              = BIT(9), /* force NCQ cap on */
331 +       AHCI_HFLAG_NO_SUSPEND           = BIT(10), /* don't suspend */
332 +       AHCI_HFLAG_SRST_TOUT_IS_OFFLINE = BIT(11), /* treat SRST timeout as
333 +                                                     link offline */
334 +       AHCI_HFLAG_NO_SNTF              = BIT(12), /* no sntf */
335 +       AHCI_HFLAG_NO_FPDMA_AA          = BIT(13), /* no FPDMA AA */
336 +       AHCI_HFLAG_YES_FBS              = BIT(14), /* force FBS cap on */
337 +       AHCI_HFLAG_DELAY_ENGINE         = BIT(15), /* do not start engine on
338 +                                                     port start (wait until
339 +                                                     error-handling stage) */
340 +       AHCI_HFLAG_NO_DEVSLP            = BIT(17), /* no device sleep */
341 +       AHCI_HFLAG_NO_FBS               = BIT(18), /* no FBS */
342  
343  #ifdef CONFIG_PCI_MSI
344 -       AHCI_HFLAG_MULTI_MSI            = (1 << 20), /* per-port MSI(-X) */
345 +       AHCI_HFLAG_MULTI_MSI            = BIT(20), /* per-port MSI(-X) */
346  #else
347         /* compile out MSI infrastructure */
348         AHCI_HFLAG_MULTI_MSI            = 0,
349  #endif
350 -       AHCI_HFLAG_WAKE_BEFORE_STOP     = (1 << 22), /* wake before DMA stop */
351 -       AHCI_HFLAG_YES_ALPM             = (1 << 23), /* force ALPM cap on */
352 -       AHCI_HFLAG_NO_WRITE_TO_RO       = (1 << 24), /* don't write to read
353 -                                                       only registers */
354 -       AHCI_HFLAG_IS_MOBILE            = (1 << 25), /* mobile chipset, use
355 -                                                       SATA_MOBILE_LPM_POLICY
356 -                                                       as default lpm_policy */
357 -       AHCI_HFLAG_SUSPEND_PHYS         = (1 << 26), /* handle PHYs during
358 -                                                       suspend/resume */
359 -       AHCI_HFLAG_IGN_NOTSUPP_POWER_ON = (1 << 27), /* ignore -EOPNOTSUPP
360 -                                                       from phy_power_on() */
361 -       AHCI_HFLAG_NO_SXS               = (1 << 28), /* SXS not supported */
362 +       AHCI_HFLAG_WAKE_BEFORE_STOP     = BIT(22), /* wake before DMA stop */
363 +       AHCI_HFLAG_YES_ALPM             = BIT(23), /* force ALPM cap on */
364 +       AHCI_HFLAG_NO_WRITE_TO_RO       = BIT(24), /* don't write to read
365 +                                                     only registers */
366 +       AHCI_HFLAG_IS_MOBILE            = BIT(25), /* mobile chipset, use
367 +                                                     SATA_MOBILE_LPM_POLICY
368 +                                                     as default lpm_policy */
369 +       AHCI_HFLAG_SUSPEND_PHYS         = BIT(26), /* handle PHYs during
370 +                                                     suspend/resume */
371 +       AHCI_HFLAG_IGN_NOTSUPP_POWER_ON = BIT(27), /* ignore -EOPNOTSUPP
372 +                                                     from phy_power_on() */
373 +       AHCI_HFLAG_NO_SXS               = BIT(28), /* SXS not supported */
374  
375         /* ap->flags bits */
376  
377 @@ -261,22 +262,22 @@ enum {
378         EM_MAX_RETRY                    = 5,
379  
380         /* em_ctl bits */
381 -       EM_CTL_RST              = (1 << 9), /* Reset */
382 -       EM_CTL_TM               = (1 << 8), /* Transmit Message */
383 -       EM_CTL_MR               = (1 << 0), /* Message Received */
384 -       EM_CTL_ALHD             = (1 << 26), /* Activity LED */
385 -       EM_CTL_XMT              = (1 << 25), /* Transmit Only */
386 -       EM_CTL_SMB              = (1 << 24), /* Single Message Buffer */
387 -       EM_CTL_SGPIO            = (1 << 19), /* SGPIO messages supported */
388 -       EM_CTL_SES              = (1 << 18), /* SES-2 messages supported */
389 -       EM_CTL_SAFTE            = (1 << 17), /* SAF-TE messages supported */
390 -       EM_CTL_LED              = (1 << 16), /* LED messages supported */
391 +       EM_CTL_RST              = BIT(9), /* Reset */
392 +       EM_CTL_TM               = BIT(8), /* Transmit Message */
393 +       EM_CTL_MR               = BIT(0), /* Message Received */
394 +       EM_CTL_ALHD             = BIT(26), /* Activity LED */
395 +       EM_CTL_XMT              = BIT(25), /* Transmit Only */
396 +       EM_CTL_SMB              = BIT(24), /* Single Message Buffer */
397 +       EM_CTL_SGPIO            = BIT(19), /* SGPIO messages supported */
398 +       EM_CTL_SES              = BIT(18), /* SES-2 messages supported */
399 +       EM_CTL_SAFTE            = BIT(17), /* SAF-TE messages supported */
400 +       EM_CTL_LED              = BIT(16), /* LED messages supported */
401  
402         /* em message type */
403 -       EM_MSG_TYPE_LED         = (1 << 0), /* LED */
404 -       EM_MSG_TYPE_SAFTE       = (1 << 1), /* SAF-TE */
405 -       EM_MSG_TYPE_SES2        = (1 << 2), /* SES-2 */
406 -       EM_MSG_TYPE_SGPIO       = (1 << 3), /* SGPIO */
407 +       EM_MSG_TYPE_LED         = BIT(0), /* LED */
408 +       EM_MSG_TYPE_SAFTE       = BIT(1), /* SAF-TE */
409 +       EM_MSG_TYPE_SES2        = BIT(2), /* SES-2 */
410 +       EM_MSG_TYPE_SGPIO       = BIT(3), /* SGPIO */
411  };
412  
413  struct ahci_cmd_hdr {
414 -- 
415 cgit 
416
417 From 5a6b64adc18d9adfb497a529ff004d59b6df151f Mon Sep 17 00:00:00 2001
418 From: Sam James <sam@gentoo.org>
419 Date: Wed, 1 Feb 2023 23:00:09 +0000
420 Subject: gcc-plugins: drop -std=gnu++11 to fix GCC 13 build
421
422 The latest GCC 13 snapshot (13.0.1 20230129) gives the following:
423 ```
424 cc1: error: cannot load plugin ./scripts/gcc-plugins/randomize_layout_plugin.so
425  :./scripts/gcc-plugins/randomize_layout_plugin.so: undefined symbol: tree_code_type
426 ```
427
428 This ends up being because of https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=b0241ce6e37031
429 upstream in GCC which changes the visibility of some types used by the kernel's
430 plugin infrastructure like tree_code_type.
431
432 After discussion with the GCC folks, we found that the kernel needs to be building
433 plugins with the same flags used to build GCC - and GCC defaults to gnu++17
434 right now. The minimum GCC version needed to build the kernel is GCC 5.1
435 and GCC 5.1 already defaults to gnu++14 anyway, so just drop the flag, as
436 all GCCs that could be used to build GCC already default to an acceptable
437 version which was >= the version we forced via flags until now.
438
439 Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108634
440 Signed-off-by: Sam James <sam@gentoo.org>
441 Signed-off-by: Kees Cook <keescook@chromium.org>
442 Link: https://lore.kernel.org/r/20230201230009.2252783-1-sam@gentoo.org
443 ---
444  scripts/gcc-plugins/Makefile | 2 +-
445  1 file changed, 1 insertion(+), 1 deletion(-)
446
447 diff --git a/scripts/gcc-plugins/Makefile b/scripts/gcc-plugins/Makefile
448 index b34d11e226366..320afd3cf8e82 100644
449 --- a/scripts/gcc-plugins/Makefile
450 +++ b/scripts/gcc-plugins/Makefile
451 @@ -7,7 +7,7 @@
452    export HOST_EXTRACFLAGS
453  else
454    HOSTLIBS := hostcxxlibs
455 -  HOST_EXTRACXXFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti
456 +  HOST_EXTRACXXFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -fno-rtti
457    HOST_EXTRACXXFLAGS += -fno-exceptions -fasynchronous-unwind-tables -ggdb
458    HOST_EXTRACXXFLAGS += -Wno-narrowing -Wno-unused-variable
459    HOST_EXTRACXXFLAGS += -Wno-format-diag
460 -- 
461 cgit 
462
463 From ff1cc97b1f4c10db224f276d9615b22835b8c424 Mon Sep 17 00:00:00 2001
464 From: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
465 Date: Tue, 13 Dec 2022 13:08:26 +0100
466 Subject: block/blk-iocost (gcc13): keep large values in a new enum
467
468 Since gcc13, each member of an enum has the same type as the enum [1]. And
469 that is inherited from its members. Provided:
470   VTIME_PER_SEC_SHIFT     = 37,
471   VTIME_PER_SEC           = 1LLU << VTIME_PER_SEC_SHIFT,
472   ...
473   AUTOP_CYCLE_NSEC        = 10LLU * NSEC_PER_SEC,
474 the named type is unsigned long.
475
476 This generates warnings with gcc-13:
477   block/blk-iocost.c: In function 'ioc_weight_prfill':
478   block/blk-iocost.c:3037:37: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'long unsigned int'
479
480   block/blk-iocost.c: In function 'ioc_weight_show':
481   block/blk-iocost.c:3047:34: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int'
482
483 So split the anonymous enum with large values to a separate enum, so
484 that they don't affect other members.
485
486 [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36113
487
488 Cc: Martin Liska <mliska@suse.cz>
489 Cc: Tejun Heo <tj@kernel.org>
490 Cc: Josef Bacik <josef@toxicpanda.com>
491 Cc: Jens Axboe <axboe@kernel.dk>
492 Cc: cgroups@vger.kernel.org
493 Cc: linux-block@vger.kernel.org
494 Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
495 Link: https://lore.kernel.org/r/20221213120826.17446-1-jirislaby@kernel.org
496 Signed-off-by: Jens Axboe <axboe@kernel.dk>
497 ---
498  block/blk-iocost.c | 2 ++
499  1 file changed, 2 insertions(+)
500
501 (limited to 'block/blk-iocost.c')
502
503 diff --git a/block/blk-iocost.c b/block/blk-iocost.c
504 index d1bdc12deaa70..549ddc9e0c6f4 100644
505 --- a/block/blk-iocost.c
506 +++ b/block/blk-iocost.c
507 @@ -232,7 +232,9 @@ enum {
508  
509         /* 1/64k is granular enough and can easily be handled w/ u32 */
510         HWEIGHT_WHOLE           = 1 << 16,
511 +};
512  
513 +enum {
514         /*
515          * As vtime is used to calculate the cost of each IO, it needs to
516          * be fairly high precision.  For example, it should be able to
517 -- 
518 cgit 
519
520 From 5f2779dfa7b8cc7dfd4a1b6586d86e0d193266f3 Mon Sep 17 00:00:00 2001
521 From: Arnd Bergmann <arnd@arndb.de>
522 Date: Wed, 18 Jan 2023 09:07:01 +0100
523 Subject: blk-iocost: avoid 64-bit division in ioc_timer_fn
524
525 The behavior of 'enum' types has changed in gcc-13, so now the
526 UNBUSY_THR_PCT constant is interpreted as a 64-bit number because
527 it is defined as part of the same enum definition as some other
528 constants that do not fit within a 32-bit integer. This in turn
529 leads to some inefficient code on 32-bit architectures as well
530 as a link error:
531
532 arm-linux-gnueabi/bin/arm-linux-gnueabi-ld: block/blk-iocost.o: in function `ioc_timer_fn':
533 blk-iocost.c:(.text+0x68e8): undefined reference to `__aeabi_uldivmod'
534 arm-linux-gnueabi-ld: blk-iocost.c:(.text+0x6908): undefined reference to `__aeabi_uldivmod'
535
536 Split the enum definition to keep the 64-bit timing constants in
537 a separate enum type from those constants that can clearly fit
538 within a smaller type.
539
540 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
541 Acked-by: Tejun Heo <tj@kernel.org>
542 Link: https://lore.kernel.org/r/20230118080706.3303186-1-arnd@kernel.org
543 Signed-off-by: Jens Axboe <axboe@kernel.dk>
544 ---
545  block/blk-iocost.c | 8 +++++---
546  1 file changed, 5 insertions(+), 3 deletions(-)
547
548 (limited to 'block')
549
550 diff --git a/block/blk-iocost.c b/block/blk-iocost.c
551 index 6955605629e4f..b691b6bb498f3 100644
552 --- a/block/blk-iocost.c
553 +++ b/block/blk-iocost.c
554 @@ -258,6 +258,11 @@ enum {
555         VRATE_MIN               = VTIME_PER_USEC * VRATE_MIN_PPM / MILLION,
556         VRATE_CLAMP_ADJ_PCT     = 4,
557  
558 +       /* switch iff the conditions are met for longer than this */
559 +       AUTOP_CYCLE_NSEC        = 10LLU * NSEC_PER_SEC,
560 +};
561 +
562 +enum {
563         /* if IOs end up waiting for requests, issue less */
564         RQ_WAIT_BUSY_PCT        = 5,
565  
566 @@ -296,9 +301,6 @@ enum {
567         SURPLUS_SCALE_ABS       = HWEIGHT_WHOLE / 50,   /* + 2% */
568         SURPLUS_MIN_ADJ_DELTA   = HWEIGHT_WHOLE / 33,   /* 3% */
569  
570 -       /* switch iff the conditions are met for longer than this */
571 -       AUTOP_CYCLE_NSEC        = 10LLU * NSEC_PER_SEC,
572 -
573         /*
574          * Count IO size in 4k pages.  The 12bit shift helps keeping
575          * size-proportional components of cost calculation in closer
576 -- 
577 cgit 
578
This page took 0.123781 seconds and 3 git commands to generate.