Skip to content

Commit 50dfd03

Browse files
committed
Merge tag 'for-linus-5.4-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull xen fixes and cleanups from Juergen Gross: - a fix in the Xen balloon driver avoiding hitting a BUG_ON() in some cases, plus a follow-on cleanup series for that driver - a patch for introducing non-blocking EFI callbacks in Xen's EFI driver, plu a cleanup patch for Xen EFI handling merging the x86 and ARM arch specific initialization into the Xen EFI driver - a fix of the Xen xenbus driver avoiding a self-deadlock when cleaning up after a user process has died - a fix for Xen on ARM after removal of ZONE_DMA - a cleanup patch for avoiding build warnings for Xen on ARM * tag 'for-linus-5.4-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: xen/xenbus: fix self-deadlock after killing user process xen/efi: have a common runtime setup function arm: xen: mm: use __GPF_DMA32 for arm64 xen/balloon: Clear PG_offline in balloon_retrieve() xen/balloon: Mark pages PG_offline in balloon_append() xen/balloon: Drop __balloon_append() xen/balloon: Set pages PageOffline() in balloon_add_region() ARM: xen: unexport HYPERVISOR_platform_op function xen/efi: Set nonblocking callbacks
2 parents e524d16 + a8fabb3 commit 50dfd03

File tree

12 files changed

+79
-139
lines changed

12 files changed

+79
-139
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 & 28 deletions
This file was deleted.

arch/arm/xen/enlighten.c

Lines changed: 1 addition & 2 deletions
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>
@@ -437,7 +436,7 @@ EXPORT_SYMBOL_GPL(HYPERVISOR_memory_op);
437436
EXPORT_SYMBOL_GPL(HYPERVISOR_physdev_op);
438437
EXPORT_SYMBOL_GPL(HYPERVISOR_vcpu_op);
439438
EXPORT_SYMBOL_GPL(HYPERVISOR_tmem_op);
440-
EXPORT_SYMBOL_GPL(HYPERVISOR_platform_op);
439+
EXPORT_SYMBOL_GPL(HYPERVISOR_platform_op_raw);
441440
EXPORT_SYMBOL_GPL(HYPERVISOR_multicall);
442441
EXPORT_SYMBOL_GPL(HYPERVISOR_vm_assist);
443442
EXPORT_SYMBOL_GPL(HYPERVISOR_dm_op);

arch/arm/xen/mm.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ unsigned long xen_get_swiotlb_free_pages(unsigned int order)
2828

2929
for_each_memblock(memory, reg) {
3030
if (reg->base < (phys_addr_t)0xffffffff) {
31-
flags |= __GFP_DMA;
31+
if (IS_ENABLED(CONFIG_ZONE_DMA32))
32+
flags |= __GFP_DMA32;
33+
else
34+
flags |= __GFP_DMA;
3235
break;
3336
}
3437
}

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 & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +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.query_variable_info = xen_efi_query_variable_info;
69-
efi.update_capsule = xen_efi_update_capsule;
70-
efi.query_capsule_caps = xen_efi_query_capsule_caps;
71-
efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count;
72-
efi.reset_system = xen_efi_reset_system;
60+
xen_efi_runtime_setup();
7361

7462
efi_systab_xen.tables = info->cfg.addr;
7563
efi_systab_xen.nr_tables = info->cfg.nent;

drivers/xen/balloon.c

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,10 @@ static DECLARE_DELAYED_WORK(balloon_worker, balloon_process);
156156
(GFP_HIGHUSER | __GFP_NOWARN | __GFP_NORETRY | __GFP_NOMEMALLOC)
157157

158158
/* balloon_append: add the given page to the balloon. */
159-
static void __balloon_append(struct page *page)
159+
static void balloon_append(struct page *page)
160160
{
161+
__SetPageOffline(page);
162+
161163
/* Lowmem is re-populated first, so highmem pages go at list tail. */
162164
if (PageHighMem(page)) {
163165
list_add_tail(&page->lru, &ballooned_pages);
@@ -169,11 +171,6 @@ static void __balloon_append(struct page *page)
169171
wake_up(&balloon_wq);
170172
}
171173

172-
static void balloon_append(struct page *page)
173-
{
174-
__balloon_append(page);
175-
}
176-
177174
/* balloon_retrieve: rescue a page from the balloon, if it is not empty. */
178175
static struct page *balloon_retrieve(bool require_lowmem)
179176
{
@@ -192,6 +189,7 @@ static struct page *balloon_retrieve(bool require_lowmem)
192189
else
193190
balloon_stats.balloon_low--;
194191

192+
__ClearPageOffline(page);
195193
return page;
196194
}
197195

@@ -377,8 +375,7 @@ static void xen_online_page(struct page *page, unsigned int order)
377375
for (i = 0; i < size; i++) {
378376
p = pfn_to_page(start_pfn + i);
379377
__online_page_set_limits(p);
380-
__SetPageOffline(p);
381-
__balloon_append(p);
378+
balloon_append(p);
382379
}
383380
mutex_unlock(&balloon_mutex);
384381
}
@@ -444,7 +441,6 @@ static enum bp_state increase_reservation(unsigned long nr_pages)
444441
xenmem_reservation_va_mapping_update(1, &page, &frame_list[i]);
445442

446443
/* Relinquish the page back to the allocator. */
447-
__ClearPageOffline(page);
448444
free_reserved_page(page);
449445
}
450446

@@ -471,7 +467,6 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp)
471467
state = BP_EAGAIN;
472468
break;
473469
}
474-
__SetPageOffline(page);
475470
adjust_managed_page_count(page, -1);
476471
xenmem_reservation_scrub_page(page);
477472
list_add(&page->lru, &pages);
@@ -611,7 +606,6 @@ int alloc_xenballooned_pages(int nr_pages, struct page **pages)
611606
while (pgno < nr_pages) {
612607
page = balloon_retrieve(true);
613608
if (page) {
614-
__ClearPageOffline(page);
615609
pages[pgno++] = page;
616610
#ifdef CONFIG_XEN_HAVE_PVMMU
617611
/*
@@ -653,10 +647,8 @@ void free_xenballooned_pages(int nr_pages, struct page **pages)
653647
mutex_lock(&balloon_mutex);
654648

655649
for (i = 0; i < nr_pages; i++) {
656-
if (pages[i]) {
657-
__SetPageOffline(pages[i]);
650+
if (pages[i])
658651
balloon_append(pages[i]);
659-
}
660652
}
661653

662654
balloon_stats.target_unpopulated -= nr_pages;
@@ -674,7 +666,6 @@ static void __init balloon_add_region(unsigned long start_pfn,
674666
unsigned long pages)
675667
{
676668
unsigned long pfn, extra_pfn_end;
677-
struct page *page;
678669

679670
/*
680671
* If the amount of usable memory has been limited (e.g., with
@@ -684,11 +675,10 @@ static void __init balloon_add_region(unsigned long start_pfn,
684675
extra_pfn_end = min(max_pfn, start_pfn + pages);
685676

686677
for (pfn = start_pfn; pfn < extra_pfn_end; pfn++) {
687-
page = pfn_to_page(pfn);
688678
/* totalram_pages and totalhigh_pages do not
689679
include the boot-time balloon extension, so
690680
don't subtract from it. */
691-
__balloon_append(page);
681+
balloon_append(pfn_to_page(pfn));
692682
}
693683

694684
balloon_stats.total_pages += extra_pfn_end - start_pfn;

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+
}

0 commit comments

Comments
 (0)