11.11Sjdolecek/* $NetBSD: granttables.h,v 1.11 2020/04/05 17:48:30 jdolecek Exp $ */
21.1Sbouyer/*
31.1Sbouyer * Copyright (c) 2006 Manuel Bouyer.
41.1Sbouyer *
51.1Sbouyer * Redistribution and use in source and binary forms, with or without
61.1Sbouyer * modification, are permitted provided that the following conditions
71.1Sbouyer * are met:
81.1Sbouyer * 1. Redistributions of source code must retain the above copyright
91.1Sbouyer *    notice, this list of conditions and the following disclaimer.
101.1Sbouyer * 2. Redistributions in binary form must reproduce the above copyright
111.1Sbouyer *    notice, this list of conditions and the following disclaimer in the
121.1Sbouyer *    documentation and/or other materials provided with the distribution.
131.1Sbouyer *
141.1Sbouyer * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
151.1Sbouyer * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
161.1Sbouyer * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
171.1Sbouyer * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
181.1Sbouyer * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
191.1Sbouyer * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
201.1Sbouyer * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
211.1Sbouyer * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
221.1Sbouyer * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
231.1Sbouyer * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
241.1Sbouyer *
251.1Sbouyer */
261.1Sbouyer
271.1Sbouyer/* Interface to the Xen Grant tables */
281.10Scherry#include <xen/include/public/xen.h>
291.10Scherry#include <xen/include/public/grant_table.h>
301.1Sbouyer
311.1Sbouyervoid xengnt_init(void);
321.1Sbouyer
331.8Sjym/* suspend/resume grant table, for save/restore operations */
341.8Sjymbool xengnt_suspend(void);
351.8Sjymbool xengnt_resume(void);
361.8Sjym
371.1Sbouyer/*
381.1Sbouyer * grant access to a remote domain. Returns a handle on the allocated grant
391.1Sbouyer * entry in table in grant_ref_t *.
401.1Sbouyer */
411.1Sbouyerint xengnt_grant_access(domid_t, paddr_t, int, grant_ref_t *);
421.1Sbouyer
431.1Sbouyer/*
441.1Sbouyer * Revoke access. Caller is responsible to ensure that the grant entry is
451.1Sbouyer * not referenced any more.
461.1Sbouyer */
471.1Sbouyervoid xengnt_revoke_access(grant_ref_t);
481.1Sbouyer
491.1Sbouyer/*
501.1Sbouyer * Query grant status (i.e. if remote has a valid mapping to this grant).
511.5Sjym * Returns GTF_reading | GTF_writing (0 if remote does not use it anymore).
521.1Sbouyer */
531.1Sbouyerint xengnt_status(grant_ref_t);
54