hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/arch/arm/xen/enlighten.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 #include <xen/xen.h>
23 #include <xen/events.h>
34 #include <xen/grant_table.h>
....@@ -14,7 +15,6 @@
1415 #include <xen/xen-ops.h>
1516 #include <asm/xen/hypervisor.h>
1617 #include <asm/xen/hypercall.h>
17
-#include <asm/xen/xen-ops.h>
1818 #include <asm/system_misc.h>
1919 #include <asm/efi.h>
2020 #include <linux/interrupt.h>
....@@ -29,6 +29,7 @@
2929 #include <linux/cpu.h>
3030 #include <linux/console.h>
3131 #include <linux/pvclock_gtod.h>
32
+#include <linux/reboot.h>
3233 #include <linux/time64.h>
3334 #include <linux/timekeeping.h>
3435 #include <linux/timekeeper_internal.h>
....@@ -36,7 +37,7 @@
3637
3738 #include <linux/mm.h>
3839
39
-struct start_info _xen_start_info;
40
+static struct start_info _xen_start_info;
4041 struct start_info *xen_start_info = &_xen_start_info;
4142 EXPORT_SYMBOL(xen_start_info);
4243
....@@ -62,46 +63,12 @@
6263 uint32_t xen_start_flags;
6364 EXPORT_SYMBOL(xen_start_flags);
6465
65
-int xen_remap_domain_gfn_array(struct vm_area_struct *vma,
66
- unsigned long addr,
67
- xen_pfn_t *gfn, int nr,
68
- int *err_ptr, pgprot_t prot,
69
- unsigned domid,
70
- struct page **pages)
71
-{
72
- return xen_xlate_remap_gfn_array(vma, addr, gfn, nr, err_ptr,
73
- prot, domid, pages);
74
-}
75
-EXPORT_SYMBOL_GPL(xen_remap_domain_gfn_array);
76
-
77
-/* Not used by XENFEAT_auto_translated guests. */
78
-int xen_remap_domain_gfn_range(struct vm_area_struct *vma,
79
- unsigned long addr,
80
- xen_pfn_t gfn, int nr,
81
- pgprot_t prot, unsigned domid,
82
- struct page **pages)
83
-{
84
- return -ENOSYS;
85
-}
86
-EXPORT_SYMBOL_GPL(xen_remap_domain_gfn_range);
87
-
8866 int xen_unmap_domain_gfn_range(struct vm_area_struct *vma,
8967 int nr, struct page **pages)
9068 {
9169 return xen_xlate_unmap_gfn_range(vma, nr, pages);
9270 }
9371 EXPORT_SYMBOL_GPL(xen_unmap_domain_gfn_range);
94
-
95
-/* Not used by XENFEAT_auto_translated guests. */
96
-int xen_remap_domain_mfn_array(struct vm_area_struct *vma,
97
- unsigned long addr,
98
- xen_pfn_t *mfn, int nr,
99
- int *err_ptr, pgprot_t prot,
100
- unsigned int domid, struct page **pages)
101
-{
102
- return -ENOSYS;
103
-}
104
-EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_array);
10572
10673 static void xen_read_wallclock(struct timespec64 *ts)
10774 {
....@@ -184,7 +151,7 @@
184151 pr_info("Xen: initializing cpu%d\n", cpu);
185152 vcpup = per_cpu_ptr(xen_vcpu_info, cpu);
186153
187
- info.mfn = virt_to_gfn(vcpup);
154
+ info.mfn = percpu_to_gfn(vcpup);
188155 info.offset = xen_offset_in_page(vcpup);
189156
190157 err = HYPERVISOR_vcpu_op(VCPUOP_register_vcpu_info, xen_vcpu_nr(cpu),
....@@ -192,7 +159,8 @@
192159 BUG_ON(err);
193160 per_cpu(xen_vcpu, cpu) = vcpup;
194161
195
- xen_setup_runstate_info(cpu);
162
+ if (!xen_kernel_unmapped_at_usr())
163
+ xen_setup_runstate_info(cpu);
196164
197165 after_register_vcpu_info:
198166 enable_percpu_irq(xen_events_irq, 0);
....@@ -214,11 +182,18 @@
214182 BUG_ON(rc);
215183 }
216184
217
-static void xen_restart(enum reboot_mode reboot_mode, const char *cmd)
185
+static int xen_restart(struct notifier_block *nb, unsigned long action,
186
+ void *data)
218187 {
219188 xen_reboot(SHUTDOWN_reboot);
189
+
190
+ return NOTIFY_DONE;
220191 }
221192
193
+static struct notifier_block xen_restart_nb = {
194
+ .notifier_call = xen_restart,
195
+ .priority = 192,
196
+};
222197
223198 static void xen_power_off(void)
224199 {
....@@ -275,7 +250,6 @@
275250 * see Documentation/devicetree/bindings/arm/xen.txt for the
276251 * documentation of the Xen Device Tree format.
277252 */
278
-#define GRANT_TABLE_PHYSADDR 0
279253 void __init xen_early_init(void)
280254 {
281255 of_scan_flat_dt(fdt_find_hyper_node, NULL);
....@@ -420,7 +394,8 @@
420394 return -EINVAL;
421395 }
422396
423
- xen_time_setup_guest();
397
+ if (!xen_kernel_unmapped_at_usr())
398
+ xen_time_setup_guest();
424399
425400 if (xen_initial_domain())
426401 pvclock_gtod_register_notifier(&xen_pvclock_gtod_notifier);
....@@ -437,7 +412,7 @@
437412 return -ENODEV;
438413
439414 pm_power_off = xen_power_off;
440
- arm_pm_restart = xen_restart;
415
+ register_restart_handler(&xen_restart_nb);
441416 if (!xen_initial_domain()) {
442417 struct timespec64 ts;
443418 xen_read_wallclock(&ts);
....@@ -468,7 +443,7 @@
468443 EXPORT_SYMBOL_GPL(HYPERVISOR_physdev_op);
469444 EXPORT_SYMBOL_GPL(HYPERVISOR_vcpu_op);
470445 EXPORT_SYMBOL_GPL(HYPERVISOR_tmem_op);
471
-EXPORT_SYMBOL_GPL(HYPERVISOR_platform_op);
446
+EXPORT_SYMBOL_GPL(HYPERVISOR_platform_op_raw);
472447 EXPORT_SYMBOL_GPL(HYPERVISOR_multicall);
473448 EXPORT_SYMBOL_GPL(HYPERVISOR_vm_assist);
474449 EXPORT_SYMBOL_GPL(HYPERVISOR_dm_op);