x86/xen: move xen_reserve_extra_memory()
authorRoger Pau Monne <roger.pau@citrix.com>
Thu, 25 Jul 2024 07:31:14 +0000 (09:31 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Apr 2025 08:45:55 +0000 (10:45 +0200)
commit fc05ea89c9ab45e70cb73e70bc0b9cdd403e0ee1 upstream.

In preparation for making the function static.

No functional change.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Message-ID: <20240725073116.14626-2-roger.pau@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
[ Stable backport - move the code as it exists ]
Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/xen/enlighten_pvh.c

index 60b358c2f43484338538617b81d10125a53fdc53..89984018141ca91886cd27c621525d3b95075d06 100644 (file)
 bool __ro_after_init xen_pvh;
 EXPORT_SYMBOL_GPL(xen_pvh);
 
-void __init xen_pvh_init(struct boot_params *boot_params)
-{
-       xen_pvh = 1;
-       xen_domain_type = XEN_HVM_DOMAIN;
-       xen_start_flags = pvh_start_info.flags;
-
-       if (xen_initial_domain())
-               x86_init.oem.arch_setup = xen_add_preferred_consoles;
-       x86_init.oem.banner = xen_banner;
-
-       xen_efi_init(boot_params);
-
-       if (xen_initial_domain()) {
-               struct xen_platform_op op = {
-                       .cmd = XENPF_get_dom0_console,
-               };
-               int ret = HYPERVISOR_platform_op(&op);
-
-               if (ret > 0)
-                       xen_init_vga(&op.u.dom0_console,
-                                    min(ret * sizeof(char),
-                                        sizeof(op.u.dom0_console)),
-                                    &boot_params->screen_info);
-       }
-}
-
-void __init mem_map_via_hcall(struct boot_params *boot_params_p)
-{
-       struct xen_memory_map memmap;
-       int rc;
-
-       memmap.nr_entries = ARRAY_SIZE(boot_params_p->e820_table);
-       set_xen_guest_handle(memmap.buffer, boot_params_p->e820_table);
-       rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
-       if (rc) {
-               xen_raw_printk("XENMEM_memory_map failed (%d)\n", rc);
-               BUG();
-       }
-       boot_params_p->e820_entries = memmap.nr_entries;
-}
-
 /*
  * Reserve e820 UNUSABLE regions to inflate the memory balloon.
  *
@@ -133,3 +92,44 @@ void __init xen_reserve_extra_memory(struct boot_params *bootp)
                xen_add_extra_mem(PFN_UP(e->addr), pages);
        }
 }
+
+void __init xen_pvh_init(struct boot_params *boot_params)
+{
+       xen_pvh = 1;
+       xen_domain_type = XEN_HVM_DOMAIN;
+       xen_start_flags = pvh_start_info.flags;
+
+       if (xen_initial_domain())
+               x86_init.oem.arch_setup = xen_add_preferred_consoles;
+       x86_init.oem.banner = xen_banner;
+
+       xen_efi_init(boot_params);
+
+       if (xen_initial_domain()) {
+               struct xen_platform_op op = {
+                       .cmd = XENPF_get_dom0_console,
+               };
+               int ret = HYPERVISOR_platform_op(&op);
+
+               if (ret > 0)
+                       xen_init_vga(&op.u.dom0_console,
+                                    min(ret * sizeof(char),
+                                        sizeof(op.u.dom0_console)),
+                                    &boot_params->screen_info);
+       }
+}
+
+void __init mem_map_via_hcall(struct boot_params *boot_params_p)
+{
+       struct xen_memory_map memmap;
+       int rc;
+
+       memmap.nr_entries = ARRAY_SIZE(boot_params_p->e820_table);
+       set_xen_guest_handle(memmap.buffer, boot_params_p->e820_table);
+       rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
+       if (rc) {
+               xen_raw_printk("XENMEM_memory_map failed (%d)\n", rc);
+               BUG();
+       }
+       boot_params_p->e820_entries = memmap.nr_entries;
+}