From nobody Fri Jan 3 06:12:51 2025 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=1727708938; cv=none; d=zohomail.com; s=zohoarc; b=VIY5o31KgRLNcXjbpvxOwFHlqzlkgrlRli4tVTVeE14cVAvA8Rqrn1JSzcSUTbEnnAo4SbQLNO+Nl0L08faXwFcu95NlEndXvwplvOJ7kPrzu0RvhfBSRztUmxdN2Pu++v+bkOPj2F8wQPU+lXMDJY6iCdtmW9ZJVlw723+NOW0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727708938; 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=TSOroKPGJr4XSbKSq9mzOX8MhVcwff6sm7/6Oa6ej/U=; b=RCLflI+L7PC5IgR4tVeGqH9FnNwSUeKj/Oliwo8naedYajUsBeGLE3UtlguJbLMoVe5TAEuKKTjbHvNywltwACJR5m7HWlQPkZRpV/weIUtJCkuJXoILflR6qo4vxLMyc5sCNKJEBqBjgYwsT9Dtf4QHH1tGFekl9GdNP92KEKE= 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 1727708938827199.43092181564884; Mon, 30 Sep 2024 08:08:58 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.807434.1218897 (Exim 4.92) (envelope-from ) id 1svI0k-0002aN-7b; Mon, 30 Sep 2024 15:08:30 +0000 Received: by outflank-mailman (output) from mailman id 807434.1218897; Mon, 30 Sep 2024 15:08:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1svI0k-0002a2-3g; Mon, 30 Sep 2024 15:08:30 +0000 Received: by outflank-mailman (input) for mailman id 807434; Mon, 30 Sep 2024 15:08:29 +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 1svI0j-0002H5-3d for xen-devel@lists.xenproject.org; Mon, 30 Sep 2024 15:08:29 +0000 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [2a00:1450:4864:20::133]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id d9146b33-7f3d-11ef-a0ba-8be0dac302b0; Mon, 30 Sep 2024 17:08:28 +0200 (CEST) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-53959a88668so3586288e87.2 for ; Mon, 30 Sep 2024 08:08:28 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-538a0432219sm1264423e87.132.2024.09.30.08.08.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 08:08:27 -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: d9146b33-7f3d-11ef-a0ba-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727708908; x=1728313708; 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=TSOroKPGJr4XSbKSq9mzOX8MhVcwff6sm7/6Oa6ej/U=; b=GB1Om2QF3d2TE65T/jY4ZKyvMJfcWFB+f6I7/CZD6hfgM7M2oZTmjw7aVaPGui3JHz whJKpoWfo/azX+dpX3oFQ70gCDfZt+rcGePlqlYfLuW9g6VlQluKNhU7F4OOFTy+hU5R DEqE1ZQD2bcRlhEnGo59JFCT0+sjfpbSCY2w+aytVGLE9ORjbr1sIJ+aN6KKztDFKREz R6Lahop7ZSJ6VKxM6htnaw61sKKlnCk+VNXHffn6GOisGFoiqWXXFEWM00YdMZnhDLR/ R7fFvdm+sNGRueA9ooSMNcD7rOBScvrw9Ff8UjHugnexmR2hJ7gLMIiyQu6sfZMZoc/U +jIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727708908; x=1728313708; 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=TSOroKPGJr4XSbKSq9mzOX8MhVcwff6sm7/6Oa6ej/U=; b=QRnhcAE7ZS4lLz6FJe13df+2VVcBhImib5C2VVrI2N23nKebsBVZOJ/LkKl/5fC9D7 nSBKbCK1+ef00UXTzYvgokkx6mYtXkaDjOjotnQbjZ/sQdfZgcq2k5Dv/obg3enoQaS0 sPXN4a6zWLfsQ+sBwWKzJv/W2THPvOF1rrhH8Gh1/6r0WZuuoX/N1YxNLdqpUAHEhuT0 Rs65hro1a7GZqCoHdjEuTrbDoixaU59BGvE1uFkHPFbZJU1+uQlNRL/VlJEYzFtuboQa 6UeHziPhlrlOsfwsN9YP+POI2FdcXeTR3Uag69ZSsV7kFzuhxK1G06qtUm4hxB8A6lJo 2FKw== X-Gm-Message-State: AOJu0Yw3krN+K5lHhVpWhDOGGxHdMGY0w3aNKj1LU/zop8ePhnMG2rkx 7y3sOejl+AX5KS1ajvZw7Apx8qV9/xlZzZVwlYhcAdD0GDL3QVgVFq22tg== X-Google-Smtp-Source: AGHT+IHiBtjsiueFbwVyej97It6FzP3dmxCYRHI65dyUougsaNjUslq5ZDsmuTVVeoorhen+1N9V2w== X-Received: by 2002:a05:6512:4010:b0:539:8ef3:6688 with SMTP id 2adb3069b0e04-5398ef368c5mr3442546e87.23.1727708907546; Mon, 30 Sep 2024 08:08:27 -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/3] xen/riscv: register Xen's load address as a boot module Date: Mon, 30 Sep 2024 17:08:22 +0200 Message-ID: <2bd3589f322d30e93d81d091ca64439048c068fc.1727708665.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1727708940367116600 Content-Type: text/plain; charset="utf-8" Avoid using BOOTMOD_XEN region for other purposes or boot modules which could result in memory corruption or undefined behaviour. Signed-off-by: Oleksii Kurochko --- xen/arch/riscv/setup.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index 6d156c3a40..39375b3366 100644 --- a/xen/arch/riscv/setup.c +++ b/xen/arch/riscv/setup.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ =20 #include +#include #include #include #include @@ -26,6 +27,8 @@ unsigned char __initdata cpu0_boot_stack[STACK_SIZE] void __init noreturn start_xen(unsigned long bootcpu_id, paddr_t dtb_addr) { + struct bootmodule *xen_bootmodule; + remove_identity_mapping(); =20 set_processor_id(0); @@ -44,6 +47,13 @@ void __init noreturn start_xen(unsigned long bootcpu_id, "Please check your bootloader.\n", dtb_addr, BOOT_FDT_VIRT_SIZE); =20 + /* Register Xen's load address as a boot module. */ + xen_bootmodule =3D add_boot_module(BOOTMOD_XEN, + virt_to_maddr(_start), + (paddr_t)(_end - _start), false); + + BUG_ON(!xen_bootmodule); + printk("All set up\n"); =20 machine_halt(); --=20 2.46.1