search for: _to_cpu

Displaying 20 results from an estimated 23 matches for "_to_cpu".

2014 Oct 22
2
[PATCH RFC v3 01/16] virtio: memory access APIs
...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
...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 v2 01/16] virtio: memory access APIs
...nclude <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
...nclude <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 06/16] virtio: make endian-ness depend on virtio 1.0
..., 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 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 23
0
[PATCH RFC v4 06/17] virtio: make endian-ness depend on virtio 1.0
..., 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 22
0
[PATCH RFC v2 06/16] virtio: make endian-ness depend on virtio 1.0
..., 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 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 23
0
[PATCH RFC v4 06/17] virtio: make endian-ness depend on virtio 1.0
..., 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 v3 01/16] virtio: memory access APIs
...ine _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. */ s/big/native/ > + > +#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...
2014 Oct 22
0
[PATCH RFC v2 01/16] virtio: memory access APIs
...ux/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
...r 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
...r 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
...clude/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 23
0
[PATCH RFC v4 01/17] virtio: memory access APIs
...+#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 native endian format. + */ + +static inline u16 __virtio16_to_cpu(bool little_endian, __virtio16 val) +{ + if (little_endian) + return le16_to_cpu((__force __le16)val); + else + return (__force u16)val; +} + +static inline __virtio16 __cpu_to_virtio16(bool little_endian, u16 val) +{ + if (little_endian) + return (__force __virtio16)cpu_to_le16(val); + else +...
2014 Oct 23
0
[PATCH RFC v4 01/17] virtio: memory access APIs
...+#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 native endian format. + */ + +static inline u16 __virtio16_to_cpu(bool little_endian, __virtio16 val) +{ + if (little_endian) + return le16_to_cpu((__force __le16)val); + else + return (__force u16)val; +} + +static inline __virtio16 __cpu_to_virtio16(bool little_endian, u16 val) +{ + if (little_endian) + return (__force __virtio16)cpu_to_le16(val); + else +...
2004 Jun 17
0
OCFS2 final on-disk format changes are going in
...fairly rough state, meaning it won't warn you if you try to format a mounted device, or warn you if the cluster size you choose is so small that bitmap operations are unbearably slow, so just be careful. The only upcoming on-disk change that we forsee at this point is to do a last pass of le##_to_cpu/cpu_to_le## macros around everything in user and kernel. As of this release, we actually seem to work on 2.4 and 2.6, little and big endian, 32- and 64-bit, and hard sector sizes from 512 to 4096. :) For any of you interested enough to know the details of what changed, we will be coming up with...
2013 Mar 13
1
Fix unaligned accesses for SPARC
...rivers/gpu/drm/nouveau/nouveau_bios.h @@ -26,6 +26,8 @@ #include "nvreg.h" +#include <asm/unaligned.h> + #define DCB_MAX_NUM_ENTRIES 16 #define DCB_MAX_NUM_I2C_ENTRIES 16 #define DCB_MAX_NUM_GPIO_ENTRIES 32 @@ -33,10 +35,10 @@ #define DCB_LOC_ON_CHIP 0 -#define ROM16(x) le16_to_cpu(*(u16 *)&(x)) -#define ROM32(x) le32_to_cpu(*(u32 *)&(x)) +#define ROM16(x) le16_to_cpu(get_unaligned((u16 *)&(x))) +#define ROM32(x) le32_to_cpu(get_unaligned((u32 *)&(x))) #define ROM48(x) ({ u8 *p = &(x); (u64)ROM16(p[4]) << 32 | ROM32(p[0]); }) -#define ROM64(x) le64_...
2012 Dec 18
0
[PATCH] [RFC] Btrfs: Subpagesize blocksize (WIP).
...4 +1938,19 @@ static inline void btrfs_set_token_##name(struct extent_buffer *eb, \ #define BTRFS_SETGET_HEADER_FUNCS(name, type, member, bits) \ static inline u##bits btrfs_##name(struct extent_buffer *eb) \ { \ - type *p = page_address(eb->pages[0]); \ - u##bits res = le##bits##_to_cpu(p->member); \ + type *p; \ + u##bits res; \ + \ + p = page_address(eb->pages[0]) + (eb->start & (PAGE_SIZE - 1)); \ + res = le##bits##_to_cpu(p->member); \ return res; \ } \ static inline void btrfs_set_##name(struct extent_buffer *eb, \...