[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 5/9] xen/x86: use arch_get_memory_map to get information from E820 map
- To: Wei Chen <wei.chen@xxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Tue, 12 Jul 2022 15:40:20 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=yckDpB+CZaEaxjaTr9UPPIv53wpyUD1nhmp+fMCR2Jw=; b=C1uryHjtDJw0x0mlgq2X2GcOD2nkjOsExw7vz/+Nito0KMbQkAXfYP1WVmQyc3qx9ca9X6s55rk6KKDXJ1lr8jdmblVTc+vPnHlSPDsLJ3h9q3ujX3QdbicheYG82I0Zu+F5dSBE57+XfG3+WL1ONE6orEbD9k164fbpuf8DEqwtCkcCz9Elq0/nfPlaNzIaiAmGivDROrNedT0nXcuc49Jm28IMC0EBVPp8b21fulvA8G9fp49AbU6zM8CD5hhbzFcHyLKGo0z5qIfss66QgXH5Bw4d4vKNIx2rcFWNMrEfbWxSTzclPm5cRYyCMKWA3TFJbgrW5KOpTbTAgGZvxw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IjoF6xf/Dh+y7H5HGxJkzkjB9lw4bxWO4igEmGVw3HSqP49ZMDw0eds7cBLJGSjiF7rBzeT4U12b0n3YGjlp6bj4+SB5i2dfId6Gm/44iwdtSF5xPm+n4Pnk+p/W2ETi698RWWyzdvx9+xxYtIUehrbRZWr8Ce7CNzagsxNZ5W0yQBaV9dec5e4RjAVKnwwohQowiNp9eQvfJa0BB7W9dytmLsn/53XIESHKo4jtpq8ZkT3iq42kEZNdIV82BQRmvqxW5FJ01NjyrVYEWfSK3xvQNvd/v/nsPeHu2Q0pQL/ZChjL4smattW2/m79LaTpIjzhGWtjF9dNJfGnEnNoaQ==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: nd@xxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Tue, 12 Jul 2022 13:40:32 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 08.07.2022 16:54, Wei Chen wrote:
> @@ -82,3 +83,25 @@ unsigned int __init arch_get_dma_bitsize(void)
> flsl(node_start_pfn(node) + node_spanned_pages(node) / 4 -
> 1)
> + PAGE_SHIFT, 32);
> }
> +
> +/*
> + * This function provides the ability for caller to get one RAM entry
> + * from architectural memory map by index.
> + *
> + * This function will return zero if it can return a proper RAM entry.
> + * otherwise it will return -ENODEV for out of scope index, or return
> + * -EINVAL for non-RAM type memory entry.
> + */
I think the comment also wants to spell out that the range is
exclusive at the end (assuming that's suitable for Arm; else now
would perhaps be the time to change it).
> +int __init arch_get_memory_map(unsigned int idx, paddr_t *start, paddr_t
> *end)
> +{
> + if ( idx >= e820.nr_map )
> + return -ENODEV;
Perhaps better -ENOENT?
> + if ( e820.map[idx].type != E820_RAM )
> + return -EINVAL;
I'm sorry, this should have occurred to me already when commenting on
v1: "get_memory_map" doesn't really fit this "RAM only" restriction.
Maybe arch_get_ram_range()? Or maybe others have some good naming
suggestion?
> + *start = e820.map[idx].addr;
> + *end = e820.map[idx].addr + e820.map[idx].size;
Nit: Would be shorter to read if you (re)used *start.
Jan
|