Skip to content

Commit

Permalink
Merge tag 'for-linus-5.4-rc2-tag' of git://git.kernel.org/pub/scm/lin…
Browse files Browse the repository at this point in the history
…ux/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
  • Loading branch information
torvalds committed Oct 4, 2019
2 parents e524d16 + a8fabb3 commit 50dfd03
Show file tree
Hide file tree
Showing 12 changed files with 79 additions and 139 deletions.
6 changes: 0 additions & 6 deletions arch/arm/include/asm/xen/xen-ops.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/arm/xen/Makefile
Original file line number Diff line number Diff line change
@@ -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
28 changes: 0 additions & 28 deletions arch/arm/xen/efi.c

This file was deleted.

3 changes: 1 addition & 2 deletions arch/arm/xen/enlighten.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -437,7 +436,7 @@ EXPORT_SYMBOL_GPL(HYPERVISOR_memory_op);
EXPORT_SYMBOL_GPL(HYPERVISOR_physdev_op);
EXPORT_SYMBOL_GPL(HYPERVISOR_vcpu_op);
EXPORT_SYMBOL_GPL(HYPERVISOR_tmem_op);
EXPORT_SYMBOL_GPL(HYPERVISOR_platform_op);
EXPORT_SYMBOL_GPL(HYPERVISOR_platform_op_raw);
EXPORT_SYMBOL_GPL(HYPERVISOR_multicall);
EXPORT_SYMBOL_GPL(HYPERVISOR_vm_assist);
EXPORT_SYMBOL_GPL(HYPERVISOR_dm_op);
Expand Down
5 changes: 4 additions & 1 deletion arch/arm/xen/mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ unsigned long xen_get_swiotlb_free_pages(unsigned int order)

for_each_memblock(memory, reg) {
if (reg->base < (phys_addr_t)0xffffffff) {
flags |= __GFP_DMA;
if (IS_ENABLED(CONFIG_ZONE_DMA32))
flags |= __GFP_DMA32;
else
flags |= __GFP_DMA;
break;
}
}
Expand Down
7 changes: 0 additions & 7 deletions arch/arm64/include/asm/xen/xen-ops.h

This file was deleted.

1 change: 0 additions & 1 deletion arch/arm64/xen/Makefile
Original file line number Diff line number Diff line change
@@ -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)
14 changes: 1 addition & 13 deletions arch/x86/xen/efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +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.query_variable_info = 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;
Expand Down
24 changes: 7 additions & 17 deletions drivers/xen/balloon.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,10 @@ static DECLARE_DELAYED_WORK(balloon_worker, balloon_process);
(GFP_HIGHUSER | __GFP_NOWARN | __GFP_NORETRY | __GFP_NOMEMALLOC)

/* balloon_append: add the given page to the balloon. */
static void __balloon_append(struct page *page)
static void balloon_append(struct page *page)
{
__SetPageOffline(page);

/* Lowmem is re-populated first, so highmem pages go at list tail. */
if (PageHighMem(page)) {
list_add_tail(&page->lru, &ballooned_pages);
Expand All @@ -169,11 +171,6 @@ static void __balloon_append(struct page *page)
wake_up(&balloon_wq);
}

static void balloon_append(struct page *page)
{
__balloon_append(page);
}

/* balloon_retrieve: rescue a page from the balloon, if it is not empty. */
static struct page *balloon_retrieve(bool require_lowmem)
{
Expand All @@ -192,6 +189,7 @@ static struct page *balloon_retrieve(bool require_lowmem)
else
balloon_stats.balloon_low--;

__ClearPageOffline(page);
return page;
}

Expand Down Expand Up @@ -377,8 +375,7 @@ static void xen_online_page(struct page *page, unsigned int order)
for (i = 0; i < size; i++) {
p = pfn_to_page(start_pfn + i);
__online_page_set_limits(p);
__SetPageOffline(p);
__balloon_append(p);
balloon_append(p);
}
mutex_unlock(&balloon_mutex);
}
Expand Down Expand Up @@ -444,7 +441,6 @@ static enum bp_state increase_reservation(unsigned long nr_pages)
xenmem_reservation_va_mapping_update(1, &page, &frame_list[i]);

/* Relinquish the page back to the allocator. */
__ClearPageOffline(page);
free_reserved_page(page);
}

Expand All @@ -471,7 +467,6 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp)
state = BP_EAGAIN;
break;
}
__SetPageOffline(page);
adjust_managed_page_count(page, -1);
xenmem_reservation_scrub_page(page);
list_add(&page->lru, &pages);
Expand Down Expand Up @@ -611,7 +606,6 @@ int alloc_xenballooned_pages(int nr_pages, struct page **pages)
while (pgno < nr_pages) {
page = balloon_retrieve(true);
if (page) {
__ClearPageOffline(page);
pages[pgno++] = page;
#ifdef CONFIG_XEN_HAVE_PVMMU
/*
Expand Down Expand Up @@ -653,10 +647,8 @@ void free_xenballooned_pages(int nr_pages, struct page **pages)
mutex_lock(&balloon_mutex);

for (i = 0; i < nr_pages; i++) {
if (pages[i]) {
__SetPageOffline(pages[i]);
if (pages[i])
balloon_append(pages[i]);
}
}

balloon_stats.target_unpopulated -= nr_pages;
Expand All @@ -674,7 +666,6 @@ static void __init balloon_add_region(unsigned long start_pfn,
unsigned long pages)
{
unsigned long pfn, extra_pfn_end;
struct page *page;

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

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

balloon_stats.total_pages += extra_pfn_end - start_pfn;
Expand Down
84 changes: 47 additions & 37 deletions drivers/xen/efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

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

efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
static efi_status_t xen_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
{
struct xen_platform_op op = INIT_EFI_OP(get_time);

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

return efi_data(op).status;
}
EXPORT_SYMBOL_GPL(xen_efi_get_time);

efi_status_t xen_efi_set_time(efi_time_t *tm)
static efi_status_t xen_efi_set_time(efi_time_t *tm)
{
struct xen_platform_op op = INIT_EFI_OP(set_time);

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

return efi_data(op).status;
}
EXPORT_SYMBOL_GPL(xen_efi_set_time);

efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending,
efi_time_t *tm)
static efi_status_t xen_efi_get_wakeup_time(efi_bool_t *enabled,
efi_bool_t *pending,
efi_time_t *tm)
{
struct xen_platform_op op = INIT_EFI_OP(get_wakeup_time);

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

return efi_data(op).status;
}
EXPORT_SYMBOL_GPL(xen_efi_get_wakeup_time);

efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
static efi_status_t xen_efi_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
{
struct xen_platform_op op = INIT_EFI_OP(set_wakeup_time);

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

return efi_data(op).status;
}
EXPORT_SYMBOL_GPL(xen_efi_set_wakeup_time);

efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor,
u32 *attr, unsigned long *data_size,
void *data)
static efi_status_t xen_efi_get_variable(efi_char16_t *name, efi_guid_t *vendor,
u32 *attr, unsigned long *data_size,
void *data)
{
struct xen_platform_op op = INIT_EFI_OP(get_variable);

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

return efi_data(op).status;
}
EXPORT_SYMBOL_GPL(xen_efi_get_variable);

efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
efi_char16_t *name,
efi_guid_t *vendor)
static efi_status_t xen_efi_get_next_variable(unsigned long *name_size,
efi_char16_t *name,
efi_guid_t *vendor)
{
struct xen_platform_op op = INIT_EFI_OP(get_next_variable_name);

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

return efi_data(op).status;
}
EXPORT_SYMBOL_GPL(xen_efi_get_next_variable);

efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor,
u32 attr, unsigned long data_size,
void *data)
static efi_status_t xen_efi_set_variable(efi_char16_t *name, efi_guid_t *vendor,
u32 attr, unsigned long data_size,
void *data)
{
struct xen_platform_op op = INIT_EFI_OP(set_variable);

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

return efi_data(op).status;
}
EXPORT_SYMBOL_GPL(xen_efi_set_variable);

efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space,
u64 *remaining_space,
u64 *max_variable_size)
static efi_status_t xen_efi_query_variable_info(u32 attr, u64 *storage_space,
u64 *remaining_space,
u64 *max_variable_size)
{
struct xen_platform_op op = INIT_EFI_OP(query_variable_info);

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

return efi_data(op).status;
}
EXPORT_SYMBOL_GPL(xen_efi_query_variable_info);

efi_status_t xen_efi_get_next_high_mono_count(u32 *count)
static efi_status_t xen_efi_get_next_high_mono_count(u32 *count)
{
struct xen_platform_op op = INIT_EFI_OP(get_next_high_monotonic_count);

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

return efi_data(op).status;
}
EXPORT_SYMBOL_GPL(xen_efi_get_next_high_mono_count);

efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
unsigned long count, unsigned long sg_list)
static efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules,
unsigned long count, unsigned long sg_list)
{
struct xen_platform_op op = INIT_EFI_OP(update_capsule);

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

return efi_data(op).status;
}
EXPORT_SYMBOL_GPL(xen_efi_update_capsule);

efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
unsigned long count, u64 *max_size,
int *reset_type)
static efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules,
unsigned long count, u64 *max_size, int *reset_type)
{
struct xen_platform_op op = INIT_EFI_OP(query_capsule_capabilities);

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

return efi_data(op).status;
}
EXPORT_SYMBOL_GPL(xen_efi_query_capsule_caps);

void xen_efi_reset_system(int reset_type, efi_status_t status,
unsigned long data_size, efi_char16_t *data)
static void xen_efi_reset_system(int reset_type, efi_status_t status,
unsigned long data_size, efi_char16_t *data)
{
switch (reset_type) {
case EFI_RESET_COLD:
Expand All @@ -281,4 +270,25 @@ 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;
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;
}
Loading

0 comments on commit 50dfd03

Please sign in to comment.