diff options
| author | Michael S. Tsirkin <mst@redhat.com> | 2014-12-11 18:10:49 -0500 |
|---|---|---|
| committer | Michael S. Tsirkin <mst@redhat.com> | 2014-12-15 16:49:28 -0500 |
| commit | b9f7ac8c72894c19bf258a54ecaa708df4ffbe80 (patch) | |
| tree | 74d25a95bf300aed5f58c6a08a8faf561db13179 /include/linux | |
| parent | b97a8a90067896f99f0d636dbc2b89a953123fad (diff) | |
vringh: update for virtio 1.0 APIs
When switching everything over to virtio 1.0 memory access APIs,
I missed converting vringh.
Fortunately, it's straight-forward.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/vringh.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/include/linux/vringh.h b/include/linux/vringh.h index f696dd0b6472..a3fa537e717a 100644 --- a/include/linux/vringh.h +++ b/include/linux/vringh.h | |||
| @@ -24,12 +24,16 @@ | |||
| 24 | #ifndef _LINUX_VRINGH_H | 24 | #ifndef _LINUX_VRINGH_H |
| 25 | #define _LINUX_VRINGH_H | 25 | #define _LINUX_VRINGH_H |
| 26 | #include <uapi/linux/virtio_ring.h> | 26 | #include <uapi/linux/virtio_ring.h> |
| 27 | #include <linux/virtio_byteorder.h> | ||
| 27 | #include <linux/uio.h> | 28 | #include <linux/uio.h> |
| 28 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
| 29 | #include <asm/barrier.h> | 30 | #include <asm/barrier.h> |
| 30 | 31 | ||
| 31 | /* virtio_ring with information needed for host access. */ | 32 | /* virtio_ring with information needed for host access. */ |
| 32 | struct vringh { | 33 | struct vringh { |
| 34 | /* Everything is little endian */ | ||
| 35 | bool little_endian; | ||
| 36 | |||
| 33 | /* Guest publishes used event idx (note: we always do). */ | 37 | /* Guest publishes used event idx (note: we always do). */ |
| 34 | bool event_indices; | 38 | bool event_indices; |
| 35 | 39 | ||
| @@ -222,4 +226,33 @@ static inline void vringh_notify(struct vringh *vrh) | |||
| 222 | vrh->notify(vrh); | 226 | vrh->notify(vrh); |
| 223 | } | 227 | } |
| 224 | 228 | ||
| 229 | static inline u16 vringh16_to_cpu(const struct vringh *vrh, __virtio16 val) | ||
| 230 | { | ||
| 231 | return __virtio16_to_cpu(vrh->little_endian, val); | ||
| 232 | } | ||
| 233 | |||
| 234 | static inline __virtio16 cpu_to_vringh16(const struct vringh *vrh, u16 val) | ||
| 235 | { | ||
| 236 | return __cpu_to_virtio16(vrh->little_endian, val); | ||
| 237 | } | ||
| 238 | |||
| 239 | static inline u32 vringh32_to_cpu(const struct vringh *vrh, __virtio32 val) | ||
| 240 | { | ||
| 241 | return __virtio32_to_cpu(vrh->little_endian, val); | ||
| 242 | } | ||
| 243 | |||
| 244 | static inline __virtio32 cpu_to_vringh32(const struct vringh *vrh, u32 val) | ||
| 245 | { | ||
| 246 | return __cpu_to_virtio32(vrh->little_endian, val); | ||
| 247 | } | ||
| 248 | |||
| 249 | static inline u64 vringh64_to_cpu(const struct vringh *vrh, __virtio64 val) | ||
| 250 | { | ||
| 251 | return __virtio64_to_cpu(vrh->little_endian, val); | ||
| 252 | } | ||
| 253 | |||
| 254 | static inline __virtio64 cpu_to_vringh64(const struct vringh *vrh, u64 val) | ||
| 255 | { | ||
| 256 | return __cpu_to_virtio64(vrh->little_endian, val); | ||
| 257 | } | ||
| 225 | #endif /* _LINUX_VRINGH_H */ | 258 | #endif /* _LINUX_VRINGH_H */ |
