hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/arch/um/kernel/um_arch.c
....@@ -1,6 +1,6 @@
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
66 #include <linux/delay.h>
....@@ -13,8 +13,8 @@
1313 #include <linux/sched.h>
1414 #include <linux/sched/task.h>
1515 #include <linux/kmsg_dump.h>
16
+#include <linux/suspend.h>
1617
17
-#include <asm/pgtable.h>
1818 #include <asm/processor.h>
1919 #include <asm/sections.h>
2020 #include <asm/setup.h>
....@@ -53,7 +53,7 @@
5353 };
5454
5555 union thread_union cpu0_irqstack
56
- __attribute__((__section__(".data..init_irqstack"))) =
56
+ __section(".data..init_irqstack") =
5757 { .thread_info = INIT_THREAD_INFO(init_task) };
5858
5959 /* Changed in setup_arch, which is called in early boot */
....@@ -77,7 +77,7 @@
7777
7878 static void *c_start(struct seq_file *m, loff_t *pos)
7979 {
80
- return *pos < NR_CPUS ? cpu_data + *pos : NULL;
80
+ return *pos < nr_cpu_ids ? cpu_data + *pos : NULL;
8181 }
8282
8383 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
....@@ -113,6 +113,7 @@
113113
114114 /* Set in uml_mem_setup and modified in linux_main */
115115 long long physmem_size = 32 * 1024 * 1024;
116
+EXPORT_SYMBOL(physmem_size);
116117
117118 static const char *usage_string =
118119 "User Mode Linux v%s\n"
....@@ -358,6 +359,54 @@
358359 os_check_bugs();
359360 }
360361
362
+void apply_retpolines(s32 *start, s32 *end)
363
+{
364
+}
365
+
366
+void apply_returns(s32 *start, s32 *end)
367
+{
368
+}
369
+
361370 void apply_alternatives(struct alt_instr *start, struct alt_instr *end)
362371 {
363372 }
373
+
374
+void *text_poke(void *addr, const void *opcode, size_t len)
375
+{
376
+ /*
377
+ * In UML, the only reference to this function is in
378
+ * apply_relocate_add(), which shouldn't ever actually call this
379
+ * because UML doesn't have live patching.
380
+ */
381
+ WARN_ON(1);
382
+
383
+ return memcpy(addr, opcode, len);
384
+}
385
+
386
+void text_poke_sync(void)
387
+{
388
+}
389
+
390
+#ifdef CONFIG_PM_SLEEP
391
+void uml_pm_wake(void)
392
+{
393
+ pm_system_wakeup();
394
+}
395
+
396
+static int init_pm_wake_signal(void)
397
+{
398
+ /*
399
+ * In external time-travel mode we can't use signals to wake up
400
+ * since that would mess with the scheduling. We'll have to do
401
+ * some additional work to support wakeup on virtio devices or
402
+ * similar, perhaps implementing a fake RTC controller that can
403
+ * trigger wakeup (and request the appropriate scheduling from
404
+ * the external scheduler when going to suspend.)
405
+ */
406
+ if (time_travel_mode != TT_MODE_EXTERNAL)
407
+ register_pm_wake_signal();
408
+ return 0;
409
+}
410
+
411
+late_initcall(init_pm_wake_signal);
412
+#endif