diff options
Diffstat (limited to 'include/xen/interface/io/ring.h')
-rw-r--r-- | include/xen/interface/io/ring.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/xen/interface/io/ring.h b/include/xen/interface/io/ring.h index 7d28aff605c7..7dc685b4057d 100644 --- a/include/xen/interface/io/ring.h +++ b/include/xen/interface/io/ring.h | |||
@@ -181,6 +181,20 @@ struct __name##_back_ring { \ | |||
181 | #define RING_GET_REQUEST(_r, _idx) \ | 181 | #define RING_GET_REQUEST(_r, _idx) \ |
182 | (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].req)) | 182 | (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].req)) |
183 | 183 | ||
184 | /* | ||
185 | * Get a local copy of a request. | ||
186 | * | ||
187 | * Use this in preference to RING_GET_REQUEST() so all processing is | ||
188 | * done on a local copy that cannot be modified by the other end. | ||
189 | * | ||
190 | * Note that https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145 may cause this | ||
191 | * to be ineffective where _req is a struct which consists of only bitfields. | ||
192 | */ | ||
193 | #define RING_COPY_REQUEST(_r, _idx, _req) do { \ | ||
194 | /* Use volatile to force the copy into _req. */ \ | ||
195 | *(_req) = *(volatile typeof(_req))RING_GET_REQUEST(_r, _idx); \ | ||
196 | } while (0) | ||
197 | |||
184 | #define RING_GET_RESPONSE(_r, _idx) \ | 198 | #define RING_GET_RESPONSE(_r, _idx) \ |
185 | (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].rsp)) | 199 | (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].rsp)) |
186 | 200 | ||