summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b416265)
raw | patch | inline | side by side (parent: b416265)
author | Wendy Liang <jliang@xilinx.com> | |
Tue, 9 Aug 2016 05:39:02 +0000 (22:39 -0700) | ||
committer | Wendy Liang <jliang@xilinx.com> | |
Thu, 13 Oct 2016 05:01:47 +0000 (22:01 -0700) |
The default memset/memcpy doesn't always work for device memory as
some architecture assumes device memory access needs to be address aligned.
the libemtal memset/memcpy IO allows unaligned device memory address.
Signed-off-by: Wendy Liang <jliang@xilinx.com>
some architecture assumes device memory access needs to be address aligned.
the libemtal memset/memcpy IO allows unaligned device memory address.
Signed-off-by: Wendy Liang <jliang@xilinx.com>
lib/rpmsg/remote_device.c | patch | blob | history | |
lib/rpmsg/rpmsg.c | patch | blob | history |
index acfb449a6e7e4f1f1ebc3885e01c03730d6f4e93..8314d9a8204c34796156e53afff9eab35bc1fa14 100644 (file)
return RPMSG_SUCCESS;
}
+static void rpmsg_memset_io(struct metal_io_region *io, void *dst, int c, size_t count)
+{
+ if ((io->mem_flags & METAL_IO_MAPPED)) {
+ metal_memset_io(dst, c, count);
+ } else {
+ memset(dst, c, count);
+ }
+}
+
/**
*------------------------------------------------------------------------
* The rest of the file implements the virtio device interface as defined
@@ -405,7 +414,7 @@ int rpmsg_rdev_create_virtqueues(struct virtio_device *dev, int flags, int nvqs,
INIT_VRING_ALLOC_INFO(ring_info, vring_table[idx]);
if (rdev->role == RPMSG_REMOTE) {
- memset((void *)ring_info.vaddr, 0x00,
+ rpmsg_memset_io(vring_table[idx].io, (void *)ring_info.vaddr, 0x00,
vring_size(vring_table[idx].num_descs, vring_table[idx].align));
}
@@ -445,7 +454,7 @@ int rpmsg_rdev_create_virtqueues(struct virtio_device *dev, int flags, int nvqs,
sg.virt = buffer;
- memset(buffer, 0x00, RPMSG_BUFFER_SIZE);
+ rpmsg_memset_io(sg.io, buffer, 0x00, RPMSG_BUFFER_SIZE);
status =
virtqueue_add_buffer(rdev->rvq, &sg, 0, 1,
buffer);
diff --git a/lib/rpmsg/rpmsg.c b/lib/rpmsg/rpmsg.c
index 09730ccdc97fff14906dba04c44ad815c324e749..595ad5e69217afbf7d4f22ce36fb6c15fb38a25d 100644 (file)
--- a/lib/rpmsg/rpmsg.c
+++ b/lib/rpmsg/rpmsg.c
rp_hdr->len = size;
/* Copy data to rpmsg buffer. */
- memcpy((void *)RPMSG_LOCATE_DATA(rp_hdr), data, size);
+ if (rdev->proc->sh_buff.io->mem_flags & METAL_IO_MAPPED)
+ metal_memcpy_io((void *)RPMSG_LOCATE_DATA(rp_hdr), data, size);
+ else
+ memcpy((void *)RPMSG_LOCATE_DATA(rp_hdr), data, size);
metal_mutex_acquire(&rdev->lock);