From patchwork Tue Apr 29 01:06:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Smarduch X-Patchwork-Id: 4084051 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2D559BFF02 for ; Tue, 29 Apr 2014 01:09:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 371D8201F7 for ; Tue, 29 Apr 2014 01:09:41 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B4C6F201EC for ; Tue, 29 Apr 2014 01:09:39 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WewVn-00084l-HE; Tue, 29 Apr 2014 01:07:07 +0000 Received: from mailout3.w2.samsung.com ([211.189.100.13] helo=usmailout3.samsung.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WewVk-00083V-M2 for linux-arm-kernel@lists.infradead.org; Tue, 29 Apr 2014 01:07:05 +0000 Received: from uscpsbgex3.samsung.com (u124.gpu85.samsung.co.kr [203.254.195.124]) by usmailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N4R0085EPR6NAB0@usmailout3.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 28 Apr 2014 21:06:42 -0400 (EDT) X-AuditID: cbfec37c-b7f796d000005f99-44-535efb227d52 Received: from usmmp2.samsung.com ( [203.254.195.78]) by uscpsbgex3.samsung.com (USCPEXMTA) with SMTP id A0.B9.24473.22BFE535; Mon, 28 Apr 2014 21:06:42 -0400 (EDT) Received: from sisasmtp.sisa.samsung.com ([105.144.21.116]) by usmmp2.samsung.com (Oracle Communications Messaging Server 7u4-27.01(7.0.4.27.0) 64bit (built Aug 30 2012)) with ESMTP id <0N4R005SWPR6YQ30@usmmp2.samsung.com>; Mon, 28 Apr 2014 21:06:42 -0400 (EDT) Received: from [105.144.129.76] (105.144.129.76) by SISAEX02SJ.sisa.samsung.com (105.144.21.116) with Microsoft SMTP Server (TLS) id 14.1.421.2; Mon, 28 Apr 2014 18:06:41 -0700 Message-id: <535EFB21.9040308@samsung.com> Date: Mon, 28 Apr 2014 18:06:41 -0700 From: Mario Smarduch User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130804 Thunderbird/17.0.8 MIME-version: 1.0 To: "kvmarm@lists.cs.columbia.edu" , Marc Zyngier , "christoffer.dall@linaro.org" , Steve Capper Subject: [PATCH v4 5/5] change update_range to handle > 4GB 2nd stage range for ARMv7 References: <535EF871.9090604@samsung.com> In-reply-to: <535EF871.9090604@samsung.com> X-Forwarded-Message-Id: <535EF871.9090604@samsung.com> X-Originating-IP: [105.144.129.76] X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpnkeLIzCtJLcpLzFFi42I5/e+wn67S77hgg1+bFC1evP7HaNH7/yKr xf2r3xkt5kwttPh46ji7xabH11gt/t75x2Yx58wDFotJb7YxWXyYsZLRgctjzbw1jB6zGnrZ PO5c28PmcX7TGmaPzUvqPfq2rGL0+LxJLoA9issmJTUnsyy1SN8ugSvj7oXDbAWXBCreTv7O 2sB4n6eLkZNDQsBE4nHHNxYIW0ziwr31bF2MXBxCAssYJWb83MYE4fQySXS8Pc8I4WxhlOje d5IZpIVXQEvi255bTCA2i4CqxJTt38BsNgFdif33NrKD2KICERJ/Tu9jhagXlPgx+R7YOhGB c4wSB06CDWUWWMYk8eLVNLAiYYFwiWPn5oMtEAJacGb9d7ChnALaEgev72ODuNVMYu6mx2CD mAXUJSbNW8QMYctLbF7zFqpXVWLbzedACziA6pUkVh8xn8AoMgvJGbOQdM9C0r2AkXkVo1hp cXJBcVJ6aoWxXnFibnFpXrpecn7uJkZI5NXsYLz31eYQowAHoxIPr0FUXLAQa2JZcWXuIUYJ DmYlEV7bVqAQb0piZVVqUX58UWlOavEhRiYOTqkGRvvXEdYtenX1f8+JyDwQvrGhP8ly9+TN /VXh4XdnHnTRnhyz9Po9tY8R2fHGbb8W/9/W/ev0hdVBRpp9wWUMi66/UE8MCXt19sjxCWL3 WB5c1NB07vvba+qUIq/2d9n/+/zcUycKeNYtUl4TybT2cY7RPxbBww4zGzWzintf7le8x3Cr 9iSLhBJLcUaioRZzUXEiABffsZmaAgAA X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140428_180704_827881_544C0DD7 X-CRM114-Status: GOOD ( 11.87 ) X-Spam-Score: -5.7 (-----) Cc: Peter Maydell , "kvm@vger.kernel.org" , "gavin.guo@canonical.com" , =?UTF-8?B?7J207KCV7ISd?= , =?UTF-8?B?7KCV7ISx7KeE?= , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds support for unmapping 2nd stage page tables for addresses >4GB on ARMv7. Signed-off-by: Mario Smarduch --- arch/arm/kvm/mmu.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c index 88f5503..afbf8ba 100644 --- a/arch/arm/kvm/mmu.c +++ b/arch/arm/kvm/mmu.c @@ -176,21 +176,25 @@ static void clear_pte_entry(struct kvm *kvm, pte_t *pte, phys_addr_t addr) } } +/* Function shared between identity and 2nd stage mappings. For 2nd stage + * the IPA may be > 4GB on ARMv7, and page table range functions + * will fail. kvm_xxx_addr_end() is used to handle both cases. + */ static void unmap_range(struct kvm *kvm, pgd_t *pgdp, - unsigned long long start, u64 size) + phys_addr_t start, u64 size) { pgd_t *pgd; pud_t *pud; pmd_t *pmd; pte_t *pte; - unsigned long long addr = start, end = start + size; - u64 next; + phys_addr_t addr = start, end = start + size; + phys_addr_t next; while (addr < end) { pgd = pgdp + pgd_index(addr); pud = pud_offset(pgd, addr); if (pud_none(*pud)) { - addr = pud_addr_end(addr, end); + addr = kvm_pud_addr_end(addr, end); continue; } @@ -200,13 +204,13 @@ static void unmap_range(struct kvm *kvm, pgd_t *pgdp, * move on. */ clear_pud_entry(kvm, pud, addr); - addr = pud_addr_end(addr, end); + addr = kvm_pud_addr_end(addr, end); continue; } pmd = pmd_offset(pud, addr); if (pmd_none(*pmd)) { - addr = pmd_addr_end(addr, end); + addr = kvm_pmd_addr_end(addr, end); continue; } @@ -221,10 +225,10 @@ static void unmap_range(struct kvm *kvm, pgd_t *pgdp, */ if (kvm_pmd_huge(*pmd) || page_empty(pte)) { clear_pmd_entry(kvm, pmd, addr); - next = pmd_addr_end(addr, end); + next = kvm_pmd_addr_end(addr, end); if (page_empty(pmd) && !page_empty(pud)) { clear_pud_entry(kvm, pud, addr); - next = pud_addr_end(addr, end); + next = kvm_pud_addr_end(addr, end); } }