@@ -161,4 +161,82 @@ struct xen_remove_from_physmap {
161161typedef struct xen_remove_from_physmap xen_remove_from_physmap_t ;
162162DEFINE_XEN_GUEST_HANDLE (xen_remove_from_physmap_t );
163163
164+ /*
165+ * Get the pages for a particular guest resource, so that they can be
166+ * mapped directly by a tools domain.
167+ */
168+ #define XENMEM_acquire_resource 28
169+ struct xen_mem_acquire_resource {
170+ /* IN - The domain whose resource is to be mapped */
171+ domid_t domid ;
172+ /* IN - the type of resource */
173+ uint16_t type ;
174+
175+ #define XENMEM_resource_ioreq_server 0
176+ #define XENMEM_resource_grant_table 1
177+ #define XENMEM_resource_vmtrace_buf 2
178+
179+ /*
180+ * IN - a type-specific resource identifier, which must be zero
181+ * unless stated otherwise.
182+ *
183+ * type == XENMEM_resource_ioreq_server -> id == ioreq server id
184+ * type == XENMEM_resource_grant_table -> id defined below
185+ */
186+ uint32_t id ;
187+
188+ #define XENMEM_resource_grant_table_id_shared 0
189+ #define XENMEM_resource_grant_table_id_status 1
190+
191+ /*
192+ * IN/OUT
193+ *
194+ * As an IN parameter number of frames of the resource to be mapped.
195+ * This value may be updated over the course of the operation.
196+ *
197+ * When frame_list is NULL and nr_frames is 0, this is interpreted as a
198+ * request for the size of the resource, which shall be returned in the
199+ * nr_frames field.
200+ *
201+ * The size of a resource will never be zero, but a nonzero result doesn't
202+ * guarantee that a subsequent mapping request will be successful. There
203+ * are further type/id specific constraints which may change between the
204+ * two calls.
205+ */
206+ uint32_t nr_frames ;
207+ /*
208+ * Padding field, must be zero on input.
209+ * In a previous version this was an output field with the lowest bit
210+ * named XENMEM_rsrc_acq_caller_owned. Future versions of this interface
211+ * will not reuse this bit as an output with the field being zero on
212+ * input.
213+ */
214+ uint32_t pad ;
215+ /*
216+ * IN - the index of the initial frame to be mapped. This parameter
217+ * is ignored if nr_frames is 0. This value may be updated
218+ * over the course of the operation.
219+ */
220+ uint64_t frame ;
221+
222+ #define XENMEM_resource_ioreq_server_frame_bufioreq 0
223+ #define XENMEM_resource_ioreq_server_frame_ioreq (n ) (1 + (n))
224+
225+ /*
226+ * IN/OUT - If the tools domain is PV then, upon return, frame_list
227+ * will be populated with the MFNs of the resource.
228+ * If the tools domain is HVM then it is expected that, on
229+ * entry, frame_list will be populated with a list of GFNs
230+ * that will be mapped to the MFNs of the resource.
231+ * If -EIO is returned then the frame_list has only been
232+ * partially mapped and it is up to the caller to unmap all
233+ * the GFNs.
234+ * This parameter may be NULL if nr_frames is 0. This
235+ * value may be updated over the course of the operation.
236+ */
237+ XEN_GUEST_HANDLE (xen_pfn_t ) frame_list ;
238+ };
239+ typedef struct xen_mem_acquire_resource xen_mem_acquire_resource_t ;
240+ DEFINE_XEN_GUEST_HANDLE (xen_mem_acquire_resource_t );
241+
164242#endif /* __XEN_PUBLIC_MEMORY_H__ */
0 commit comments