From nobody Mon Feb 9 17:08:03 2026 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=1728481612; cv=none; d=zohomail.com; s=zohoarc; b=KFzw+jY+6/vLvWy2jz+YNvUgNJ58+jIiou+Tr2O5b8v18PLiC7pUzpY4CZVZZ+Yl8J7pqQyu6E+R+RZF/c0oPqYUNH3efgUG5FamS8rihM/YkGgMBnPfB43Uk/gxPhc3qfi/ysveRUVO0rOgXzvl/0B4glT86xi+vZXvJ1lnlv4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728481612; 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=PSPaRmxzt0eAVlcbacBly/DaDiKEi9jlpaGGhdonnXU=; b=V2xSllcXSYERDm5NQsAOYivEiPD3nX3Dt44FSYGQa+UMPBlt6zP6S56k2IkUVgOQ3QBmt8eph319f7aJlFdrBPUeNEYPELB9SiGF+p3b+9G4gfjg+VgLEW4q0Yc/6zUgFHHrVjD3+YhiVavLyOaartTUW7xDMmQwaoyOz+kkJFY= 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 1728481612768801.9641338704312; Wed, 9 Oct 2024 06:46:52 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.814532.1228127 (Exim 4.92) (envelope-from ) id 1syX0j-0005ql-N8; Wed, 09 Oct 2024 13:45:53 +0000 Received: by outflank-mailman (output) from mailman id 814532.1228127; Wed, 09 Oct 2024 13:45:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1syX0j-0005qb-Jo; Wed, 09 Oct 2024 13:45:53 +0000 Received: by outflank-mailman (input) for mailman id 814532; Wed, 09 Oct 2024 13:45:52 +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 1syX0i-0005Gw-I0 for xen-devel@lists.xenproject.org; Wed, 09 Oct 2024 13:45:52 +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 cbfea96b-8644-11ef-99a2-01e77a169b0f; Wed, 09 Oct 2024 15:45:51 +0200 (CEST) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-53994aadb66so6262247e87.2 for ; Wed, 09 Oct 2024 06:45:51 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c8e0598947sm5435334a12.11.2024.10.09.06.45.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2024 06:45:49 -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: cbfea96b-8644-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728481550; x=1729086350; 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=PSPaRmxzt0eAVlcbacBly/DaDiKEi9jlpaGGhdonnXU=; b=nFDSlchmC6qt4Yfd40Sz2ZKbuss5LIlunBOwS/NPmUw6kFf2ACF8fDnyl1vQ/Z6Agz QqqECZtdpOu09GNbp+BicS/LneTW+gkJpREzkWKqL5al61YJG/wRf8yKIt5dNABaTP+X 8/jkQ1fvhI7jncgH0r5EshIycaEOm6BJtvD0HJT06k0Kf66EZVElQFlGvqyWfCh5Hrg2 7ibqT3WJQMzC1H2SvQ3eHbKkR+fyUUSD+pe95GPTXcTqEyADpgVwzCRb0ZFEQdctRqaO J7BObTDqUgIGaMtu+LbJsAIc5q3h9a6jFnydfGOFMkHQHdd5ripbrYXppnmZtK91fzj0 qeYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728481550; x=1729086350; 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=PSPaRmxzt0eAVlcbacBly/DaDiKEi9jlpaGGhdonnXU=; b=ta4wzEh51Mph+0rEO7/JOa6GFN+0tglbVMk6FjWovqmUm4PpfmzcEyETAws40S0p95 5oWZZqRdNU8wC2QLVtU5iH9a1/5XutKq6he5gJ3uIySJhRinu6vNx4EmPSq9yBdT8e+I z49Dp+zZTJCbhdXaya1dobwH8YemmqA/CQYTIYZlN38Heb1qiLe+1HQNgM80vGgkZbbM UBl6tN7MqR9Upyn9+BVQQiobqA/9VIwm4TKGuCJOMj0GhXiQ4xMPhr7xiIDySHL8fi+X iVUvnY1oUL2vdA+FQ2pe+dS/nEVChNVwy4feSEvNJLnBgynhGoi5svQrepMrO3QIwzSY /U0g== X-Gm-Message-State: AOJu0Yyj7S1SDRjBXcRH7yt85n7xeVLjk4/KLiPjwFg0lemkr6APX6JC akD+9oBm21FLbwqIwu23mn9RdIuHomAyqVVynl3rKm1svCvvZwBFwYz2Cg== X-Google-Smtp-Source: AGHT+IETkjSORs4fMVZO6b+/grQCRsc7UVKkbbOABRhAOi7uwdEmraxZ2/th2k7e3kvUZwRQbn65RA== X-Received: by 2002:a05:6512:3050:b0:533:46cc:a736 with SMTP id 2adb3069b0e04-539c92b1a6bmr141554e87.37.1728481550026; Wed, 09 Oct 2024 06:45:50 -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 v3 3/3] xen/riscv: register Xen's load address as a boot module Date: Wed, 9 Oct 2024 15:45:41 +0200 Message-ID: X-Mailer: git-send-email 2.46.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1728481614072116600 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 Acked-by: Jan Beulich --- Changes in V3: - Add Acked-by: Jan Beulich . --- Changes in V2: - Drop local variable xen_bootmodule as it won't be used after initializat= ion. - Drop unnecessary cast for the 3rd argument of add_boot_module() call in start_xen(). - Change BUG_ON(!xen_bootmodule) to panic(). --- xen/arch/riscv/setup.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index 6d156c3a40..f531ca38ee 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 @@ -44,6 +45,11 @@ 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. */ + if ( !add_boot_module(BOOTMOD_XEN, virt_to_maddr(_start), + _end - _start, false) ) + panic("Failed to add BOOTMOD_XEN\n"); + printk("All set up\n"); =20 machine_halt(); --=20 2.46.2