[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen stable-4.10] x86/guest: map shared_info page
commit efa15c993b600e9636cd091c626ee0c989afc62f Author: Roger Pau Monne <roger.pau@xxxxxxxxxx> AuthorDate: Tue Jan 9 11:19:44 2018 +0000 Commit: Roger Pau Monne <roger.pau@xxxxxxxxxx> CommitDate: Thu Jan 11 17:51:19 2018 +0000 x86/guest: map shared_info page Use an unpopulated PFN in order to map it. Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxx> Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- Changes since v1: - Use an unpopulated PFN to map the shared_info page. - Mask all event channels. - Report XENMEM_add_to_physmap error code in case of failure. --- xen/arch/x86/guest/xen.c | 27 +++++++++++++++++++++++++++ xen/include/asm-x86/fixmap.h | 3 +++ xen/include/asm-x86/guest/xen.h | 5 +++++ 3 files changed, 35 insertions(+) diff --git a/xen/arch/x86/guest/xen.c b/xen/arch/x86/guest/xen.c index abf53ebbc6..f62f93af16 100644 --- a/xen/arch/x86/guest/xen.c +++ b/xen/arch/x86/guest/xen.c @@ -77,6 +77,31 @@ void __init probe_hypervisor(void) xen_guest = true; } +static void map_shared_info(void) +{ + mfn_t mfn; + struct xen_add_to_physmap xatp = { + .domid = DOMID_SELF, + .space = XENMAPSPACE_shared_info, + }; + unsigned int i; + unsigned long rc; + + if ( hypervisor_alloc_unused_page(&mfn) ) + panic("unable to reserve shared info memory page"); + + xatp.gpfn = mfn_x(mfn); + rc = xen_hypercall_memory_op(XENMEM_add_to_physmap, &xatp); + if ( rc ) + panic("failed to map shared_info page: %ld", rc); + + set_fixmap(FIX_XEN_SHARED_INFO, mfn_x(mfn) << PAGE_SHIFT); + + /* Mask all upcalls */ + for ( i = 0; i < ARRAY_SIZE(XEN_shared_info->evtchn_mask); i++ ) + write_atomic(&XEN_shared_info->evtchn_mask[i], ~0ul); +} + static void __init init_memmap(void) { unsigned int i; @@ -109,6 +134,8 @@ static void __init init_memmap(void) void __init hypervisor_setup(void) { init_memmap(); + + map_shared_info(); } int hypervisor_alloc_unused_page(mfn_t *mfn) diff --git a/xen/include/asm-x86/fixmap.h b/xen/include/asm-x86/fixmap.h index 51b0e7e945..ded4ddf21b 100644 --- a/xen/include/asm-x86/fixmap.h +++ b/xen/include/asm-x86/fixmap.h @@ -45,6 +45,9 @@ enum fixed_addresses { FIX_COM_BEGIN, FIX_COM_END, FIX_EHCI_DBGP, +#ifdef CONFIG_XEN_GUEST + FIX_XEN_SHARED_INFO, +#endif /* CONFIG_XEN_GUEST */ /* Everything else should go further down. */ FIX_APIC_BASE, FIX_IO_APIC_BASE_0, diff --git a/xen/include/asm-x86/guest/xen.h b/xen/include/asm-x86/guest/xen.h index 427837797b..f25ad4241b 100644 --- a/xen/include/asm-x86/guest/xen.h +++ b/xen/include/asm-x86/guest/xen.h @@ -21,6 +21,11 @@ #include <xen/types.h> +#include <asm/e820.h> +#include <asm/fixmap.h> + +#define XEN_shared_info ((struct shared_info *)fix_to_virt(FIX_XEN_SHARED_INFO)) + #ifdef CONFIG_XEN_GUEST extern bool xen_guest; -- generated by git-patchbot for /home/xen/git/xen.git#stable-4.10 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |