Displaying 16 results from an estimated 16 matches for "define_virtio_xx_to_cpu".
2014 Oct 22
2
[PATCH RFC v2 01/16] virtio: memory access APIs
...ux/err.h>
#include <linux/bug.h>
#include <linux/virtio.h>
+#include <linux/virtio_byteorder.h>
#include <uapi/linux/virtio_config.h>
/**
@@ -152,6 +153,21 @@ int virtqueue_set_affinity(struct virtqueue *vq, int cpu)
return 0;
}
+/* Memory accessors */
+#define DEFINE_VIRTIO_XX_TO_CPU(bits) \
+static inline u##bits virtio##bits##_to_cpu(struct virtio_device *vdev, __virtio##bits val) \
+{ \
+ return __virtio##bits##_to_cpu(false, val); \
+} \
+static inline __virtio##bits cpu_to_virtio##bits(struct virtio_device *vdev, u##bits val) \
+{ \
+ return __cpu_to_virtio##bits(false, va...
2014 Oct 22
2
[PATCH RFC v2 01/16] virtio: memory access APIs
...ux/err.h>
#include <linux/bug.h>
#include <linux/virtio.h>
+#include <linux/virtio_byteorder.h>
#include <uapi/linux/virtio_config.h>
/**
@@ -152,6 +153,21 @@ int virtqueue_set_affinity(struct virtqueue *vq, int cpu)
return 0;
}
+/* Memory accessors */
+#define DEFINE_VIRTIO_XX_TO_CPU(bits) \
+static inline u##bits virtio##bits##_to_cpu(struct virtio_device *vdev, __virtio##bits val) \
+{ \
+ return __virtio##bits##_to_cpu(false, val); \
+} \
+static inline __virtio##bits cpu_to_virtio##bits(struct virtio_device *vdev, u##bits val) \
+{ \
+ return __cpu_to_virtio##bits(false, va...
2014 Oct 22
0
[PATCH RFC v2 01/16] virtio: memory access APIs
...#include <linux/virtio_byteorder.h>
What patch creates this file?
> #include <uapi/linux/virtio_config.h>
>
> /**
> @@ -152,6 +153,21 @@ int virtqueue_set_affinity(struct virtqueue *vq, int cpu)
> return 0;
> }
>
> +/* Memory accessors */
> +#define DEFINE_VIRTIO_XX_TO_CPU(bits) \
> +static inline u##bits virtio##bits##_to_cpu(struct virtio_device *vdev, __virtio##bits val) \
> +{ \
> + return __virtio##bits##_to_cpu(false, val); \
> +} \
> +static inline __virtio##bits cpu_to_virtio##bits(struct virtio_device *vdev, u##bits val) \
> +{ \
> + ret...
2014 Oct 21
2
[PATCH RFC] virtio 1.0 vring endian-ness
..., what's your opinion? Reasonable?
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index 67e06fe..32211aa 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -62,6 +62,26 @@ static inline void virtio_wmb(bool weak_barriers)
}
#endif
+#define DEFINE_VIRTIO_XX_TO_CPU(bits) \
+static inline u##bits virtio##bits##_to_cpu(bool little_endian, __virtio##bits val) \
+{ \
+ if (little_endian) \
+ return le##bits##_to_cpu((__force __le##bits)val); \
+ else \
+ return (__force u##bits)val; \
+} \
+static inline __virtio##bits cpu_to_virtio##bits(bool little_endian, u#...
2014 Oct 21
2
[PATCH RFC] virtio 1.0 vring endian-ness
..., what's your opinion? Reasonable?
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index 67e06fe..32211aa 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -62,6 +62,26 @@ static inline void virtio_wmb(bool weak_barriers)
}
#endif
+#define DEFINE_VIRTIO_XX_TO_CPU(bits) \
+static inline u##bits virtio##bits##_to_cpu(bool little_endian, __virtio##bits val) \
+{ \
+ if (little_endian) \
+ return le##bits##_to_cpu((__force __le##bits)val); \
+ else \
+ return (__force u##bits)val; \
+} \
+static inline __virtio##bits cpu_to_virtio##bits(bool little_endian, u#...
2014 Oct 22
0
[PATCH RFC] virtio 1.0 vring endian-ness
...diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
> index 67e06fe..32211aa 100644
> --- a/include/linux/virtio_ring.h
> +++ b/include/linux/virtio_ring.h
> @@ -62,6 +62,26 @@ static inline void virtio_wmb(bool weak_barriers)
> }
> #endif
>
> +#define DEFINE_VIRTIO_XX_TO_CPU(bits) \
> +static inline u##bits virtio##bits##_to_cpu(bool little_endian, __virtio##bits val) \
> +{ \
> + if (little_endian) \
> + return le##bits##_to_cpu((__force __le##bits)val); \
> + else \
> + return (__force u##bits)val; \
> +} \
> +static inline __virtio##bits cp...
2014 Oct 22
0
[PATCH RFC v2 06/16] virtio: make endian-ness depend on virtio 1.0
...2 insertions(+), 2 deletions(-)
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 7d46280..be0f6dd 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -157,11 +157,11 @@ int virtqueue_set_affinity(struct virtqueue *vq, int cpu)
#define DEFINE_VIRTIO_XX_TO_CPU(bits) \
static inline u##bits virtio##bits##_to_cpu(struct virtio_device *vdev, __virtio##bits val) \
{ \
- return __virtio##bits##_to_cpu(false, val); \
+ return __virtio##bits##_to_cpu(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val); \
} \
static inline __virtio##bits cpu_to_virtio##bits(s...
2014 Oct 22
1
[PATCH RFC v3 06/16] virtio: make endian-ness depend on virtio 1.0
...2 insertions(+), 2 deletions(-)
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 7d46280..be0f6dd 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -157,11 +157,11 @@ int virtqueue_set_affinity(struct virtqueue *vq, int cpu)
#define DEFINE_VIRTIO_XX_TO_CPU(bits) \
static inline u##bits virtio##bits##_to_cpu(struct virtio_device *vdev, __virtio##bits val) \
{ \
- return __virtio##bits##_to_cpu(false, val); \
+ return __virtio##bits##_to_cpu(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val); \
} \
static inline __virtio##bits cpu_to_virtio##bits(s...
2014 Oct 22
0
[PATCH RFC v2 06/16] virtio: make endian-ness depend on virtio 1.0
...2 insertions(+), 2 deletions(-)
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 7d46280..be0f6dd 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -157,11 +157,11 @@ int virtqueue_set_affinity(struct virtqueue *vq, int cpu)
#define DEFINE_VIRTIO_XX_TO_CPU(bits) \
static inline u##bits virtio##bits##_to_cpu(struct virtio_device *vdev, __virtio##bits val) \
{ \
- return __virtio##bits##_to_cpu(false, val); \
+ return __virtio##bits##_to_cpu(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val); \
} \
static inline __virtio##bits cpu_to_virtio##bits(s...
2014 Oct 22
1
[PATCH RFC v3 06/16] virtio: make endian-ness depend on virtio 1.0
...2 insertions(+), 2 deletions(-)
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 7d46280..be0f6dd 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -157,11 +157,11 @@ int virtqueue_set_affinity(struct virtqueue *vq, int cpu)
#define DEFINE_VIRTIO_XX_TO_CPU(bits) \
static inline u##bits virtio##bits##_to_cpu(struct virtio_device *vdev, __virtio##bits val) \
{ \
- return __virtio##bits##_to_cpu(false, val); \
+ return __virtio##bits##_to_cpu(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val); \
} \
static inline __virtio##bits cpu_to_virtio##bits(s...
2014 Oct 22
2
[PATCH RFC v3 01/16] virtio: memory access APIs
...teorder.h
@@ -0,0 +1,29 @@
+#ifndef _LINUX_VIRTIO_BYTEORDER_H
+#define _LINUX_VIRTIO_BYTEORDER_H
+#include <linux/types.h>
+#include <uapi/linux/virtio_types.h>
+
+/* Memory accessors for handling virtio in modern little endian and in
+ * compatibility big endian format. */
+
+#define __DEFINE_VIRTIO_XX_TO_CPU(bits) \
+static inline u##bits __virtio##bits##_to_cpu(bool little_endian, __virtio##bits val) \
+{ \
+ if (little_endian) \
+ return le##bits##_to_cpu((__force __le##bits)val); \
+ else \
+ return (__force u##bits)val; \
+} \
+static inline __virtio##bits __cpu_to_virtio##bits(bool little_endian...
2014 Oct 22
2
[PATCH RFC v3 01/16] virtio: memory access APIs
...teorder.h
@@ -0,0 +1,29 @@
+#ifndef _LINUX_VIRTIO_BYTEORDER_H
+#define _LINUX_VIRTIO_BYTEORDER_H
+#include <linux/types.h>
+#include <uapi/linux/virtio_types.h>
+
+/* Memory accessors for handling virtio in modern little endian and in
+ * compatibility big endian format. */
+
+#define __DEFINE_VIRTIO_XX_TO_CPU(bits) \
+static inline u##bits __virtio##bits##_to_cpu(bool little_endian, __virtio##bits val) \
+{ \
+ if (little_endian) \
+ return le##bits##_to_cpu((__force __le##bits)val); \
+ else \
+ return (__force u##bits)val; \
+} \
+static inline __virtio##bits __cpu_to_virtio##bits(bool little_endian...
2014 Oct 23
0
[PATCH RFC v4 06/17] virtio: make endian-ness depend on virtio 1.0
...2 insertions(+), 2 deletions(-)
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 4bc2ebe..952b6d7 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -157,11 +157,11 @@ int virtqueue_set_affinity(struct virtqueue *vq, int cpu)
#define DEFINE_VIRTIO_XX_TO_CPU(bits) \
static inline u##bits virtio##bits##_to_cpu(struct virtio_device *vdev, __virtio##bits val) \
{ \
- return __virtio##bits##_to_cpu(false, val); \
+ return __virtio##bits##_to_cpu(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val); \
} \
static inline __virtio##bits cpu_to_virtio##bits(s...
2014 Oct 23
0
[PATCH RFC v4 06/17] virtio: make endian-ness depend on virtio 1.0
...2 insertions(+), 2 deletions(-)
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 4bc2ebe..952b6d7 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -157,11 +157,11 @@ int virtqueue_set_affinity(struct virtqueue *vq, int cpu)
#define DEFINE_VIRTIO_XX_TO_CPU(bits) \
static inline u##bits virtio##bits##_to_cpu(struct virtio_device *vdev, __virtio##bits val) \
{ \
- return __virtio##bits##_to_cpu(false, val); \
+ return __virtio##bits##_to_cpu(virtio_has_feature(vdev, VIRTIO_F_VERSION_1), val); \
} \
static inline __virtio##bits cpu_to_virtio##bits(s...
2014 Oct 23
0
[PATCH RFC v4 01/17] virtio: memory access APIs
...ux/err.h>
#include <linux/bug.h>
#include <linux/virtio.h>
+#include <linux/virtio_byteorder.h>
#include <uapi/linux/virtio_config.h>
/**
@@ -152,6 +153,47 @@ int virtqueue_set_affinity(struct virtqueue *vq, int cpu)
return 0;
}
+/* Memory accessors */
+#define DEFINE_VIRTIO_XX_TO_CPU(bits) \
+static inline u##bits virtio##bits##_to_cpu(struct virtio_device *vdev, __virtio##bits val) \
+{ \
+ return __virtio##bits##_to_cpu(false, val); \
+} \
+static inline __virtio##bits cpu_to_virtio##bits(struct virtio_device *vdev, u##bits val) \
+{ \
+ return __cpu_to_virtio##bits(false, va...
2014 Oct 23
0
[PATCH RFC v4 01/17] virtio: memory access APIs
...ux/err.h>
#include <linux/bug.h>
#include <linux/virtio.h>
+#include <linux/virtio_byteorder.h>
#include <uapi/linux/virtio_config.h>
/**
@@ -152,6 +153,47 @@ int virtqueue_set_affinity(struct virtqueue *vq, int cpu)
return 0;
}
+/* Memory accessors */
+#define DEFINE_VIRTIO_XX_TO_CPU(bits) \
+static inline u##bits virtio##bits##_to_cpu(struct virtio_device *vdev, __virtio##bits val) \
+{ \
+ return __virtio##bits##_to_cpu(false, val); \
+} \
+static inline __virtio##bits cpu_to_virtio##bits(struct virtio_device *vdev, u##bits val) \
+{ \
+ return __cpu_to_virtio##bits(false, va...