From nobody Thu Nov 21 20:21:17 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1729070186; cv=none; d=zohomail.com; s=zohoarc; b=anA09Xa2DtPc9+J0bjvD3Y6HHlY95FazRbajSVvpfa/XQw24AZh1gSgrGQgePqS0+MteMetYekBakv5kM+dpIO2fvCh6bL/SIpuoSav5rwJvKEINjig6yMJYAcu5t1y5HJd+HxFY0UupGYYS02rJjACKux7G433/02LMIVuOSqQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729070186; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=FUi2WJJTrylVj2kHi62rhC3wT5w2qKiq8sfSJLHijNw=; b=hr8bpCD2EPnUglKsJalr3vSiU142UGGOyXvsrpyCvhbymVbKzNCWpJQpNBw7dUhpqLOPRcJscywa4btkdjj7fmTWEm1AIuFPzR5gzal2ztVgAwhCilc3cqFsmzjIKCOtM6zCzTGqo+oonaxDMj1HxLk1DBrghtyuymg6k88ZT9Q= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1729070186867314.2632974378523; Wed, 16 Oct 2024 02:16:26 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.819722.1233146 (Exim 4.92) (envelope-from ) id 1t108T-00055m-TU; Wed, 16 Oct 2024 09:16:05 +0000 Received: by outflank-mailman (output) from mailman id 819722.1233146; Wed, 16 Oct 2024 09:16:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t108T-00055e-PK; Wed, 16 Oct 2024 09:16:05 +0000 Received: by outflank-mailman (input) for mailman id 819722; Wed, 16 Oct 2024 09:16:05 +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 1t108S-0004r9-UK for xen-devel@lists.xenproject.org; Wed, 16 Oct 2024 09:16:04 +0000 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [2a00:1450:4864:20::231]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 44274d92-8b9f-11ef-99a3-01e77a169b0f; Wed, 16 Oct 2024 11:16:03 +0200 (CEST) Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2fb59652cb9so22534091fa.3 for ; Wed, 16 Oct 2024 02:16:03 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53a000129eesm391451e87.259.2024.10.16.02.16.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 02:16:00 -0700 (PDT) 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" X-Inumbo-ID: 44274d92-8b9f-11ef-99a3-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729070161; x=1729674961; 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=FUi2WJJTrylVj2kHi62rhC3wT5w2qKiq8sfSJLHijNw=; b=OLfcMp6jd2wJO/AI0zZN8EKwpcGZWnN91cXbiVSQurhvxjfxfoHL5Zw61726NK1cnf Sy70v2dmbMhH+hBvctyKPi+WLd6B2e83TF/yQOOMYpBYwRQ4e/iTucHubSeFDbNFe//+ 9mz1Wk2Vuag+Xv7Ry4c5r+h2z4qoJB7eUck/9vN5YDjKaeEY6x8aK72NQINoc8hZNgd/ Bgry8MDOGjilT7nHrDtaXsmzJyKJwTfDvJcUE6Tw/iLJ5XEE82AUDB5lv97j9ICys0wv GPdeHtjlLZxGWGFjNF7H5nE6PhothGPUAh4277Epf2jv0CvwUe8xj8H3EHJhklOr0eEW 4bIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729070161; x=1729674961; 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=FUi2WJJTrylVj2kHi62rhC3wT5w2qKiq8sfSJLHijNw=; b=oeq0c166YrWarczeVLbMAhyN3hS0oMsx09nCFlMQYTU1J1+vBvQitusJ/vXNVGYE88 dWvrguzlKTNNPdmoBVdRDOW8QIyxfIrJ/9lRI2aQ2QpXM6F3dcUcCxzidq6x0pjjf1OG Np+5fkpO8vV1G9wUFyc98GxjlWdyXNctLwmeaHLYc99xeZZcNeBJAxJq4PJ+RVfGGhS6 3hMya0lb+b00Ubg7nUMcXGjvo5efB2ZmgROtw1lxeUH1EtVTPEI2edZ6vvGznGHZ8ggx x8ZGPJXHjEsw7yU6dfI9eY8Q1oNrA2v7LW4d0TKYYZ8uMzQ4GT6Gr+MWAuH0aXnVHJqm AyZQ== X-Gm-Message-State: AOJu0YwDPq8CCLz9ftLrWSZF7MgS5RKMCnoFMO9+sbrh0IbvFyScmLWW npKS42OY1L+ZINMcQfsoZP7VTZxmYihS8obMxvxCZTzC8RHC538Hw2Qbmw== X-Google-Smtp-Source: AGHT+IER3QcgvTjxn2/fyXoLjy8xB7tf/OJVdzSVEvhg72jqpoBa/NoQ/kGK1cJewxHeYkXQQOSFOg== X-Received: by 2002:a05:6512:6d2:b0:539:f4c1:71d3 with SMTP id 2adb3069b0e04-539f4c17406mr6039710e87.29.1729070161226; Wed, 16 Oct 2024 02:16:01 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Alistair Francis , Bob Eshleman , Connor Davis , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH v1 1/5] xen/riscv: add stub for share_xen_page_with_guest() Date: Wed, 16 Oct 2024 11:15:53 +0200 Message-ID: <3dfd4bdf6584e73ecdbff5a66fdbaec68e31cc3c.1729068334.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1729070187379116600 Content-Type: text/plain; charset="utf-8" To avoid the following linkage fail the stub for share_xen_page_with_guest() is introduced: riscv64-linux-gnu-ld: prelink.o: in function `tasklet_kill': /build/xen/common/tasklet.c:176: undefined reference to `share_xen_page_w= ith_guest' riscv64-linux-gnu-ld: ./.xen-syms.0: hidden symbol `share_xen_page_with_g= uest' isn't defined riscv64-linux-gnu-ld: final link failed: bad value $ find . -name \*.o | while read F; do nm $F | grep share_xen_page_with_gue= st && echo $F; done U share_xen_page_with_guest ./xen/common/built_in.o U share_xen_page_with_guest ./xen/common/trace.o U share_xen_page_with_guest ./xen/prelink.o Despite the linker fingering tasklet.c (very likely a toolchain bug), it's trace.o which has the undefined reference. Looking at trace.i, there is call of share_xen_page_with_guest() in share_xen_page_with_privileged_guests() from asm/mm.h. Signed-off-by: Oleksii Kurochko --- xen/arch/riscv/stubs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c index 5951b0ce91..c9a590b225 100644 --- a/xen/arch/riscv/stubs.c +++ b/xen/arch/riscv/stubs.c @@ -2,7 +2,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -409,3 +411,11 @@ unsigned long get_upper_mfn_bound(void) { BUG_ON("unimplemented"); } + +/* mm.c */ + +void share_xen_page_with_guest(struct page_info *page, struct domain *d, + enum XENSHARE_flags flags) +{ + BUG_ON("unimplemented"); +} --=20 2.47.0 From nobody Thu Nov 21 20:21:17 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1729070188; cv=none; d=zohomail.com; s=zohoarc; b=fqXsfIXvo8xL3AgjCc+om6f9fUbg3+dpeTYfwlozBZo9DOiFXcxUHdyFxlY3XWDnzyxyGwdwoqcDtcMRF87rUptxeesxQ5DTk7FREyjWBZzfij3F1akErgOlHvmCrDO8DKsiURWKFMKcXZfI4KNAxumvXUSEW89WzHaCNR7N3L8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729070188; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zTo8wcoBAnZWVL6JY0i7rOCMbKVxaD9bONOTGNKU9j0=; b=PYqpOXsAV/T2BM4GumeLfgM58FbWtG2/829MwabuFOuthY86AiHsqdBFMVdBQuRABJGUJXsAahIpwpVECf7D6w+vbXZk6fqFlmjUaR+sVIZutTcwE5Gq5A7kA3ut28ZR31B/YMjJWIF0ZQFhscKsMCX5JXBRA/f4KNmsvbZgtFY= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1729070188556370.09830934822855; Wed, 16 Oct 2024 02:16:28 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.819723.1233156 (Exim 4.92) (envelope-from ) id 1t108V-0005La-6O; Wed, 16 Oct 2024 09:16:07 +0000 Received: by outflank-mailman (output) from mailman id 819723.1233156; Wed, 16 Oct 2024 09:16:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t108V-0005LR-3f; Wed, 16 Oct 2024 09:16:07 +0000 Received: by outflank-mailman (input) for mailman id 819723; Wed, 16 Oct 2024 09:16:05 +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 1t108T-0004r9-L4 for xen-devel@lists.xenproject.org; Wed, 16 Oct 2024 09:16:05 +0000 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [2a00:1450:4864:20::136]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 44c55a29-8b9f-11ef-99a3-01e77a169b0f; Wed, 16 Oct 2024 11:16:04 +0200 (CEST) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-539f2b95775so4121713e87.1 for ; Wed, 16 Oct 2024 02:16:04 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53a000129eesm391451e87.259.2024.10.16.02.16.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 02:16:01 -0700 (PDT) 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" X-Inumbo-ID: 44c55a29-8b9f-11ef-99a3-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729070163; x=1729674963; 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=zTo8wcoBAnZWVL6JY0i7rOCMbKVxaD9bONOTGNKU9j0=; b=C2cAA6GZr+IRir0BpoKtgIeq9vxBXkASqUuKhHDfWjUW8xpbf619sAIPRX4oh8aQwo 38y9neezO0KcnrmiYbsdzWYwGPLyflyoXBF5KA7UYO1PR/S23nvfBk36kyEiNwYdQWh/ JSKplRCW3zR7e7wOP6Og9tUsK81Jv0RFlmQFObHr/KAoXFF8jYZU5nJJkZSX/FGIQg2+ lG53A0YXTeEipLzj+OsIBbZllTCt1IWTf5rDEL3hDNeKz+5vNT3470/YO3CLzgYZvMFr NODx42L/ojBUgAzrIuzV6jLiTVwoafclyRPd33jtoUyohtW96BiEA/gKcXHG3iI3I30Y V7jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729070163; x=1729674963; 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=zTo8wcoBAnZWVL6JY0i7rOCMbKVxaD9bONOTGNKU9j0=; b=XT/4qknI1gm3xEKUVyk+OpybGkd5ydNMUH8FtXa1plRe7z3PQGgHTp6/RAOa11nn9r PC5qkS9fftJeMTSwyNmcLZihPh1RY0TKOXN/zAur36sKE/Hblwn3cLaiiqqthbLVJf3U sKN4R4QKdBKy/GjwbE2u9HIwRUrBxUpMaYLSDnrSRbDUJPsxKHCtPdz6Nvf7Q1rtjlDk Vv1J2MUKFPCMOt1XmpXwhGyTpzzfeob2HwqFLjMDjGHlEv2oK4JY5AlLueaovrhlP9hl pu5ZZW9eZcN0dI4lU+2qw5w+PJXYbpoL0sHxSCyS0Afh4sXcVKrZSYOJy3h6ZIs46cS0 KuKw== X-Gm-Message-State: AOJu0YyMwYuZLlm8h9KPXsGtAOaauTYrTf9YU72o4YWBK8dZgCK//cLq pot3rcidG8vs96ld7g7bT5DpFueTHHG5IWIEUFdOKrx5v7g86Mke0Z5otA== X-Google-Smtp-Source: AGHT+IGiD8tLBcbs6M/QvfKxQOuo5Zgnq6pEzPkd4C4CIXLglaZ+oIXatCYihqviEWs7KjcKGIUlFA== X-Received: by 2002:a05:6512:220d:b0:539:8a50:6ee8 with SMTP id 2adb3069b0e04-539e57282b1mr9234525e87.57.1729070163190; Wed, 16 Oct 2024 02:16:03 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Alistair Francis , Bob Eshleman , Connor Davis , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH v1 2/5] xen/riscv: implement maddr_to_virt() Date: Wed, 16 Oct 2024 11:15:54 +0200 Message-ID: X-Mailer: git-send-email 2.47.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1729070189389116600 Content-Type: text/plain; charset="utf-8" Implement the `maddr_to_virt()` function to convert a machine address to a virtual address. This function is specifically designed to be used only for the DIRECTMAP region, so a check has been added to ensure that the address does not exceed `DIRECTMAP_SIZE`. Signed-off-by: Oleksii Kurochko --- xen/arch/riscv/include/asm/mm.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/m= m.h index ebb142502e..0396e66f47 100644 --- a/xen/arch/riscv/include/asm/mm.h +++ b/xen/arch/riscv/include/asm/mm.h @@ -25,8 +25,12 @@ =20 static inline void *maddr_to_virt(paddr_t ma) { - BUG_ON("unimplemented"); - return NULL; + /* Offset in the direct map, accounting for pdx compression */ + unsigned long va_offset =3D maddr_to_directmapoff(ma); + + ASSERT(va_offset < DIRECTMAP_SIZE); + + return (void *)(DIRECTMAP_VIRT_START + va_offset); } =20 /* --=20 2.47.0 From nobody Thu Nov 21 20:21:17 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1729070187; cv=none; d=zohomail.com; s=zohoarc; b=XeDwzSkh9JHBNMGYXFnAxX1pV9Ws7GqR3S51xSb9Lxih891rrvR6527bOC72QuG+qLA1xm/NJuk7/Vuh6m0k/GY20sB5QXShwLc5tvIMGLFSRoleQBFC2WLFL+2QGnCHg52f+unU6kVCEVVcDjYaIC5tH+ir3SWpRC2lNH5ia30= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729070187; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fGuFYCXwauYG/Y17jk3tmaCDchtBJlytkAwIlTZfzko=; b=hor4e6u89qNr9uJyBKBVRM+h5uNr/Qa2x98dmgeVgnjk42Rz7dKAoXCl9M7+SosP4D7ThG1RZIjlf66rYbVvLQssjj4JVIlmS3qTyAAnyVeEgybvH3WhPoMSNwtY23gSZTx6qlwiUvuwmesnDttJZTgqR+d/2rbEx0mwSHOEr5w= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 172907018704364.81237533939975; Wed, 16 Oct 2024 02:16:27 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.819724.1233166 (Exim 4.92) (envelope-from ) id 1t108W-0005bX-FM; Wed, 16 Oct 2024 09:16:08 +0000 Received: by outflank-mailman (output) from mailman id 819724.1233166; Wed, 16 Oct 2024 09:16:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t108W-0005bD-AV; Wed, 16 Oct 2024 09:16:08 +0000 Received: by outflank-mailman (input) for mailman id 819724; Wed, 16 Oct 2024 09:16:06 +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 1t108U-0005Dr-K1 for xen-devel@lists.xenproject.org; Wed, 16 Oct 2024 09:16:06 +0000 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [2a00:1450:4864:20::12a]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 458c7379-8b9f-11ef-a0be-8be0dac302b0; Wed, 16 Oct 2024 11:16:05 +0200 (CEST) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-539f76a6f0dso2882761e87.1 for ; Wed, 16 Oct 2024 02:16:05 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53a000129eesm391451e87.259.2024.10.16.02.16.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 02:16:03 -0700 (PDT) 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" X-Inumbo-ID: 458c7379-8b9f-11ef-a0be-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729070165; x=1729674965; 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=fGuFYCXwauYG/Y17jk3tmaCDchtBJlytkAwIlTZfzko=; b=Wbrq0EcMkiODkwUFRkqGJwOY180q+enFGkXV7OzyML3HclgAY5NGw1kCm74rZIqTau 3Grqu61S0+I3JJD9JiW0LWQroJ7hYJOQDVWA1QiTEQ/sZ0ZccPnpy+Um6+jckrQHyM2n oep4MykeDfgaioDDDb66TvYr4TbbI2mwXHfQEqIQgZek47Q7pV2eXvtq0PnU9SgyPqsE FsigDQ8CoUdMExA1GhoBnmXQONOTxhCgx0Ub/kTsUircqdz6F0NRcbyxxI++lx3TAumr 7nsKNCurpCYdZgKVPedhkG259QpUqV0J4mlb2Msth9I4o4YRYl1XyyhZptmIe6gNtDM3 yKcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729070165; x=1729674965; 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=fGuFYCXwauYG/Y17jk3tmaCDchtBJlytkAwIlTZfzko=; b=isMRpWokANn5nQRtSPzry1+/x94aBQhT5C0FsGmBjdp6upqIdEdLETvU0tCOz8RAyQ coTfqDJ+/Jpx5dfYrFeMzgqgoyvU1l1/MnM406uRt+Gkxs7DK4OEwq3X1cDSwL0+JZhl 5uSqjEXZTMngtKNfWh+m2eGZB5sLAFkCcuBGCH1rURnGdz9KO1xPLshLnYmsuu383h2U j54Sd9g9/RPJuAfNPFWjKYOm2GpoYHEbBZPquaNBdm6likpnORUanftWFknDXbm2JwAZ zr1WN25IQ8IYogV5daXCiC3HmLmrarLonOv6TllWcpiTU2dxkJVoo5F1N4EcAzz8JRX9 6iWg== X-Gm-Message-State: AOJu0YxvRilVtNzj0q5QEKGQWbhTVj3L0evMxo4MfEFr1vP0IDUURAs/ 9gcxUiHI4QKuO0kJxh+fUcsyoRVkmRCWGkK/RS1BpLiy4qdNONIE4WIAOQ== X-Google-Smtp-Source: AGHT+IHZkUCj21Y7l52VIWLe416ZSMs2Ro+dERhPbC13frSrZPSSU46sMhzh1iRQsImnvC/Xb+KtPg== X-Received: by 2002:a05:6512:e9c:b0:539:f807:ad93 with SMTP id 2adb3069b0e04-539f807caf1mr5086745e87.38.1729070164430; Wed, 16 Oct 2024 02:16:04 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Alistair Francis , Bob Eshleman , Connor Davis , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH v1 3/5] xen/riscv: introduce setup_mm() Date: Wed, 16 Oct 2024 11:15:55 +0200 Message-ID: <300a4a5911766d42ec01c3fcaee664d72b484296.1729068334.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1729070187548116600 Content-Type: text/plain; charset="utf-8" Introduce the implementation of setup_mm(), which includes: 1. Adding all free regions to the boot allocator, as memory is needed to allocate page tables used for frame table mapping. 2. Calculating RAM size and the RAM end address. 3. Setting up direct map mappings from the PFN of physical address 0 to the PFN of RAM end. 4. Setting up frame table mappings from physical address 0 to ram_end. 5. Setting up total_pages and max_page. 6. Establishing `directmap_virt_end`, which is not currently used but is intended for future use in virt_to_page() to ensure that virtual addresses do not exceed directmap_virt_end. In the case of RISC-V 64, which has a large virtual address space (the minimum supported MMU mode is Sv39, providing TB of VA space), the direct map and frame table are mapped starting from physical address 0. This simplifies the calculations and thereby improves performance for page_to_mfn(), mfn_to_page(), and maddr_to_virt(), as there is no need to account for {directmap, frametable}_base_pdx. Signed-off-by: Oleksii Kurochko --- xen/arch/riscv/include/asm/mm.h | 2 + xen/arch/riscv/include/asm/setup.h | 2 + xen/arch/riscv/mm.c | 93 ++++++++++++++++++++++++++++++ xen/arch/riscv/setup.c | 3 + 4 files changed, 100 insertions(+) diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/m= m.h index 0396e66f47..7b472220e5 100644 --- a/xen/arch/riscv/include/asm/mm.h +++ b/xen/arch/riscv/include/asm/mm.h @@ -12,6 +12,8 @@ =20 #include =20 +extern vaddr_t directmap_virt_end; + #define pfn_to_paddr(pfn) ((paddr_t)(pfn) << PAGE_SHIFT) #define paddr_to_pfn(pa) ((unsigned long)((pa) >> PAGE_SHIFT)) =20 diff --git a/xen/arch/riscv/include/asm/setup.h b/xen/arch/riscv/include/as= m/setup.h index c0214a9bf2..844a2f0ef1 100644 --- a/xen/arch/riscv/include/asm/setup.h +++ b/xen/arch/riscv/include/asm/setup.h @@ -5,6 +5,8 @@ =20 #define max_init_domid (0) =20 +void setup_mm(void); + #endif /* ASM__RISCV__SETUP_H */ =20 /* diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c index 27026d803b..53b7483f75 100644 --- a/xen/arch/riscv/mm.c +++ b/xen/arch/riscv/mm.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -423,3 +424,95 @@ void * __init early_fdt_map(paddr_t fdt_paddr) =20 return fdt_virt; } + +#ifndef CONFIG_RISCV_32 +/* Map the region in the directmap area. */ +static void __init setup_directmap_mappings(unsigned long nr_mfns) +{ + if ( nr_mfns > PFN_DOWN(DIRECTMAP_SIZE) ) + panic("The directmap cannot cover the physical region %#"PRIpaddr"= - %#"PRIpaddr"\n", + 0UL, nr_mfns << PAGE_SHIFT); + + if ( map_pages_to_xen((vaddr_t)mfn_to_virt(0), + _mfn(0), nr_mfns, + PAGE_HYPERVISOR_RW) ) + panic("Unable to setup the directmap mappings.\n"); +} + +/* Map a frame table to cover physical addresses ps through pe */ +static void __init setup_frametable_mappings(paddr_t ps, paddr_t pe) +{ + unsigned long nr_mfns =3D mfn_x(mfn_add(maddr_to_mfn(pe), -1)) - + mfn_x(maddr_to_mfn(ps)) + 1; + unsigned long frametable_size =3D nr_mfns * sizeof(struct page_info); + mfn_t base_mfn; + + if ( frametable_size > FRAMETABLE_SIZE ) + panic("The frametable cannot cover the physical region %#"PRIpaddr= " - %#"PRIpaddr"\n", + ps, pe); + + frametable_size =3D ROUNDUP(frametable_size, MB(2)); + base_mfn =3D alloc_boot_pages(frametable_size >> PAGE_SHIFT, 2<<(20-12= )); + + if ( map_pages_to_xen(FRAMETABLE_VIRT_START, base_mfn, + frametable_size >> PAGE_SHIFT, + PAGE_HYPERVISOR_RW) ) + panic("Unable to setup the frametable mappings.\n"); + + memset(&frame_table[0], 0, nr_mfns * sizeof(struct page_info)); + memset(&frame_table[nr_mfns], -1, + frametable_size - (nr_mfns * sizeof(struct page_info))); +} + +vaddr_t directmap_virt_end __read_mostly; + +/* + * Setup memory management + * + * RISC-V 64 has a large virtual address space (the minimum supported + * MMU mode is Sv39, which provides TBs of VA space). + * In the case of RISC-V 64, the directmap and frametable are mapped + * starting from physical address 0 to simplify the page_to_mfn(), + * mfn_to_page(), and maddr_to_virt() calculations, as there is no need + * to account for {directmap, frametable}_base_pdx in this setup. + */ +void __init setup_mm(void) +{ + const struct membanks *banks =3D bootinfo_get_mem(); + paddr_t ram_end =3D 0; + paddr_t ram_size =3D 0; + unsigned int i; + + /* + * We need some memory to allocate the page-tables used for the direct= map + * mappings. But some regions may contain memory already allocated + * for other uses (e.g. modules, reserved-memory...). + * + * For simplicity, add all the free regions in the boot allocator. + */ + populate_boot_allocator(); + + total_pages =3D 0; + + for ( i =3D 0; i < banks->nr_banks; i++ ) + { + const struct membank *bank =3D &banks->bank[i]; + paddr_t bank_end =3D bank->start + bank->size; + + ram_size =3D ram_size + bank->size; + ram_end =3D max(ram_end, bank_end); + } + + setup_directmap_mappings(PFN_DOWN(ram_end)); + + total_pages =3D PFN_DOWN(ram_size); + + directmap_virt_end =3D DIRECTMAP_VIRT_START + ram_end; + + setup_frametable_mappings(0, ram_end); + max_page =3D PFN_DOWN(ram_end); +} + +#else /* CONFIG_RISCV_32 */ +#error setup_mm(), setup_{directmap,frametable}_mapping() should be implem= ented for RV_32 +#endif diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index e29bd75d7c..2887a18c0c 100644 --- a/xen/arch/riscv/setup.c +++ b/xen/arch/riscv/setup.c @@ -12,6 +12,7 @@ =20 #include #include +#include #include #include =20 @@ -59,6 +60,8 @@ void __init noreturn start_xen(unsigned long bootcpu_id, printk("Command line: %s\n", cmdline); cmdline_parse(cmdline); =20 + setup_mm(); + printk("All set up\n"); =20 machine_halt(); --=20 2.47.0 From nobody Thu Nov 21 20:21:18 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1729070193; cv=none; d=zohomail.com; s=zohoarc; b=LSPuSCpp7M61Ee7npLRJVFnbXiG6cY+owfwJW7RMDReiAzqNDTrzr6onc/aTaqqIv5El2QYiK7Hq1/ebqzh+hENfBWEKfMDwkhGr7+CbVBbGsG8I39CVt6LHP0U/1Y0+fSD0Vg6GHMqZKqWNpv5mOHMyJ81gS+bp2vhqg98dfPo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729070193; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5lMS96kWM5Eui5gIIP4UZOxeSh3q2YL3fIRawSS4m1s=; b=M+I6bmyGYwKOZGh/22cRRTTpwZT5zcRuRPKij3J9vdFmLfVSIr2ZdbPstQ5S6CAE3FL5ctxGQVuvkI+NKqjVWPZXRfE3+VhQjNL5THNcA/2IHA8Dvf1ByWOtEpfpMZfSuEenWNoUsjXDiNC9qAnakJWT0KnWMLqTfi2qtKB2UNw= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1729070193095554.3169029864947; Wed, 16 Oct 2024 02:16:33 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.819725.1233172 (Exim 4.92) (envelope-from ) id 1t108W-0005fR-Te; Wed, 16 Oct 2024 09:16:08 +0000 Received: by outflank-mailman (output) from mailman id 819725.1233172; Wed, 16 Oct 2024 09:16:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t108W-0005es-MA; Wed, 16 Oct 2024 09:16:08 +0000 Received: by outflank-mailman (input) for mailman id 819725; Wed, 16 Oct 2024 09:16:07 +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 1t108V-0005Dr-9e for xen-devel@lists.xenproject.org; Wed, 16 Oct 2024 09:16:07 +0000 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [2a00:1450:4864:20::132]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 45fe840f-8b9f-11ef-a0be-8be0dac302b0; Wed, 16 Oct 2024 11:16:06 +0200 (CEST) Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-539983beb19so6739871e87.3 for ; Wed, 16 Oct 2024 02:16:06 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53a000129eesm391451e87.259.2024.10.16.02.16.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 02:16:04 -0700 (PDT) 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" X-Inumbo-ID: 45fe840f-8b9f-11ef-a0be-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729070166; x=1729674966; 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=5lMS96kWM5Eui5gIIP4UZOxeSh3q2YL3fIRawSS4m1s=; b=Mj0Wx8eCBhJJoinEo/hdwMCMVWWoA0evI5uarwiSx5zXUCfwylbAaVBCq/3d+L1m+L Hp8jepS4l7vnMfL/QApXfrnwVyPnwO2LSSpzGV4Nblh2Wn4HOsxLi+4GdSQU2dK3PXQE Mic6MA02b3SSZso4H0L6s+/LX6F3oaHaYHLzM7Ec2XlicUW7d7/m5/RzRXxloVdyolcM +fDIvM5BRsfEIgQ2q0fsrDL/W8X2YDFcl9SI5+4HAtW9ySZxTiw3gSSnLNjOoebP/9/+ B37FBZClijhVdeqvHBgpY1bavUte3WK2RKGomkV4nQWETTazGUhrhrorcZs8YbMTctbC QBIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729070166; x=1729674966; 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=5lMS96kWM5Eui5gIIP4UZOxeSh3q2YL3fIRawSS4m1s=; b=W5DQMtfJX0Q1r6FZVQ5+IL5bLSb2+IYTgSTXF+B26BLU1S02QPtXQ0beO9j2uDe+io gCM6jiM3ongdZ1qOWKWrwle/umbRTX8nCPiY3oiyB6SA8WHqIUiFDzIVATEfJDogEPbK wRoYkMXcvjYeMxzXr04uut9XFCjPF9YKZH04nxSkrdxXgaCtCQi7irXjHPSSiOu4nsqG jCBiakjaMWJHhLcddfbAVEOVUQMZvq/orjrcwO0YECZjlf6z5jtxHtXIoNnOh5KZwbS2 5x2ot7I90zMq5WFh6Dy1m+JdyKOTzVGEMWJzn/xvypCj4EB4UY9gMQWLdfjr9jKWQZX8 0t2A== X-Gm-Message-State: AOJu0YwQgBBq9goMRSNjGuV7cEU1lMI6cmIMic/5dXcywUWvCNIqV70s DJzhRWNovGoA8+cQ47AqfdVk4S3NpEbVokjRBhEBcvGdCKKTg0INYhi/eQ== X-Google-Smtp-Source: AGHT+IGb80fSI23TL9q6T+bth+NXlB2cHrY4hxUWVqG0EVh54POIsEn5HZendV2P+tHGigv2GJpZ1Q== X-Received: by 2002:ac2:4c4c:0:b0:539:8e77:9129 with SMTP id 2adb3069b0e04-539da583e0fmr9305769e87.44.1729070165278; Wed, 16 Oct 2024 02:16:05 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Alistair Francis , Bob Eshleman , Connor Davis , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH v1 4/5] xen/riscv: initialize the VMAP_DEFAULT virtual range Date: Wed, 16 Oct 2024 11:15:56 +0200 Message-ID: X-Mailer: git-send-email 2.47.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1729070193444116600 Content-Type: text/plain; charset="utf-8" Call vm_init() to initialize the VMAP_DEFAULT virtual range. To support this, introduce the populate_pt_range() and arch_vmap_virt_end() functions, which are used by vm_init()->vm_init_type(). Signed-off-by: Oleksii Kurochko Acked-by: Jan Beulich --- xen/arch/riscv/mm.c | 11 +++++------ xen/arch/riscv/pt.c | 6 ++++++ xen/arch/riscv/setup.c | 3 +++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c index 53b7483f75..2a55246f80 100644 --- a/xen/arch/riscv/mm.c +++ b/xen/arch/riscv/mm.c @@ -352,12 +352,6 @@ void arch_dump_shared_mem_info(void) BUG_ON("unimplemented"); } =20 -int populate_pt_range(unsigned long virt, unsigned long nr_mfns) -{ - BUG_ON("unimplemented"); - return -1; -} - int xenmem_add_to_physmap_one(struct domain *d, unsigned int space, union add_to_physmap_extra extra, unsigned long idx, gfn_t gfn) @@ -516,3 +510,8 @@ void __init setup_mm(void) #else /* CONFIG_RISCV_32 */ #error setup_mm(), setup_{directmap,frametable}_mapping() should be implem= ented for RV_32 #endif + +void *__init arch_vmap_virt_end(void) +{ + return (void *)(VMAP_VIRT_START + VMAP_VIRT_SIZE); +} diff --git a/xen/arch/riscv/pt.c b/xen/arch/riscv/pt.c index cc5e2d3266..d62aceb36c 100644 --- a/xen/arch/riscv/pt.c +++ b/xen/arch/riscv/pt.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -419,3 +420,8 @@ int map_pages_to_xen(unsigned long virt, =20 return pt_update(virt, mfn, nr_mfns, flags); } + +int __init populate_pt_range(unsigned long virt, unsigned long nr_mfns) +{ + return pt_update(virt, INVALID_MFN, nr_mfns, PTE_POPULATE); +} diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index 2887a18c0c..3652cb056d 100644 --- a/xen/arch/riscv/setup.c +++ b/xen/arch/riscv/setup.c @@ -7,6 +7,7 @@ #include #include #include +#include =20 #include =20 @@ -62,6 +63,8 @@ void __init noreturn start_xen(unsigned long bootcpu_id, =20 setup_mm(); =20 + vm_init(); + printk("All set up\n"); =20 machine_halt(); --=20 2.47.0 From nobody Thu Nov 21 20:21:18 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1729070195; cv=none; d=zohomail.com; s=zohoarc; b=Qy1KTjwAVFfawl0kYZUNRD0BbhSmrFUGBnDdzhgCwdAcEjGf96eEmPyG+VcxlkjyKqFy3TCxOsrypOOr+E4dnL7oGJKywuMaRo1llohblQ2PlEU29Ox2zDSbWEok9r7XjPqu//2L622LIYL3ZN0GVTGOOHRY1rb/OKtweaWKIEk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1729070195; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=uq1Ji0h1S5Dw2PEhn0+S62eckwVA0WVyWGndSlD+Pe0=; b=kpIF/JEp98TTOhIvN2Lgr94A3VkUwuvULK5F7IscPke5m10e2vNVgUApZjjvM0keFtd48zt3AR9pJEe5m8OOJ2ky1fuPYyEPjbxCv+l1tUcTqv6D7fWH5KYFuddkqjyTLYsf0LcLndLGSdIQ7zvPzVgQ4eU6Ks4vparSSNijNKg= 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1729070195346981.4009701479231; Wed, 16 Oct 2024 02:16:35 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.819726.1233187 (Exim 4.92) (envelope-from ) id 1t108Y-00065c-8i; Wed, 16 Oct 2024 09:16:10 +0000 Received: by outflank-mailman (output) from mailman id 819726.1233187; Wed, 16 Oct 2024 09:16:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t108Y-00065H-2I; Wed, 16 Oct 2024 09:16:10 +0000 Received: by outflank-mailman (input) for mailman id 819726; Wed, 16 Oct 2024 09:16:08 +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 1t108W-0005Dr-9j for xen-devel@lists.xenproject.org; Wed, 16 Oct 2024 09:16:08 +0000 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [2a00:1450:4864:20::12f]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 464a56a6-8b9f-11ef-a0be-8be0dac302b0; Wed, 16 Oct 2024 11:16:06 +0200 (CEST) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-539fbbadf83so3650876e87.0 for ; Wed, 16 Oct 2024 02:16:06 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53a000129eesm391451e87.259.2024.10.16.02.16.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 02:16:05 -0700 (PDT) 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" X-Inumbo-ID: 464a56a6-8b9f-11ef-a0be-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729070166; x=1729674966; 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=uq1Ji0h1S5Dw2PEhn0+S62eckwVA0WVyWGndSlD+Pe0=; b=LpondwmI2+PhEDMQBJFrAL4cBU9ir79eVPXLnvmxhrrQmPkN0Umj7jksn3+hTjqyDl S7X+ExE9M3QPziSXfm6cFi+JTSq/5EaFy+oqpNeTlfELvqR7gQJdQr+yWE5XFvUYKqR8 PNbificNlG4guCVl+FwnYvOd2Qhm5oBvYAGk6y6WRnEcS/VpQREqKJFOheabCq9mBgES xWqwsrhIM8DGsHxrbrpf+vbrl8EGV7KbG3mWWWGddH7maUkEw4GQpuYiEg02GE2t5ACC td/SQMA/nKp8RnZoAeIZ2Pk/gJY8zFTZNY01u8Xjg+w2xqtjsW7JQLGVtCQgOUt6/d9R VIXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729070166; x=1729674966; 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=uq1Ji0h1S5Dw2PEhn0+S62eckwVA0WVyWGndSlD+Pe0=; b=ofIHNf2XHbR3jONHaZg2Sb0hQokUt/6IlCL9mJPeJUTgVPPKy8tWaqy6mfMdpC79mE ZKzLGdx3gNoq8itqn/X3xPiZtMdCpanzsrqQbxMX4nX3vK2+jmV72UpvFzEx1Gkt2Ega 9jim8Cs7uvJE9vulaWiC0bXy0vvnzZv0FUDf7jdHSIsWcQHHWiCpK47HgilMXB7qXUlR 86dkt4+n/3xQHu4+F+ccrZBQZ4ctel5haKbx+/ZBN83rUY0pWTrQ0nAJ6wBuX/WSl83q 5Kw9xDRMl3VwmLzuc19JCfvlRphb3IKiXQzybzqf9kTZx2R6xY4rkI2HfZokDT03Zhwd aNmA== X-Gm-Message-State: AOJu0Yxkuc1M/LmsTsviJcPvPJct59f3we3+fkgDkUHWMRKlv2y+0Z2U 4pE4VBl1WoNWLs1iJb7zXGx5XoqvPSz+ReJZLIWDEQT7C2WliucaPjB1+w== X-Google-Smtp-Source: AGHT+IGO+hyNoyG8ho2yeBme03+6EdXfXPmLx1WZxdmZiZeFAIbiv88WI4R0FDSR9TzuYZZ5fIxFCw== X-Received: by 2002:a05:6512:3d23:b0:536:568f:c5ed with SMTP id 2adb3069b0e04-539da3b41c0mr8592917e87.1.1729070165984; Wed, 16 Oct 2024 02:16:05 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Alistair Francis , Bob Eshleman , Connor Davis , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH v1 5/5] xen/riscv: finalize boot allocator and transition to boot state Date: Wed, 16 Oct 2024 11:15:57 +0200 Message-ID: X-Mailer: git-send-email 2.47.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1729070197402116600 Content-Type: text/plain; charset="utf-8" Add a call to end_boot_allocator() in start_xen() to finalize the boot memory allocator, moving free pages to the domain sub-allocator. After initializing the memory subsystem, update `system_state` from `SYS_STATE_early_boot` to `SYS_STATE_boot`, signifying the end of the early boot phase. Signed-off-by: Oleksii Kurochko Acked-by: Jan Beulich --- xen/arch/riscv/setup.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index 3652cb056d..9680332fee 100644 --- a/xen/arch/riscv/setup.c +++ b/xen/arch/riscv/setup.c @@ -65,6 +65,14 @@ void __init noreturn start_xen(unsigned long bootcpu_id, =20 vm_init(); =20 + end_boot_allocator(); + + /* + * The memory subsystem has been initialized, we can now switch from + * early_boot -> boot. + */ + system_state =3D SYS_STATE_boot; + printk("All set up\n"); =20 machine_halt(); --=20 2.47.0