From: Ian Campbell Subject: [PATCH] xen: arm: correct return value of raw_copy_to_guest_* Date: Fri, 6 Dec 2013 15:25:10 +0000 Message-ID: <1386343510-31974-1-git-send-email-ian.campbell@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: julien.grall@linaro.org, tim@xen.org, Ian Campbell , stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org This is a generic interface which is supposed to return the number of bytes which were not copied. Make it so and update the one incorrect caller. Make the flush_dcache parameter to the helper an int while at it. Signed-off-by: Ian Campbell --- xen/arch/arm/domain_build.c | 8 ++++---- xen/arch/arm/guestcopy.c | 8 +++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 0269294..73a7cff 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -907,15 +907,15 @@ static int prepare_dtb(struct domain *d, struct kernel_info *kinfo) static void dtb_load(struct kernel_info *kinfo) { void * __user dtb_virt = (void * __user)(register_t)kinfo->dtb_paddr; - unsigned long rc; + unsigned long left; printk("Loading dom0 DTB to 0x%"PRIpaddr"-0x%"PRIpaddr"\n", kinfo->dtb_paddr, kinfo->dtb_paddr + fdt_totalsize(kinfo->fdt)); - rc = raw_copy_to_guest_flush_dcache(dtb_virt, kinfo->fdt, + left = raw_copy_to_guest_flush_dcache(dtb_virt, kinfo->fdt, fdt_totalsize(kinfo->fdt)); - if ( rc != 0 ) - panic("Unable to copy the DTB to dom0 memory (rc = %lu)", rc); + if ( left != 0 ) + panic("Unable to copy the DTB to dom0 memory (left = %lu bytes)", left); xfree(kinfo->fdt); } diff --git a/xen/arch/arm/guestcopy.c b/xen/arch/arm/guestcopy.c index 08800a4..f1b2dda 100644 --- a/xen/arch/arm/guestcopy.c +++ b/xen/arch/arm/guestcopy.c @@ -6,21 +6,19 @@ #include static unsigned long raw_copy_to_guest_helper(void *to, const void *from, - unsigned len, unsigned flush_dcache) + unsigned len, int flush_dcache) { /* XXX needs to handle faults */ unsigned offset = (vaddr_t)to & ~PAGE_MASK; while ( len ) { - int rc; paddr_t g; void *p; unsigned size = min(len, (unsigned)PAGE_SIZE - offset); - rc = gvirt_to_maddr((vaddr_t) to, &g); - if ( rc ) - return rc; + if ( gvirt_to_maddr((vaddr_t) to, &g) ) + return len; p = map_domain_page(g>>PAGE_SHIFT); p += offset; -- 1.7.10.4