From nobody Mon Feb 9 10:33:18 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=1703258985; cv=none; d=zohomail.com; s=zohoarc; b=mkiD+DT9oVhc52RYyGxKkb/qK7esTubw+xxfZRT0bszLTyoWRDjekTU7ez4joQSl8CHHt2Og/SxvuVYGtxo1crg2mDhAZvHlnP/AHe4FWDT4QWnLtrTXwmhQ5oC++CrZAWdc9IxJ/hgH9cNXb3RDjlfhdrG1gRsXFcdk51g4qw0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1703258985; 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=BIctziQEpONFKZE794AYy1MUnDyOQ/io/VpH00G6+uw=; b=F8i0MxwAstNaquDpyQsMM3qYDPkb058RFdjOxDv7CiK/X1UagVkTaujpjfMvGolQ/s4WomBNMq4v0VWwKsbuEUFJLMpxd5JjnSGXV3wsecG/bZttuAPs7pBDX1OR+TG8/OG63c8qGGM0R2xKW338fx2VD8ZdR7EwJcCqFHo23UI= 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 1703258985721480.5069293856958; Fri, 22 Dec 2023 07:29:45 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.659612.1029320 (Exim 4.92) (envelope-from ) id 1rGhSt-0003wL-QK; Fri, 22 Dec 2023 15:29:31 +0000 Received: by outflank-mailman (output) from mailman id 659612.1029320; Fri, 22 Dec 2023 15:29:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rGhSt-0003wE-MG; Fri, 22 Dec 2023 15:29:31 +0000 Received: by outflank-mailman (input) for mailman id 659612; Fri, 22 Dec 2023 15:29:30 +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 1rGhDm-0007Ie-IX for xen-devel@lists.xenproject.org; Fri, 22 Dec 2023 15:13:54 +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 b81e5a7d-a0dc-11ee-98eb-6d05b1d4d9a1; Fri, 22 Dec 2023 16:13:53 +0100 (CET) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-50e67e37661so1185022e87.0 for ; Fri, 22 Dec 2023 07:13:53 -0800 (PST) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id j7-20020a056512108700b0050e6df07728sm45983lfg.180.2023.12.22.07.13.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 07:13:52 -0800 (PST) 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: b81e5a7d-a0dc-11ee-98eb-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703258033; x=1703862833; 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=BIctziQEpONFKZE794AYy1MUnDyOQ/io/VpH00G6+uw=; b=Pq69uNo9UmY8C/nDqOxqd9Lr074ks3H8e3ckjDuc1wdXcXG0dRa5eTQesDGtxLbpfj C++bGR4jJacsMilflGlf5gC2ta3Y9WcRRH03tgKwKHT+gRDW+iUA9Ap1H1jIUOjf9GI8 yHn/BnL4tnYMvtD0VVbkxwxVxZu/HwDz9ToAJl8m2FZBg5pPxfErKJhJa/aDKbboKrDH Zuipyc4HyfpwHjSS+67SBbX4htSlV1iafRiz8uUKxQlI1cbjIRPQtzAjuPRcB/8isdjl tXJgz4fyG9YVN/gTOV2Zbfl0suHJD8G6vrSYrOkJmvsBrSof/THnR9A6LU1TqWYh5/+r JKVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703258033; x=1703862833; 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=BIctziQEpONFKZE794AYy1MUnDyOQ/io/VpH00G6+uw=; b=EUAtVIBMVQQifOTEvG3YylFd8tdVdPW/Z/x9ioULX6Aq8YJFsw7IDkWZ3d4KcyaPlZ 7LTCZKoX7feFVo2jBB0f4pB50cEEey7g80l9eRVrMtKLhY13NwroBIT9VIBE996IHXp4 YAOkD/nTqFRJ38EZ+jUgOmaWLTMWJLJL1026oRJ4zoy309dSsReA3glKY7+HMRiZhj4f 6VnSclFqMwc9Ec11KzI5pPOWFXZGgOg+63t2B4plLas3t/CVK4cwbu7lqoJnBRUrCDlV LB3KzcRIkLHC4Ld3KOrcJnELabXgZ2aLRNg0LcXr78Zn1r+zbXyXiCobEYmK2oSzkCV+ z3DA== X-Gm-Message-State: AOJu0Yz9vCx7D9lwk7YtX6hCrXr7fkkrOokHVZ98/oSpMbVN5oV/wAgN CxPREFZafD9D/zCSGMECH1EVheJKcZY= X-Google-Smtp-Source: AGHT+IGU38HlC5nYk6vnjGkSK+GHyHf2rC6zXqjN2QiH9rknKQBhCeW9LnhUCjN3t94czdDjLTn1YA== X-Received: by 2002:a19:5f54:0:b0:50e:6878:a715 with SMTP id a20-20020a195f54000000b0050e6878a715mr720490lfj.48.1703258033079; Fri, 22 Dec 2023 07:13:53 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Alistair Francis , Bob Eshleman , Connor Davis , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH v3 29/34] xen/riscv: add minimal stuff to page.h to build full Xen Date: Fri, 22 Dec 2023 17:13:13 +0200 Message-ID: <7aa26bdad9bf923fd57f7a90e41c049cab0cd5bd.1703255175.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1703258986366100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Oleksii Kurochko Acked-by: Jan Beulich --- Changes in V3: - update the commit message - add implemetation of PAGE_HYPERVISOR macros - add Acked-by: Jan Beulich - drop definition of pfn_to_addr, and paddr_to_pfn in --- Changes in V2: - Nothing changed. Only rebase. --- xen/arch/riscv/include/asm/mm.h | 3 --- xen/arch/riscv/include/asm/page.h | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/m= m.h index 07c7a0abba..57026e134d 100644 --- a/xen/arch/riscv/include/asm/mm.h +++ b/xen/arch/riscv/include/asm/mm.h @@ -5,9 +5,6 @@ =20 #include =20 -#define pfn_to_paddr(pfn) ((paddr_t)(pfn) << PAGE_SHIFT) -#define paddr_to_pfn(pa) ((unsigned long)((pa) >> PAGE_SHIFT)) - extern unsigned char cpu0_boot_stack[]; =20 void setup_initial_pagetables(void); diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm= /page.h index 95074e29b3..85176702d5 100644 --- a/xen/arch/riscv/include/asm/page.h +++ b/xen/arch/riscv/include/asm/page.h @@ -6,6 +6,7 @@ #ifndef __ASSEMBLY__ =20 #include +#include #include =20 #include @@ -32,6 +33,10 @@ #define PTE_LEAF_DEFAULT (PTE_VALID | PTE_READABLE | PTE_WRITAB= LE) #define PTE_TABLE (PTE_VALID) =20 +#define PAGE_HYPERVISOR_RW (PTE_VALID | PTE_READABLE | PTE_WRITAB= LE) + +#define PAGE_HYPERVISOR PAGE_HYPERVISOR_RW + /* Calculate the offsets into the pagetables for a given VA */ #define pt_linear_offset(lvl, va) ((va) >> XEN_PT_LEVEL_SHIFT(lvl)) =20 @@ -46,6 +51,9 @@ typedef struct { #endif } pte_t; =20 +#define pfn_to_paddr(pfn) ((paddr_t)(pfn) << PAGE_SHIFT) +#define paddr_to_pfn(pa) ((unsigned long)((pa) >> PAGE_SHIFT)) + static inline pte_t paddr_to_pte(paddr_t paddr, unsigned int permissions) { @@ -62,6 +70,20 @@ static inline bool pte_is_valid(pte_t p) return p.pte & PTE_VALID; } =20 +static inline void invalidate_icache(void) +{ + BUG(); +} + +#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) +#define copy_page(dp, sp) memcpy(dp, sp, PAGE_SIZE) + +/* TODO: Flush the dcache for an entire page. */ +static inline void flush_page_to_ram(unsigned long mfn, bool sync_icache) +{ + BUG(); +} + #endif /* __ASSEMBLY__ */ =20 #endif /* _ASM_RISCV_PAGE_H */ --=20 2.43.0