From patchwork Thu Aug 31 11:01:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 13371336 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 028C7C83F10 for ; Thu, 31 Aug 2023 11:01:38 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.593788.926884 (Exim 4.92) (envelope-from ) id 1qbfQP-0002gl-Qw; Thu, 31 Aug 2023 11:01:21 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 593788.926884; Thu, 31 Aug 2023 11:01:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qbfQP-0002gc-Ne; Thu, 31 Aug 2023 11:01:21 +0000 Received: by outflank-mailman (input) for mailman id 593788; Thu, 31 Aug 2023 11:01:20 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qbfQO-0002RJ-Gc for xen-devel@lists.xenproject.org; Thu, 31 Aug 2023 11:01:20 +0000 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [2607:f8b0:4864:20::430]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b6909c9d-47ed-11ee-8783-cb3800f73035; Thu, 31 Aug 2023 13:01:20 +0200 (CEST) Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-68c3b9f8333so419683b3a.1 for ; Thu, 31 Aug 2023 04:01:19 -0700 (PDT) Received: from leoy-yangtze.lan (211-75-219-203.hinet-ip.hinet.net. [211.75.219.203]) by smtp.gmail.com with ESMTPSA id o9-20020a63a809000000b0056c2de1f32esm1161686pgf.78.2023.08.31.04.01.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Aug 2023 04:01:18 -0700 (PDT) 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" X-Inumbo-ID: b6909c9d-47ed-11ee-8783-cb3800f73035 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693479678; x=1694084478; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IfO6gt1jg7JX4SuFiMGAMKpFfTvUV21HN5Stf3HGJ4k=; b=Bo2f+w4o6urk8f+y3aWJwjytQfu+7AcCmNWObe4KrQfBoIsMUErRgEZJrGp6IXcnyk Zc27KfnCdm2L1QWoboP26YWeRUj0TuOgAiSXqYsH+ZIt+kWWtlefSsE1O/2huca2JYh5 tVOLA4bHIvdKNnxYN1KXVKmLoH8N0QHE7MEZWyxDsew321wFgCG+Yjv5tNoSqIGiNgTg ++F51CZsRX0w7HvROjQsOlqUMzztLbpgbXqnbrcCn406cNcKLdwHduppUyNetlYNHP+M IFH7itBa2JQmOwMYGgAIfgIh6tRyjpGjTdcIMbQVDZFMWWR6Y0QsYExSu9ZbFGSjDGJ5 hXig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693479678; x=1694084478; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IfO6gt1jg7JX4SuFiMGAMKpFfTvUV21HN5Stf3HGJ4k=; b=lUDrA1L1Mt1DnWUeOnmERj0Ayr10SX3fvCit9BfyLFmcEdIhDYcmT+WTRfeH/rMINv 7Yy80Ui2IFte/JEA2xFnQ2c6GTMdwujvsw4cO6BYj0meDvJ2CnG1+Er7hz1SoLTBjoQU E6azfnr2ww93J5R8CzH4OIkx1mXX9maT9FF6shRU5tMqtLgoJg3BYSpwCnzgRNZ57PHH F1JLa8hIZZFzKu2VBA3En3e6qm9v4YNEel63fKtMxNFvPTTXtTErkiCGbXf1/lMliBb1 pdwlU+13Ql1VgLgSPTdXquQLkbH5nKJ9mhMfVSaGOPKL4FHmm40itTTpff8dRq69OXh6 pqXA== X-Gm-Message-State: AOJu0Yzs6f91zlyUbYzjwMMvt4QjkWYx8T12sa96bRE7wAjQl1ighwxk Lbz6eh2wwhJqzHpIKssbRqie8aKTcZWcPxRA+hvDsD6vMQU= X-Google-Smtp-Source: AGHT+IFbx34Tello++nJn7BJ5NMYqxmFPfEV4zrn1NMGKprp7QAuKPtGKOt5ijYg69NBQXXXOe9sSw== X-Received: by 2002:a05:6a00:7ce:b0:68a:6735:e43 with SMTP id n14-20020a056a0007ce00b0068a67350e43mr2640708pfu.11.1693479678448; Thu, 31 Aug 2023 04:01:18 -0700 (PDT) From: Leo Yan To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Alexey Klimov , Leo Yan Subject: [PATCH v1 1/2] xen/arm: Add macro XEN_VM_MAPPING Date: Thu, 31 Aug 2023 19:01:06 +0800 Message-Id: <20230831110107.2747633-2-leo.yan@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230831110107.2747633-1-leo.yan@linaro.org> References: <20230831110107.2747633-1-leo.yan@linaro.org> MIME-Version: 1.0 Xen maps the virtual memory space starting from L0 slot 4, so it's open coded for macros with the offset '4'. For more readable, add a new macro XEN_VM_MAPPING which defines the start slot for Xen virtual memory mapping, and all virtual memory regions are defined based on it. Signed-off-by: Leo Yan --- xen/arch/arm/include/asm/config.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/include/asm/config.h b/xen/arch/arm/include/asm/config.h index 83cbf6b0cb..21f4e68a40 100644 --- a/xen/arch/arm/include/asm/config.h +++ b/xen/arch/arm/include/asm/config.h @@ -117,11 +117,14 @@ #define XEN_VIRT_START _AT(vaddr_t, MB(2)) #else +#define IDENTITY_MAPPING_AREA_NR_L0 4 +#define XEN_VM_MAPPING SLOT0(IDENTITY_MAPPING_AREA_NR_L0) + #define SLOT0_ENTRY_BITS 39 #define SLOT0(slot) (_AT(vaddr_t,slot) << SLOT0_ENTRY_BITS) #define SLOT0_ENTRY_SIZE SLOT0(1) -#define XEN_VIRT_START (SLOT0(4) + _AT(vaddr_t, MB(2))) +#define XEN_VIRT_START (XEN_VM_MAPPING + _AT(vaddr_t, MB(2))) #endif /* @@ -184,12 +187,10 @@ #else /* ARM_64 */ -#define IDENTITY_MAPPING_AREA_NR_L0 4 - -#define VMAP_VIRT_START (SLOT0(4) + GB(1)) +#define VMAP_VIRT_START (XEN_VM_MAPPING + GB(1)) #define VMAP_VIRT_SIZE GB(1) -#define FRAMETABLE_VIRT_START (SLOT0(4) + GB(32)) +#define FRAMETABLE_VIRT_START (XEN_VM_MAPPING + GB(32)) #define FRAMETABLE_SIZE GB(32) #define FRAMETABLE_NR (FRAMETABLE_SIZE / sizeof(*frame_table)) From patchwork Thu Aug 31 11:01:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 13371337 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B64E2C83F10 for ; Thu, 31 Aug 2023 11:01:42 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.593790.926894 (Exim 4.92) (envelope-from ) id 1qbfQU-0002yE-2Y; Thu, 31 Aug 2023 11:01:26 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 593790.926894; Thu, 31 Aug 2023 11:01:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qbfQT-0002y5-UO; Thu, 31 Aug 2023 11:01:25 +0000 Received: by outflank-mailman (input) for mailman id 593790; Thu, 31 Aug 2023 11:01:24 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qbfQS-0002x7-Qj for xen-devel@lists.xenproject.org; Thu, 31 Aug 2023 11:01:24 +0000 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [2607:f8b0:4864:20::42b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id b82ee6a9-47ed-11ee-9b0d-b553b5be7939; Thu, 31 Aug 2023 13:01:22 +0200 (CEST) Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-68a402c1fcdso528236b3a.1 for ; Thu, 31 Aug 2023 04:01:22 -0700 (PDT) Received: from leoy-yangtze.lan (211-75-219-203.hinet-ip.hinet.net. [211.75.219.203]) by smtp.gmail.com with ESMTPSA id o9-20020a63a809000000b0056c2de1f32esm1161686pgf.78.2023.08.31.04.01.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Aug 2023 04:01:20 -0700 (PDT) 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" X-Inumbo-ID: b82ee6a9-47ed-11ee-9b0d-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693479681; x=1694084481; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FNWUOGWF52DUMNgUzQtRSA7m6UouW3TS9Lcf703h7SI=; b=RS9lEADjb9huvTBuq0qU9GMxC5xKStBe1cDedngDaM3RWbD3XMenEvGGRrE741Wa/l aHrdgOVRy75Wl52zqD4BK1ntRo8N0uacBqThaBKatxAraGZ64AzHKJ4XiWUY1UH8Uffq y11UeQfulLFcfB0MuRy90Sq5e5iCQHr2hdCs/m5sLfdBuRswInUdWnLvL+t3ImGHeyRi 7sk4NLu+DQy/0u2UqI9soeheWqC3obGZzM039dakaE5AvuErkA6rnRYPVPpPpfEVFnTx YuaZreMqMBS1iNrTKQw5jQ8M1yXKGs2eF8or4Mlx+KINxMI5oN1nx8so1YRhdYW94jZl 38XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693479681; x=1694084481; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FNWUOGWF52DUMNgUzQtRSA7m6UouW3TS9Lcf703h7SI=; b=Kck6TRUsn8731otDwOX/TWJTiyhpuqHaWm0mWlHiai5oJAjmP7JEQ2r2QZk7U154GA TUm7iSnJm+1V+HUJuYjGKRj3z8xyZsgHCs7F8jLPTqIRjtxijiJblOryFvFzm/QWTTfa aZMypsuwjPLdyJZLoX930uJN8Z+qulTPKwRCOmBRiFaWs7VJTdJ0BFrzLh33+f5+OIQQ sF8EhFA5UXagoFHZ5kmXOF02+aPxGq76xrgE93Ys8UF+SHiGdZvYzfax6BtjF5f1iuII uds3rirLOFDlcHe/z6HKTr3f0M0aNKlTsXlizRQxnWeTrcLshSJ4EzbJGut8mffQSkqi bYvQ== X-Gm-Message-State: AOJu0YzEqpQMUTS2SAIS1X6W+ucYQlhXnvtAD3uGftcMWmjKJSSS4QOb NoU4vntzSNRIXuaThC0Dl3YcnapHokUIR7HEbBFmt7vN4Tk= X-Google-Smtp-Source: AGHT+IHBvhlfHGJHHiueKu6JRQER8/WU/2Wcbrb+ZuOjTldbeD+dzozunS6234J3gq5+bvVJVqhi2A== X-Received: by 2002:a05:6a20:12d2:b0:14c:5dc2:659c with SMTP id v18-20020a056a2012d200b0014c5dc2659cmr5460366pzg.22.1693479681170; Thu, 31 Aug 2023 04:01:21 -0700 (PDT) From: Leo Yan To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Alexey Klimov , Leo Yan Subject: [PATCH v1 2/2] xen/arm: Enlarge identity map space to 127TiB Date: Thu, 31 Aug 2023 19:01:07 +0800 Message-Id: <20230831110107.2747633-3-leo.yan@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230831110107.2747633-1-leo.yan@linaro.org> References: <20230831110107.2747633-1-leo.yan@linaro.org> MIME-Version: 1.0 On some platforms, the memory regions could be: (XEN) MODULE[0]: 00000807f6df0000 - 00000807f6f3e000 Xen (XEN) MODULE[1]: 00000807f8054000 - 00000807f8056000 Device Tree (XEN) MODULE[2]: 00000000fa834000 - 00000000fc5de1d5 Ramdisk (XEN) MODULE[3]: 00000000fc5df000 - 00000000ffb3f810 Kernel In this case, the Xen binary is loaded above 2TB, so Xen fails to boot up due to the out of the identity map space. This patch enlarges identity map space to 127TiB, which can support the memory space [0x0 .. 0x00007eff_ffff_ffff], thus it has flexibility for support different platforms. Fixes: 1c78d76b67 ("xen/arm64: mm: Introduce helpers to prepare/enable/disable") Reported-by: Alexey Klimov Signed-off-by: Leo Yan Tested-by: Alexey Klimov --- xen/arch/arm/include/asm/config.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/include/asm/config.h b/xen/arch/arm/include/asm/config.h index 21f4e68a40..3e97c95b57 100644 --- a/xen/arch/arm/include/asm/config.h +++ b/xen/arch/arm/include/asm/config.h @@ -87,11 +87,11 @@ * 2G - 4G Domheap: on-demand-mapped * * ARM64 layout: - * 0x0000000000000000 - 0x000001ffffffffff (2TB, L0 slots [0..3]) + * 0x0000000000000000 - 0x00007effffffffff (127TB, L0 slots [0..253]) * * Reserved to identity map Xen * - * 0x0000020000000000 - 0x0000027fffffffff (512GB, L0 slot [4]) + * 0x000007f000000000 - 0x00007fffffffffff (1TB, L0 slot [254..255]) * (Relative offsets) * 0 - 2M Unmapped * 2M - 10M Xen text, data, bss @@ -103,9 +103,6 @@ * * 32G - 64G Frametable: 56 bytes per page for 2TB of RAM * - * 0x0000028000000000 - 0x00007fffffffffff (125TB, L0 slots [5..255]) - * Unused - * * 0x0000800000000000 - 0x000084ffffffffff (5TB, L0 slots [256..265]) * 1:1 mapping of RAM * @@ -117,7 +114,7 @@ #define XEN_VIRT_START _AT(vaddr_t, MB(2)) #else -#define IDENTITY_MAPPING_AREA_NR_L0 4 +#define IDENTITY_MAPPING_AREA_NR_L0 254 #define XEN_VM_MAPPING SLOT0(IDENTITY_MAPPING_AREA_NR_L0) #define SLOT0_ENTRY_BITS 39