.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
---|
3 | | - * Licensed under the GPL |
---|
4 | 4 | */ |
---|
5 | 5 | |
---|
| 6 | +#include <linux/cpu.h> |
---|
6 | 7 | #include <linux/delay.h> |
---|
7 | 8 | #include <linux/init.h> |
---|
8 | 9 | #include <linux/mm.h> |
---|
.. | .. |
---|
13 | 14 | #include <linux/sched.h> |
---|
14 | 15 | #include <linux/sched/task.h> |
---|
15 | 16 | #include <linux/kmsg_dump.h> |
---|
| 17 | +#include <linux/suspend.h> |
---|
16 | 18 | |
---|
17 | | -#include <asm/pgtable.h> |
---|
18 | 19 | #include <asm/processor.h> |
---|
19 | 20 | #include <asm/sections.h> |
---|
20 | 21 | #include <asm/setup.h> |
---|
.. | .. |
---|
53 | 54 | }; |
---|
54 | 55 | |
---|
55 | 56 | union thread_union cpu0_irqstack |
---|
56 | | - __attribute__((__section__(".data..init_irqstack"))) = |
---|
| 57 | + __section(".data..init_irqstack") = |
---|
57 | 58 | { .thread_info = INIT_THREAD_INFO(init_task) }; |
---|
58 | 59 | |
---|
59 | 60 | /* Changed in setup_arch, which is called in early boot */ |
---|
.. | .. |
---|
77 | 78 | |
---|
78 | 79 | static void *c_start(struct seq_file *m, loff_t *pos) |
---|
79 | 80 | { |
---|
80 | | - return *pos < NR_CPUS ? cpu_data + *pos : NULL; |
---|
| 81 | + return *pos < nr_cpu_ids ? cpu_data + *pos : NULL; |
---|
81 | 82 | } |
---|
82 | 83 | |
---|
83 | 84 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) |
---|
.. | .. |
---|
113 | 114 | |
---|
114 | 115 | /* Set in uml_mem_setup and modified in linux_main */ |
---|
115 | 116 | long long physmem_size = 32 * 1024 * 1024; |
---|
| 117 | +EXPORT_SYMBOL(physmem_size); |
---|
116 | 118 | |
---|
117 | 119 | static const char *usage_string = |
---|
118 | 120 | "User Mode Linux v%s\n" |
---|
.. | .. |
---|
352 | 354 | setup_hostinfo(host_info, sizeof host_info); |
---|
353 | 355 | } |
---|
354 | 356 | |
---|
355 | | -void __init check_bugs(void) |
---|
| 357 | +void __init arch_cpu_finalize_init(void) |
---|
356 | 358 | { |
---|
357 | 359 | arch_check_bugs(); |
---|
358 | 360 | os_check_bugs(); |
---|
359 | 361 | } |
---|
360 | 362 | |
---|
| 363 | +void apply_retpolines(s32 *start, s32 *end) |
---|
| 364 | +{ |
---|
| 365 | +} |
---|
| 366 | + |
---|
| 367 | +void apply_returns(s32 *start, s32 *end) |
---|
| 368 | +{ |
---|
| 369 | +} |
---|
| 370 | + |
---|
361 | 371 | void apply_alternatives(struct alt_instr *start, struct alt_instr *end) |
---|
362 | 372 | { |
---|
363 | 373 | } |
---|
| 374 | + |
---|
| 375 | +void *text_poke(void *addr, const void *opcode, size_t len) |
---|
| 376 | +{ |
---|
| 377 | + /* |
---|
| 378 | + * In UML, the only reference to this function is in |
---|
| 379 | + * apply_relocate_add(), which shouldn't ever actually call this |
---|
| 380 | + * because UML doesn't have live patching. |
---|
| 381 | + */ |
---|
| 382 | + WARN_ON(1); |
---|
| 383 | + |
---|
| 384 | + return memcpy(addr, opcode, len); |
---|
| 385 | +} |
---|
| 386 | + |
---|
| 387 | +void text_poke_sync(void) |
---|
| 388 | +{ |
---|
| 389 | +} |
---|
| 390 | + |
---|
| 391 | +void uml_pm_wake(void) |
---|
| 392 | +{ |
---|
| 393 | + pm_system_wakeup(); |
---|
| 394 | +} |
---|
| 395 | + |
---|
| 396 | +#ifdef CONFIG_PM_SLEEP |
---|
| 397 | +static int init_pm_wake_signal(void) |
---|
| 398 | +{ |
---|
| 399 | + /* |
---|
| 400 | + * In external time-travel mode we can't use signals to wake up |
---|
| 401 | + * since that would mess with the scheduling. We'll have to do |
---|
| 402 | + * some additional work to support wakeup on virtio devices or |
---|
| 403 | + * similar, perhaps implementing a fake RTC controller that can |
---|
| 404 | + * trigger wakeup (and request the appropriate scheduling from |
---|
| 405 | + * the external scheduler when going to suspend.) |
---|
| 406 | + */ |
---|
| 407 | + if (time_travel_mode != TT_MODE_EXTERNAL) |
---|
| 408 | + register_pm_wake_signal(); |
---|
| 409 | + return 0; |
---|
| 410 | +} |
---|
| 411 | + |
---|
| 412 | +late_initcall(init_pm_wake_signal); |
---|
| 413 | +#endif |
---|