xen/arm: Introduce copy_to_guest_phys_flush_dcache
authorJulien Grall <julien.grall@linaro.org>
Tue, 12 Dec 2017 19:02:03 +0000 (19:02 +0000)
committerStefano Stabellini <sstabellini@kernel.org>
Tue, 12 Dec 2017 20:07:39 +0000 (12:07 -0800)
This new function will be used in a follow-up patch to copy data to the guest
using the IPA (aka guest physical address) and then clean the cache.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/guestcopy.c
xen/include/asm-arm/guest_access.h

index 93e4aa2d3fca537919a58d02bbd0b478f0bc25d2..7a0f3e9d5fc67c28258e8b924caec150cc40c168 100644 (file)
@@ -130,6 +130,15 @@ unsigned long raw_copy_from_guest(void *to, const void __user *from, unsigned le
                       COPY_from_guest | COPY_linear);
 }
 
+unsigned long copy_to_guest_phys_flush_dcache(struct domain *d,
+                                              paddr_t gpa,
+                                              void *buf,
+                                              unsigned int len)
+{
+    return copy_guest(buf, gpa, len, GPA_INFO(d),
+                      COPY_to_guest | COPY_ipa | COPY_flush_dcache);
+}
+
 int access_guest_memory_by_ipa(struct domain *d, paddr_t gpa, void *buf,
                                uint32_t size, bool is_write)
 {
index 6796801cfe033e2691848cf734faede98d86fbc1..224d2a033bebcb3b1fad6da11b4f0705e09b014e 100644 (file)
@@ -11,6 +11,12 @@ unsigned long raw_copy_to_guest_flush_dcache(void *to, const void *from,
 unsigned long raw_copy_from_guest(void *to, const void *from, unsigned len);
 unsigned long raw_clear_guest(void *to, unsigned len);
 
+/* Copy data to guest physical address, then clean the region. */
+unsigned long copy_to_guest_phys_flush_dcache(struct domain *d,
+                                              paddr_t phys,
+                                              void *buf,
+                                              unsigned int len);
+
 int access_guest_memory_by_ipa(struct domain *d, paddr_t ipa, void *buf,
                                uint32_t size, bool is_write);