Skip to content

Commit 0951570

Browse files
jgross1bostrovs
authored andcommitted
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]> Reviewed-by: Jan Beulich <[email protected]> [boris: "Dropped EXPORT_SYMBOL_GPL(xen_efi_runtime_setup)"] Signed-off-by: Boris Ostrovsky <[email protected]>
1 parent ec066de commit 0951570

File tree

9 files changed

+49
-122
lines changed

9 files changed

+49
-122
lines changed

arch/arm/include/asm/xen/xen-ops.h

Lines changed: 0 additions & 6 deletions
This file was deleted.

arch/arm/xen/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
obj-y := enlighten.o hypercall.o grant-table.o p2m.o mm.o
3-
obj-$(CONFIG_XEN_EFI) += efi.o

arch/arm/xen/efi.c

Lines changed: 0 additions & 30 deletions
This file was deleted.

arch/arm/xen/enlighten.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <xen/xen-ops.h>
1616
#include <asm/xen/hypervisor.h>
1717
#include <asm/xen/hypercall.h>
18-
#include <asm/xen/xen-ops.h>
1918
#include <asm/system_misc.h>
2019
#include <asm/efi.h>
2120
#include <linux/interrupt.h>

arch/arm64/include/asm/xen/xen-ops.h

Lines changed: 0 additions & 7 deletions
This file was deleted.

arch/arm64/xen/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
xen-arm-y += $(addprefix ../../arm/xen/, enlighten.o grant-table.o p2m.o mm.o)
33
obj-y := xen-arm.o hypercall.o
4-
obj-$(CONFIG_XEN_EFI) += $(addprefix ../../arm/xen/, efi.o)

arch/x86/xen/efi.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,7 @@ static efi_system_table_t __init *xen_efi_probe(void)
5757
return NULL;
5858

5959
/* Here we know that Xen runs on EFI platform. */
60-
61-
efi.get_time = xen_efi_get_time;
62-
efi.set_time = xen_efi_set_time;
63-
efi.get_wakeup_time = xen_efi_get_wakeup_time;
64-
efi.set_wakeup_time = xen_efi_set_wakeup_time;
65-
efi.get_variable = xen_efi_get_variable;
66-
efi.get_next_variable = xen_efi_get_next_variable;
67-
efi.set_variable = xen_efi_set_variable;
68-
efi.set_variable_nonblocking = xen_efi_set_variable;
69-
efi.query_variable_info = xen_efi_query_variable_info;
70-
efi.query_variable_info_nonblocking = xen_efi_query_variable_info;
71-
efi.update_capsule = xen_efi_update_capsule;
72-
efi.query_capsule_caps = xen_efi_query_capsule_caps;
73-
efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count;
74-
efi.reset_system = xen_efi_reset_system;
60+
xen_efi_runtime_setup();
7561

7662
efi_systab_xen.tables = info->cfg.addr;
7763
efi_systab_xen.nr_tables = info->cfg.nent;

drivers/xen/efi.c

Lines changed: 47 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
#define efi_data(op) (op.u.efi_runtime_call)
4242

43-
efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
43+
static efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
4444
{
4545
struct xen_platform_op op = INIT_EFI_OP(get_time);
4646

@@ -61,9 +61,8 @@ efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
6161

6262
return efi_data(op).status;
6363
}
64-
EXPORT_SYMBOL_GPL(xen_efi_get_time);
6564

66-
efi_status_t xen_efi_set_time(efi_time_t *tm)
65+
static efi_status_t xen_efi_set_time(efi_time_t *tm)
6766
{
6867
struct xen_platform_op op = INIT_EFI_OP(set_time);
6968

@@ -75,10 +74,10 @@ efi_status_t xen_efi_set_time(efi_time_t *tm)
7574

7675
return efi_data(op).status;
7776
}
78-
EXPORT_SYMBOL_GPL(xen_efi_set_time);
7977

80-
efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending,
81-
efi_time_t *tm)
78+
static efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled,
79+
efi_bool_t *pending,
80+
efi_time_t *tm)
8281
{
8382
struct xen_platform_op op = INIT_EFI_OP(get_wakeup_time);
8483

@@ -98,9 +97,8 @@ efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending,
9897

9998
return efi_data(op).status;
10099
}
101-
EXPORT_SYMBOL_GPL(xen_efi_get_wakeup_time);
102100

103-
efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
101+
static efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
104102
{
105103
struct xen_platform_op op = INIT_EFI_OP(set_wakeup_time);
106104

@@ -117,11 +115,10 @@ efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
117115

118116
return efi_data(op).status;
119117
}
120-
EXPORT_SYMBOL_GPL(xen_efi_set_wakeup_time);
121118

122-
efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor,
123-
u32 *attr, unsigned long *data_size,
124-
void *data)
119+
static efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor,
120+
u32 *attr, unsigned long *data_size,
121+
void *data)
125122
{
126123
struct xen_platform_op op = INIT_EFI_OP(get_variable);
127124

@@ -141,11 +138,10 @@ efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor,
141138

142139
return efi_data(op).status;
143140
}
144-
EXPORT_SYMBOL_GPL(xen_efi_get_variable);
145141

146-
efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
147-
efi_char16_t *name,
148-
efi_guid_t *vendor)
142+
static efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
143+
efi_char16_t *name,
144+
efi_guid_t *vendor)
149145
{
150146
struct xen_platform_op op = INIT_EFI_OP(get_next_variable_name);
151147

@@ -165,11 +161,10 @@ efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
165161

166162
return efi_data(op).status;
167163
}
168-
EXPORT_SYMBOL_GPL(xen_efi_get_next_variable);
169164

170-
efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor,
171-
u32 attr, unsigned long data_size,
172-
void *data)
165+
static efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor,
166+
u32 attr, unsigned long data_size,
167+
void *data)
173168
{
174169
struct xen_platform_op op = INIT_EFI_OP(set_variable);
175170

@@ -186,11 +181,10 @@ efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor,
186181

187182
return efi_data(op).status;
188183
}
189-
EXPORT_SYMBOL_GPL(xen_efi_set_variable);
190184

191-
efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space,
192-
u64 *remaining_space,
193-
u64 *max_variable_size)
185+
static efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space,
186+
u64 *remaining_space,
187+
u64 *max_variable_size)
194188
{
195189
struct xen_platform_op op = INIT_EFI_OP(query_variable_info);
196190

@@ -208,9 +202,8 @@ efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space,
208202

209203
return efi_data(op).status;
210204
}
211-
EXPORT_SYMBOL_GPL(xen_efi_query_variable_info);
212205

213-
efi_status_t xen_efi_get_next_high_mono_count(u32 *count)
206+
static efi_status_t xen_efi_get_next_high_mono_count(u32 *count)
214207
{
215208
struct xen_platform_op op = INIT_EFI_OP(get_next_high_monotonic_count);
216209

@@ -221,10 +214,9 @@ efi_status_t xen_efi_get_next_high_mono_count(u32 *count)
221214

222215
return efi_data(op).status;
223216
}
224-
EXPORT_SYMBOL_GPL(xen_efi_get_next_high_mono_count);
225217

226-
efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
227-
unsigned long count, unsigned long sg_list)
218+
static efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
219+
unsigned long count, unsigned long sg_list)
228220
{
229221
struct xen_platform_op op = INIT_EFI_OP(update_capsule);
230222

@@ -241,11 +233,9 @@ efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
241233

242234
return efi_data(op).status;
243235
}
244-
EXPORT_SYMBOL_GPL(xen_efi_update_capsule);
245236

246-
efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
247-
unsigned long count, u64 *max_size,
248-
int *reset_type)
237+
static efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
238+
unsigned long count, u64 *max_size, int *reset_type)
249239
{
250240
struct xen_platform_op op = INIT_EFI_OP(query_capsule_capabilities);
251241

@@ -264,10 +254,9 @@ efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
264254

265255
return efi_data(op).status;
266256
}
267-
EXPORT_SYMBOL_GPL(xen_efi_query_capsule_caps);
268257

269-
void xen_efi_reset_system(int reset_type, efi_status_t status,
270-
unsigned long data_size, efi_char16_t *data)
258+
static void xen_efi_reset_system(int reset_type, efi_status_t status,
259+
unsigned long data_size, efi_char16_t *data)
271260
{
272261
switch (reset_type) {
273262
case EFI_RESET_COLD:
@@ -281,4 +270,25 @@ void xen_efi_reset_system(int reset_type, efi_status_t status,
281270
BUG();
282271
}
283272
}
284-
EXPORT_SYMBOL_GPL(xen_efi_reset_system);
273+
274+
/*
275+
* Set XEN EFI runtime services function pointers. Other fields of struct efi,
276+
* e.g. efi.systab, will be set like normal EFI.
277+
*/
278+
void __init xen_efi_runtime_setup(void)
279+
{
280+
efi.get_time = xen_efi_get_time;
281+
efi.set_time = xen_efi_set_time;
282+
efi.get_wakeup_time = xen_efi_get_wakeup_time;
283+
efi.set_wakeup_time = xen_efi_set_wakeup_time;
284+
efi.get_variable = xen_efi_get_variable;
285+
efi.get_next_variable = xen_efi_get_next_variable;
286+
efi.set_variable = xen_efi_set_variable;
287+
efi.set_variable_nonblocking = xen_efi_set_variable;
288+
efi.query_variable_info = xen_efi_query_variable_info;
289+
efi.query_variable_info_nonblocking = xen_efi_query_variable_info;
290+
efi.update_capsule = xen_efi_update_capsule;
291+
efi.query_capsule_caps = xen_efi_query_capsule_caps;
292+
efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count;
293+
efi.reset_system = xen_efi_reset_system;
294+
}

include/xen/xen-ops.h

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -212,30 +212,7 @@ int xen_xlate_map_ballooned_pages(xen_pfn_t **pfns, void **vaddr,
212212

213213
bool xen_running_on_version_or_later(unsigned int major, unsigned int minor);
214214

215-
efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc);
216-
efi_status_t xen_efi_set_time(efi_time_t *tm);
217-
efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending,
218-
efi_time_t *tm);
219-
efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm);
220-
efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor,
221-
u32 *attr, unsigned long *data_size,
222-
void *data);
223-
efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
224-
efi_char16_t *name, efi_guid_t *vendor);
225-
efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor,
226-
u32 attr, unsigned long data_size,
227-
void *data);
228-
efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space,
229-
u64 *remaining_space,
230-
u64 *max_variable_size);
231-
efi_status_t xen_efi_get_next_high_mono_count(u32 *count);
232-
efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
233-
unsigned long count, unsigned long sg_list);
234-
efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
235-
unsigned long count, u64 *max_size,
236-
int *reset_type);
237-
void xen_efi_reset_system(int reset_type, efi_status_t status,
238-
unsigned long data_size, efi_char16_t *data);
215+
void xen_efi_runtime_setup(void);
239216

240217

241218
#ifdef CONFIG_PREEMPT

0 commit comments

Comments
 (0)