From nobody Sun Dec 22 01:11:58 2024 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=1727708943; cv=none; d=zohomail.com; s=zohoarc; b=CfaklqGI80Nr5ZbugS8+DVFjN1nyrDzYv05fPreFpUDXzcxlkDTD5cF0CKtgddcApmWlnggFDMJeu8wUzEKQBM7myqlV0fTZnfXXR847LFDCyKXQ3aGKlfOrnJjmA1/h6NuIel4Zi2n2dWG9AcL4bIFpTw2MkVOHP+agMQFCRXw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1727708943; 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=d/37IdOCxVXI2z1guCYamgvqmlzEY2bjfj9nmrfmg4E=; b=UkUDg6cKN/cv5nMlM8U0f4tg6n8Rask0hdmjfml4eWhZXjDMBMM6xvNstrxSPaFGLgAntnxOpaYiv6krDQ7X9MYW3VnxIykrO+tk+ZtVXUz3AtCndAJD0ACGqAUXzAcjqO0aViInZcZlwVtPZd/WXQdTCTxJs0A/I6fpnVxbeQ8= 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 172770894303016.252180889354804; Mon, 30 Sep 2024 08:09:03 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.807435.1218913 (Exim 4.92) (envelope-from ) id 1svI0l-00031D-GP; Mon, 30 Sep 2024 15:08:31 +0000 Received: by outflank-mailman (output) from mailman id 807435.1218913; Mon, 30 Sep 2024 15:08: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 1svI0l-000311-Co; Mon, 30 Sep 2024 15:08:31 +0000 Received: by outflank-mailman (input) for mailman id 807435; Mon, 30 Sep 2024 15:08:29 +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 1svI0j-00022q-Lb for xen-devel@lists.xenproject.org; Mon, 30 Sep 2024 15:08:29 +0000 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [2a00:1450:4864:20::22b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id d8ceb4b8-7f3d-11ef-99a2-01e77a169b0f; Mon, 30 Sep 2024 17:08:28 +0200 (CEST) Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2fac49b17ebso12486181fa.0 for ; Mon, 30 Sep 2024 08:08:27 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-538a0432219sm1264423e87.132.2024.09.30.08.08.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 08:08:26 -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: d8ceb4b8-7f3d-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727708907; x=1728313707; 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=d/37IdOCxVXI2z1guCYamgvqmlzEY2bjfj9nmrfmg4E=; b=MAnG1ScBxLNvzfkD+zRAKoWNNNjzQ/K5+BEbp6sa+AUqavcBDs+HMIGeEhjXZL8JSK TeHVC+CiSVNEDinvEoou7OOIOOtKVeDye2tnaVyAmdJSp6nFCmh8g+yg0iN2O9WasmEM +vUk4UZJRQJ7YhnlSI5rNkxNUKHAEUV7UCkpI56GPuaNnOJRbmpNK8P6amOT1TZPhmbO VW90mPdY+XB6c/EpyjTjaHUJBl8F6L//jFyha4sD7IUqueRXHjmyaSnnPoHBGXf9nYnq Y4WTyy4k5455RNUdiSRyREs5zRH7Hhd/EuRKyLmfZFpfjcgUUkQoPH2d1oXO2hDg7eDw HLhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727708907; x=1728313707; 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=d/37IdOCxVXI2z1guCYamgvqmlzEY2bjfj9nmrfmg4E=; b=NcHYO05EI58TelKfiLHcjLCYfpV/Cs2YzxH6Ydj81UqB6w3dm9XMSaKU7nxo0Ljc0y 8jZhneLaYhW42IkCH1KC9SLmbFqaOxm6ZYCSes3BtuwrpJXxrZJzih1YeA3qXosk6x6h TKiXaz5sRxhhfbO0XcjjMwwU1YlSOyApeul0K9UCSMg1zHeuNszMgSnlF0U7roWShnmM WjZ71lOc0EsYi2EPSN3jT90k7oKnOoMWfgE1dYgSln3lgTEpUOkVJPLMDstyEnMk+9jb KZy+ZEiS2ub8L8u02X3q5epvoKtGvhFj7YYQwXoAqZtjF/aSczAJxfwR1wz19D9IRNjD uBJA== X-Gm-Message-State: AOJu0Yxwu5yriCzSogqP51VKJwigLVagECHk3hhn/QjocJz7CoF/hxlB oBR3/6XW498G/RLFUCnnkzba3kV6ohLtJgHf2alz5OhZpPa+1lpWKlBVDg== X-Google-Smtp-Source: AGHT+IGq/yaJsQpWzmrjwiC8QsA6trMJCZDFbf4/V9BBieWtt8Z4Zgm8g0b3EEMhx+BRdc6+0/KDEA== X-Received: by 2002:a05:6512:334f:b0:539:8847:d7e9 with SMTP id 2adb3069b0e04-5398847d900mr4524107e87.35.1727708906904; Mon, 30 Sep 2024 08:08:26 -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 v1 2/3] xen/riscv: switch LINK_TO_LOAD() to virt_to_maddr() Date: Mon, 30 Sep 2024 17:08:21 +0200 Message-ID: <9a462c58f3af0ff5e5d312777cd1552b2a5a930c.1727708665.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1727708944318116600 Content-Type: text/plain; charset="utf-8" Except for switching LINK_TO_LOAD() to virt_to_maddr(), LINK_TO_LOAD() is dropped, as virt_to_maddr() covers all the cases where LINK_TO_LOAD() is used. Signed-off-by: Oleksii Kurochko --- xen/arch/riscv/mm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c index 7a1919e07e..59da61716c 100644 --- a/xen/arch/riscv/mm.c +++ b/xen/arch/riscv/mm.c @@ -29,7 +29,6 @@ struct mmu_desc { unsigned long __ro_after_init phys_offset; =20 #define LOAD_TO_LINK(addr) ((unsigned long)(addr) - phys_offset) -#define LINK_TO_LOAD(addr) ((unsigned long)(addr) + phys_offset) =20 /* * It is expected that Xen won't be more then 2 MB. @@ -122,7 +121,7 @@ static void __init setup_initial_mapping(struct mmu_des= c *mmu_desc, unsigned long paddr =3D (page_addr - map_start) + pa_start; unsigned int permissions =3D PTE_LEAF_DEFAULT; unsigned long addr =3D is_identity_mapping - ? page_addr : LINK_TO_LOAD(page_addr); + ? page_addr : virt_to_maddr(page_addr= ); pte_t pte_to_be_written; =20 index =3D pt_index(0, page_addr); @@ -225,7 +224,7 @@ void __init setup_fixmap_mappings(void) =20 BUG_ON(pte_is_valid(*pte)); =20 - tmp =3D paddr_to_pte(LINK_TO_LOAD((unsigned long)&xen_fixmap), PTE_TAB= LE); + tmp =3D paddr_to_pte(virt_to_maddr(&xen_fixmap), PTE_TABLE); write_pte(pte, tmp); =20 RISCV_FENCE(rw, rw); @@ -312,7 +311,7 @@ void __init remove_identity_mapping(void) pte_t *pgtbl; unsigned int index, xen_index; unsigned long ident_start =3D - LINK_TO_LOAD(turn_on_mmu) & XEN_PT_LEVEL_MAP_MASK(0); + virt_to_maddr((unsigned long)turn_on_mmu) & XEN_PT_LEVEL_MAP_MASK(= 0); =20 for ( pgtbl =3D stage1_pgtbl_root, i =3D CONFIG_PAGING_LEVELS; i; i-- ) { --=20 2.46.1