hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/arch/um/kernel/um_arch.c
....@@ -1,8 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3
- * Licensed under the GPL
44 */
55
6
+#include <linux/cpu.h>
67 #include <linux/delay.h>
78 #include <linux/init.h>
89 #include <linux/mm.h>
....@@ -13,8 +14,8 @@
1314 #include <linux/sched.h>
1415 #include <linux/sched/task.h>
1516 #include <linux/kmsg_dump.h>
17
+#include <linux/suspend.h>
1618
17
-#include <asm/pgtable.h>
1819 #include <asm/processor.h>
1920 #include <asm/sections.h>
2021 #include <asm/setup.h>
....@@ -53,7 +54,7 @@
5354 };
5455
5556 union thread_union cpu0_irqstack
56
- __attribute__((__section__(".data..init_irqstack"))) =
57
+ __section(".data..init_irqstack") =
5758 { .thread_info = INIT_THREAD_INFO(init_task) };
5859
5960 /* Changed in setup_arch, which is called in early boot */
....@@ -77,7 +78,7 @@
7778
7879 static void *c_start(struct seq_file *m, loff_t *pos)
7980 {
80
- return *pos < NR_CPUS ? cpu_data + *pos : NULL;
81
+ return *pos < nr_cpu_ids ? cpu_data + *pos : NULL;
8182 }
8283
8384 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
....@@ -113,6 +114,7 @@
113114
114115 /* Set in uml_mem_setup and modified in linux_main */
115116 long long physmem_size = 32 * 1024 * 1024;
117
+EXPORT_SYMBOL(physmem_size);
116118
117119 static const char *usage_string =
118120 "User Mode Linux v%s\n"
....@@ -352,12 +354,60 @@
352354 setup_hostinfo(host_info, sizeof host_info);
353355 }
354356
355
-void __init check_bugs(void)
357
+void __init arch_cpu_finalize_init(void)
356358 {
357359 arch_check_bugs();
358360 os_check_bugs();
359361 }
360362
363
+void apply_retpolines(s32 *start, s32 *end)
364
+{
365
+}
366
+
367
+void apply_returns(s32 *start, s32 *end)
368
+{
369
+}
370
+
361371 void apply_alternatives(struct alt_instr *start, struct alt_instr *end)
362372 {
363373 }
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