From nobody Fri May 17 09:38:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1646042841; cv=none; d=zohomail.com; s=zohoarc; b=mcxNMXoGKKNAZARDyjcAvBKhdKbtM9dUtENcbzAKVm53+ObCJVk8t45AFv+jG/f6464zstSBJf4Zw7DZ20Bce3t98P84mhI9wWhIfiJu2o0yzvnQEUL/xwQvgR9Ym7aXVV5iadTskDGwK1DBLI0YNCWnzIwqXViRnbUJU+kmDCg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646042841; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=f3Jb6TzGg/yx/at/IZdJKmtMdmjk5P7HjMANFFUjdOs=; b=VijaxU0mdUZ+vN9YvTjqx2R65bdetiaAlbw3X5I/Yka3UyGpNaeJQK42docqfB1AoOkRy6KCOtg7cBTB3bC1ncwRdXzl5WkR1qAxmMU2OU8JPyE5QIt+Z4h9Pn6vZNWiOVyHNDpl+ud2ChH9Vw51QUHp476+Yy7fTjanUio6Ct8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1646042841868476.5581659807125; Mon, 28 Feb 2022 02:07:21 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.280288.478179 (Exim 4.92) (envelope-from ) id 1nOcvn-00021y-Pz; Mon, 28 Feb 2022 10:07:03 +0000 Received: by outflank-mailman (output) from mailman id 280288.478179; Mon, 28 Feb 2022 10:07:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nOcvn-00021r-Me; Mon, 28 Feb 2022 10:07:03 +0000 Received: by outflank-mailman (input) for mailman id 280288; Mon, 28 Feb 2022 10:07:02 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nOcvm-00020A-D3 for xen-devel@lists.xenproject.org; Mon, 28 Feb 2022 10:07:02 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nOcvm-0002MD-3z; Mon, 28 Feb 2022 10:07:02 +0000 Received: from 54-240-197-224.amazon.com ([54.240.197.224] helo=dev-dsk-jgrall-1b-035652ec.eu-west-1.amazon.com) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nOcvl-0004V1-SI; Mon, 28 Feb 2022 10:07:02 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date: Subject:Cc:To:From; bh=f3Jb6TzGg/yx/at/IZdJKmtMdmjk5P7HjMANFFUjdOs=; b=1Hf6EM NF+7ulziq1Gje4Oec+PyKnNb+WnaNr0P+i8oi/PhGKJ0OZXxBOHdVDF2mfZReFO4gtxi8rpQLtwe1 Z5v6hbVveBOoad+ESyhgrRFQdvYKlQkV0rRvhdToemmo/B0ma8reaN9yWH4TjCfhnQ/K8FIbVKsdi sp9VRE0Rz6Q=; From: Julien Grall To: xen-devel@lists.xenproject.org Cc: julien@xen.org, Julien Grall , Stefano Stabellini , Bertrand Marquis , Volodymyr Babchuk Subject: [PATCH] xen/arm: mm: Encode existing constraints of the memory layout Date: Mon, 28 Feb 2022 10:06:59 +0000 Message-Id: <20220228100659.58089-1-julien@xen.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @xen.org) X-ZM-MESSAGEID: 1646042844132100001 Content-Type: text/plain; charset="utf-8" From: Julien Grall 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. Signed-off-by: Julien Grall Reviewed-by: Bertrand Marquis --- 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(voi= d) #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. + */ +#define CHECK_SAME_SLOT(level, virt1, virt2) \ + BUILD_BUG_ON(level##_table_offset(virt1) !=3D level##_table_offset(vir= t2)) + +#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 } =20 void dump_pt_walk(paddr_t ttbr, paddr_t addr, --=20 2.32.0