From nobody Tue Nov 11 13:46:40 2025 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1559599446; cv=none; d=zoho.com; s=zohoarc; b=fc6BWzfEgM83c3gmywrID3NIIwIJ49djSYFObeD7wEiGvBaUy1G4Q6oMpxkNXkrFOzieUm66RFYx18hluwDvfjjpLX+OWsMxG6wbp3DK/AHw13OUCfAdeQ/Z6whVfSbLPU08X9GrCB4CHJQsIWGJXKsRbS/6oDQTf/hlGEgICH4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559599446; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=lvqLSdZuKYOXTlRcxCVwuT367xbv/5/bqP9HqqYjtag=; b=jDtOfzATmGYT4VV5GOyIGG0adF2eUwgQ7BN3wxtkJKa1/MSDghgj0rQtFhOE4wm1WxBhvurCuSZqVT/3XX6TBDcBDijqgfX5zS7A/+709E0IVMfupsOYt0exvkvrb/C/EvDni4P9HoTNSSEg2506kvjWzLK5nsUbUvPZlKVpG1Q= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1559599446192231.66825765159956; Mon, 3 Jun 2019 15:04:06 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hXv2W-0003Sj-VL; Mon, 03 Jun 2019 22:02:48 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hXv2W-0003SX-Bf for xen-devel@lists.xenproject.org; Mon, 03 Jun 2019 22:02:48 +0000 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 52269080-864b-11e9-8f4e-c72f00ae0891; Mon, 03 Jun 2019 22:02:47 +0000 (UTC) Received: from sstabellini-ThinkPad-T480s.xilinx.com (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 985982054F; Mon, 3 Jun 2019 22:02:46 +0000 (UTC) X-Inumbo-ID: 52269080-864b-11e9-8f4e-c72f00ae0891 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559599366; bh=nMfJrr9GCqfib1f87JPsGrJ4pJieLk2+NbBRp70klbk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l0WYsnzoahDqKX1pumtiWrlycAEELOc+mx+/G6L4AY3e5E08rqcrkQ8bo/zFsCiKX pIQGwMChM8K6mNfWraXOjcpGLTBdvrtNQ0gKvGYh6jeEiN4uQSFhqCXhZ0Mt0xuLNY HdWKmJXbKyKBcF+rsFqCHJ47+uTsoG+fEDc7OPu0= From: Stefano Stabellini To: xen-devel@lists.xenproject.org Date: Mon, 3 Jun 2019 15:02:43 -0700 Message-Id: <20190603220245.22750-1-sstabellini@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Subject: [Xen-devel] [PATCH v3 1/3] xen/arm: fix nr_pdxs calculation X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , julien.grall@arm.com, sstabellini@kernel.org, JBeulich@suse.com MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) pfn_to_pdx expects an address, not a size, as a parameter. Specifically, it expects the end address, then the masks calculations compensate for any holes between start and end. Thus, we should pass the end address to pfn_to_pdx. The initial pdx is stored in frametable_base_pdx, so we can subtract the result of pfn_to_pdx(start_address) from nr_pdxs; we know that we don't need to cover any memory in the range 0-start in the frametable. Remove the variable `nr_pages' because it is unused. Signed-off-by: Stefano Stabellini CC: JBeulich@suse.com Reviewed-by: Julien Grall --- Changes in v3: - improve commit message Changes in v2: - use mfn_to_pdx and maddr_to_mfn along with mfn_add() --- xen/arch/arm/mm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 6ac169ce27..22ed91b5c9 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -886,8 +886,8 @@ void __init setup_xenheap_mappings(unsigned long base_m= fn, /* Map a frame table to cover physical addresses ps through pe */ void __init setup_frametable_mappings(paddr_t ps, paddr_t pe) { - unsigned long nr_pages =3D (pe - ps) >> PAGE_SHIFT; - unsigned long nr_pdxs =3D pfn_to_pdx(nr_pages); + unsigned long nr_pdxs =3D mfn_to_pdx(mfn_add(maddr_to_mfn(pe), -1)) - + mfn_to_pdx(maddr_to_mfn(ps)) + 1; unsigned long frametable_size =3D nr_pdxs * sizeof(struct page_info); mfn_t base_mfn; const unsigned long mapping_size =3D frametable_size < MB(32) ? MB(2) = : MB(32); --=20 2.17.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel