1*c24c993fSbouyer /* $NetBSD: xen_shm.h,v 1.12 2020/04/25 15:26:17 bouyer Exp $ */ 2e9666f30Sbouyer 3e9666f30Sbouyer /* 4e9666f30Sbouyer * Copyright (c) 2005 Manuel Bouyer. 5e9666f30Sbouyer * 6e9666f30Sbouyer * Redistribution and use in source and binary forms, with or without 7e9666f30Sbouyer * modification, are permitted provided that the following conditions 8e9666f30Sbouyer * are met: 9e9666f30Sbouyer * 1. Redistributions of source code must retain the above copyright 10e9666f30Sbouyer * notice, this list of conditions and the following disclaimer. 11e9666f30Sbouyer * 2. Redistributions in binary form must reproduce the above copyright 12e9666f30Sbouyer * notice, this list of conditions and the following disclaimer in the 13e9666f30Sbouyer * documentation and/or other materials provided with the distribution. 14e9666f30Sbouyer * 15e9666f30Sbouyer * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16e9666f30Sbouyer * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17e9666f30Sbouyer * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18e9666f30Sbouyer * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19e9666f30Sbouyer * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20e9666f30Sbouyer * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21e9666f30Sbouyer * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22e9666f30Sbouyer * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23e9666f30Sbouyer * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24e9666f30Sbouyer * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25e9666f30Sbouyer * 26e9666f30Sbouyer */ 27e9666f30Sbouyer 28d1d1596eSbouyer #include "opt_xen.h" 290ac3367fStls 308d1b8859Sjdolecek #define XENSHM_MAX_PAGES_PER_REQUEST ((MAXPHYS + PAGE_SIZE) >> PAGE_SHIFT) 310ac3367fStls 32e9666f30Sbouyer /* 33e9666f30Sbouyer * Helper routines for the backend drivers. This implement the necessary 341c9ce81dSyamt * functions to map a bunch of pages from foreign domains in our kernel VM 35e9666f30Sbouyer * space, do I/O to it, and unmap it. 36e9666f30Sbouyer */ 37e9666f30Sbouyer 388d1b8859Sjdolecek int xen_shm_map(int, int, grant_ref_t *, vaddr_t, grant_handle_t *, int); 39b0631557Sbouyer void xen_shm_unmap(vaddr_t, int, grant_handle_t *); 40e9666f30Sbouyer 41e9666f30Sbouyer /* flags for xen_shm_map() */ 42d1d1596eSbouyer #define XSHM_RO 0x02 /* map the guest's memory read-only */ 43