[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Arm: AArch32: Need suggestions to support 32 bit physical addresses
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Ayan Kumar Halder <ayankuma@xxxxxxx>
- Date: Wed, 30 Nov 2022 12:43:09 +0000
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YwnZRvaQilf5sgrXXdNIkyArvMuVhp1jNizG2R1Qvk0=; b=BLAL2D1maGAtTKXiB0cE9I+XvJYWNlCoSdNKhuhrCDkbDHRkNyREWbQGPqivSbItdDJR9RZyOiY5GB5QWj/L3dWxzFBLb1FemHTSj8WPvvKX7imG+xX1jqqRpgyg/l6XOFQ/GFxaHt8f5gWBJaijUPAiZhE8dRvn9QUTRjP+F3GoOaLnbIY8zwF0qm33FU2Nx5PB03Te7UW6IuVRZ6hUYnO3hp2HxuN56vTpzi3PSByXSy/uAKcmR2tNWQY5PgRNxXbMt3bO6sWfKwrkvr/oUPhgGu0GGl3rNXJE+gTmu0cVCluR6znuP3K6reYKmex9DrE+sa4JfIpwZJGUwSBikQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dQzXxcwvTaAD6CcjUBbeFt5wnrWfr6RLvbvJCDSVhsQ3vYuKxTxDiruD1N33/NI22XGv6uanXCvTWSt7UxyrKeIN32+QixBbACa7pCXBE2yjRwLQIw9pvXK/ox0XY8CMaX5NGkWWVlGjmEXUiKf4AWtJWyoNePfVXPb3T9LLxDnUdgOwU64h0FtI8jIh8Hl4kCO2C2d/quEL/FylQ7rOYUKjnA41YteUeue2eTYdeFGprJgMm/CtsRSvoD0eQYwTml3vmnRA8gQRhTP5/7HHNmvU5QX2Xgis229w5AAML1XM/PIP7okNd8DEZvO6B/brb5UrxraYJ2lNdwcJuiJxrg==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
- Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, "Stabellini, Stefano" <stefano.stabellini@xxxxxxx>, bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Andre Przywara <andre.przywara@xxxxxxx>, "Volodymyr_Babchuk@xxxxxxxx" <Volodymyr_Babchuk@xxxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, Vladimir Murzin <vladimir.murzin@xxxxxxx>, Julien Grall <julien@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Wed, 30 Nov 2022 12:43:39 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 30/11/2022 12:01, Jan Beulich wrote:
On 30.11.2022 12:27, Ayan Kumar Halder wrote:
Looking at "min(flsl(mfn + 1) - 1 + PAGE_SHIFT, PADDR_BITS);", I do not
understand the reason for "... -1" (ie subtracting by 1).
Do you know the reason ?
That's because fls() and flsl() and friends return 1-based bit indexes
(with 0 being returned when the input was zero), when we need 0-based
values here.
IIUC, you are comparing the count of bits here (not bit indexes).
PADDR_BITS = 52 (x86), 48 (arm64) and 40 (armv7 arm32).
Also fls() returning 0 is correct as none of the bits are set.
In this case "flsl(mfn + 1)" will return 1 when mfn == 0(min value), so
I think you are subtracting by 1.
Should I send a patch to fix the below ?
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 62afb07bc6..cd390a0956 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2245,7 +2245,7 @@ void __init xenheap_max_mfn(unsigned long mfn)
{
ASSERT(!first_node_initialised);
ASSERT(!xenheap_bits);
- BUILD_BUG_ON(PADDR_BITS >= BITS_PER_LONG);
+ BUILD_BUG_ON(PADDR_BITS > BITS_PER_LONG);
xenheap_bits = min(flsl(mfn + 1) - 1 + PAGE_SHIFT, PADDR_BITS);
printk(XENLOG_INFO "Xen heap: %u bits\n", xenheap_bits);
}
- Ayan
Jan
|