xref: /dflybsd-src/sys/dev/drm/i915/gvt/hypercall.h (revision a85cb24f18e3804e75ab8bcda7692564d0563317)
11487f786SFrançois Tigeot /*
21487f786SFrançois Tigeot  * Copyright(c) 2011-2016 Intel Corporation. All rights reserved.
31487f786SFrançois Tigeot  *
41487f786SFrançois Tigeot  * Permission is hereby granted, free of charge, to any person obtaining a
51487f786SFrançois Tigeot  * copy of this software and associated documentation files (the "Software"),
61487f786SFrançois Tigeot  * to deal in the Software without restriction, including without limitation
71487f786SFrançois Tigeot  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
81487f786SFrançois Tigeot  * and/or sell copies of the Software, and to permit persons to whom the
91487f786SFrançois Tigeot  * Software is furnished to do so, subject to the following conditions:
101487f786SFrançois Tigeot  *
111487f786SFrançois Tigeot  * The above copyright notice and this permission notice (including the next
121487f786SFrançois Tigeot  * paragraph) shall be included in all copies or substantial portions of the
131487f786SFrançois Tigeot  * Software.
141487f786SFrançois Tigeot  *
151487f786SFrançois Tigeot  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
161487f786SFrançois Tigeot  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
171487f786SFrançois Tigeot  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
181487f786SFrançois Tigeot  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
191487f786SFrançois Tigeot  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
201487f786SFrançois Tigeot  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
211487f786SFrançois Tigeot  * SOFTWARE.
221e12ee3bSFrançois Tigeot  *
231e12ee3bSFrançois Tigeot  * Authors:
241e12ee3bSFrançois Tigeot  *    Eddie Dong <eddie.dong@intel.com>
251e12ee3bSFrançois Tigeot  *    Dexuan Cui
261e12ee3bSFrançois Tigeot  *    Jike Song <jike.song@intel.com>
271e12ee3bSFrançois Tigeot  *
281e12ee3bSFrançois Tigeot  * Contributors:
291e12ee3bSFrançois Tigeot  *    Zhi Wang <zhi.a.wang@intel.com>
301e12ee3bSFrançois Tigeot  *
311487f786SFrançois Tigeot  */
321487f786SFrançois Tigeot 
331487f786SFrançois Tigeot #ifndef _GVT_HYPERCALL_H_
341487f786SFrançois Tigeot #define _GVT_HYPERCALL_H_
351487f786SFrançois Tigeot 
361487f786SFrançois Tigeot /*
371487f786SFrançois Tigeot  * Specific GVT-g MPT modules function collections. Currently GVT-g supports
381487f786SFrançois Tigeot  * both Xen and KVM by providing dedicated hypervisor-related MPT modules.
391487f786SFrançois Tigeot  */
401487f786SFrançois Tigeot struct intel_gvt_mpt {
41*4be47400SFrançois Tigeot 	int (*host_init)(struct device *dev, void *gvt, const void *ops);
42*4be47400SFrançois Tigeot 	void (*host_exit)(struct device *dev, void *gvt);
431e12ee3bSFrançois Tigeot 	int (*attach_vgpu)(void *vgpu, unsigned long *handle);
441e12ee3bSFrançois Tigeot 	void (*detach_vgpu)(unsigned long handle);
451e12ee3bSFrançois Tigeot 	int (*inject_msi)(unsigned long handle, u32 addr, u16 data);
461e12ee3bSFrançois Tigeot 	unsigned long (*from_virt_to_mfn)(void *p);
471e12ee3bSFrançois Tigeot 	int (*set_wp_page)(unsigned long handle, u64 gfn);
481e12ee3bSFrançois Tigeot 	int (*unset_wp_page)(unsigned long handle, u64 gfn);
491e12ee3bSFrançois Tigeot 	int (*read_gpa)(unsigned long handle, unsigned long gpa, void *buf,
501e12ee3bSFrançois Tigeot 			unsigned long len);
511e12ee3bSFrançois Tigeot 	int (*write_gpa)(unsigned long handle, unsigned long gpa, void *buf,
521e12ee3bSFrançois Tigeot 			 unsigned long len);
531e12ee3bSFrançois Tigeot 	unsigned long (*gfn_to_mfn)(unsigned long handle, unsigned long gfn);
541e12ee3bSFrançois Tigeot 	int (*map_gfn_to_mfn)(unsigned long handle, unsigned long gfn,
55*4be47400SFrançois Tigeot 			      unsigned long mfn, unsigned int nr, bool map);
561e12ee3bSFrançois Tigeot 	int (*set_trap_area)(unsigned long handle, u64 start, u64 end,
571e12ee3bSFrançois Tigeot 			     bool map);
581487f786SFrançois Tigeot };
591487f786SFrançois Tigeot 
601487f786SFrançois Tigeot extern struct intel_gvt_mpt xengt_mpt;
611487f786SFrançois Tigeot extern struct intel_gvt_mpt kvmgt_mpt;
621487f786SFrançois Tigeot 
631487f786SFrançois Tigeot #endif /* _GVT_HYPERCALL_H_ */
64