From patchwork Thu May 12 06:36:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 9076801 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 27E43BF29F for ; Thu, 12 May 2016 06:40:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 55A2C201DD for ; Thu, 12 May 2016 06:40:09 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7CCE7201BC for ; Thu, 12 May 2016 06:40:08 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b0kEz-0008Sl-PB; Thu, 12 May 2016 06:36:57 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b0kEy-0008Rw-Rn for xen-devel@lists.xen.org; Thu, 12 May 2016 06:36:57 +0000 Received: from [85.158.137.68] by server-1.bemta-3.messagelabs.com id B5/0D-07924-78424375; Thu, 12 May 2016 06:36:55 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmkeJIrShJLcpLzFFi42K5GHrgkG6bikm 4wap52hZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8au5z/YC9ZxVLzZcZK5gXECexcjJ4eQwERG iX3PlLsYuThYBC6xSNzoeccGkpAQeMci8WpmDYQdI3F57VJ2CLtSYt6kNYwQzSoSczf1MII0C wl0M0k8uPORBSTBJqAmceT9TLAiEQFviZ0fuplBbGYBSYmpx78ygdjCAiESy/bcAYpzAG1WlV j9jx8kzCvgKrF33kUWiF1yElPutzNNYORbwMiwilG9OLWoLLVI10QvqSgzPaMkNzEzR9fQwFg vN7W4ODE9NScxqVgvOT93EyMwSBiAYAdj4xenQ4ySHExKorxSfCbhQnxJ+SmVGYnFGfFFpTmp xYcYZTg4lCR41ygD5QSLUtNTK9Iyc4DhCpOW4OBREuFNUwJK8xYXJOYWZ6ZDpE4xGnNs+X1tL RPHtqn31jIJseTl56VKifNOB5kkAFKaUZoHNwgWR5cYZaWEeRmBThPiKUgtys0sQZV/xSjOwa gkzGsCMoUnM68Ebt8roFOYgE6pvm4EckpJIkJKqoHR+7PH//2zjDJvZvY2L/L61P6LPzqM2dd s1+ztUUvCw+dnvl0afjyperWA2ecpwbkiJUxLF1vO01kZseJD9MvprBXNpRw/ZRYp50zgCp42 4duFXQ/PtIsL7ulbXZ742F75SdicqsP7tTSMFaz7/X79Fz+eGPHx6KtVOwpPOsZoJ6mXrZlU7 Z6gxFKckWioxVxUnAgAz8XcGp4CAAA= X-Env-Sender: van.freenix@gmail.com X-Msg-Ref: server-11.tower-31.messagelabs.com!1463035013!13473349!1 X-Originating-IP: [209.85.192.194] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 26578 invoked from network); 12 May 2016 06:36:54 -0000 Received: from mail-pf0-f194.google.com (HELO mail-pf0-f194.google.com) (209.85.192.194) by server-11.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 12 May 2016 06:36:54 -0000 Received: by mail-pf0-f194.google.com with SMTP id 145so5576613pfz.1 for ; Wed, 11 May 2016 23:36:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=LccVMt+PSQJNNGdMbxNBoqHb7R8owME16iKHcQNku0Y=; b=rd168Cd70VX2A+Kmyo5RaObgr7Ji0U1eH7g9H6bxFdZ9MvLo72U5nI36ztVBcShI2u pWckbOTbXTq4j6kLzLbdslhFudentNK5wwWZXZWXsRmmh+dnj9u8lgM3jO4bUeUEm6Uw tyTidp/YjZJaNODMIR/VEhEIYv7VNUTVUbKJak8rXQQtOB44xOS823zMufn53Ro3MUjV MeN/e9DBWX+8oY7e1I3dVUCEpeFYrP7CmWLRbzp14w+T9i079UbiFQlom3p7iyCRgW8f zhJEDOlH9ZFfyeQs5iyPZiEGxEF8sFYfFdt2FS52630rWyZN2v6y6kSdXzg2saumxOUn UHvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=LccVMt+PSQJNNGdMbxNBoqHb7R8owME16iKHcQNku0Y=; b=E8wTHjVVlQhyujdJpeIi1sO+WFcE9suumE74+9lBzjC+/QGmJq/lMjskdMWRyPf8d1 6PKoCYsHYWnQMSHOynWOlCopBB8nGdSQoGcxNqnzEn1bIYpQTqwWUUjFYhKLZwjjphTF LPAuo8yW9zEjPcGQOWo8K0Y4x9AYbw3jHbydj6E6Xx1+MYzvXBWYxZTwvvbN0Kk28ySz FSXVH3XLaW/ieAut/ZlWM0GAmGUytuZ6fpZVv639G1zbv2ovqn9Ry6t26ClpEMiCwYme VlMTo/Md44g3TdNKVfbLbDUZV/PQXoHjy6jpcMXhvhXJX01Gm2XNUtdVLzDX4SlzQI2I sebg== X-Gm-Message-State: AOPr4FXW4WtyfTdwiyHgwiV59M5p3s+IOZsZkONUnf40RSlrlDcg+rMzbMGNnyPF3fRXuQ== X-Received: by 10.98.67.150 with SMTP id l22mr11244927pfi.85.1463035013058; Wed, 11 May 2016 23:36:53 -0700 (PDT) Received: from linux-7smt.suse (gate-zmy3.freescale.com. [192.88.167.1]) by smtp.gmail.com with ESMTPSA id h88sm16851368pfd.10.2016.05.11.23.36.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 May 2016 23:36:52 -0700 (PDT) From: Peng Fan To: xen-devel@lists.xen.org, julien.grall@arm.com, sstabellini@kernel.org Date: Thu, 12 May 2016 14:36:40 +0800 Message-Id: <1463035000-28745-1-git-send-email-van.freenix@gmail.com> X-Mailer: git-send-email 2.6.2 Cc: van.freenix@gmail.com Subject: [Xen-devel] [PATCH] xen/arm: mm: fix nr_second calculation in setup_frametable_mappings X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, 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 To ARM64, "frametable_size >> SECOND_SHIFT" means the number of second level entries, not the number of second level pages. "DIV_ROUND_UP(frametable_size >> SECOND_SHIFT, LPAE_ENTRIES)" is the correct way to calculate the second level pages needed for frametable mapping. Signed-off-by: Peng Fan Cc: Stefano Stabellini Cc: Julien Grall --- xen/arch/arm/mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 0a4f845..7c7f8e9 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -767,7 +767,7 @@ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe) base_mfn = alloc_boot_pages(frametable_size >> PAGE_SHIFT, 32<<(20-12)); #ifdef CONFIG_ARM_64 - nr_second = frametable_size >> SECOND_SHIFT; + nr_second = DIV_ROUND_UP(frametable_size >> SECOND_SHIFT, LPAE_ENTRIES); second_base = alloc_boot_pages(nr_second, 1); second = mfn_to_virt(second_base); for ( i = 0; i < nr_second; i++ )