[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xen/arm: mm: Encode existing constraints of the memory layout


  • To: Julien Grall <julien@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Thu, 3 Mar 2022 16:04:47 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.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=SlRr7aCU51z2Riu3PuDAKxN3VyMlDlI98DwNYn1Hphg=; b=l+D3k94QwEFpoAvXmytHlpzbYG/LrPOI3UDacogMR4JYFxkAHat4xWONsfk73qyVxlmCHvPXIGpfW8Va/ruLNFKEDUZOg9mjjPXLub4nS6NriQlEV2gUVRD1gnvoEdfYEgOOSeHgaWQPV78jt8vzOlECrt6jRE9x7v+FA4xaSA7fo6FKtEHTPzDPWDMQXGXVvDNc3LpG4suEpTd3nwFl3ZKh3dfY8ISvNscJs0PkL5pBhVrd50zjcmFGnVriXlHHMlqpjQz6T536kHOxDU7nnmX9MwviIcyBFf4/e2860pcHPE2QAJf8Wa5Ctx0v1y0QGKuLmrOzs3Aw5VFFMXvKrA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OG9CHqGieim8v0Rbjd2niR55F5iUBZsQg6Ie+Wj7pjjRSE62Jm/PX/0j7ctRyxR9TgDtZJr51YhyW6bWflMSMgG5DUa0HQWvegPk3GVB2ZgKmo6kWs7w92Iy7o+k/YhhWnHByxfx9XHYU4Fxmyw7mbbEHuBfc8Jx6ttjIo2/bKoeg5TmODFcLKxYRAtSkI2LLGxmG1ro3kyCu6r21w3M649qLU76vG9l2eLZ38AMdQFes2WWyaNp0QHY4F5Qi4yJ71ny69mQTBBMxBlJ+jAAsFuCWO+G5aziUKTj9b/8fdH1vKBueZ4uGz6mSgd/p32xcbUk4ivbYvEfkjBaxWeEzA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 03 Mar 2022 16:05:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYLIr12CXCtSE8aUS3fUoiw1XVAayt17mA
  • Thread-topic: [PATCH] xen/arm: mm: Encode existing constraints of the memory layout

Hi Julien,

> On 28 Feb 2022, at 10:06, Julien Grall <julien@xxxxxxx> wrote:
> 
> From: Julien Grall <jgrall@xxxxxxxxxx>
> 
> The boot code expects the regions XEN_VIRT_START, FIXMAP_ADDR(0),
> BOOT_FDT_VIRT_START to use the same 0th (arm64 only) and 1st slot.
> 
> Add some BUILD_BUG_ON() to confirm that. This is helpful if one wants
> to re-order the memory layout.

Very good idea :-)

> 
> Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>

Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Just a small NIT after if you want to do it on commit...

> ---
> xen/arch/arm/mm.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
> 
> diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
> index 8a17222109c6..40423a70f0ae 100644
> --- a/xen/arch/arm/mm.c
> +++ b/xen/arch/arm/mm.c
> @@ -211,6 +211,22 @@ static void __init __maybe_unused build_assertions(void)
> #ifdef CONFIG_DOMAIN_PAGE
>     BUILD_BUG_ON(DOMHEAP_VIRT_START & ~FIRST_MASK);
> #endif
> +    /*
> +     * The boot code expects the regions XEN_VIRT_START, FIXMAP_ADDR(0),
> +     * BOOT_FDT_VIRT_START to use the same 0th (arm64 only) and 1st
> +     * slot.

NIT: I would just add at the end of the sentence “in the page tables.”

Cheers
Bertrand

> +     */
> +#define CHECK_SAME_SLOT(level, virt1, virt2) \
> +    BUILD_BUG_ON(level##_table_offset(virt1) != level##_table_offset(virt2))
> +
> +#ifdef CONFIG_ARM_64
> +    CHECK_SAME_SLOT(zeroeth, XEN_VIRT_START, FIXMAP_ADDR(0));
> +    CHECK_SAME_SLOT(zeroeth, XEN_VIRT_START, BOOT_FDT_VIRT_START);
> +#endif
> +    CHECK_SAME_SLOT(first, XEN_VIRT_START, FIXMAP_ADDR(0));
> +    CHECK_SAME_SLOT(first, XEN_VIRT_START, BOOT_FDT_VIRT_START);
> +
> +#undef CHECK_SAME_SLOT
> }
> 
> void dump_pt_walk(paddr_t ttbr, paddr_t addr,
> -- 
> 2.32.0
> 


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.