Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751613AbbBXGeZ (ORCPT ); Tue, 24 Feb 2015 01:34:25 -0500 Received: from cantor2.suse.de ([195.135.220.15]:39690 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750748AbbBXGeY (ORCPT ); Tue, 24 Feb 2015 01:34:24 -0500 Message-ID: <54EC1B6F.1090606@suse.com> Date: Tue, 24 Feb 2015 07:34:23 +0100 From: Juergen Gross User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: David Vrabel , linux-kernel@vger.kernel.org, xen-devel@lists.xensource.com, konrad.wilk@oracle.com, david.vrabel@citrix.com, boris.ostrovsky@oracle.com Subject: Re: [Xen-devel] [PATCH 08/13] xen: add service function to copy physical memory areas References: <1424242326-26611-1-git-send-email-jgross@suse.com> <1424242326-26611-9-git-send-email-jgross@suse.com> <54E61ECE.4060609@cantab.net> In-Reply-To: <54E61ECE.4060609@cantab.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2236 Lines: 64 On 02/19/2015 06:35 PM, David Vrabel wrote: > On 18/02/2015 06:52, Juergen Gross wrote: >> In case a pre-allocated memory area is to be moved in order to avoid >> a conflict with the target E820 map we need a way to copy data between >> physical addresses. >> >> Add a function doing this via early_memremap(). > [...] >> --- a/arch/x86/xen/setup.c >> +++ b/arch/x86/xen/setup.c >> @@ -766,6 +766,35 @@ phys_addr_t __init xen_find_free_area(phys_addr_t >> size) >> } >> >> /* >> + * Like memcpy, but with physical addresses for dest and src. >> + */ >> +void __init xen_phys_memcpy(phys_addr_t dest, phys_addr_t src, >> phys_addr_t n) >> +{ >> + phys_addr_t dest_off, src_off, dest_len, src_len, len; >> + void *from, *to; >> + >> + while (n) { >> + dest_off = dest & ~PAGE_MASK; >> + src_off = src & ~PAGE_MASK; >> + dest_len = n; >> + if (dest_len > (NR_FIX_BTMAPS << PAGE_SHIFT) - dest_off) >> + dest_len = (NR_FIX_BTMAPS << PAGE_SHIFT) - dest_off; >> + src_len = n; >> + if (src_len > (NR_FIX_BTMAPS << PAGE_SHIFT) - src_off) >> + src_len = (NR_FIX_BTMAPS << PAGE_SHIFT) - src_off; >> + len = min(dest_len, src_len); >> + to = early_memremap(dest - dest_off, dest_len + dest_off); >> + from = early_memremap(src - src_off, src_len + src_off); >> + memcpy(to, from, len); >> + early_iounmap(to, dest_len + dest_off); >> + early_iounmap(from, src_len + src_off); > > early_memunmap surely? Hmm, yes, sure. I'll update the patch and send another one for correcting the code where I took the usage from (relocate_initrd). Juergen > > Otherwise, > > Reviewed-by: David Vrabel > > David > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/