From nobody Fri May 10 02:38:29 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=1687181736; cv=none; d=zohomail.com; s=zohoarc; b=BtAblqN5hvLPIfJ79LMNX5FdTtt1kfXFNPdrtltylguF6/y9pioPT/+AZHwHITJnGZCSC+t6pX+H+wgAjVMJI0h32cnlVV/5p8wi4cKkXKznoscoC8jzZdigwNC5MrywkyzCpuc/QSWEJ9eq5PcGeo3BNtWBhnKn5PwW4sAf9sE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687181736; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3lTrFI+N+q0Z5lbRmcu+HhnZnUn+lm1yJaD6BC834Oo=; b=ZpUrvQna2E5yW7f/qcxFaNIKwqRE9nlDq4omNfHaeoQovOEWaBz2QXgm/uzN/8IxC7GIujqt13IIqBQpAuSrZuKBhaMw/fpeH+zJCCCszZn8KEe9aFMvPTLbmah52srV3ILHU4zvs+3zoUA7hbRbu3ddpIl0T2Jxrf30imMjzrU= 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 1687181736179990.4418685144825; Mon, 19 Jun 2023 06:35:36 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.551090.860413 (Exim 4.92) (envelope-from ) id 1qBF1x-0000zZ-Nm; Mon, 19 Jun 2023 13:34:53 +0000 Received: by outflank-mailman (output) from mailman id 551090.860413; Mon, 19 Jun 2023 13:34:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qBF1x-0000yo-Ku; Mon, 19 Jun 2023 13:34:53 +0000 Received: by outflank-mailman (input) for mailman id 551090; Mon, 19 Jun 2023 13:34:53 +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 1qBF1x-0000wG-1x for xen-devel@lists.xenproject.org; Mon, 19 Jun 2023 13:34:53 +0000 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [2a00:1450:4864:20::234]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 11b0e6fa-0ea6-11ee-b234-6b7b168915f2; Mon, 19 Jun 2023 15:34:51 +0200 (CEST) Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2b45d7ec066so34793361fa.0 for ; Mon, 19 Jun 2023 06:34:51 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id f26-20020a2e9e9a000000b002adb0164258sm5222236ljk.112.2023.06.19.06.34.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 06:34:50 -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: 11b0e6fa-0ea6-11ee-b234-6b7b168915f2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687181691; x=1689773691; 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=3lTrFI+N+q0Z5lbRmcu+HhnZnUn+lm1yJaD6BC834Oo=; b=V73menrMYIejLyOrY48lNf15BBv6m0sFtGu05lv7xJUI9BovrZW3KBh3AXwwgYyp7m LF2/ABbl+gVyRBfa03FG8X2pqxrKdc3XV/rtrrlbHAxnjyNPfFqv8IF8k1d22U/UMXRX OH4NnH6aaQ3/OFH39xPWN/UFjWiHcpu5Q6OS18kryhEb9HX4HAKw3biGZFUaiLZHuJED mOn0/2UUXAyvMOKfDsx8iIux8/MKWw1MDQAtDRufwTS3l2fOTX0hlcGx4tu2RBBDU2KG Q+xw6LlSnJ7NrNWAA4hvHPwqpauBrBFcfqYA5hEHxgH/PbfyB54xxqW9uRrEJfxYhoYc 27QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687181691; x=1689773691; 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=3lTrFI+N+q0Z5lbRmcu+HhnZnUn+lm1yJaD6BC834Oo=; b=Q6xfkO2C7F1cmzgqwOsy3jYQBGLUBsbf302E5sy/2Qef/FoEdloQS6n8oYBdv9hN8C oP/9TJA2AdmlyRUhzAXeLeLOpSHob8CB9wcjeINRprSNTqG6WXjuHMthqqSsWHKVA4Fq 9wvoCDhgiWcSZtqeF7YqDLeA7SfUy7W5SkPC4FgEJYh8llraiTUvFBF2MOT8W7/IqjFc iuKvmLjwMubO+3xLn+bS8JO3BJ2HGhRKZp+R1hSXue2qkEgnpUy1wO3c7ImraTLvC02S /8v3wZccO7cBJlC3bD/vBM2fXUpWA0HyEo/PcLfiqYhYU2rm2pnk/s3jgpqSv8tx4Sdy Uyrw== X-Gm-Message-State: AC+VfDxaQCaqieBI4rSU4V7mha5ojQTWKLDRVT2kA+jiDEhdHz4X11qk ChKL+/Bqefw+6imfNz0RHgxqgdgfJn0= X-Google-Smtp-Source: ACHHUZ4saqFSwNocDKLrVOYoNs2j5ihKl8gUgN/mzpc2AX/eZeCOxZXiZser47imprkK9HrWIZfi1Q== X-Received: by 2002:a2e:9d1a:0:b0:2b4:7d45:7654 with SMTP id t26-20020a2e9d1a000000b002b47d457654mr671204lji.21.1687181690991; Mon, 19 Jun 2023 06:34:50 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , Julien Grall , Oleksii Kurochko , Bob Eshleman , Alistair Francis , Connor Davis Subject: [PATCH v2 1/6] xen/riscv: add .sbss section to .bss Date: Mon, 19 Jun 2023 16:34:42 +0300 Message-Id: <47f3fbdb6b808a4cad8491a607cf035491093655.1687178053.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1687181737539100001 Content-Type: text/plain; charset="utf-8" Sometimes variables are located in .sbss section but it won't be mapped after MMU will be enabled. To avoid MMU failures .sbss should be mapped Signed-off-by: Oleksii Kurochko Acked-by: Alistair Francis --- Changes in V2: - add .sbss.*. - move .sbss* ahead of .bss*. - add Acked-by: Alistair Francis --- xen/arch/riscv/xen.lds.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/riscv/xen.lds.S b/xen/arch/riscv/xen.lds.S index 878130f313..9064852173 100644 --- a/xen/arch/riscv/xen.lds.S +++ b/xen/arch/riscv/xen.lds.S @@ -149,7 +149,7 @@ SECTIONS *(.bss.percpu.read_mostly) . =3D ALIGN(SMP_CACHE_BYTES); __per_cpu_data_end =3D .; - *(.bss .bss.*) + *(.sbss .sbss.* .bss .bss.*) . =3D ALIGN(POINTER_ALIGN); __bss_end =3D .; } :text --=20 2.40.1 From nobody Fri May 10 02:38:29 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=1687181723; cv=none; d=zohomail.com; s=zohoarc; b=Js3TWRVVPBe3V5NBSodz3h9Z78B069m9Cy5H9/GwXQAqCswpOg918b8agj8MP2snEQTYdfwNWQRA1rUUanMZLvlih34b8ZJtsVyYN5gEW5jQNERuQK9SmjF1089EWJyxLasaNhAAlQZexDUnvmERmImc4cizdM3B5941hFUScr4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687181723; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=D79BErD46lr9bA2msM28xOF0IDn3VryLu7dildSZSiQ=; b=gmll/Ryocp7ev4Hwi0CYwK8qWjc+Q12OeoJqhhVGcZXDIOHVwk3PgC/cwv2POyiuxV66NkVDHYqAt+wLoXtak57PPhJEDAIXXtOod5ZkbXtH7qO4Y/LwJy21ywDf5htod5RBavNHRYi/d5oJdMKADfMXpoLtziSrMVQwRG7escY= 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 1687181723325988.4836436860319; Mon, 19 Jun 2023 06:35:23 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.551091.860429 (Exim 4.92) (envelope-from ) id 1qBF1z-0001QY-4B; Mon, 19 Jun 2023 13:34:55 +0000 Received: by outflank-mailman (output) from mailman id 551091.860429; Mon, 19 Jun 2023 13:34:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qBF1z-0001QQ-0a; Mon, 19 Jun 2023 13:34:55 +0000 Received: by outflank-mailman (input) for mailman id 551091; Mon, 19 Jun 2023 13:34:54 +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 1qBF1y-0000wG-2C for xen-devel@lists.xenproject.org; Mon, 19 Jun 2023 13:34:54 +0000 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [2a00:1450:4864:20::231]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 1202d6e3-0ea6-11ee-b234-6b7b168915f2; Mon, 19 Jun 2023 15:34:52 +0200 (CEST) Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2b46b11051aso26899771fa.3 for ; Mon, 19 Jun 2023 06:34:52 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id f26-20020a2e9e9a000000b002adb0164258sm5222236ljk.112.2023.06.19.06.34.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 06:34:51 -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: 1202d6e3-0ea6-11ee-b234-6b7b168915f2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687181692; x=1689773692; 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=D79BErD46lr9bA2msM28xOF0IDn3VryLu7dildSZSiQ=; b=CiU8FgdpglJH1B2wDzox9elNXnPOGHvSmx8ag4Iu0woaTXZ9X/ui3yu0i8QrlR0mPw o3/0Bd8Uw5YS43cMK1jGN0Wx5m9lQWPaw/yhNlBWTFCbn/F040pn7WW+IiC/mfRIdtNM M9NDGNV2gVysWaXytZyMewSd0IFSmNNbTOZu2QjMxJci68N8Ssisnz8LHxKU4sxRO4jH GOJmUf0fA9m0cbr94B43Lo/TmTjStbg2Mpxelv7FXUoSnXs6TdaXLERWSpz9nV3eVdMh uH2Ut5vF6en9pVMsKRVK/x8L6OMs8XZXQYLYw28mqG5yan1FNs4hzjFUJy4YtLPThz1F F4UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687181692; x=1689773692; 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=D79BErD46lr9bA2msM28xOF0IDn3VryLu7dildSZSiQ=; b=A925MmXB+bWA5sTrHvNlPcx3A/Iyss0VcU5FQDuHYsOtBlkKCfCCM3Wd/wp02p6NzQ JZ96u/I1YolHoywCB+VnCudYtY3Fw3NlvkZ2Y03WfXN2RNJF1iFWuyFPBuud/DyqQW7M qCRRXGb+1o1KIVxUW0rH+EpEEmkKMaBZdItHRbdYBzMmoupsOfkvvy3DHrBWxiozB6HE pXIuakInLUB+8NL+YNT5YqYhNomQzICB3VR19yJhxRrrr1a5tqDsPwqX1vJTuLjRL/vE WIro+sqwUzjmjXAGxcMqCFDN1v17ppqODn9VrfT+6ZmZtvI/lICx62TqiN6+vN2OjxOE 9qMQ== X-Gm-Message-State: AC+VfDzWLJWfMRW2//6HnMBv6AvJlaByoCw3z2MjP2f1BZjg1W1c0suD qkyARpcgIFvhNwQ8gzid6CqUU6K3PY8= X-Google-Smtp-Source: ACHHUZ5KWo1WLQnAxG/Ix18faBmCWyG6Ft5VzG7rhfuLO4ZVwOJ/WBt520ZwTZj7Kv88Gh3hr40WjQ== X-Received: by 2002:a2e:9e07:0:b0:2b4:5fdd:f588 with SMTP id e7-20020a2e9e07000000b002b45fddf588mr4174106ljk.43.1687181691633; Mon, 19 Jun 2023 06:34:51 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , Julien Grall , Oleksii Kurochko , Bob Eshleman , Alistair Francis , Connor Davis Subject: [PATCH v2 2/6] xen/riscv: introduce reset_stack() function Date: Mon, 19 Jun 2023 16:34:43 +0300 Message-Id: <6024617719467cd2da8ae03b81ddc899f2ba4311.1687178053.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1687181724432100007 Content-Type: text/plain; charset="utf-8" The reason for reset_stack() introduction is that stack should be reset twice: 1. Before jumping to C world at the start of _start() function. 2. After jumping from 1:1 mapping world. Signed-off-by: Oleksii Kurochko Reviewed-by: Alistair Francis --- Changes in V2: - update the commit message. - move out reset_stack() from .text.header to .text. - add Reviewed-by: Alistair Francis . --- xen/arch/riscv/riscv64/head.S | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S index 8887f0cbd4..2c0304646a 100644 --- a/xen/arch/riscv/riscv64/head.S +++ b/xen/arch/riscv/riscv64/head.S @@ -27,8 +27,16 @@ ENTRY(start) add t3, t3, __SIZEOF_POINTER__ bltu t3, t4, .L_clear_bss =20 + jal reset_stack + + tail start_xen + + .section .text, "ax", %progbits + +ENTRY(reset_stack) la sp, cpu0_boot_stack li t0, STACK_SIZE add sp, sp, t0 =20 - tail start_xen + ret + --=20 2.40.1 From nobody Fri May 10 02:38:29 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=1687181732; cv=none; d=zohomail.com; s=zohoarc; b=aWGA0jNQFUw6E9O5LP6FEUAz+bVltvIUA00GNYuE8nP645OIp3OtO/rAoUHawnELZJRvgtKZSiQeFfoYyXFrnnnbztUhHrLGuVvXW11EKvFtuXx3eMorGw31p1qWKajVJYgjR4gulJV0zVMIo3xlE+1vzHi2d/IhcNtwFFntkz0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687181732; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=sORtZXgE060MfqgzUMWkg8dUi4XV3lqZfHNe2K/q7sI=; b=LhoI6DrFLqdBJC+oUwwYUE912Z8GFf8ml5LjgS5wUmo8B0PNbn1Xsr2ltD4z3kc6T1FjFT9TGsgPDVBDPRCoPO6x+QuVtGHOe4nUN7k/y+xuig99Q6ogVA/DpD3ckiTxnU2gao9BLmUHIedJ9lG/K/792sYhniDCXB0D5sVRbKI= 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 168718173231636.59081032217807; Mon, 19 Jun 2023 06:35:32 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.551092.860440 (Exim 4.92) (envelope-from ) id 1qBF20-0001gd-Ch; Mon, 19 Jun 2023 13:34:56 +0000 Received: by outflank-mailman (output) from mailman id 551092.860440; Mon, 19 Jun 2023 13:34:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qBF20-0001gR-9K; Mon, 19 Jun 2023 13:34:56 +0000 Received: by outflank-mailman (input) for mailman id 551092; Mon, 19 Jun 2023 13:34:55 +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 1qBF1z-0000wG-2K for xen-devel@lists.xenproject.org; Mon, 19 Jun 2023 13:34:55 +0000 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [2a00:1450:4864:20::231]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 1249333c-0ea6-11ee-b234-6b7b168915f2; Mon, 19 Jun 2023 15:34:52 +0200 (CEST) Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2b475b54253so18176251fa.2 for ; Mon, 19 Jun 2023 06:34:52 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id f26-20020a2e9e9a000000b002adb0164258sm5222236ljk.112.2023.06.19.06.34.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 06:34:52 -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: 1249333c-0ea6-11ee-b234-6b7b168915f2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687181692; x=1689773692; 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=sORtZXgE060MfqgzUMWkg8dUi4XV3lqZfHNe2K/q7sI=; b=OR0omCmUNaVSa+ABBOx/mOMTZqtSrg6iAJ0Abk/76R1iFgfm8Frq9meARruSN+bmG0 NHlQS33KVXMqdgY1V0vJxMgQ71srBSCBbX6JhzlwUhbIURabBcuCK3QcKg69GQKQA2qQ 2LiusC94Q8PFXAycaXF2gXuujHRoZO0GzijoyHLgdpWbsf0uZONS1QqeRpJ6pDhXhRta 8D5V83oHK62h5iZ7mxS/TG1D7/B1vrjcXWwbx/JEI8WutdZlCbE6RqgXmIaQ+7r3bJ/I jt8519iFNXlj+XAD+OndzCKjxpQQl44lgAyQPzMEXV+27YHmuuJMmLplQ4ctqg250ZsT jZDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687181692; x=1689773692; 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=sORtZXgE060MfqgzUMWkg8dUi4XV3lqZfHNe2K/q7sI=; b=Dm31vlox2de0hWddux2YxDjuoe5gv7Z7HLuImeLxZhPfGq7WV8oW1U3LO+L/bar5+P HS9Xg5o/VRs1swil0sFi1iCFimaDIdxDv8SUVkF3J7aXjVX0idbsCKdR05GcHrqTYvkV Wj8+HNTvMDgmQ+XAtf9BRKbpPGIA4l54NWVXBwBrFPZvXTBThQ0wlNJ4vGDvQ4l50X05 mIeFlnjcWafoRgQJgYIPq1SOMkYCIXi9rT4o41npbz3Ent6sryCSQl1uSYU1SoByom2d 3LYEXMlcLwm5vZDEZnY+Hzi0HdFypSyt6gWSdWWBQKVhKdfs+Fc5Bfc1vuPFqHselLsb /e4g== X-Gm-Message-State: AC+VfDyL56HKCbFsG1jH1/gqJHBPgDm4lnVGf3b46rzNwydfQc4sBlXX 50BtVxu57D9eu6A0S15661ree7RYRd4= X-Google-Smtp-Source: ACHHUZ7RsJ0m8hdhaMr1HpFujvB18TcExNhz338pGRj9J7mC5H49DOpM8HXn7sen6S+9NG4lwYxjIA== X-Received: by 2002:a2e:b603:0:b0:2b4:6d7e:4b08 with SMTP id r3-20020a2eb603000000b002b46d7e4b08mr2968830ljn.35.1687181692290; Mon, 19 Jun 2023 06:34:52 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , Julien Grall , Oleksii Kurochko , Bob Eshleman , Alistair Francis , Connor Davis Subject: [PATCH v2 3/6] xen/riscv: introduce function for physical offset calculation Date: Mon, 19 Jun 2023 16:34:44 +0300 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1687181734502100001 Content-Type: text/plain; charset="utf-8" The function was introduced to calculate and save physical offset before MMU is enabled because access to start() is PC-relative and in case of linker_addr !=3D load_addr it will result in incorrect value in phys_offset. Signed-off-by: Oleksii Kurochko --- Changes in V2: - add __ro_after_init for phys_offset variable. - remove double blank lines. - add __init for calc_phys_offset(). - update the commit message. - declaring variable phys_off as non static as it will be used in head.S. --- xen/arch/riscv/include/asm/mm.h | 2 ++ xen/arch/riscv/mm.c | 18 +++++++++++++++--- xen/arch/riscv/riscv64/head.S | 2 ++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/m= m.h index 64293eacee..996041ce81 100644 --- a/xen/arch/riscv/include/asm/mm.h +++ b/xen/arch/riscv/include/asm/mm.h @@ -11,4 +11,6 @@ void setup_initial_pagetables(void); void enable_mmu(void); void cont_after_mmu_is_enabled(void); =20 +void calc_phys_offset(void); + #endif /* _ASM_RISCV_MM_H */ diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c index 8ceed445cf..570033f17f 100644 --- a/xen/arch/riscv/mm.c +++ b/xen/arch/riscv/mm.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -19,9 +20,10 @@ struct mmu_desc { =20 extern unsigned char cpu0_boot_stack[STACK_SIZE]; =20 -#define PHYS_OFFSET ((unsigned long)_start - XEN_VIRT_START) -#define LOAD_TO_LINK(addr) ((addr) - PHYS_OFFSET) -#define LINK_TO_LOAD(addr) ((addr) + PHYS_OFFSET) +unsigned long __ro_after_init phys_offset; + +#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. @@ -273,3 +275,13 @@ void __init noreturn noinline enable_mmu() switch_stack_and_jump((unsigned long)cpu0_boot_stack + STACK_SIZE, cont_after_mmu_is_enabled); } + +/* + * calc_phys_offset() should be used before MMU is enabled because access = to + * start() is PC-relative and in case when load_addr !=3D linker_addr phys= _offset + * will have an incorrect value + */ +void __init calc_phys_offset(void) +{ + phys_offset =3D (unsigned long)start - XEN_VIRT_START; +} diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S index 2c0304646a..850fbb58a7 100644 --- a/xen/arch/riscv/riscv64/head.S +++ b/xen/arch/riscv/riscv64/head.S @@ -29,6 +29,8 @@ ENTRY(start) =20 jal reset_stack =20 + jal calc_phys_offset + tail start_xen =20 .section .text, "ax", %progbits --=20 2.40.1 From nobody Fri May 10 02:38:29 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=1687181718; cv=none; d=zohomail.com; s=zohoarc; b=CAi/PEKeZinUT/ZHwGdzL6KhHhGHqDvBPEh0ngN53OtStx6g/9w9AYaD39qwEr7HgzEgXHbqrYVkJqvfKCmD6ACThJ58scAhbfU9c6gau6fdpQmxwUwTs3QKb2u8og3DpEgmu8qjw6WUJuq8ZYot9Pea4QelmwCBfMaIC8yVfpA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687181718; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oc9XrpqHGKjN07zKvhZfUAZGEobGlBzlNsUquN7G9EQ=; b=mjENqmd0KGq2SxnmGK52IQMvYxdLivJO4tORKlphTcN/ZeLuNW0joOlg/28Ib7ftbsOa/IQSU4rIDb4SKdXGNZgV29Lb9va8NTgDnChPCZ8p8k8ZyxKJP7BCVBisPuC90aACYgvBb8eKaa6PSFnpjzb7NbJ8iQ9L+BpPV/o9XwU= 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 1687181718725269.87439925953095; Mon, 19 Jun 2023 06:35:18 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.551093.860450 (Exim 4.92) (envelope-from ) id 1qBF21-0001wz-MU; Mon, 19 Jun 2023 13:34:57 +0000 Received: by outflank-mailman (output) from mailman id 551093.860450; Mon, 19 Jun 2023 13:34:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qBF21-0001wq-Hu; Mon, 19 Jun 2023 13:34:57 +0000 Received: by outflank-mailman (input) for mailman id 551093; Mon, 19 Jun 2023 13:34:56 +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 1qBF20-0000wG-2K for xen-devel@lists.xenproject.org; Mon, 19 Jun 2023 13:34:56 +0000 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [2a00:1450:4864:20::233]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 12f430c3-0ea6-11ee-b234-6b7b168915f2; Mon, 19 Jun 2023 15:34:54 +0200 (CEST) Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2b477e9d396so16229591fa.3 for ; Mon, 19 Jun 2023 06:34:54 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id f26-20020a2e9e9a000000b002adb0164258sm5222236ljk.112.2023.06.19.06.34.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 06:34:52 -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: 12f430c3-0ea6-11ee-b234-6b7b168915f2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687181693; x=1689773693; 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=oc9XrpqHGKjN07zKvhZfUAZGEobGlBzlNsUquN7G9EQ=; b=ZkZAUi+4SMhxBZDcxPlPFvUJlTNYtvBiVxqlIc74NR78N8cmRU6dwx4bOQcPTrD//v /lSa61v742q9QyrhK+Coo2pZtVmyjqd/0m7lw0dgS6wa4HluZzy0qY1EhZ9Enew+xY1f hn22DngA8bKj7Lk8zWoCycHnI3I9qoc2hK2FKOcUjgvPgpWubzK0oc+ryyiqgklecjOg FsqDKb06vJbkzFtQ1b8AqUUZ5h0LNedBSLIiONCNy8d5tsx19bUMIt+PN1VRHMA6zWot c0k+B/BZ/qSKuQBB5ab3eg9GLetLmuXfWUuuC2+OdsWXYYK8KjOZFV0GUc38yl68CY0N RJ5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687181693; x=1689773693; 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=oc9XrpqHGKjN07zKvhZfUAZGEobGlBzlNsUquN7G9EQ=; b=iKAWh2VxyLULOnF4p8lVkZQ1i43AEKv/vDzgAL4oUwn1RNDNULGjDmi7b1bPxNAMH2 /rIQ0UR3I1IRISVuQUNYIhLu9C1Y7x1qG13Z4DVLBcjTMEGxPDVRJ9oru2ZveRlN4xKT ONrfGSu/AQbH8aLNCuzM+5t5r++ELonU+Htq5l1BQyqDVRPx1YMVFAkZIJQ/bH1e5X56 63WPGUA9RiAr9hWoIcOdoTjt3jPpmuye5AfBrnIZzCSYkbWDLneS3ppX8Wdfwv+QOviF lo6PGiQsmgFaNnTqW3WexLE/rLMKaje1OD/SSPUdtS5n4TlZ6BzftpeGBI1gyDVtpi2Z uNZA== X-Gm-Message-State: AC+VfDzrRzIAfsgNKOCYIKn9OCwaI3fWEAfiDSyt+sA5ZsUufHG4mTkF YEFQqQu9zCcea/Gq9fRXiENmsnGGbvY= X-Google-Smtp-Source: ACHHUZ6ObWB2MlCYIatUomne6yHJ3k7kGHyiExiyOkvCU5MNLQp59z2Af3xvzIxoDbYY5EVusAiLfw== X-Received: by 2002:a2e:a0ca:0:b0:2b4:6f17:31f7 with SMTP id f10-20020a2ea0ca000000b002b46f1731f7mr2824729ljm.27.1687181693093; Mon, 19 Jun 2023 06:34:53 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , Julien Grall , Oleksii Kurochko , Bob Eshleman , Alistair Francis , Connor Davis Subject: [PATCH v2 4/6] xen/riscv: introduce identity mapping Date: Mon, 19 Jun 2023 16:34:45 +0300 Message-Id: <21d8ce65f718bc10c2213688f79cf5f978bcaf16.1687178053.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1687181720533100003 Content-Type: text/plain; charset="utf-8" The way how switch to virtual address was implemented in the commit e66003e7be ("xen/riscv: introduce setup_initial_pages") isn't safe enough as: * enable_mmu() depends on hooking all exceptions and pagefault. * Any exception other than pagefault, or not taking a pagefault causes it to malfunction, which means you will fail to boot depending on where Xen was loaded into memory. Instead of the proposed way of switching to virtual addresses was decided to use identity mapping of the entrire Xen and after switching to virtual addresses identity mapping is removed from page-tables. Since it is not easy to keep track where the identity map was mapped, so we will look for the top-level entry exclusive to the identity map and remove it. Fixes: e66003e7be ("xen/riscv: introduce setup_initial_pages") Signed-off-by: Oleksii Kurochko Suggested-by: Andrew Cooper --- Changes in V2: - update definition of PGTBL_INITIAL_COUNT and the comment above. - code style fixes. - 1:1 mapping for entire Xen. - remove id_addrs array becase entire Xen is mapped. - reverse condition for cycle inside remove_identity_mapping(). - fix page table walk in remove_identity_mapping(). - update the commit message. - add Suggested-by: Andrew Cooper - save hart_id and dtb_addr before call MMU related C functions. - use phys_offset variable instead of doing calcultations to get phys off= set in head.S file. ( it can be easily done as entire Xen is 1:1 mapped ) - declare enable_muu() as __init. --- xen/arch/riscv/include/asm/config.h | 2 + xen/arch/riscv/include/asm/mm.h | 3 +- xen/arch/riscv/mm.c | 84 ++++++++++++++++------------- xen/arch/riscv/riscv64/head.S | 34 ++++++++++++ xen/arch/riscv/setup.c | 14 +---- 5 files changed, 88 insertions(+), 49 deletions(-) diff --git a/xen/arch/riscv/include/asm/config.h b/xen/arch/riscv/include/a= sm/config.h index 38862df0b8..fa90ae0898 100644 --- a/xen/arch/riscv/include/asm/config.h +++ b/xen/arch/riscv/include/asm/config.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + #ifndef __RISCV_CONFIG_H__ #define __RISCV_CONFIG_H__ =20 diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/m= m.h index 996041ce81..500fdc9c5a 100644 --- a/xen/arch/riscv/include/asm/mm.h +++ b/xen/arch/riscv/include/asm/mm.h @@ -9,7 +9,8 @@ void setup_initial_pagetables(void); =20 void enable_mmu(void); -void cont_after_mmu_is_enabled(void); + +void remove_identity_mapping(void); =20 void calc_phys_offset(void); =20 diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c index 570033f17f..2693b817c5 100644 --- a/xen/arch/riscv/mm.c +++ b/xen/arch/riscv/mm.c @@ -25,6 +25,12 @@ unsigned long __ro_after_init phys_offset; #define LOAD_TO_LINK(addr) ((unsigned long)(addr) - phys_offset) #define LINK_TO_LOAD(addr) ((unsigned long)(addr) + phys_offset) =20 +/* + * Should be removed as soon as enough headers will be merged for inclusio= n of + * . + */ +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) + /* * It is expected that Xen won't be more then 2 MB. * The check in xen.lds.S guarantees that. @@ -35,8 +41,10 @@ unsigned long __ro_after_init phys_offset; * * It might be needed one more page table in case when Xen load address * isn't 2 MB aligned. + * + * (CONFIG_PAGING_LEVELS - 1) page tables are needed for identity mapping. */ -#define PGTBL_INITIAL_COUNT ((CONFIG_PAGING_LEVELS - 1) + 1) +#define PGTBL_INITIAL_COUNT ((CONFIG_PAGING_LEVELS - 1) * 2 + 1) =20 pte_t __section(".bss.page_aligned") __aligned(PAGE_SIZE) stage1_pgtbl_root[PAGETABLE_ENTRIES]; @@ -75,6 +83,7 @@ static void __init setup_initial_mapping(struct mmu_desc = *mmu_desc, unsigned int index; pte_t *pgtbl; unsigned long page_addr; + bool is_identity_mapping =3D map_start =3D=3D pa_start; =20 if ( (unsigned long)_start % XEN_PT_LEVEL_SIZE(0) ) { @@ -108,16 +117,18 @@ static void __init setup_initial_mapping(struct mmu_d= esc *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); pte_t pte_to_be_written; =20 index =3D pt_index(0, page_addr); =20 - if ( is_kernel_text(LINK_TO_LOAD(page_addr)) || - is_kernel_inittext(LINK_TO_LOAD(page_addr)) ) - permissions =3D - PTE_EXECUTABLE | PTE_READABLE | PTE_VALID; + if ( is_kernel_text(addr) || + is_kernel_inittext(addr) ) + permissions =3D + PTE_EXECUTABLE | PTE_READABLE | PTE_VALID; =20 - if ( is_kernel_rodata(LINK_TO_LOAD(page_addr)) ) + if ( is_kernel_rodata(addr) ) permissions =3D PTE_READABLE | PTE_VALID; =20 pte_to_be_written =3D paddr_to_pte(paddr, permissions); @@ -232,22 +243,18 @@ void __init setup_initial_pagetables(void) linker_start, linker_end, load_start); + + if ( linker_start =3D=3D load_start ) + return; + + setup_initial_mapping(&mmu_desc, + load_start, + load_end, + load_start); } =20 -void __init noreturn noinline enable_mmu() +void __init enable_mmu(void) { - /* - * Calculate a linker time address of the mmu_is_enabled - * label and update CSR_STVEC with it. - * MMU is configured in a way where linker addresses are mapped - * on load addresses so in a case when linker addresses are not equal - * to load addresses, after MMU is enabled, it will cause - * an exception and jump to linker time addresses. - * Otherwise if load addresses are equal to linker addresses the code - * after mmu_is_enabled label will be executed without exception. - */ - csr_write(CSR_STVEC, LOAD_TO_LINK((unsigned long)&&mmu_is_enabled)); - /* Ensure page table writes precede loading the SATP */ sfence_vma(); =20 @@ -255,25 +262,30 @@ void __init noreturn noinline enable_mmu() csr_write(CSR_SATP, PFN_DOWN((unsigned long)stage1_pgtbl_root) | RV_STAGE1_MODE << SATP_MODE_SHIFT); +} =20 - asm volatile ( ".p2align 2" ); - mmu_is_enabled: - /* - * Stack should be re-inited as: - * 1. Right now an address of the stack is relative to load time - * addresses what will cause an issue in case of load start address - * isn't equal to linker start address. - * 2. Addresses in stack are all load time relative which can be an - * issue in case when load start address isn't equal to linker - * start address. - * - * We can't return to the caller because the stack was reseted - * and it may have stash some variable on the stack. - * Jump to a brand new function as the stack was reseted - */ +void __init remove_identity_mapping(void) +{ + unsigned int i; + pte_t *pgtbl; + unsigned int index, xen_index; + unsigned long load_addr =3D LINK_TO_LOAD(_start); =20 - switch_stack_and_jump((unsigned long)cpu0_boot_stack + STACK_SIZE, - cont_after_mmu_is_enabled); + for ( pgtbl =3D stage1_pgtbl_root, i =3D 0; + i <=3D (CONFIG_PAGING_LEVELS - 1); + i++ ) + { + index =3D pt_index(CONFIG_PAGING_LEVELS - 1 - i, load_addr); + xen_index =3D pt_index(CONFIG_PAGING_LEVELS - 1 - i, XEN_VIRT_STAR= T); + + if ( index !=3D xen_index ) + { + pgtbl[index].pte =3D 0; + break; + } + + pgtbl =3D (pte_t *)pte_to_paddr(pgtbl[index]); + } } =20 /* diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S index 850fbb58a7..41983ffe63 100644 --- a/xen/arch/riscv/riscv64/head.S +++ b/xen/arch/riscv/riscv64/head.S @@ -29,8 +29,42 @@ ENTRY(start) =20 jal reset_stack =20 + /* + * save hart_id and dtb_base as a0 and a1 register can be used + * by C code ( f.e. setup_initial_pagetables will update a0 and + * a1 ) + */ + mv s0, a0 + mv s1, a1 + jal calc_phys_offset =20 + jal setup_initial_pagetables + + jal enable_mmu + + la t1, phys_offset + REG_L t1, (t1) + + /* Calculate proper VA after jump from 1:1 mapping */ + la t0, .L_primary_switched + sub t0, t0, t1 + + /* Jump from 1:1 mapping world */ + jr t0 + +.L_primary_switched: + /* + * cpu0_boot_stack address is 1:1 mapping related so it should be + * recalculated after jump from 1:1 mapping world as 1:1 mapping + * will be removed soon in start_xen(). + */ + jal reset_stack + + /* restore bootcpu_id and dtb address */ + mv a0, s0 + mv a1, s1 + tail start_xen =20 .section .text, "ax", %progbits diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index 845d18d86f..c4ef0b3165 100644 --- a/xen/arch/riscv/setup.c +++ b/xen/arch/riscv/setup.c @@ -11,20 +11,10 @@ unsigned char __initdata cpu0_boot_stack[STACK_SIZE] void __init noreturn start_xen(unsigned long bootcpu_id, paddr_t dtb_addr) { - early_printk("Hello from C env\n"); - - setup_initial_pagetables(); - - enable_mmu(); - - for ( ;; ) - asm volatile ("wfi"); + remove_identity_mapping(); =20 - unreachable(); -} + early_printk("Hello from C env\n"); =20 -void __init noreturn cont_after_mmu_is_enabled(void) -{ early_printk("All set up\n"); =20 for ( ;; ) --=20 2.40.1 From nobody Fri May 10 02:38:29 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=1687181730; cv=none; d=zohomail.com; s=zohoarc; b=FLeHrl6LFQlsnVWccF2bC8LZbMvDg1VRyXHTErgG8FZVjhv39egSVd7YZ9vY3tbwF8QJklp9kGiCtGJi0xgg6abBdQGq6cHOESeDPAFLQmc4utu9PJnzCK1M9+UMo8nVsUN7VTlgy7sAN8gwsAIR0vE2+5iR5m//PVnt/WX5/fE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687181730; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=g5CVjF/hqhtai/8e3vIC1wUJzJlWbPdW3j0oBx5KVr8=; b=ibxMTFVbA4HQVY0ZaOocG/8kc/dFWFkBk+KZv2sHwnt21BiB0PDhk3YOOQdM0baOUSkr1iFUjTDfHC1uG3hAdIbQ6n6S/QxyBoY7k4z9+NftqV2CAPYYGd0hLvnaFMss6nWBMDky1777RLmGMtMhQwvM32M3jmjaodA2uGKmy2A= 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 1687181730254101.6744866141205; Mon, 19 Jun 2023 06:35:30 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.551094.860455 (Exim 4.92) (envelope-from ) id 1qBF22-000214-14; Mon, 19 Jun 2023 13:34:58 +0000 Received: by outflank-mailman (output) from mailman id 551094.860455; Mon, 19 Jun 2023 13:34:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qBF21-00020g-Sb; Mon, 19 Jun 2023 13:34:57 +0000 Received: by outflank-mailman (input) for mailman id 551094; Mon, 19 Jun 2023 13:34:57 +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 1qBF21-0000wG-2P for xen-devel@lists.xenproject.org; Mon, 19 Jun 2023 13:34:57 +0000 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [2a00:1450:4864:20::231]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 135742c1-0ea6-11ee-b234-6b7b168915f2; Mon, 19 Jun 2023 15:34:54 +0200 (CEST) Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2b466066950so33046481fa.2 for ; Mon, 19 Jun 2023 06:34:54 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id f26-20020a2e9e9a000000b002adb0164258sm5222236ljk.112.2023.06.19.06.34.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 06:34:53 -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: 135742c1-0ea6-11ee-b234-6b7b168915f2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687181694; x=1689773694; 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=g5CVjF/hqhtai/8e3vIC1wUJzJlWbPdW3j0oBx5KVr8=; b=j6YcsFJs1tQo7uxgUdoGnDmykVVLTJzX1VQ93j6Te3N4W5L0Kir/FqkQPdQbCLZIUQ 3NagYGigQKSR+DF0iSW75CnMxhLnMOZwBVhoLkoaRn1I/b5AZOBCg4aK3J3eXYCy4wVX u7IPRmFQ8BhFmpvio9BE0IdRag/ZhYz9A7Es9FR/rXKTuJX24v2TANYO248aD2FbypQO VNwkFMescN01bUZkMFjQT92FmTd984ml20I4umjcZU1GWPDOAaXjmY5hWFfuSM+mefJE kTw9IvEBephDuwt+vRE9pT54gYXEXkD3iY9Y0lwsMiJaR93sWT9TJogSprBrOSzIrqZV UmCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687181694; x=1689773694; 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=g5CVjF/hqhtai/8e3vIC1wUJzJlWbPdW3j0oBx5KVr8=; b=iVk2QdDLjBeRY/wRA1F9IcxpNgmv8T6tfQ/+pOhjtBR5R0nlM1B7qoFFhKXQw8EFw8 LRKI4KCu1M0lqzcB1bAHkwrUO8HyaGURr5wHEaQovy+jh9njX7KnVK9F3uMz2CUpsxej oUgCJR1Xdeu7zBPSWaXhR+MHKnyqo6vnsHsA0uQGVyNDhLW2WDeZ9s+/fsqFyc8C4pHw JGRS7c6inev7aBHGG8OQSZFg6yMEeqAMUv4+eTMp0OuTOwv1Dw/l+eeleUBzMcBo28Om yrNXnrZ6cMr7Dp1w8UrKAPRC+EMCzLlZ0SsvDjMG8aYnBpiWcavTk83oiJEdbdbXS88a pf1w== X-Gm-Message-State: AC+VfDxX5kr2342xhsP1OgJyJrK/DY8bKob2BXf/Ua+sG2ZPcnwTTSAB E7bSoAnZ0yPqDOOxiTZwc0N4iejY+uw= X-Google-Smtp-Source: ACHHUZ6Jm/ZgYJwHq2MaQVAp6h+Ozy6XKDvbFPp0kkAXh/HL30m7RY6IVvCmgU3VQj8w0bau+tbKBg== X-Received: by 2002:a2e:94c1:0:b0:2af:1817:26e1 with SMTP id r1-20020a2e94c1000000b002af181726e1mr6013828ljh.30.1687181693813; Mon, 19 Jun 2023 06:34:53 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , Julien Grall , Oleksii Kurochko , Bob Eshleman , Alistair Francis , Connor Davis Subject: [PATCH v2 5/6] xen/riscv: add SPDX tags Date: Mon, 19 Jun 2023 16:34:46 +0300 Message-Id: <19dfd66d1a446bf1f5cdccd74b7a64f56baa8f5c.1687178053.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1687181731511100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Oleksii Kurochko Suggested-by: Andrew Cooper Reviewed-by: Alistair Francis --- Changes in V2: - change SPDX tags from GPL-2.0-or-later to GPL-2.0-only. - add Suggested-by: Andrew Cooper . --- xen/arch/riscv/include/asm/current.h | 2 ++ xen/arch/riscv/include/asm/early_printk.h | 2 ++ xen/arch/riscv/include/asm/mm.h | 2 ++ xen/arch/riscv/include/asm/page-bits.h | 2 ++ xen/arch/riscv/include/asm/page.h | 2 ++ xen/arch/riscv/include/asm/traps.h | 2 ++ xen/arch/riscv/include/asm/types.h | 2 ++ xen/arch/riscv/mm.c | 2 ++ xen/arch/riscv/setup.c | 2 ++ 9 files changed, 18 insertions(+) diff --git a/xen/arch/riscv/include/asm/current.h b/xen/arch/riscv/include/= asm/current.h index d87e6717e0..d84f15dc50 100644 --- a/xen/arch/riscv/include/asm/current.h +++ b/xen/arch/riscv/include/asm/current.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + #ifndef __ASM_CURRENT_H #define __ASM_CURRENT_H =20 diff --git a/xen/arch/riscv/include/asm/early_printk.h b/xen/arch/riscv/inc= lude/asm/early_printk.h index 05106e160d..85e60df33a 100644 --- a/xen/arch/riscv/include/asm/early_printk.h +++ b/xen/arch/riscv/include/asm/early_printk.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + #ifndef __EARLY_PRINTK_H__ #define __EARLY_PRINTK_H__ =20 diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/m= m.h index 500fdc9c5a..3f694a43ef 100644 --- a/xen/arch/riscv/include/asm/mm.h +++ b/xen/arch/riscv/include/asm/mm.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + #ifndef _ASM_RISCV_MM_H #define _ASM_RISCV_MM_H =20 diff --git a/xen/arch/riscv/include/asm/page-bits.h b/xen/arch/riscv/includ= e/asm/page-bits.h index 4a3e33589a..8f1f474371 100644 --- a/xen/arch/riscv/include/asm/page-bits.h +++ b/xen/arch/riscv/include/asm/page-bits.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + #ifndef __RISCV_PAGE_BITS_H__ #define __RISCV_PAGE_BITS_H__ =20 diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm= /page.h index 22b36e03a4..95074e29b3 100644 --- a/xen/arch/riscv/include/asm/page.h +++ b/xen/arch/riscv/include/asm/page.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + #ifndef _ASM_RISCV_PAGE_H #define _ASM_RISCV_PAGE_H =20 diff --git a/xen/arch/riscv/include/asm/traps.h b/xen/arch/riscv/include/as= m/traps.h index f3fb6b25d1..3fef318478 100644 --- a/xen/arch/riscv/include/asm/traps.h +++ b/xen/arch/riscv/include/asm/traps.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + #ifndef __ASM_TRAPS_H__ #define __ASM_TRAPS_H__ =20 diff --git a/xen/arch/riscv/include/asm/types.h b/xen/arch/riscv/include/as= m/types.h index 0c0ce78c8f..c2cdfd9caa 100644 --- a/xen/arch/riscv/include/asm/types.h +++ b/xen/arch/riscv/include/asm/types.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + #ifndef __RISCV_TYPES_H__ #define __RISCV_TYPES_H__ =20 diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c index 2693b817c5..663048c783 100644 --- a/xen/arch/riscv/mm.c +++ b/xen/arch/riscv/mm.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + #include #include #include diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index c4ef0b3165..6593f601c1 100644 --- a/xen/arch/riscv/setup.c +++ b/xen/arch/riscv/setup.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + #include #include =20 --=20 2.40.1 From nobody Fri May 10 02:38:29 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=1687181720; cv=none; d=zohomail.com; s=zohoarc; b=e7irI8AsPMjyoD6FECOaMKmVxBCzIkqW5WIaCROXqfz1V+6h8rRfVtsNk8Uwl0yoJgkopzYa3ZzldOg2NzTvHPGEpWGCIkWP2ZNN6Q+1KoPIVOmm2OQRLk3JLMvsAQC/alsDou8b2zkiFRSUz6nRPiZ+7FNr/73Xk9STcDgXz3c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687181720; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=A+nQRuKJN5u5llfZLQokcA1AqsaluOe8xrZ2dOYYFlU=; b=GXoMEg3fyeU7/mte/npxHhvQncOlljzhSCIF/PwxZ+8WSvQJ/Vjsu6TGBimYIFfXOu+ZIgBQSytREMDAbb4P5302s1ASgx8zm/JJpiGaEyQ4spmFU/Ha/RJkhYN8dVFSXOOUfta2s5tcS5ci2lrbVB3WDmWmcJMMk2e6PtsVewg= 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 16871817204471013.9038328186671; Mon, 19 Jun 2023 06:35:20 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.551095.860469 (Exim 4.92) (envelope-from ) id 1qBF23-0002RO-F0; Mon, 19 Jun 2023 13:34:59 +0000 Received: by outflank-mailman (output) from mailman id 551095.860469; Mon, 19 Jun 2023 13:34:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qBF23-0002Qc-A6; Mon, 19 Jun 2023 13:34:59 +0000 Received: by outflank-mailman (input) for mailman id 551095; Mon, 19 Jun 2023 13:34:58 +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 1qBF22-0000wG-2d for xen-devel@lists.xenproject.org; Mon, 19 Jun 2023 13:34:58 +0000 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [2a00:1450:4864:20::231]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 13931462-0ea6-11ee-b234-6b7b168915f2; Mon, 19 Jun 2023 15:34:55 +0200 (CEST) Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2b45e6e1b73so39972241fa.0 for ; Mon, 19 Jun 2023 06:34:55 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id f26-20020a2e9e9a000000b002adb0164258sm5222236ljk.112.2023.06.19.06.34.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 06:34:54 -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: 13931462-0ea6-11ee-b234-6b7b168915f2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687181694; x=1689773694; 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=A+nQRuKJN5u5llfZLQokcA1AqsaluOe8xrZ2dOYYFlU=; b=IcjnYKnNhrFHWPDVKzhjiky1im4j8NA7VDhZVTZMDDywDb2b7PIBuZnmWwZAkYFZub XKa29BMrVjFyxuTtBW4yMDhYO3S9gDrnU4uD+2ya0VmH4ub5inzmSbrr/EAanncUl3zx Z35vq510+ztCwLilxyEQiOxCDDcIB6iKCLdtqn92wbqmWXzr7A8dtah+4sYBEPKoiXz+ bhrRR3TH4vAixbxwjYSyy5ZtD6kGTCCSN5YUvdBnhQLMr4sY/cPBaNGoe3SLbIFiSfNV EWTD2yN0VrJgLRLleZXaadIq09oxDiX5pqECfh018w0Hfg/s0uOz5TD/S+peJUHqXnFr AbOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687181694; x=1689773694; 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=A+nQRuKJN5u5llfZLQokcA1AqsaluOe8xrZ2dOYYFlU=; b=Qv5X1gz/yJTHomHs3gUA9YW3OwVpYVJjWjizDKCGVkDWzsXuLnHS3ZEEKlAxnt6Ipq e2qhhBBGEStQm34cQMAS5469OHqBzvA+X1DDy4oNt55RXeV2iEXBJVtoO17BudiQKW97 /t1VPLNRtxVofcBm+DNlR2fG1vbAuoFDcqlaE/NOhc6OPui1R/QRrnZnHMxcWmMwkKug mhyekQ9/1q4zRggBcZPBZbAlEmidmuvCWOWeWlRsZZ3qQzsO50xpX/EoSgmimdjEa57/ 0L8OksXhMFms8y5u2hw9m4dBwqo5Uhpg6iwqQbb9CAThj6rNNrudWIDTPkqTVcPB1mxt XCXA== X-Gm-Message-State: AC+VfDwEiFxo8WQOSNaZcxL8L3gb2k7oprG9MazPiAXCHBqtCV4fOZKl kCxY4KzxZTgMzkvTYc2cBGCDTmiAEoU= X-Google-Smtp-Source: ACHHUZ4N4kcSEsgLuUYkpuO9tCKdB4apKqEk2SMLIh9nX6/fbfCsIDWTSakOgrEa9ycVLGBiYBG9Gg== X-Received: by 2002:a2e:7003:0:b0:2b4:70b1:af01 with SMTP id l3-20020a2e7003000000b002b470b1af01mr2575846ljc.20.1687181694484; Mon, 19 Jun 2023 06:34:54 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , Julien Grall , Oleksii Kurochko , Bob Eshleman , Alistair Francis , Connor Davis Subject: [PATCH v2 6/6] xen/riscv: move extern of cpu0_boot_stack to header Date: Mon, 19 Jun 2023 16:34:47 +0300 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1687181722325100005 Content-Type: text/plain; charset="utf-8" Signed-off-by: Oleksii Kurochko Suggested-by: Andrew Cooper Reviewed-by: Alistair Francis --- Changes in V2: - add Suggested-by: Andrew Cooper . --- xen/arch/riscv/include/asm/mm.h | 2 ++ xen/arch/riscv/mm.c | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/m= m.h index 3f694a43ef..085eaab7fb 100644 --- a/xen/arch/riscv/include/asm/mm.h +++ b/xen/arch/riscv/include/asm/mm.h @@ -8,6 +8,8 @@ #define pfn_to_paddr(pfn) ((paddr_t)(pfn) << PAGE_SHIFT) #define paddr_to_pfn(pa) ((unsigned long)((pa) >> PAGE_SHIFT)) =20 +extern unsigned char cpu0_boot_stack[]; + void setup_initial_pagetables(void); =20 void enable_mmu(void); diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c index 663048c783..602b89aeed 100644 --- a/xen/arch/riscv/mm.c +++ b/xen/arch/riscv/mm.c @@ -20,8 +20,6 @@ struct mmu_desc { pte_t *pgtbl_base; }; =20 -extern unsigned char cpu0_boot_stack[STACK_SIZE]; - unsigned long __ro_after_init phys_offset; =20 #define LOAD_TO_LINK(addr) ((unsigned long)(addr) - phys_offset) --=20 2.40.1