Lines Matching +full:1 +full:- +full:a
1 /* SPDX-License-Identifier: MIT */
7 * page-ownership transfers.
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 * Copyright (c) 2004, K A Fraser
38 * Xen's grant tables provide a generic mechanism to memory sharing
42 * Each domain has its own grant table. This is a data structure that
45 * table are identified by grant references. A grant reference is an
46 * integer, which indexes into the grant table. It acts as a
50 * This capability-based system allows shared-memory communications
51 * between unprivileged domains. A grant reference also encapsulates
52 * the details of a shared page, removing the need for a domain to
53 * know the real machine address of a page it is sharing. This makes
62 /* Some rough guidelines on accessing and updating grant-table entries
63 * in a concurrency-safe manner. For more information, Linux contains a
65 …* http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=drivers/xen/grant-table.c;…
67 * NB. WMB is a no-op on current-generation x86 processors. However, a
70 * Introducing a valid entry into the grant table:
71 * 1. Write ent->domid.
72 * 2. Write ent->frame:
74 * GTF_accept_transfer: Pseudo-phys frame slot being filled by new
77 * 4. Write ent->flags, inc. valid type.
80 * 1. flags = ent->flags.
82 * 3. Check result of SMP-safe CMPXCHG(&ent->flags, flags, 0).
83 * NB. No need for WMB as reuse of entry is control-dependent on success of
84 * step 3, and all architectures guarantee ordering of ctrl-dep writes.
86 * Invalidating an in-use GTF_permit_access entry:
88 * which can set a timeout on the use of a grant entry and take necessary
92 * 1. flags = ent->flags.
94 * 3. Check result of SMP-safe CMPXCHG(&ent->flags, flags, 0).
95 * NB. No need for WMB as reuse of entry is control-dependent on success of
96 * step 3, and all architectures guarantee ordering of ctrl-dep writes.
101 * ent->flags).
103 * Invalidating a committed GTF_accept_transfer entry:
104 * 1. Wait for (ent->flags & GTF_transfer_completed).
106 * Changing a GTF_permit_access from writable to read-only:
107 * Use SMP-safe CMPXCHG to set GTF_readonly, while checking !GTF_writing.
109 * Changing a GTF_permit_access from read-only to writable:
110 * Use SMP-safe bit-setting instruction.
114 * Reference to a grant entry in a specified domain's grant table.
119 * A grant table comprises a packed array of grant entries in one or more
120 * page frames shared between Xen and a guest.
126 * Version 1 of the grant table entry structure is maintained purely
142 * (non-translated guests only). [XEN]
149 * version changes and may be pre-populated at domain creation by tools.
153 #define GNTTAB_RESERVED_XENSTORE 1
161 * GTF_transitive: Allow @domid to transitively access a subrange of
165 #define GTF_permit_access (1U << 0)
172 * GTF_readonly: Restrict @domid to read-only mappings and accesses. [GST]
178 * GTF_sub_page: Grant access to only a subrange of the page. @domid
183 #define GTF_readonly (1U << _GTF_readonly)
185 #define GTF_reading (1U << _GTF_reading)
187 #define GTF_writing (1U << _GTF_writing)
189 #define GTF_PWT (1U << _GTF_PWT)
191 #define GTF_PCD (1U << _GTF_PCD)
193 #define GTF_PAT (1U << _GTF_PAT)
195 #define GTF_sub_page (1U << _GTF_sub_page)
200 * to transferring ownership of a page frame. When a guest sees this flag
203 * GTF_transfer_completed: It is safe for the guest to spin-wait on this flag
205 * address, followed by ORing this flag, in a timely manner.
208 #define GTF_transfer_committed (1U << _GTF_transfer_committed)
210 #define GTF_transfer_completed (1U << _GTF_transfer_completed)
222 * @args points to an array of a per-command data structure. The array
228 #define GNTTABOP_unmap_grant_ref 1
245 * Handle to track a mapping created via a grant reference.
251 * by devices and/or host CPUs. If successful, <handle> is a tracking number
253 * is a negative status code.
255 * 1. If GNTMAP_device_map is specified then <dev_bus_addr> is the address
257 * 2. If GNTMAP_host_map is specified then a mapping will be added at
258 * either a host virtual address in the current address space, or at
259 * a PTE at the specified machine address. The type of mapping to
262 * 3. Mappings should only be destroyed via GNTTABOP_unmap_grant_ref. If a
281 * GNTTABOP_unmap_grant_ref: Destroy one or more grant-reference mappings
283 * field is ignored. If non-zero, they must refer to a device/host mapping
286 * 1. The call may fail in an undefined manner if either mapping is not
288 * 3. After executing a batch of unmaps, it is guaranteed that no stale
303 * GNTTABOP_setup_table: Set up a grant table for <dom> comprising at least
307 * 1. <dom> may be specified as DOMID_SELF.
308 * 2. Only a sufficiently-privileged domain may specify <dom> != DOMID_SELF.
309 * 3. Xen may not support more than a single grant-table page per domain.
334 #define GNTMAP_device_map (1<<_GNTMAP_device_map)
336 #define _GNTMAP_host_map (1)
337 #define GNTMAP_host_map (1<<_GNTMAP_host_map)
338 /* Accesses to the granted frame will be restricted to read-only access. */
340 #define GNTMAP_readonly (1<<_GNTMAP_readonly)
344 * 1 => The host mapping is usable by guest OS + current application.
347 #define GNTMAP_application_map (1<<_GNTMAP_application_map)
351 * 0 => This map request contains a host virtual address.
352 * 1 => This map request contains the machine address of the PTE to update.
355 #define GNTMAP_contains_pte (1<<_GNTMAP_contains_pte)
365 * Values for error status returns. All errors are -ve.
369 #define GNTST_general_error (-1) /* General undefined error */
370 #define GNTST_bad_domain (-2) /* Unrecognsed domain id */
371 #define GNTST_bad_gntref (-3) /* Unrecognised or inappropriate gntref */
372 #define GNTST_bad_handle (-4) /* Unrecognised or inappropriate handle */
373 #define GNTST_bad_virt_addr (-5) /* Inappropriate virtual address to map */
374 #define GNTST_bad_dev_addr (-6) /* Inappropriate device address to unmap */
375 #define GNTST_no_device_space (-7) /* Out of space in I/O MMU */
376 #define GNTST_permission_denied (-8) /* Not enough privilege for operation */
377 #define GNTST_bad_page (-9) /* Specified page was invalid for op */
378 #define GNTST_bad_copy_arg (-10) /* copy arguments cross page boundary */
379 #define GNTST_address_too_big (-11) /* transfer page address too large */
380 #define GNTST_eagain (-12) /* Operation not done; try again */