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