/* * MMU operations common to all auto-translated physmap guests. * * Copyright (C) 2015 Citrix Systems R&D Ltd. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation; or, when distributed * separately from the Linux kernel or incorporated into other * software packages, subject to the following license: * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this source file (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, modify, * merge, publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ #include <linux/kernel.h> #include <linux/mm.h> #include <linux/slab.h> #include <linux/vmalloc.h> #include <asm/xen/hypercall.h> #include <asm/xen/hypervisor.h> #include <xen/xen.h> #include <xen/xen-ops.h> #include <xen/page.h> #include <xen/interface/xen.h> #include <xen/interface/memory.h> #include <xen/balloon.h> xen_gfn_fn_t; /* Break down the pages in 4KB chunk and call fn for each gfn */ static void xen_for_each_gfn(struct page **pages, unsigned nr_gfn, xen_gfn_fn_t fn, void *data) { … } struct remap_data { … }; static void setup_hparams(unsigned long gfn, void *data) { … } static int remap_pte_fn(pte_t *ptep, unsigned long addr, void *data) { … } int xen_xlate_remap_gfn_array(struct vm_area_struct *vma, unsigned long addr, xen_pfn_t *gfn, int nr, int *err_ptr, pgprot_t prot, unsigned domid, struct page **pages) { … } EXPORT_SYMBOL_GPL(…); static void unmap_gfn(unsigned long gfn, void *data) { … } int xen_xlate_unmap_gfn_range(struct vm_area_struct *vma, int nr, struct page **pages) { … } EXPORT_SYMBOL_GPL(…); struct map_balloon_pages { … }; static void setup_balloon_gfn(unsigned long gfn, void *data) { … } /** * xen_xlate_map_ballooned_pages - map a new set of ballooned pages * @gfns: returns the array of corresponding GFNs * @virt: returns the virtual address of the mapped region * @nr_grant_frames: number of GFNs * @return 0 on success, error otherwise * * This allocates a set of ballooned pages and maps them into the * kernel's address space. */ int __init xen_xlate_map_ballooned_pages(xen_pfn_t **gfns, void **virt, unsigned long nr_grant_frames) { … } struct remap_pfn { … }; static int remap_pfn_fn(pte_t *ptep, unsigned long addr, void *data) { … } /* Used by the privcmd module, but has to be built-in on ARM */ int xen_remap_vma_range(struct vm_area_struct *vma, unsigned long addr, unsigned long len) { … } EXPORT_SYMBOL_GPL(…);