Michael S. Tsirkin
2014-Oct-23 16:24 UTC
[PATCH RFC v4 07/17] virtio_config: endian conversion for v1.0
We (ab)use virtio conversion functions for device-specific config space accesses. Reviewed-by: David Hildenbrand <dahi at linux.vnet.ibm.com> Signed-off-by: Rusty Russell <rusty at rustcorp.com.au> Signed-off-by: Cornelia Huck <cornelia.huck at de.ibm.com> Signed-off-by: Michael S. Tsirkin <mst at redhat.com> --- include/linux/virtio_config.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h index 952b6d7..05b9ff7 100644 --- a/include/linux/virtio_config.h +++ b/include/linux/virtio_config.h @@ -281,12 +281,13 @@ static inline u16 virtio_cread16(struct virtio_device *vdev, { u16 ret; vdev->config->get(vdev, offset, &ret, sizeof(ret)); - return ret; + return virtio16_to_cpu(vdev, (__force __virtio16)ret); } static inline void virtio_cwrite16(struct virtio_device *vdev, unsigned int offset, u16 val) { + val = (__force u16)cpu_to_virtio16(vdev, val); vdev->config->set(vdev, offset, &val, sizeof(val)); } @@ -295,12 +296,13 @@ static inline u32 virtio_cread32(struct virtio_device *vdev, { u32 ret; vdev->config->get(vdev, offset, &ret, sizeof(ret)); - return ret; + return virtio32_to_cpu(vdev, (__force __virtio32)ret); } static inline void virtio_cwrite32(struct virtio_device *vdev, unsigned int offset, u32 val) { + val = (__force u32)cpu_to_virtio32(vdev, val); vdev->config->set(vdev, offset, &val, sizeof(val)); } @@ -309,12 +311,13 @@ static inline u64 virtio_cread64(struct virtio_device *vdev, { u64 ret; vdev->config->get(vdev, offset, &ret, sizeof(ret)); - return ret; + return virtio64_to_cpu(vdev, (__force __virtio64)ret); } static inline void virtio_cwrite64(struct virtio_device *vdev, unsigned int offset, u64 val) { + val = (__force u64)cpu_to_virtio64(vdev, val); vdev->config->set(vdev, offset, &val, sizeof(val)); } -- MST
Cornelia Huck
2014-Oct-24 08:53 UTC
[PATCH RFC v4 07/17] virtio_config: endian conversion for v1.0
On Thu, 23 Oct 2014 19:24:30 +0300 "Michael S. Tsirkin" <mst at redhat.com> wrote:> We (ab)use virtio conversion functions for device-specific > config space accesses. > > Reviewed-by: David Hildenbrand <dahi at linux.vnet.ibm.com> > Signed-off-by: Rusty Russell <rusty at rustcorp.com.au> > Signed-off-by: Cornelia Huck <cornelia.huck at de.ibm.com> > Signed-off-by: Michael S. Tsirkin <mst at redhat.com> > --- > include/linux/virtio_config.h | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-)Not objecting to the patch, but something seems to have gotten messed up wrt authorship? You only adapted it, right?
Michael S. Tsirkin
2014-Oct-24 13:52 UTC
[PATCH RFC v4 07/17] virtio_config: endian conversion for v1.0
On Fri, Oct 24, 2014 at 10:53:27AM +0200, Cornelia Huck wrote:> On Thu, 23 Oct 2014 19:24:30 +0300 > "Michael S. Tsirkin" <mst at redhat.com> wrote: > > > We (ab)use virtio conversion functions for device-specific > > config space accesses. > > > > Reviewed-by: David Hildenbrand <dahi at linux.vnet.ibm.com> > > Signed-off-by: Rusty Russell <rusty at rustcorp.com.au> > > Signed-off-by: Cornelia Huck <cornelia.huck at de.ibm.com> > > Signed-off-by: Michael S. Tsirkin <mst at redhat.com> > > --- > > include/linux/virtio_config.h | 9 ++++++--- > > 1 file changed, 6 insertions(+), 3 deletions(-) > > Not objecting to the patch, but something seems to have gotten messed > up wrt authorship? You only adapted it, right?I'll change author to Rusty.
Reasonably Related Threads
- [PATCH RFC v4 07/17] virtio_config: endian conversion for v1.0
- [PATCH RFC v4 07/17] virtio_config: endian conversion for v1.0
- [PATCH v4 07/42] virtio_config: endian conversion for v1.0
- [PATCH v4 07/42] virtio_config: endian conversion for v1.0
- [PATCH v4 07/42] virtio_config: endian conversion for v1.0