xen/efi: have a common runtime setup function
Subsystems (7)
Juergen Gross
maintainerPATCH 1/1 xen/efi: have a common runtime setup function
Today the EFI runtime functions are setup in architecture specific code (x86 and arm), with the functions themselves living in drivers/xen as they are not architecture dependent.
As the setup is exactly the same for arm and x86 move the setup to drivers/xen, too. This at once removes the need to make the single functions global visible.
Signed-off-by Juergen Gross <[email protected]>
--- arch/arm/include/asm/xen/xen-ops.h | 6 --- arch/arm/xen/Makefile | 1 - arch/arm/xen/efi.c | 30 ------------- arch/arm/xen/enlighten.c | 1 - arch/arm64/include/asm/xen/xen-ops.h | 7 --- arch/arm64/xen/Makefile | 1 - arch/x86/xen/efi.c | 16 +------ drivers/xen/efi.c | 85 ++++++++++++++++++++---------------- include/xen/xen-ops.h | 25 +---------- 9 files changed, 50 insertions(+), 122 deletions(-) delete mode 100644 arch/arm/include/asm/xen/xen-ops.h delete mode 100644 arch/arm/xen/efi.c delete mode 100644 arch/arm64/include/asm/xen/xen-ops.h
arch/arm/include/asm/xen/xen-ops.h deleted +0 -6
@@ -1,6 +0,0 @@ -#ifndef _ASM_XEN_OPS_H -#define _ASM_XEN_OPS_H - -void xen_efi_runtime_setup (void ); - -#endif /* _ASM_XEN_OPS_H */
arch/arm/xen/Makefile +0 -1
@@ -1,3 +1,2 @@ # SPDX-License-Identifier: GPL-2.0-only obj-y := enlighten.o hypercall.o grant-table.o p2m.o mm.o -obj-$(CONFIG_XEN_EFI) += efi.o
arch/arm/xen/efi.c deleted +0 -30
@@ -1,30 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* -* Copyright (c) 2015, Linaro Limited, Shannon Zhao -*/ - -#include <linux/efi.h> -#include <xen/xen-ops.h> -#include <asm/xen/xen-ops.h> - -/* Set XEN EFI runtime services function pointers. Other fields of struct efi, -* e.g. efi.systab, will be set like normal EFI. -*/ -void __init xen_efi_runtime_setup (void ) -{ - efi.get_time = xen_efi_get_time; - efi.set_time = xen_efi_set_time; - efi.get_wakeup_time = xen_efi_get_wakeup_time; - efi.set_wakeup_time = xen_efi_set_wakeup_time; - efi.get_variable = xen_efi_get_variable; - efi.get_next_variable = xen_efi_get_next_variable; - efi.set_variable = xen_efi_set_variable; - efi.set_variable_nonblocking = xen_efi_set_variable; - efi.query_variable_info = xen_efi_query_variable_info; - efi.query_variable_info_nonblocking = xen_efi_query_variable_info; - efi.update_capsule = xen_efi_update_capsule; - efi.query_capsule_caps = xen_efi_query_capsule_caps; - efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count; - efi.reset_system = xen_efi_reset_system; -} -EXPORT_SYMBOL_GPL (xen_efi_runtime_setup);
arch/arm/xen/enlighten.c +0 -1
@@ -15,7 +15,6 @@#include <xen/xen-ops.h> #include <asm/xen/hypervisor.h> #include <asm/xen/hypercall.h> -#include <asm/xen/xen-ops.h> #include <asm/system_misc.h> #include <asm/efi.h> #include <linux/interrupt.h>
arch/arm64/include/asm/xen/xen-ops.h deleted +0 -7
@@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_XEN_OPS_H -#define _ASM_XEN_OPS_H - -void xen_efi_runtime_setup (void ); - -#endif /* _ASM_XEN_OPS_H */
arch/arm64/xen/Makefile +0 -1
@@ -1,4 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only xen-arm-y += $(addprefix ../../arm/xen/, enlighten.o grant-table.o p2m.o mm.o) obj-y := xen-arm.o hypercall.o -obj-$(CONFIG_XEN_EFI) += $(addprefix ../../arm/xen/, efi.o)
arch/x86/xen/efi.c +1 -15
@@ -57,21 +57,7 @@ static efi_system_table_t __init *xen_efi_probe(void)return NULL ;/* Here we know that Xen runs on EFI platform. */ - - efi.get_time = xen_efi_get_time; - efi.set_time = xen_efi_set_time; - efi.get_wakeup_time = xen_efi_get_wakeup_time; - efi.set_wakeup_time = xen_efi_set_wakeup_time; - efi.get_variable = xen_efi_get_variable; - efi.get_next_variable = xen_efi_get_next_variable; - efi.set_variable = xen_efi_set_variable; - efi.set_variable_nonblocking = xen_efi_set_variable; - efi.query_variable_info = xen_efi_query_variable_info; - efi.query_variable_info_nonblocking = xen_efi_query_variable_info; - efi.update_capsule = xen_efi_update_capsule; - efi.query_capsule_caps = xen_efi_query_capsule_caps; - efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count; - efi.reset_system = xen_efi_reset_system; +xen_efi_runtime_setup (); efi_systab_xen.tables = info->cfg.addr; efi_systab_xen.nr_tables = info->cfg.nent;
drivers/xen/efi.c +48 -37
171 lines not on this page · raw message
include/xen/xen-ops.h +1 -24
@@ -212,30 +212,7 @@ int xen_xlate_map_ballooned_pages(xen_pfn_t **pfns, void **vaddr,bool xen_running_on_version_or_later (unsigned int major,unsigned int minor); -efi_status_t xen_efi_get_time (efi_time_t *tm,efi_time_cap_t *tc); -efi_status_t xen_efi_set_time (efi_time_t *tm); -efi_status_t xen_efi_get_wakeup_time (efi_bool_t *enabled,efi_bool_t *pending, -efi_time_t *tm); -efi_status_t xen_efi_set_wakeup_time (efi_bool_t enabled,efi_time_t *tm); -efi_status_t xen_efi_get_variable (efi_char16_t *name,efi_guid_t *vendor, -u32 *attr,unsigned long *data_size, -void *data); -efi_status_t xen_efi_get_next_variable (unsigned long *name_size, -efi_char16_t *name,efi_guid_t *vendor); -efi_status_t xen_efi_set_variable (efi_char16_t *name,efi_guid_t *vendor, -u32 attr,unsigned long data_size, -void *data); -efi_status_t xen_efi_query_variable_info (u32 attr,u64 *storage_space, -u64 *remaining_space, -u64 *max_variable_size); -efi_status_t xen_efi_get_next_high_mono_count (u32 *count); -efi_status_t xen_efi_update_capsule (efi_capsule_header_t **capsules, -unsigned long count,unsigned long sg_list); -efi_status_t xen_efi_query_capsule_caps (efi_capsule_header_t **capsules, -unsigned long count,u64 *max_size, -int *reset_type); -void xen_efi_reset_system (int reset_type,efi_status_t status, -unsigned long data_size,efi_char16_t *data); +void xen_efi_runtime_setup (void );#ifdef CONFIG_PREEMPT
Signature · 1 line
2.16.4
Quoted 18 lines · Juergen Gross
drivers/xen/efi.c +13
-1@@ -281,4 +270,26 @@ void xen_efi_reset_system(int reset_type, efi_status_t status,BUG (); } } -EXPORT_SYMBOL_GPL (xen_efi_reset_system); + +/* +* Set XEN EFI runtime services function pointers. Other fields of struct efi, +* e.g. efi.systab, will be set like normal EFI. +*/ +void __init xen_efi_runtime_setup (void ) +{ + efi.get_time = xen_efi_get_time; + efi.set_time = xen_efi_set_time; + efi.get_wakeup_time = xen_efi_get_wakeup_time; + efi.set_wakeup_time = xen_efi_set_wakeup_time; + efi.get_variable = xen_efi_get_variable; + efi.get_next_variable = xen_efi_get_next_variable;
drivers/xen/efi.c void xen_efi_reset_system(int reset_type, efi_status_t status, · line 295
Quoted 10 lines
drivers/xen/efi.c +10
-0+ efi.set_variable = xen_efi_set_variable; + efi.set_variable_nonblocking = xen_efi_set_variable; + efi.query_variable_info = xen_efi_query_variable_info; + efi.query_variable_info_nonblocking = xen_efi_query_variable_info; + efi.update_capsule = xen_efi_update_capsule; + efi.query_capsule_caps = xen_efi_query_capsule_caps; + efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count; + efi.reset_system = xen_efi_reset_system; +} +EXPORT_SYMBOL_GPL (xen_efi_runtime_setup);
I don't think exporting an __init function is a good idea, and I also don't see why the function would need exporting had it had the __init dropped. With the line dropped
Reviewed-by Jan Beulich <[email protected]>
Jan