xen: Fixes for 4.13-rc5
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABAgAGBQJZjs9BAAoJELDendYovxMvXXAH/j3pdoshQbflSUBsDAkybhv5 BVe7+bhtwnoawcjCpXq27SMY3qG/YWnATW28XjxBCoe3t7StNcJr5QGXTWMnTjwN f/YA0aqtCoLp9JhovTi9WTTCf1/I9CKYFBdCaAmLkDeMudyifZkbXiDbDe0UZmAc UJt0Jx8KrdMGkuRVp92049calluv+PDHO7gUpGpzoHDJ0IXc1cH9caHTbL+LhioY o0qqQOz9FnJQIvqSGYRkjXudmGwHYCr61yXvWhwqa4PE3Tzss2ckGtzZPLI8s1QN p5m01FbIMQKjLbwpQZaRWmGxSzY2vYxf/TShK8eIsBfRYxsR4d7cXULC2vIJGFI= =jiAk -----END PGP SIGNATURE----- Merge tag 'for-linus-4.13b-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip Pull xen fixes from Juergen Gross: "Some fixes for Xen: - a fix for a regression introduced in 4.13 for a Xen HVM-guest configured with KASLR - a fix for a possible deadlock in the xenbus driver when booting the system - a fix for lost interrupts in Xen guests" * tag 'for-linus-4.13b-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: xen/events: Fix interrupt lost during irq_disable and irq_enable xen: avoid deadlock in xenbus xen: fix hvm guest with kaslr enabled xen: split up xen_hvm_init_shared_info() x86: provide an init_mem_mapping hypervisor hook
This commit is contained in:
Коммит
043cd07c55
|
@ -43,6 +43,9 @@ struct hypervisor_x86 {
|
|||
|
||||
/* pin current vcpu to specified physical cpu (run rarely) */
|
||||
void (*pin_vcpu)(int);
|
||||
|
||||
/* called during init_mem_mapping() to setup early mappings. */
|
||||
void (*init_mem_mapping)(void);
|
||||
};
|
||||
|
||||
extern const struct hypervisor_x86 *x86_hyper;
|
||||
|
@ -57,8 +60,15 @@ extern const struct hypervisor_x86 x86_hyper_kvm;
|
|||
extern void init_hypervisor_platform(void);
|
||||
extern bool hypervisor_x2apic_available(void);
|
||||
extern void hypervisor_pin_vcpu(int cpu);
|
||||
|
||||
static inline void hypervisor_init_mem_mapping(void)
|
||||
{
|
||||
if (x86_hyper && x86_hyper->init_mem_mapping)
|
||||
x86_hyper->init_mem_mapping();
|
||||
}
|
||||
#else
|
||||
static inline void init_hypervisor_platform(void) { }
|
||||
static inline bool hypervisor_x2apic_available(void) { return false; }
|
||||
static inline void hypervisor_init_mem_mapping(void) { }
|
||||
#endif /* CONFIG_HYPERVISOR_GUEST */
|
||||
#endif /* _ASM_X86_HYPERVISOR_H */
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <asm/dma.h> /* for MAX_DMA_PFN */
|
||||
#include <asm/microcode.h>
|
||||
#include <asm/kaslr.h>
|
||||
#include <asm/hypervisor.h>
|
||||
|
||||
/*
|
||||
* We need to define the tracepoints somewhere, and tlb.c
|
||||
|
@ -636,6 +637,8 @@ void __init init_mem_mapping(void)
|
|||
load_cr3(swapper_pg_dir);
|
||||
__flush_tlb_all();
|
||||
|
||||
hypervisor_init_mem_mapping();
|
||||
|
||||
early_memtest(0, max_pfn_mapped << PAGE_SHIFT);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <asm/setup.h>
|
||||
#include <asm/hypervisor.h>
|
||||
#include <asm/e820/api.h>
|
||||
#include <asm/early_ioremap.h>
|
||||
|
||||
#include <asm/xen/cpuid.h>
|
||||
#include <asm/xen/hypervisor.h>
|
||||
|
@ -21,38 +22,50 @@
|
|||
#include "mmu.h"
|
||||
#include "smp.h"
|
||||
|
||||
void __ref xen_hvm_init_shared_info(void)
|
||||
static unsigned long shared_info_pfn;
|
||||
|
||||
void xen_hvm_init_shared_info(void)
|
||||
{
|
||||
struct xen_add_to_physmap xatp;
|
||||
u64 pa;
|
||||
|
||||
if (HYPERVISOR_shared_info == &xen_dummy_shared_info) {
|
||||
/*
|
||||
* Search for a free page starting at 4kB physical address.
|
||||
* Low memory is preferred to avoid an EPT large page split up
|
||||
* by the mapping.
|
||||
* Starting below X86_RESERVE_LOW (usually 64kB) is fine as
|
||||
* the BIOS used for HVM guests is well behaved and won't
|
||||
* clobber memory other than the first 4kB.
|
||||
*/
|
||||
for (pa = PAGE_SIZE;
|
||||
!e820__mapped_all(pa, pa + PAGE_SIZE, E820_TYPE_RAM) ||
|
||||
memblock_is_reserved(pa);
|
||||
pa += PAGE_SIZE)
|
||||
;
|
||||
|
||||
memblock_reserve(pa, PAGE_SIZE);
|
||||
HYPERVISOR_shared_info = __va(pa);
|
||||
}
|
||||
|
||||
xatp.domid = DOMID_SELF;
|
||||
xatp.idx = 0;
|
||||
xatp.space = XENMAPSPACE_shared_info;
|
||||
xatp.gpfn = virt_to_pfn(HYPERVISOR_shared_info);
|
||||
xatp.gpfn = shared_info_pfn;
|
||||
if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp))
|
||||
BUG();
|
||||
}
|
||||
|
||||
static void __init reserve_shared_info(void)
|
||||
{
|
||||
u64 pa;
|
||||
|
||||
/*
|
||||
* Search for a free page starting at 4kB physical address.
|
||||
* Low memory is preferred to avoid an EPT large page split up
|
||||
* by the mapping.
|
||||
* Starting below X86_RESERVE_LOW (usually 64kB) is fine as
|
||||
* the BIOS used for HVM guests is well behaved and won't
|
||||
* clobber memory other than the first 4kB.
|
||||
*/
|
||||
for (pa = PAGE_SIZE;
|
||||
!e820__mapped_all(pa, pa + PAGE_SIZE, E820_TYPE_RAM) ||
|
||||
memblock_is_reserved(pa);
|
||||
pa += PAGE_SIZE)
|
||||
;
|
||||
|
||||
shared_info_pfn = PHYS_PFN(pa);
|
||||
|
||||
memblock_reserve(pa, PAGE_SIZE);
|
||||
HYPERVISOR_shared_info = early_memremap(pa, PAGE_SIZE);
|
||||
}
|
||||
|
||||
static void __init xen_hvm_init_mem_mapping(void)
|
||||
{
|
||||
early_memunmap(HYPERVISOR_shared_info, PAGE_SIZE);
|
||||
HYPERVISOR_shared_info = __va(PFN_PHYS(shared_info_pfn));
|
||||
}
|
||||
|
||||
static void __init init_hvm_pv_info(void)
|
||||
{
|
||||
int major, minor;
|
||||
|
@ -153,6 +166,7 @@ static void __init xen_hvm_guest_init(void)
|
|||
|
||||
init_hvm_pv_info();
|
||||
|
||||
reserve_shared_info();
|
||||
xen_hvm_init_shared_info();
|
||||
|
||||
/*
|
||||
|
@ -218,5 +232,6 @@ const struct hypervisor_x86 x86_hyper_xen_hvm = {
|
|||
.init_platform = xen_hvm_guest_init,
|
||||
.pin_vcpu = xen_pin_vcpu,
|
||||
.x2apic_available = xen_x2apic_para_available,
|
||||
.init_mem_mapping = xen_hvm_init_mem_mapping,
|
||||
};
|
||||
EXPORT_SYMBOL(x86_hyper_xen_hvm);
|
||||
|
|
|
@ -574,7 +574,7 @@ static void shutdown_pirq(struct irq_data *data)
|
|||
|
||||
static void enable_pirq(struct irq_data *data)
|
||||
{
|
||||
startup_pirq(data);
|
||||
enable_dynirq(data);
|
||||
}
|
||||
|
||||
static void disable_pirq(struct irq_data *data)
|
||||
|
|
|
@ -857,6 +857,8 @@ static int xenwatch_thread(void *unused)
|
|||
struct list_head *ent;
|
||||
struct xs_watch_event *event;
|
||||
|
||||
xenwatch_pid = current->pid;
|
||||
|
||||
for (;;) {
|
||||
wait_event_interruptible(watch_events_waitq,
|
||||
!list_empty(&watch_events));
|
||||
|
@ -925,7 +927,6 @@ int xs_init(void)
|
|||
task = kthread_run(xenwatch_thread, NULL, "xenwatch");
|
||||
if (IS_ERR(task))
|
||||
return PTR_ERR(task);
|
||||
xenwatch_pid = task->pid;
|
||||
|
||||
/* shutdown watches for kexec boot */
|
||||
xs_reset_watches();
|
||||
|
|
Загрузка…
Ссылка в новой задаче