Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Anton Blanchard | 560285c | 2012-11-01 14:55:04 +0000 | [diff] [blame] | 2 | #ifndef _ASM_POWERPC_SETUP_H |
| 3 | #define _ASM_POWERPC_SETUP_H |
| 4 | |
| 5 | #include <uapi/asm/setup.h> |
| 6 | |
| 7 | #ifndef __ASSEMBLY__ |
| 8 | extern void ppc_printk_progress(char *s, unsigned short hex); |
| 9 | |
| 10 | extern unsigned int rtas_data; |
Anton Blanchard | 560285c | 2012-11-01 14:55:04 +0000 | [diff] [blame] | 11 | extern unsigned long long memory_limit; |
Anton Blanchard | 560285c | 2012-11-01 14:55:04 +0000 | [diff] [blame] | 12 | extern void *zalloc_maybe_bootmem(size_t size, gfp_t mask); |
| 13 | |
Anton Blanchard | 560285c | 2012-11-01 14:55:04 +0000 | [diff] [blame] | 14 | struct device_node; |
| 15 | extern void note_scsi_host(struct device_node *, void *); |
| 16 | |
| 17 | /* Used in very early kernel initialization. */ |
| 18 | extern unsigned long reloc_offset(void); |
| 19 | extern unsigned long add_reloc_offset(unsigned long); |
| 20 | extern void reloc_got2(unsigned long); |
| 21 | |
| 22 | #define PTRRELOC(x) ((typeof(x)) add_reloc_offset((unsigned long)(x))) |
| 23 | |
Robert Jennings | b88c476 | 2013-10-28 09:20:51 -0500 | [diff] [blame] | 24 | void check_for_initrd(void); |
Nicholas Piggin | 9bd9be0 | 2018-02-14 01:08:16 +1000 | [diff] [blame] | 25 | void mem_topology_setup(void); |
Anton Blanchard | 1023973 | 2014-09-17 22:15:33 +1000 | [diff] [blame] | 26 | void initmem_init(void); |
David Gibson | ab9dbf7 | 2017-12-04 16:27:25 +1100 | [diff] [blame] | 27 | void setup_panic(void); |
Jason Baron | b71d47c | 2013-11-25 23:23:11 +0000 | [diff] [blame] | 28 | #define ARCH_PANIC_TIMEOUT 180 |
Robert Jennings | b88c476 | 2013-10-28 09:20:51 -0500 | [diff] [blame] | 29 | |
Benjamin Herrenschmidt | d3cbff1 | 2016-07-05 15:03:49 +1000 | [diff] [blame] | 30 | #ifdef CONFIG_PPC_PSERIES |
Nicholas Piggin | 7fa95f9 | 2020-06-11 18:12:03 +1000 | [diff] [blame] | 31 | extern bool pseries_enable_reloc_on_exc(void); |
Benjamin Herrenschmidt | d3cbff1 | 2016-07-05 15:03:49 +1000 | [diff] [blame] | 32 | extern void pseries_disable_reloc_on_exc(void); |
| 33 | extern void pseries_big_endian_exceptions(void); |
Nick Child | e14ff96 | 2021-12-16 17:00:27 -0500 | [diff] [blame] | 34 | void __init pseries_little_endian_exceptions(void); |
Benjamin Herrenschmidt | d3cbff1 | 2016-07-05 15:03:49 +1000 | [diff] [blame] | 35 | #else |
Nicholas Piggin | 7fa95f9 | 2020-06-11 18:12:03 +1000 | [diff] [blame] | 36 | static inline bool pseries_enable_reloc_on_exc(void) { return false; } |
Benjamin Herrenschmidt | d3cbff1 | 2016-07-05 15:03:49 +1000 | [diff] [blame] | 37 | static inline void pseries_disable_reloc_on_exc(void) {} |
| 38 | static inline void pseries_big_endian_exceptions(void) {} |
| 39 | static inline void pseries_little_endian_exceptions(void) {} |
| 40 | #endif /* CONFIG_PPC_PSERIES */ |
| 41 | |
Michael Ellerman | aa8a5e0 | 2018-01-10 03:07:15 +1100 | [diff] [blame] | 42 | void rfi_flush_enable(bool enable); |
| 43 | |
| 44 | /* These are bit flags */ |
| 45 | enum l1d_flush_type { |
| 46 | L1D_FLUSH_NONE = 0x1, |
| 47 | L1D_FLUSH_FALLBACK = 0x2, |
| 48 | L1D_FLUSH_ORI = 0x4, |
| 49 | L1D_FLUSH_MTTRIG = 0x8, |
| 50 | }; |
| 51 | |
Michael Ellerman | abf110f | 2018-03-14 19:40:39 -0300 | [diff] [blame] | 52 | void setup_rfi_flush(enum l1d_flush_type, bool enable); |
Nicholas Piggin | f796437 | 2020-11-17 16:59:12 +1100 | [diff] [blame] | 53 | void setup_entry_flush(bool enable); |
| 54 | void setup_uaccess_flush(bool enable); |
Michael Ellerman | aa8a5e0 | 2018-01-10 03:07:15 +1100 | [diff] [blame] | 55 | void do_rfi_flush_fixups(enum l1d_flush_type types); |
Michael Ellerman | af375ee | 2018-07-28 09:06:35 +1000 | [diff] [blame] | 56 | #ifdef CONFIG_PPC_BARRIER_NOSPEC |
Nick Child | d276960 | 2021-12-16 17:00:16 -0500 | [diff] [blame] | 57 | void __init setup_barrier_nospec(void); |
Michael Ellerman | af375ee | 2018-07-28 09:06:35 +1000 | [diff] [blame] | 58 | #else |
Chengyang Fan | 6c6fdbb | 2021-01-25 17:53:38 +0800 | [diff] [blame] | 59 | static inline void setup_barrier_nospec(void) { } |
Michael Ellerman | af375ee | 2018-07-28 09:06:35 +1000 | [diff] [blame] | 60 | #endif |
Nicholas Piggin | 9a32a7e | 2020-11-17 16:59:13 +1100 | [diff] [blame] | 61 | void do_uaccess_flush_fixups(enum l1d_flush_type types); |
Nicholas Piggin | f796437 | 2020-11-17 16:59:12 +1100 | [diff] [blame] | 62 | void do_entry_flush_fixups(enum l1d_flush_type types); |
Michal Suchanek | 2eea7f0 | 2018-04-24 14:15:55 +1000 | [diff] [blame] | 63 | void do_barrier_nospec_fixups(bool enable); |
Michal Suchanek | 815069c | 2018-04-24 14:15:56 +1000 | [diff] [blame] | 64 | extern bool barrier_nospec_enabled; |
| 65 | |
Michael Ellerman | 179ab1c | 2018-07-28 09:06:34 +1000 | [diff] [blame] | 66 | #ifdef CONFIG_PPC_BARRIER_NOSPEC |
Michal Suchanek | 815069c | 2018-04-24 14:15:56 +1000 | [diff] [blame] | 67 | void do_barrier_nospec_fixups_range(bool enable, void *start, void *end); |
| 68 | #else |
Chengyang Fan | 6c6fdbb | 2021-01-25 17:53:38 +0800 | [diff] [blame] | 69 | static inline void do_barrier_nospec_fixups_range(bool enable, void *start, void *end) { } |
Michal Suchanek | 815069c | 2018-04-24 14:15:56 +1000 | [diff] [blame] | 70 | #endif |
Michael Ellerman | aa8a5e0 | 2018-01-10 03:07:15 +1100 | [diff] [blame] | 71 | |
Diana Craciun | f633a8a | 2018-12-12 16:03:04 +0200 | [diff] [blame] | 72 | #ifdef CONFIG_PPC_FSL_BOOK3E |
Nick Child | d276960 | 2021-12-16 17:00:16 -0500 | [diff] [blame] | 73 | void __init setup_spectre_v2(void); |
Diana Craciun | f633a8a | 2018-12-12 16:03:04 +0200 | [diff] [blame] | 74 | #else |
Chengyang Fan | 6c6fdbb | 2021-01-25 17:53:38 +0800 | [diff] [blame] | 75 | static inline void setup_spectre_v2(void) {} |
Diana Craciun | f633a8a | 2018-12-12 16:03:04 +0200 | [diff] [blame] | 76 | #endif |
Nick Child | ce0c6be | 2021-12-16 17:00:17 -0500 | [diff] [blame] | 77 | void __init do_btb_flush_fixups(void); |
Diana Craciun | 76a5eaa | 2018-12-12 16:03:00 +0200 | [diff] [blame] | 78 | |
Anton Blanchard | 560285c | 2012-11-01 14:55:04 +0000 | [diff] [blame] | 79 | #endif /* !__ASSEMBLY__ */ |
| 80 | |
| 81 | #endif /* _ASM_POWERPC_SETUP_H */ |
| 82 | |