From patchwork Wed Apr 17 10:04:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13633140 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 214E0C4345F for ; Wed, 17 Apr 2024 10:05:36 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.707312.1105183 (Exim 4.92) (envelope-from ) id 1rx2AN-00028f-Hc; Wed, 17 Apr 2024 10:05:23 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 707312.1105183; Wed, 17 Apr 2024 10:05:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rx2AN-00027n-0B; Wed, 17 Apr 2024 10:05:23 +0000 Received: by outflank-mailman (input) for mailman id 707312; Wed, 17 Apr 2024 10:05:21 +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 1rx2AL-0007lI-SW for xen-devel@lists.xenproject.org; Wed, 17 Apr 2024 10:05:21 +0000 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [2a00:1450:4864:20::12c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 003428eb-fca2-11ee-b909-491648fe20b8; Wed, 17 Apr 2024 12:05:21 +0200 (CEST) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-516d2b9cd69so6631302e87.2 for ; Wed, 17 Apr 2024 03:05:21 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id p2-20020a056512328200b00516cd83e497sm1893187lfe.210.2024.04.17.03.05.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 03:05:20 -0700 (PDT) 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: 003428eb-fca2-11ee-b909-491648fe20b8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713348321; x=1713953121; 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=NWUhP94yvcA6vU5jYmkYKwbyjJ+QxvIbXmFZAa4CYbo=; b=CJzJ0eBSiYQhxQuW8wlVD9GLDMOWfGdJI0gjX7+il9tppL2nbCxBXRu2uRo9kpwBXV L04l8cAir2u8t7aGtsUf3839YKM+RGp5lmkP/AYWOB67O0VbmuK5DllJ66u8oqSvHM3w +66p9ZyNegDKY5yrF4IO73+TIlwHwGOOfDFWuSBLs1ztta13Faq8hxnmpjLDwnSfNEAb hE32jHb1mEElXMFXmF+oPq1u7VqxV04lvV5bXZLA7MmP+UlteLgx1JL1yOdrhqQlYAfm JK+/7qi7Po2cxauKSF0GcEmEF1Fi/S597idja+4kgsi6MZdtc+tL8BY3oTK5F5h2TorL LkUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713348321; x=1713953121; 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=NWUhP94yvcA6vU5jYmkYKwbyjJ+QxvIbXmFZAa4CYbo=; b=lsaj6RkQbob+iU5SolpCf42hx4kQjl+K8sBzT7R2JjbaOncwojjGCPBgfcJN2d97qg nK8MyIqe3d5VDnJYoDMHeayiZB5IbVdAEKkpIM7R+ud58IIdTqxXRB/IaxHPrc1GQhFu pNrFOpKIB0e1kexQlAErwwt9WAn9+cr7z58r8fv6D4oURnsQJMxjOIv8M1/jsueO/asg oJk2CyB403RaFwdDQzponPA13dhipnVBgSq7maD9/FPQdSDZygMtlxzG+6mBaPnAM4CE VxWiLUeTY1PMPWIVdWewrZZvkb4dGCRqCGlepBidJx/Se6ON82x2BoUj9XUP3bVI4RAd 1klw== X-Gm-Message-State: AOJu0YyoU1aGC+FASvXUfjBjccDEEN3C+kI/8MDSfKkKms8cGKi0r8LE U10spTwO5lneSF5mTnf2BLk/E+UaidZyJSfs7bJZ49vH59qB0a96CPVsbA== X-Google-Smtp-Source: AGHT+IGItd1Co/dnsTLPLrblG3pxMnQ+rY3gmxCzMZpWSytXlOcqxgjmCKgBDhK9mFtoXmAsfxoTGQ== X-Received: by 2002:a19:6b03:0:b0:518:f8a6:9f42 with SMTP id d3-20020a196b03000000b00518f8a69f42mr4877242lfa.17.1713348320754; Wed, 17 Apr 2024 03:05:20 -0700 (PDT) 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 Subject: [PATCH v8 12/17] xen/riscv: add minimal stuff to page.h to build full Xen Date: Wed, 17 Apr 2024 12:04:55 +0200 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 Signed-off-by: Oleksii Kurochko Acked-by: Jan Beulich --- Changes in V5-V8: - Nothing changed. Only rebase. --- Changes in V4: --- - Change message -> subject in "Changes in V3" - s/BUG/BUG_ON("...") - Do proper rebase ( pfn_to_paddr() and paddr_to_pfn() aren't removed ). --- Changes in V3: - update the commit subject - 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/page.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm/page.h index 95074e29b3..c831e16417 100644 --- a/xen/arch/riscv/include/asm/page.h +++ b/xen/arch/riscv/include/asm/page.h @@ -6,6 +6,7 @@ #ifndef __ASSEMBLY__ #include +#include #include #include @@ -32,6 +33,10 @@ #define PTE_LEAF_DEFAULT (PTE_VALID | PTE_READABLE | PTE_WRITABLE) #define PTE_TABLE (PTE_VALID) +#define PAGE_HYPERVISOR_RW (PTE_VALID | PTE_READABLE | PTE_WRITABLE) + +#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)) @@ -62,6 +67,20 @@ static inline bool pte_is_valid(pte_t p) return p.pte & PTE_VALID; } +static inline void invalidate_icache(void) +{ + BUG_ON("unimplemented"); +} + +#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_ON("unimplemented"); +} + #endif /* __ASSEMBLY__ */ #endif /* _ASM_RISCV_PAGE_H */