From nobody Mon Apr 13 00:05:42 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=1775836544; cv=none; d=zohomail.com; s=zohoarc; b=cTUDsSJE5gY6wP7h3t55sJn4pFPstojeXT2FLlAXCIi6nv6Raei3JiuqaO2+Xpjqbt+EUoFBcOngsRf0DVl4TDYbLcziVQIarhMSqcMwwkPUzVdHwGYc+/E+Wnfm5XB92qiKOFfghS7vZSkfrMOi2t18jdgJIjFNF7ggrgs2bPI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1775836544; h=Content-Type: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=j/LD+Q0Pk+2kpOMYSoWm4Kl0NPbf+mdTSKTiw89GJZY=; b=FLsmrY78aLIga8XoKfijcV9hiRai5VsQ1ECHWRbPgq6bNyLv+GFjlrrJqVGbjgBYuV2SUL7i76Tp8rsEsNtl7vfrgERNXka6lDiZlKtaFy2R59Q0Y8fbduXId4tpPA3olY27WLGWRJJKSxLqniU2mWpBNitiI8s7lS5klGoKamU= 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 1775836544649126.42829586264497; Fri, 10 Apr 2026 08:55:44 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1279434.1563928 (Exim 4.92) (envelope-from ) id 1wBECc-00011S-1g; Fri, 10 Apr 2026 15:55:26 +0000 Received: by outflank-mailman (output) from mailman id 1279434.1563928; Fri, 10 Apr 2026 15:55:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wBECb-00010H-No; Fri, 10 Apr 2026 15:55:25 +0000 Received: by outflank-mailman (input) for mailman id 1279434; Fri, 10 Apr 2026 15:55:24 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) id 1wBECZ-0000go-Vt for xen-devel@lists.xenproject.org; Fri, 10 Apr 2026 15:55:23 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wBECZ-00Cgsb-BJ for xen-devel@lists.xenproject.org; Fri, 10 Apr 2026 17:55:23 +0200 Received: from [10.42.69.7] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 69d91d6a-e002-0a2a0a5209dd-0a2a4507c022-4 for ; Fri, 10 Apr 2026 17:55:23 +0200 Received: from [209.85.128.42] (helo=mail-wm1-f42.google.com) by tlsNG-ef75cf.mxtls.expurgate.net with ESMTPS (eXpurgate 4.56.0) (envelope-from ) id 69d91d6b-ba2d-0a2a45070019-d155802ac91f-3 for ; Fri, 10 Apr 2026 17:55:23 +0200 Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-488b8bc6bc9so15801995e9.3 for ; Fri, 10 Apr 2026 08:55:23 -0700 (PDT) Received: from fedora (user-109-243-69-121.play-internet.pl. [109.243.69.121]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488d5b3c597sm78285605e9.12.2026.04.10.08.55.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2026 08:55:22 -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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=20251104 header.d=gmail.com header.i="@gmail.com" header.h="Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775836522; x=1776441322; 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=j/LD+Q0Pk+2kpOMYSoWm4Kl0NPbf+mdTSKTiw89GJZY=; b=NS3KKP6d9Lf0fLcTNYe9rrRWHhAl/mMHQNBT30DY00SlZK9DezZLP4xT+2fzpjjxLi sAhWQZYF046B74ioVBvGtEiET7fBNm80/IYzswi5EWhBxtz8VG5n6jTLFrU82xhdGVSc yFu4fmEAPSGM5yxLJBth/1NYXq0tK9Ty/SPBLJVPV5M5EclwEPfniJ4qcp2SPLHWGy1v uZ9Y7bcGIzoT1vmPLP9IZ2KHV/2ppkIKc9+Uo6lj03G1QFoZJ2O0BwB8diRHAdWiomsk Beq58GP7deZd9O1QmMXZRKmemYCEgn6vFeq75bf1bm8cvGjMsWfAxuWPzQiEeUknxU9q hviQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775836522; x=1776441322; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=j/LD+Q0Pk+2kpOMYSoWm4Kl0NPbf+mdTSKTiw89GJZY=; b=mwyL6u975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775836522434; Fri, 10 Apr 2026 08:55:22 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Romain Caritey , Oleksii Kurochko , Alistair Francis , Connor Davis , Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini Subject: [PATCH v3 11/12] xen/riscv: add definition of guest RAM banks Date: Fri, 10 Apr 2026 17:54:57 +0200 Message-ID: <8280fe1a5effacd595d3dd69b2b11e06226411b2.1775836193.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-ef75cf/1775836523-8955341E-457CF58A/10/73395122804 X-purgate-type: spam X-purgate-size: 3066 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1775836546960154100 The dom0less solution uses defined RAM banks as compile-time constants, so introduce macros to describe guest RAM banks. The reason for 2 banks is that there is typically always a use case for low memory under 4 GB, but the bank under 4 GB ends up being small because there are other things under 4 GB it can conflict with (interrupt controller, PCI BARs, etc.). So a second bank is added above that MMIO region (starting at 8 GiB) to provide the remaining RAM; the gap between the two banks also exercises code paths handling discontiguous memory. For Sv32 guests (34-bit GPA, 16 GiB addressable), bank0 provides 2 GB (2=E2=80=934 GB) and the first 8 GB of bank1 (8=E2=80=9316 GB) is accessibl= e. Extended regions are useful for RISC-V: they could be used to provide a "space" for Linux to map grant mappings. Despite the fact that for every guest MMU mode the GPA could be up to 56 bits wide (except Sv32 whose GPA is 34 bits), the combined size of both banks is limited to 1018 GB as it is more than enough for most use cases. Add inclusion of asm/guest-layout.h to asm/domain.h to make dom0less common code build happy. Signed-off-by: Oleksii Kurochko --- Changes in v3: - Move GUEST_RAM*-related defines to asm/p2m.h instead of public header. --- Changes in v2: - New patch. --- xen/arch/riscv/include/asm/domain.h | 1 + xen/arch/riscv/include/asm/guest-layout.h | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 xen/arch/riscv/include/asm/guest-layout.h diff --git a/xen/arch/riscv/include/asm/domain.h b/xen/arch/riscv/include/a= sm/domain.h index 6c48bf13111d..6044ce0feee0 100644 --- a/xen/arch/riscv/include/asm/domain.h +++ b/xen/arch/riscv/include/asm/domain.h @@ -7,6 +7,7 @@ #include #include =20 +#include #include #include =20 diff --git a/xen/arch/riscv/include/asm/guest-layout.h b/xen/arch/riscv/inc= lude/asm/guest-layout.h new file mode 100644 index 000000000000..68d95a09394c --- /dev/null +++ b/xen/arch/riscv/include/asm/guest-layout.h @@ -0,0 +1,23 @@ +#ifndef ASM_RISCV_GUEST_LAYOUT_H +#define ASM_RISCV_GUEST_LAYOUT_H + +#include + +#define GUEST_RAM_BANKS 2 + +/* + * The way to find the extended regions (to be exposed to the guest as unu= sed + * address space) relies on the fact that the regions reserved for the RAM + * below are big enough to also accommodate such regions. + */ +#define GUEST_RAM0_BASE xen_mk_ullong(0x80000000) /* 2GB of low RAM @ 2G= B */ +#define GUEST_RAM0_SIZE xen_mk_ullong(0x80000000) + +#define GUEST_RAM1_BASE xen_mk_ullong(0x0200000000) /* 1016 GB of RAM @ = 8GB */ +#define GUEST_RAM1_SIZE xen_mk_ullong(0xFE00000000) + +/* TODO: allocate these all dynamically */ +#define GUEST_RAM_BANK_BASES { GUEST_RAM0_BASE, GUEST_RAM1_BASE } +#define GUEST_RAM_BANK_SIZES { GUEST_RAM0_SIZE, GUEST_RAM1_SIZE } + +#endif /* ASM_RISCV_GUEST_LAYOUT_H */ --=20 2.53.0