Message ID | 20171212190212.5535-8-julien.grall@linaro.org |
---|---|
State | Accepted |
Commit | 5302bd490bea7fe9b65181b4aea0a53aad2942ba |
Headers | show |
Series | xen/arm: Stage-2 handling cleanup | expand |
On Tue, 12 Dec 2017, Julien Grall wrote: > 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> > --- > Changes in v2: > - Use the new interface > --- > xen/arch/arm/guestcopy.c | 9 +++++++++ > xen/include/asm-arm/guest_access.h | 6 ++++++ > 2 files changed, 15 insertions(+) > > diff --git a/xen/arch/arm/guestcopy.c b/xen/arch/arm/guestcopy.c > index 93e4aa2d3f..7a0f3e9d5f 100644 > --- a/xen/arch/arm/guestcopy.c > +++ b/xen/arch/arm/guestcopy.c > @@ -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) > { > diff --git a/xen/include/asm-arm/guest_access.h b/xen/include/asm-arm/guest_access.h > index 6796801cfe..224d2a033b 100644 > --- a/xen/include/asm-arm/guest_access.h > +++ b/xen/include/asm-arm/guest_access.h > @@ -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); > > -- > 2.11.0 >
diff --git a/xen/arch/arm/guestcopy.c b/xen/arch/arm/guestcopy.c index 93e4aa2d3f..7a0f3e9d5f 100644 --- a/xen/arch/arm/guestcopy.c +++ b/xen/arch/arm/guestcopy.c @@ -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) { diff --git a/xen/include/asm-arm/guest_access.h b/xen/include/asm-arm/guest_access.h index 6796801cfe..224d2a033b 100644 --- a/xen/include/asm-arm/guest_access.h +++ b/xen/include/asm-arm/guest_access.h @@ -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);
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> --- Changes in v2: - Use the new interface --- xen/arch/arm/guestcopy.c | 9 +++++++++ xen/include/asm-arm/guest_access.h | 6 ++++++ 2 files changed, 15 insertions(+)