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=1775836536; cv=none; d=zohomail.com; s=zohoarc; b=LhWzxxFhajmapXW28aQUeo9NVBnndY4BCuD/ZvzTvHczsKjoPj0xXSvLSWPmP5qxHitVq9iRaBYl+dN+Ps5tTqlsrgtZec5Q0oITFFRKOM5x8HvmfygD1oFqlN82HmnE9RuIYMZ93pdK0i/kxG/n6DCHgt4St4cog+J44C+qqnw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1775836536; 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=MSz7tlr6rhlyBnCcpNqgWXaL+9iidsazDOLEUrgU1Kw=; b=oFHLghJGzT2mus1w+7oo/KmoryD+zlUPm0VU/xZV+yOIlrBd9rFdyeijGoZFCkd01OHBMf0X82rIceOTrcP5rTBdGWs7K/AGeuaVCL6WYU5BQ3JzLMZskz7LegdGuyrjVBGBSeLZCzzfarFIn1YFPmoaD/o2p0M0NpKcZInJjAI= 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 1775836536938851.1093986511482; Fri, 10 Apr 2026 08:55:36 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1279414.1563842 (Exim 4.92) (envelope-from ) id 1wBECQ-00070B-PV; Fri, 10 Apr 2026 15:55:14 +0000 Received: by outflank-mailman (output) from mailman id 1279414.1563842; Fri, 10 Apr 2026 15:55:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wBECQ-000702-KQ; Fri, 10 Apr 2026 15:55:14 +0000 Received: by outflank-mailman (input) for mailman id 1279414; Fri, 10 Apr 2026 15:55:12 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) id 1wBECO-0006mB-Ch for xen-devel@lists.xenproject.org; Fri, 10 Apr 2026 15:55:12 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wBECM-00Cwd5-71 for xen-devel@lists.xenproject.org; Fri, 10 Apr 2026 17:55:11 +0200 Received: from [10.42.69.10] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 69d91d5e-bab6-0a2a0a5309dd-0a2a450abe1c-6 for ; Fri, 10 Apr 2026 17:55:11 +0200 Received: from [209.85.128.51] (helo=mail-wm1-f51.google.com) by tlsNG-4011c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.56.0) (envelope-from ) id 69d91d5f-ee98-0a2a450a0019-d1558033c175-3 for ; Fri, 10 Apr 2026 17:55:11 +0200 Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4838c15e3cbso19690445e9.3 for ; Fri, 10 Apr 2026 08:55:11 -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.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2026 08:55:10 -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=1775836511; x=1776441311; 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=MSz7tlr6rhlyBnCcpNqgWXaL+9iidsazDOLEUrgU1Kw=; b=hkRvH8V/UMxke5UZ1Lwi2OAgzeNI7sqEUD29pCsTTe3itNieOme7Hc3EAA7NjFTIRl Vg/GC34oJLhcnG5KGK7lsg7PxSvrqKtId9ybvREqAuXukabeuDRnKZRIU5X/GxoZpeQm ql6rx8xuh9TO2fzSn/4WFVXF+tfUiXvedGj+m0N/AB18Djdp8ZXCszgIPQv6jXF0/S8V INQpZ6O/T3kbmakXPUOd4WQfgh0JGJE605R6pZC3Hj18o0MyZ9EYTsLZ2LbFKzHJzVw7 IPU0J+PwNdw01LreR+X4H5Yxaybv5St5PrzwUUWDrInkv9Kf4Tnzj5tdO8o9OgJwf/PS dMCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775836511; x=1776441311; 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=MSz7tlr6rhlyBnCcpNqgWXaL+9iidsazDOLEUrgU1Kw=; b=dt6sdg9BVxKEd4BpZpyuzZUuxmdla3b4BofA9WHqgGcN+mhMlQxPbfoKN0wmVY8VUp tZgGHDSMNOrV59XiknF1SYmwTl9VvviW/YT3i5+Yi7qNcg7L8t3Utoxv/7ocvAW3/iWy O9pkhu0UBKdOS+SF8GYXmkTiXoTN3Q5e4q9yZJpHXh5FSGeYPrYZ1/kgQkB9VziT65DM /EWflfYDuZmYiTmnGFsbgA52Hf54c4B2qCNjTSjWijOcbAz3FUQx8gfNZLkbAgRx2+b2 T/7bO8eddLXypU4iS2dyzX+eQQa+MdcqG7bqLnFsGkXqzjczBqOKy89tYggEA7Q+Apv4 zcWw== X-Gm-Message-State: AOJu0YwrqLSP8cVfERwMt1qomEvtaYCevJd9l8BF6wOySJky+RGiIR7q tuoTLYAtVYz7kgYBKheatPsZJw3lQ08CaAJC1JXONVkF1PDdWlKaxwRwapvJgw== X-Gm-Gg: AeBDiev67pnAEQgFEWo0ghAKMhFtjZsftWc833YSkNx40YbWcIECY9rEIxwWAYK9uuG Tgft9YInLQM9IfaAnI0AfjH8S84FMvMr50NtK52+/esfdbN/IyGunR3NYWcX3j7JoueefKSP+BJ jhsOC/n+H8GGzNhFg+JltLLShHKQIjtBJlhSGXJd6rPKv2Gg8/ci9y/3YQW82OIjHkd2Ihwnwd2 uYyiLSHtB3mSBKbCqZC02GonhJXfIx2afV/ydV/l5Ce1L4VJ1c5bZ36gNbVk9K3s3ndaa0Aj0rk DOcDVi8CqqG9SWcTx7+vg/dJa3Afox7t5Nm1tUsj5Tvx+VhpFRrjL8MxPP9PzQurMW1R4t1UNDT UxUs/WxqOpJGXJGEdsLpVzA+WKeH9Ia3eXbsURz/JxW/w6gOOvipMvPW6c87MiRHRhC2bqADq48 WXCrdDP7Bi+4hpiUMUfG/n45owLDOSRyJthppM+YL7OxetCVCr1Bw0gpQXgrNMoOHmOA== X-Received: by 2002:a05:600d:1c:b0:487:1108:48bc with SMTP id 5b1f17b1804b1-488d6836d87mr38497135e9.17.1775836510630; Fri, 10 Apr 2026 08:55:10 -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 01/12] xen/riscv: implement get_page_from_gfn() Date: Fri, 10 Apr 2026 17:54:47 +0200 Message-ID: X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-4011c0/1775836511-C58140B1-46DD9E41/10/73395122804 X-purgate-type: spam X-purgate-size: 3227 X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1775836538958158500 Content-Type: text/plain; charset="utf-8" The function is implemented out-of-line rather than as a static inline, to avoid header ordering issues where struct domain is incomplete when asm/p2m.h is included, leading to build failures: In file included from ./arch/riscv/include/asm/domain.h:10, from ./include/xen/domain.h:16, from ./include/xen/sched.h:11, from ./include/xen/event.h:12, from common/cpu.c:3: ./arch/riscv/include/asm/p2m.h: In function 'get_page_from_gfn': ./arch/riscv/include/asm/p2m.h:50:33: error: invalid use of undefined typ= e 'struct domain' 50 | #define p2m_get_hostp2m(d) (&(d)->arch.p2m) | ^~ ./arch/riscv/include/asm/p2m.h:180:38: note: in expansion of macro 'p2m_g= et_hostp2m' 180 | return p2m_get_page_from_gfn(p2m_get_hostp2m(d), _gfn(gfn= ), t); | ^~~~~~~~~~~~~~~ make[2]: *** [Rules.mk:253: common/cpu.o] Error 1 make[1]: *** [build.mk:72: common] Error 2 make: *** [Makefile:623: xen] Error 2 Signed-off-by: Oleksii Kurochko --- Changes in v3: - As nothing is called get_page_from_gfn() for system domains, leave only handling of not system domains. --- Changes in v2: - Align implemntation with Arm's get_page_from_gfn(). - Update the first comment about DOMID_XEN to mention that isn't "normal" domain instead of no-autotranslated. - Drop footer after commit message. --- xen/arch/riscv/include/asm/p2m.h | 8 ++------ xen/arch/riscv/p2m.c | 13 +++++++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/xen/arch/riscv/include/asm/p2m.h b/xen/arch/riscv/include/asm/= p2m.h index 60f27f9b347e..54ea67990f06 100644 --- a/xen/arch/riscv/include/asm/p2m.h +++ b/xen/arch/riscv/include/asm/p2m.h @@ -164,12 +164,8 @@ typedef unsigned int p2m_query_t; #define P2M_ALLOC (1u<<0) /* Populate PoD and paged-out entries */ #define P2M_UNSHARE (1u<<1) /* Break CoW sharing */ =20 -static inline struct page_info *get_page_from_gfn( - struct domain *d, unsigned long gfn, p2m_type_t *t, p2m_query_t q) -{ - BUG_ON("unimplemented"); - return NULL; -} +struct page_info *get_page_from_gfn(struct domain *d, unsigned long gfn, + p2m_type_t *t, p2m_query_t q); =20 static inline void memory_type_changed(struct domain *d) { diff --git a/xen/arch/riscv/p2m.c b/xen/arch/riscv/p2m.c index 89e5db606fc8..d63697c89a1a 100644 --- a/xen/arch/riscv/p2m.c +++ b/xen/arch/riscv/p2m.c @@ -1534,3 +1534,16 @@ void p2m_handle_vmenter(void) * won't be reused until need_flush is set to true. */ } + +struct page_info *get_page_from_gfn(struct domain *d, unsigned long gfn, + p2m_type_t *t, p2m_query_t q) +{ + /* + * system domains are domains which doesn't have p2m translation table= s, + * so they can't use p2m_get_page_from_gfn() and extra care should be + * done for them. + */ + ASSERT(!is_system_domain(d)); + + return p2m_get_page_from_gfn(p2m_get_hostp2m(d), _gfn(gfn), t); +} --=20 2.53.0