Heiko Carstens | 971a9ca | 2018-05-04 13:22:12 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * Copyright IBM Corp. 2007, 2018 |
| 4 | */ |
| 5 | |
| 6 | /* |
| 7 | * Early setup functions which may not rely on an initialized bss |
| 8 | * section. The last thing that is supposed to happen here is |
| 9 | * initialization of the bss section. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/processor.h> |
| 13 | #include <linux/string.h> |
| 14 | #include <asm/sections.h> |
| 15 | #include <asm/lowcore.h> |
Heiko Carstens | 971a9ca | 2018-05-04 13:22:12 +0200 | [diff] [blame] | 16 | #include <asm/timex.h> |
Vasily Gorbik | 42db5ed | 2017-11-17 14:29:13 +0100 | [diff] [blame] | 17 | #include <asm/kasan.h> |
Heiko Carstens | 971a9ca | 2018-05-04 13:22:12 +0200 | [diff] [blame] | 18 | #include "entry.h" |
| 19 | |
| 20 | static void __init reset_tod_clock(void) |
| 21 | { |
| 22 | u64 time; |
| 23 | |
| 24 | if (store_tod_clock(&time) == 0) |
| 25 | return; |
| 26 | /* TOD clock not running. Set the clock to Unix Epoch. */ |
| 27 | if (set_tod_clock(TOD_UNIX_EPOCH) != 0 || store_tod_clock(&time) != 0) |
| 28 | disabled_wait(0); |
| 29 | |
| 30 | memset(tod_clock_base, 0, 16); |
| 31 | *(__u64 *) &tod_clock_base[1] = TOD_UNIX_EPOCH; |
| 32 | S390_lowcore.last_update_clock = TOD_UNIX_EPOCH; |
| 33 | } |
| 34 | |
Heiko Carstens | 971a9ca | 2018-05-04 13:22:12 +0200 | [diff] [blame] | 35 | static void __init clear_bss_section(void) |
| 36 | { |
| 37 | memset(__bss_start, 0, __bss_stop - __bss_start); |
| 38 | } |
| 39 | |
| 40 | void __init startup_init_nobss(void) |
| 41 | { |
| 42 | reset_tod_clock(); |
Heiko Carstens | 971a9ca | 2018-05-04 13:22:12 +0200 | [diff] [blame] | 43 | clear_bss_section(); |
Vasily Gorbik | 42db5ed | 2017-11-17 14:29:13 +0100 | [diff] [blame] | 44 | kasan_early_init(); |
Heiko Carstens | 971a9ca | 2018-05-04 13:22:12 +0200 | [diff] [blame] | 45 | } |