From patchwork Thu May 12 13:03:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 9080761 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3A5FB9F1C1 for ; Thu, 12 May 2016 13:05:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5BFE82022D for ; Thu, 12 May 2016 13:05:40 +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 119A72021A for ; Thu, 12 May 2016 13:05:36 +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 1b0qHF-0001MD-8M; Thu, 12 May 2016 13:03:41 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b0qHE-0001Lz-36 for xen-devel@lists.xen.org; Thu, 12 May 2016 13:03:40 +0000 Received: from [193.109.254.147] by server-5.bemta-14.messagelabs.com id C4/45-03971-B2F74375; Thu, 12 May 2016 13:03:39 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplkeJIrShJLcpLzFFi42K5GHrHSVer3iT cYPIzQ4slHxezODB6HN39mymAMYo1My8pvyKBNWPbstlMBf84K872LGNsYNzL0cXIxSEkMIFR Yuri66wgDovAJRaJiV19zCCOhMA7Fomjl3qAMpxATozE/9kL2CHsSol7b+6ygdhCAioSczf1M ELY3UwSr2eZgdhsAmoSR97PBIuLCHhL7PzQzQxiMwtISkw9/pUJxBYWCJe4s3gJC4jNIqAq0b juBFgNr4CLxMUF/5khdslJTLnfzjSBkW8BI8MqRvXi1KKy1CJdQ72kosz0jJLcxMwcXUNDE73 c1OLixPTUnMSkYr3k/NxNjMBAYQCCHYxHO50PMUpyMCmJ8vJVm4QL8SXlp1RmJBZnxBeV5qQW H2KU4eBQkuA1qgPKCRalpqdWpGXmAEMWJi3BwaMkwtsGkuYtLkjMLc5Mh0idYjTm2PL72lomj m1T761lEmLJy89LlRLn1QcpFQApzSjNgxsEi6VLjLJSwryMQKcJ8RSkFuVmlqDKv2IU52BUEu b9Xws0hSczrwRu3yugU5iATqm+bgRySkkiQkqqgbFFoyTt1onIjB039Fat17X6tqP0aODR0CP C8/4v2CVizJsbcfDDLk6Gzw8mTVtzR27K7M17Fy09d6yuWUdU9vl+NsYtGRGF8Vfv97JP1My3 Ksvd1b57bezmNwfl34deVvmw6My5UFVtzadzG90XaDS//3M7e81DIwkD8U3fa5ukRE+or1Cct CpSiaU4I9FQi7moOBEAA+U/tKACAAA= X-Env-Sender: van.freenix@gmail.com X-Msg-Ref: server-12.tower-27.messagelabs.com!1463058217!41141905!1 X-Originating-IP: [209.85.220.66] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 6761 invoked from network); 12 May 2016 13:03:38 -0000 Received: from mail-pa0-f66.google.com (HELO mail-pa0-f66.google.com) (209.85.220.66) by server-12.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 12 May 2016 13:03:38 -0000 Received: by mail-pa0-f66.google.com with SMTP id gh9so6081818pac.0 for ; Thu, 12 May 2016 06:03:38 -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=xcxZ1YmszrAtEWbw04E8gd/96UhRYIfN9jNhcWJp6LY=; b=xYguojaj9mPo9suv4xY2RyTU0E62ElRaBnM34hq6ZVxqeyZVr+s3LaifjC5xKNzUuv dg2PXJw0nObODZOxxOD0ZdxOctW3dDbYVW6AjQyKW5ztDrNL5T/UNlRfuPKBIdc2ZJAy 5K8T9whk0Z/7BbElVw9e71uHNDH8is12gKWHKnjyBq9TRHRcms8sdFvEGzT5nEYEr/n7 1buW43K4yDzf6g6a7+07KIJUK/OXWoDj6QETima6JPbCt643pzsjl+XI3uLaBHC2S56L aMP4NTvGgWEeDcAEkcMzBZlAlctSnArTP+99e/wjO5pdNSQHojP2zRXG9cgSOJq9SCPY 1Tig== 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=xcxZ1YmszrAtEWbw04E8gd/96UhRYIfN9jNhcWJp6LY=; b=ZKAZMW5+zJ3b5eubsKz5h2Da8C29GZg1UXGv4by0R5e6eVf45Hw/Yn25DqjGQGzGNO FoGCywmd+6LnR41Hjfdm1ZyC04Ab3AASkolcgnNmv9fulG6JPBuyM1CC9gkOrcrCzu/e IFK+Ij3uIhuxu4wNPC/ybBFSLvOH5r/swRBhUIcliO7lw8FM18W7AH8EdmO6zkqXXArx 10OeQiMg/ul0U9YcDiDxffCXW7o+MGCnvY9TpqPeZXXwaCEwTw662s20MVrcwG6KC82U yd8BLnZ2KCL4GVlP+Ck0nBpFTGrsNM+Qe0zmQdKA+ncJtjcOzpWurUCAyeoV1cHHmDKk MBsA== X-Gm-Message-State: AOPr4FW+R5xfRENyDUoz1YJ7cfjbnoiaIpqjowk3B2pFe3hjwuWgELu6Pdq+ENRW4Q4PBg== X-Received: by 10.66.82.166 with SMTP id j6mr13574874pay.140.1463058213432; Thu, 12 May 2016 06:03:33 -0700 (PDT) Received: from linux-7smt.suse (gate-zmy3.freescale.com. [192.88.167.1]) by smtp.gmail.com with ESMTPSA id a14sm19861034pfc.57.2016.05.12.06.03.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 May 2016 06:03:32 -0700 (PDT) From: Peng Fan To: xen-devel@lists.xen.org, julien.grall@arm.com, sstabellini@kernel.org Date: Thu, 12 May 2016 21:03:08 +0800 Message-Id: <1463058188-4478-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 V2] 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 On ARM64, "frametable_size >> SECOND_SHIFT" computes the number of second level entries, not the number of second level pages. "ROUNDUP(frametable_size, FIRST_SIZE) >> FIRST_SHIFT" which computes the number of the first level entries (the number of second level pages), is the correct one that should be used. Signed-off-by: Peng Fan Cc: Stefano Stabellini Cc: Julien Grall Reviewed-by: Julien Grall --- V2: Take Julien's suggestion in http://lists.xen.org/archives/html/xen-devel/2016-05/msg01145.html. Refine commit log. xen/arch/arm/mm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 0a4f845..5f60aa4 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -767,7 +767,8 @@ 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; + /* Compute the number of second level pages. */ + nr_second = ROUNDUP(frametable_size, FIRST_SIZE) >> FIRST_SHIFT; second_base = alloc_boot_pages(nr_second, 1); second = mfn_to_virt(second_base); for ( i = 0; i < nr_second; i++ )