From nobody Wed May 29 05:27:09 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=1686081353; cv=none; d=zohomail.com; s=zohoarc; b=KqM6+W7y3/S0pgRDRPMaNz1p4zf0NA0U6/7pUk2OBcFTylT3C04I4SrfZyy16zeAD4xmF6dQZ107fhc0575agq3GVFK/vPv15VCasNSA/ACjatvXj2mWh2q7sH86n2Cm5heViUHMbuiyok7dq+ITVpKs0M6jc8S6Cj7TPrrVsMc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686081353; 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=7TGArhQdSQX8UOhmIpz6TBiOEP22ajLMR7OWHR6Nu4A=; b=ZPi7tVug47hzEO050qEW1cFMQKDQcoRMAvqV5T8OFWQtv8550pNfXTOoowEAcx4rUMgIuLXRVAbe9zws9I5J66aHB7dw3HxGeqhON8p03dQrPNnbftOpbP7uHTkHtC/wWmE1eJ8JZkrF025jd3VCUHi37Dk/pGBfeOp5A1oTqD0= 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 1686081353538565.4803952372753; Tue, 6 Jun 2023 12:55:53 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.544184.849761 (Exim 4.92) (envelope-from ) id 1q6cm2-0002ez-7P; Tue, 06 Jun 2023 19:55:22 +0000 Received: by outflank-mailman (output) from mailman id 544184.849761; Tue, 06 Jun 2023 19:55:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1q6cm2-0002es-4k; Tue, 06 Jun 2023 19:55:22 +0000 Received: by outflank-mailman (input) for mailman id 544184; Tue, 06 Jun 2023 19:55: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 1q6cm1-0002el-H8 for xen-devel@lists.xenproject.org; Tue, 06 Jun 2023 19:55:21 +0000 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [2a00:1450:4864:20::131]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 111a1ffe-04a4-11ee-b232-6b7b168915f2; Tue, 06 Jun 2023 21:55:20 +0200 (CEST) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-4f4b384c09fso7994921e87.3 for ; Tue, 06 Jun 2023 12:55:20 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id j29-20020ac2551d000000b004f1383d57ecsm1563284lfk.202.2023.06.06.12.55.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 12:55:19 -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: 111a1ffe-04a4-11ee-b232-6b7b168915f2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686081320; x=1688673320; 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=7TGArhQdSQX8UOhmIpz6TBiOEP22ajLMR7OWHR6Nu4A=; b=O/XGaXCCKoTPUoZQ8DfwCH/WP0x17xGqKCKSMRVwnICDn5x6+ADpIfUG2vJJxCaDcN QFOtJe3BevRTdoRxJ1ihm4+sKe3JcEDxsdXFX3YdPQ+YGsT14pmvjZIUNfm3DpzQyQV1 sVz6ntBRlEqDBMyEDqmt/Phn47dsMM5EKpGP6bW/ObW/xhPDtskv/EzeaGrwm5Dh9Eup JIF3S1CRyf0y4cuYGUuv7/j7E4ppdu/YTOVcJg1lcvjR2QlxzsRNkH4IjTHkfq3C7COe oSiKG8EWvk4/M86K/1vgJf3wJayoGlvoweT7MwP38fVyJfMtgei/ecNoMkSJWBjYzHCn ImcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686081320; x=1688673320; 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=7TGArhQdSQX8UOhmIpz6TBiOEP22ajLMR7OWHR6Nu4A=; b=Lw8rQ7xi596fGcX8gatd/heJjKMhtjlKlX+wRczZqo/L/Otlc2SB+SHOHeW2p/d1Zy xqckWYjiPUmQBHazSeVhTM61/0xKJuiHWx084BQoGL67NUGQo6E9XQpi1o7XNQ7psCYd DWJ3T/wdilUkPIAnoKhxtaFe+ouzSSnD8O+VJmxsY+VVIhMscSV5sDhH+SaKVUb5CKPF 1fzJxHpTY4UlHKWstGl9q5yDkx8XZcaS3OA/F/mqrNMBHTbu/dBHPYl6PW5gqBxvjdp9 b3A3hKhprd/YyCt8LGB5N87otJVBrrScxBsPJXf8KccIP+EcpEKFm6cFOCCvyKjtHZM1 +Z4w== X-Gm-Message-State: AC+VfDwW3CMGc1+FIyp8ObX2N27ittrKIOILkX3H3ufrH7k5EmcvDM9A l7iCDA+2d23YLSUjxQMSl6m38m22unQ= X-Google-Smtp-Source: ACHHUZ57sB49WRMNcaI7ZfKQo7gAicuQco4hCa6Kjlrsr1+WkBj5jKHEmupI5ZX9n2A1vFpA6QoZyQ== X-Received: by 2002:a19:a416:0:b0:4f6:116d:6d26 with SMTP id q22-20020a19a416000000b004f6116d6d26mr1219679lfc.42.1686081319616; Tue, 06 Jun 2023 12:55:19 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , Oleksii Kurochko , Bob Eshleman , Alistair Francis , Connor Davis Subject: [PATCH v1 1/8] xen/riscv: make sure that identity mapping isn't bigger then page size Date: Tue, 6 Jun 2023 22:55:09 +0300 Message-Id: <4ad639bed6b8aa6cee34288a7ce154db21d761b5.1686080337.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: 1686081355744100009 Content-Type: text/plain; charset="utf-8" Signed-off-by: Oleksii Kurochko Acked-by: Alistair Francis --- xen/arch/riscv/xen.lds.S | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xen/arch/riscv/xen.lds.S b/xen/arch/riscv/xen.lds.S index 878130f313..74afbaab9b 100644 --- a/xen/arch/riscv/xen.lds.S +++ b/xen/arch/riscv/xen.lds.S @@ -20,6 +20,7 @@ SECTIONS . =3D XEN_VIRT_START; _start =3D .; .text : { + _idmap_start =3D .; _stext =3D .; /* Text section */ *(.text.header) =20 @@ -35,6 +36,7 @@ SECTIONS *(.gnu.warning) . =3D ALIGN(POINTER_ALIGN); _etext =3D .; /* End of text section */ + _idmap_end =3D .; } :text =20 . =3D ALIGN(PAGE_SIZE); @@ -174,3 +176,10 @@ ASSERT(!SIZEOF(.got), ".got non-empty") ASSERT(!SIZEOF(.got.plt), ".got.plt non-empty") =20 ASSERT(_end - _start <=3D MB(2), "Xen too large for early-boot assumptions= ") + +/* + * We require that Xen is loaded at a page boundary, so this ensures that = any + * code running on the identity map cannot cross a page boundary. + */ +ASSERT(IS_ALIGNED(_idmap_start, PAGE_SIZE), "_idmap_start should be page-a= ligned") +ASSERT(_idmap_end - _idmap_start <=3D PAGE_SIZE, "Identity mapped code is = larger than a page size") --=20 2.40.1 From nobody Wed May 29 05:27:09 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=1686081355; cv=none; d=zohomail.com; s=zohoarc; b=OBM6Q5kXXP4SP87DhRWyyqayG96VOXWPNU2LAKRzPsPFvdR/FA4fGGAKHiiZpwQ1BGPT1Q1oAdaGTv6zBKIXZpWTso/hC1XURcA+MZWZBjomNox8w4U/QHCw5HPMM/BsvjRyeRtYEa1rS3YMcKHvPvELgMZChex8lMce38L99ow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686081355; 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=t+18CatWiKovUOnQdDJlhtreSRlIgkyqtkY8A4pd8sw=; b=R3EMU//JoW4xfFQ9AcKsnsIzFnrVohaTfPfGxfmPD2uQPnfCfeZTbY4MPWrW6eyhagLtUhV19qkh9On23ky++wO2+9vxgFoaVqw0haAGoM9l5KDCIWyfytkmAHSangAu4XPMXu+Qmy/RfqySeIDoOchL+wroN6JOld6diKGFaYw= 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 1686081355218490.9149383322689; Tue, 6 Jun 2023 12:55:55 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.544186.849781 (Exim 4.92) (envelope-from ) id 1q6cm4-00038p-Ly; Tue, 06 Jun 2023 19:55:24 +0000 Received: by outflank-mailman (output) from mailman id 544186.849781; Tue, 06 Jun 2023 19:55:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1q6cm4-00038i-I7; Tue, 06 Jun 2023 19:55:24 +0000 Received: by outflank-mailman (input) for mailman id 544186; Tue, 06 Jun 2023 19:55:23 +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 1q6cm3-0002er-1m for xen-devel@lists.xenproject.org; Tue, 06 Jun 2023 19:55:23 +0000 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [2a00:1450:4864:20::135]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 119c6400-04a4-11ee-8611-37d641c3527e; Tue, 06 Jun 2023 21:55:21 +0200 (CEST) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-4f3bb395e69so8248867e87.2 for ; Tue, 06 Jun 2023 12:55:21 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id j29-20020ac2551d000000b004f1383d57ecsm1563284lfk.202.2023.06.06.12.55.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 12:55:20 -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: 119c6400-04a4-11ee-8611-37d641c3527e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686081320; x=1688673320; 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=t+18CatWiKovUOnQdDJlhtreSRlIgkyqtkY8A4pd8sw=; b=R75eONep1sHqYGlAQtJiVqzQtXpLFmwkLqxeB+GmSvuq/ciEdTvPszXfLahAMY7tGc D+uGE+KDjR/Utps1OLY6tk0WCWJsQAewCzZOidD8GjfgRsH6lz5Z8o+B4bvIopkJJwTO Xwzou3FZJGb/U8rkEEMl21Rd7QvyGPg69R6yhHwn8eIDksUHY2uYzlYQELOc+nTisMSx iENa3+/+nRb6vpqcGC7NUDL8OuRm62HzmsraTfCNxcWFqZDnMEHQRsQljCHyY4LUjmvm i5eGvMY7dJu3acRn0wIpTMTsk8Hfn9kZQ71AY3EN+4jCu84S3DuPUtV4P3k/BSPL3muf 3wCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686081320; x=1688673320; 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=t+18CatWiKovUOnQdDJlhtreSRlIgkyqtkY8A4pd8sw=; b=IOmyx6k4QuBbpt5rj0qkgG/Ay5CBoIHgMC1+mqKfU4MT5EtO647ggSfgPSsLliQRhr N5KXzhtZrWa9D6aKpHYVEZ+Jag1OuxCile2lj3/JTGKPojKW2KzZF0MrFADssu7jFyrl EMBYFq37LIcuB+ECAI+/6elFqwtE37czEEV8W+VSU3nCYYC+tZU6fMuKFy1kBdJKnEhF DHBWi00LAgGpHuPhPVkRlr6SzhcBs4Nv/NfSAortl4zUJohNe9fkAuysXIXhhfbh+J0t 9G8zywmk6anD+8GELKn+IEEt7gtYHKpaifokmidIRMfF6oNxljGqD5YDH0c3HVHvNtyd BUzg== X-Gm-Message-State: AC+VfDzv7aWGP30ZYXcQ0TdItwcqxBg4/ydWUx0isSTbpK7ludycjjN/ 0VcX5vAa57ScB+4qEhyqRyq4Z16iz2c= X-Google-Smtp-Source: ACHHUZ4UcloTqSs1Y4vaiE14ffnJJkLDv6vbidnhs+aE6gUIqCSpz0KuNcZqnYToz8dqHx/nXt0q0w== X-Received: by 2002:ac2:4ac5:0:b0:4ec:8524:65a4 with SMTP id m5-20020ac24ac5000000b004ec852465a4mr1178650lfp.55.1686081320441; Tue, 06 Jun 2023 12:55:20 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , Oleksii Kurochko , Bob Eshleman , Alistair Francis , Connor Davis Subject: [PATCH v1 2/8] xen/riscv: add .sbss section to .bss Date: Tue, 6 Jun 2023 22:55:10 +0300 Message-Id: <6a0f3171323f0092b8374f2244182c7e7ca850c0.1686080337.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: 1686081355512100005 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 --- 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 74afbaab9b..9a2799bab5 100644 --- a/xen/arch/riscv/xen.lds.S +++ b/xen/arch/riscv/xen.lds.S @@ -151,7 +151,7 @@ SECTIONS *(.bss.percpu.read_mostly) . =3D ALIGN(SMP_CACHE_BYTES); __per_cpu_data_end =3D .; - *(.bss .bss.*) + *(.bss .bss.* .sbss) . =3D ALIGN(POINTER_ALIGN); __bss_end =3D .; } :text --=20 2.40.1 From nobody Wed May 29 05:27:09 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=1686081347; cv=none; d=zohomail.com; s=zohoarc; b=ZFCEEFvCC2arzMdSJ4yWVfYb8T7K1Dcf9SrGbG06v9wYLnwhO+C+vmHf/RhOtmxoJN8BU3CmCmPaCOjLfyATXCSfUSPldycCNDzlnPh1nNZbkMpBu6zezXHk1X+EgTbugGPT8ujuyoY0rHRdcLzarmAyw9giygPqM9VvkuShivo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686081347; 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=P5ZlKuhoRDHAHEke7zy4B0qROcvwjfCq2K3tRqo2H9M=; b=FzUtiFc/L6yVK0TgygjttV+KByC4GisNsS2RD0CpYss6oPBNKTL1gp+ZrFya7pCTUJ87fLKNgrJV2AeVHNtVZmaWDOzUCgoVioN/zZvmLdYl+N5Rq5sYY5gITIoiKC4D4vP9mWsxlRQn4FcPtlLs7m4K/KCI/RveKVkvaavBh+Y= 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 1686081347730217.4045008150772; Tue, 6 Jun 2023 12:55:47 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.544187.849791 (Exim 4.92) (envelope-from ) id 1q6cm5-0003Oi-TJ; Tue, 06 Jun 2023 19:55:25 +0000 Received: by outflank-mailman (output) from mailman id 544187.849791; Tue, 06 Jun 2023 19:55:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1q6cm5-0003OZ-Pl; Tue, 06 Jun 2023 19:55:25 +0000 Received: by outflank-mailman (input) for mailman id 544187; Tue, 06 Jun 2023 19:55:24 +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 1q6cm4-0002er-1t for xen-devel@lists.xenproject.org; Tue, 06 Jun 2023 19:55:24 +0000 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [2a00:1450:4864:20::12e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 120e5a7a-04a4-11ee-8611-37d641c3527e; Tue, 06 Jun 2023 21:55:22 +0200 (CEST) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-4f611ac39c5so6324491e87.2 for ; Tue, 06 Jun 2023 12:55:22 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id j29-20020ac2551d000000b004f1383d57ecsm1563284lfk.202.2023.06.06.12.55.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 12:55:20 -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: 120e5a7a-04a4-11ee-8611-37d641c3527e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686081321; x=1688673321; 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=P5ZlKuhoRDHAHEke7zy4B0qROcvwjfCq2K3tRqo2H9M=; b=YZ6C4Se0SQL9HgctTBmHpY8KVbIgMujcltWIX4TOTMQExmGRAxe1gkS6ctvFACrp3O AL/vpiYPZcMu+OdCzIKaoAUXI+BKSSF5zRoLw35yDnqhzBeXnkUvhdKjg023fXttztMZ 1mspfAnNg7hVGwiOa3nQxHrWyD7PnSsTYgvZeYrgLtzVcxsT1KzjCVAQLSR1BWqQczkO G/jc18/nY7Gf4JsB5+AUC3R9iacO+/JXdDFxt49CC2HPcelBMEzpdmY94hNLIMO9DWGF HKVPsBqNdPmEyzonh2LvAJJMvUXOGj/eqiMi3HyU0+bA0nMVC68zc1E5OH/Ue7ApHnWT ZbpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686081321; x=1688673321; 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=P5ZlKuhoRDHAHEke7zy4B0qROcvwjfCq2K3tRqo2H9M=; b=RmEsusTUYTf5jhWEX4iKaEtwSONodE/3mn0RznQjCzxzfGPlgFraX/n+HKTzCvKFSz FRiForrmp0snxeBlKCa6aMm71TOgr8vdNYxUjvWey7ax5GN/YAOSipjtH/lVNbGgASV1 w3JsuwS2cRDlEGTg7fxMd99I4ZtJwf2Ass5GtxgQPmbHD+XPraOM4MWNEqBNawBcUdMy oew0NerKslBhi68aXA02BPKvKSxGGgefC0QrQwwxc5xqtvSlmOFmSzSA5esEnlxIpocf FErshvyeiKgdTAs6z2ymCKyEOtt+LvXx1CiMp5QFU9tFotY/Wq7SWHsp+sOt8HOnLFRL qvsg== X-Gm-Message-State: AC+VfDySJBJ8Y6cu63vRRHPbQsJpOSbsBHa5SESWc6jnF5wSHneN32C3 7utpq9VrT3VvybLQ+kJAwoHBjInq7GA= X-Google-Smtp-Source: ACHHUZ6L0qbELbOxHqUXbl6i3ZhhXr/xDqThMRfeDj1DFSSjpLayi8x1Z0w/qzO67vt1VLNDqC6QuA== X-Received: by 2002:ac2:46c6:0:b0:4f6:3000:4d5a with SMTP id p6-20020ac246c6000000b004f630004d5amr1524831lfo.38.1686081321296; Tue, 06 Jun 2023 12:55:21 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , Oleksii Kurochko , Bob Eshleman , Alistair Francis , Connor Davis Subject: [PATCH v1 3/8] xen/riscv: introduce reset_stack() function Date: Tue, 6 Jun 2023 22:55:11 +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: 1686081349937100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Oleksii Kurochko Reviewed-by: Alistair Francis --- xen/arch/riscv/riscv64/head.S | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S index 8887f0cbd4..6fb7dd80fd 100644 --- a/xen/arch/riscv/riscv64/head.S +++ b/xen/arch/riscv/riscv64/head.S @@ -27,8 +27,14 @@ ENTRY(start) add t3, t3, __SIZEOF_POINTER__ bltu t3, t4, .L_clear_bss =20 + jal reset_stack + + tail start_xen + +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 Wed May 29 05:27:09 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=1686081355; cv=none; d=zohomail.com; s=zohoarc; b=LvRFQd0lF65BFQbuPmqsyb91CwENq3Gy2z4NjKtbbbDsg4XoXWn47lAqmsK17Movoguy39awFIvDUWJc2JGqSmLlnPq8OJzpXY6WcwoJQXA7ot4289M07uyuvXzbipgGglhv5Dar7s4kU9cVfWKesXK/dZxX1WzEle8wVgCCPNE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686081355; 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=R9dfuEcyOpcttJDizez0uwxVrhy0pEYRLPEtmcdqVH0=; b=eGTRavMXevPdYISweA0Yjf6jI6a88CJH57qp76N8N7UcRtrcEXndeWhb5chlPpVfcZZwxyElQEfMbkTfYkbGpt18HPYQ5FuJCfu4bjNFDWcaIrhWgR8vFNazXj5YnRbnG8plHkWPcgu+1JKmtyFxELYe0qDD5zpBPzi5vn3hjPE= 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 1686081355321961.8720927293027; Tue, 6 Jun 2023 12:55:55 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.544188.849798 (Exim 4.92) (envelope-from ) id 1q6cm6-0003St-El; Tue, 06 Jun 2023 19:55:26 +0000 Received: by outflank-mailman (output) from mailman id 544188.849798; Tue, 06 Jun 2023 19:55:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1q6cm6-0003SR-7N; Tue, 06 Jun 2023 19:55:26 +0000 Received: by outflank-mailman (input) for mailman id 544188; Tue, 06 Jun 2023 19:55:25 +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 1q6cm5-0002er-1x for xen-devel@lists.xenproject.org; Tue, 06 Jun 2023 19:55:25 +0000 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [2a00:1450:4864:20::12f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 127d81b0-04a4-11ee-8611-37d641c3527e; Tue, 06 Jun 2023 21:55:22 +0200 (CEST) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-4f6148f9679so5914935e87.3 for ; Tue, 06 Jun 2023 12:55:22 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id j29-20020ac2551d000000b004f1383d57ecsm1563284lfk.202.2023.06.06.12.55.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 12:55:21 -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: 127d81b0-04a4-11ee-8611-37d641c3527e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686081322; x=1688673322; 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=R9dfuEcyOpcttJDizez0uwxVrhy0pEYRLPEtmcdqVH0=; b=cO8vQhjZKZBCx/OMXvcYedquJasxp/5/p/DIaMDSm2K3nQHlfOGDVpPnc9bY5HDhKK RPlE5am5L3iXLcij5OkzvzvNpdl3+Rfp2dKxUNFnGX0M7MsIGMKzOYS81zP8nygsuM80 eBInYtgi+/j7NN3H0eNvGjBZuvc/AOJvzrufzepeZtMJCn97QH5d4Ivhhe9W6qWqwi2K qOVeKgRz8ptdjKNhpeeE35ZyZvPpf80CF8fEblojihRui3ViqhqnXkiG8u2+BxZH6Tnl Jkm6JAZzGhE0eSFNKEjDbgKuDc6GBj5eq1o8d2j2jh0XGcDQ4qvVnNvj/B7jHjFdZ/y7 KmfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686081322; x=1688673322; 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=R9dfuEcyOpcttJDizez0uwxVrhy0pEYRLPEtmcdqVH0=; b=Ivig9W9Wh5s+b122Y9EsCksV7KaME+9udVpCVVa1qxKyTkKPbfSQxwOeRz3qSBDvEQ xOE4udFdTU+h/62nBVighrfC2HA0GJcV0D057mrkyr8hAAViukyWXlNqRrKS/pUdbM9E OU4tyGCUJxzH/59Hi2gKu6ARGmmObio3fsu1rHLQ8VeXZtCeTd7HFRflr0WMJrLeAoNj cYk5Q+uSuDH3SqcrKnDq/xbLS0QfctHa2daoADWjgI3dplfDNUcxIugE93y8Z2C2/LxZ X+F5nWHSfjr9VLa+7MTczNPdhhN8nsQxJZ1lK41zhT26jnW9uNjOxfAn9iorMfDA7XuZ aarg== X-Gm-Message-State: AC+VfDyPYfMd2xR2WvXZrwqFVCN0ye/vhTLTrgE4Yr4dL3yT1mxiBnxv WjJcH4H9NKXh1M+rWPEMT02zf4vsaLs= X-Google-Smtp-Source: ACHHUZ4U3H6nveqzFxmohTnQISG3EbtKgdJoOK4rxT3Anq8lXoVZ8R0n4farW5PFO3Mkc81zgFmGhw== X-Received: by 2002:ac2:46fc:0:b0:4f3:a91c:23d0 with SMTP id q28-20020ac246fc000000b004f3a91c23d0mr1668492lfo.31.1686081322050; Tue, 06 Jun 2023 12:55:22 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , Oleksii Kurochko , Bob Eshleman , Alistair Francis , Connor Davis Subject: [PATCH v1 4/8] xen/riscv: introduce function for physical offset calculation Date: Tue, 6 Jun 2023 22:55:12 +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: 1686081355547100006 Content-Type: text/plain; charset="utf-8" The function was introduced to not 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 --- 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..c092897f9a 100644 --- a/xen/arch/riscv/mm.c +++ b/xen/arch/riscv/mm.c @@ -19,9 +19,11 @@ 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) +static unsigned long 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 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 6fb7dd80fd..69f3a24987 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 ENTRY(reset_stack) --=20 2.40.1 From nobody Wed May 29 05:27:09 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=1686081351; cv=none; d=zohomail.com; s=zohoarc; b=eQ730KL5QQuZC2QbvltSkkE2s+5Imy/OvW+Iwn3w+yQg2PRkaaJz56yoYsrxxmi5YTp/B5cXj5QWNjfe8E/fnqk3n4hkyRDwkY/XNKwq1IG6WsQYOs0RfPgydph/tND++h+wkJHCzZK5l4eVuWD48baaY2RUFEpMRWrd6qCPu38= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686081351; 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=efjoH6YD/NFQ9wxK29jeXVZ4gBqY6bo96HJMQ+wU7+s=; b=Hr2mgrV9wBdJS/eFxhuWgzlryxtb4hL7gYOvNktee5+W0pyO9iqvsvIE0NAnmXh4UibTBzy1C7lgVqxlv0P9bH2MJKIZ1JS+sjqhhZL8Vq1moccZoWtOsElZ9qRZqr4e0ZQpqQS3kzugo6RkzLzmRIn9gbPpCmCsh6wdhCi+Zwc= 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 1686081351940112.96372402967165; Tue, 6 Jun 2023 12:55:51 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.544189.849811 (Exim 4.92) (envelope-from ) id 1q6cm7-0003ur-N9; Tue, 06 Jun 2023 19:55:27 +0000 Received: by outflank-mailman (output) from mailman id 544189.849811; Tue, 06 Jun 2023 19:55:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1q6cm7-0003u8-J1; Tue, 06 Jun 2023 19:55:27 +0000 Received: by outflank-mailman (input) for mailman id 544189; Tue, 06 Jun 2023 19:55:26 +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 1q6cm6-0002er-21 for xen-devel@lists.xenproject.org; Tue, 06 Jun 2023 19:55:26 +0000 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [2a00:1450:4864:20::12e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 13064545-04a4-11ee-8611-37d641c3527e; Tue, 06 Jun 2023 21:55:23 +0200 (CEST) Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-4f611ac39c5so6324518e87.2 for ; Tue, 06 Jun 2023 12:55:23 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id j29-20020ac2551d000000b004f1383d57ecsm1563284lfk.202.2023.06.06.12.55.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 12:55:22 -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: 13064545-04a4-11ee-8611-37d641c3527e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686081323; x=1688673323; 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=efjoH6YD/NFQ9wxK29jeXVZ4gBqY6bo96HJMQ+wU7+s=; b=IzT6WqJv+D8ugHDKjmTICaR1Sxn3wyRwA3GFTrztineoxv69HfJ+OkIeiDmKwLV+fK 6I0m5K40P4q4b4jNbvtResiQ10VttI2r77l+iucyWTUv+2RhchZudesKoAREn4YRSvUW Y2WqVxdKrSMMCKQNC3NVaBw/QdsTX4/AzXJAewKHSKT38TOgQA3+LMg3OkoRlWqi4wkl 9P7S6tNcyvc9ThPkTQmj5dgySiXH4baKXK1puCTBQemMQJ8mgoYrP4lEiWfCGLsTMpwv nqRgR5mVCzxbC4xALShu791X1yzngMlNO0dNpj6pbgiiUFTsdGgXNcttJlGY9YMvw0pQ WPlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686081323; x=1688673323; 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=efjoH6YD/NFQ9wxK29jeXVZ4gBqY6bo96HJMQ+wU7+s=; b=Tb47hrsiwhdjSgkExIlIj7OCgnTmyrzDmoj1sOh5F2+8JzjoeN1Kk/gZKnAGABhSOU nEZvzinCJvPaFE1i+3sHSmAW+0K6eLk5Fl9zaz0jcH76hCTzXocfOVjVx7BkzYlHXjIx dxxTCCU8TRnGsHpMBFSujJCXaXq8eav6tcXA5qSlFN3yge3Px1hk+mY9pQuBw3j6SGWv dNjktVxjKJ85fPJ5Praf+ZwWj+I3NXrLKZeyU+9e4XnNUnCluFn/SgxTwYs0HTf4/5Or bedYkdKjhela6JrQBPZ5iSSkGq7CACHeXXEeubtOjOrgIPxEhPdpZ6P6BnFWdoM2Mon5 w9pw== X-Gm-Message-State: AC+VfDykR1/JU5UH+23hLzdY4Q8q1XsjNg7vKgtojCZ92p4ucZD4lExH 46WFgFRhaIdmlLaP2Cfo2wLIf9DC95A= X-Google-Smtp-Source: ACHHUZ5c9Rv5X/veMwg4l2ZWaYseSRPYtCf8TDawy3b6rVcB/VpclMQuUaY9txvzD8tLgvANkIjmGA== X-Received: by 2002:ac2:4c18:0:b0:4f2:6651:7c7b with SMTP id t24-20020ac24c18000000b004f266517c7bmr1328798lfq.61.1686081322877; Tue, 06 Jun 2023 12:55:22 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , Oleksii Kurochko , Bob Eshleman , Alistair Francis , Connor Davis Subject: [PATCH v1 5/8] xen/riscv: introduce identity mapping Date: Tue, 6 Jun 2023 22:55:13 +0300 Message-Id: <32aef31768cd81ffc8c848af6c29cd8510bbbf6d.1686080337.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: 1686081353540100002 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") wasn't safe enough so identity mapping was introduced and used. Fixes: e66003e7be ("xen/riscv: introduce setup_initial_pages") Signed-off-by: Oleksii Kurochko --- xen/arch/riscv/include/asm/mm.h | 3 +- xen/arch/riscv/mm.c | 99 ++++++++++++++++++++++----------- xen/arch/riscv/riscv64/head.S | 30 ++++++++++ xen/arch/riscv/setup.c | 14 +---- 4 files changed, 99 insertions(+), 47 deletions(-) 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 c092897f9a..ab790f571d 100644 --- a/xen/arch/riscv/mm.c +++ b/xen/arch/riscv/mm.c @@ -24,6 +24,11 @@ static unsigned long 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])) =20 /* * It is expected that Xen won't be more then 2 MB. @@ -35,8 +40,10 @@ static unsigned long phys_offset; * * It might be needed one more page table in case when Xen load address * isn't 2 MB aligned. + * + * 3 additional page tables are needed for identity mapping. */ -#define PGTBL_INITIAL_COUNT ((CONFIG_PAGING_LEVELS - 1) + 1) +#define PGTBL_INITIAL_COUNT ((CONFIG_PAGING_LEVELS - 1) + 1 + 3) =20 pte_t __section(".bss.page_aligned") __aligned(PAGE_SIZE) stage1_pgtbl_root[PAGETABLE_ENTRIES]; @@ -75,6 +82,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 +116,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 +242,27 @@ 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_start + PAGE_SIZE, + load_start); + + setup_initial_mapping(&mmu_desc, + (unsigned long)cpu0_boot_stack, + (unsigned long)cpu0_boot_stack + PAGE_SIZE, + (unsigned long)cpu0_boot_stack); } =20 -void __init noreturn noinline enable_mmu() +/* + * enable_mmu() can't be __init because __init section isn't part of ident= ity + * mapping so it will cause an issue after MMU will be enabled. + */ +void 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 +270,41 @@ void __init noreturn noinline enable_mmu() csr_write(CSR_SATP, PFN_DOWN((unsigned long)stage1_pgtbl_root) | RV_STAGE1_MODE << SATP_MODE_SHIFT); +} + +void __init remove_identity_mapping(void) +{ + int i, j; + pte_t *pgtbl; + unsigned int index, xen_index; =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 + * id_addrs should be in sync with id mapping in + * setup_initial_pagetables() */ + unsigned long id_addrs[] =3D { + LINK_TO_LOAD(_start), + LINK_TO_LOAD(cpu0_boot_stack), + }; =20 - switch_stack_and_jump((unsigned long)cpu0_boot_stack + STACK_SIZE, - cont_after_mmu_is_enabled); + pgtbl =3D stage1_pgtbl_root; + + for ( j =3D 0; j < ARRAY_SIZE(id_addrs); j++ ) + { + for ( pgtbl =3D stage1_pgtbl_root, i =3D CONFIG_PAGING_LEVELS - 1;= i >=3D 0; i-- ) + { + index =3D pt_index(i, id_addrs[j]); + xen_index =3D pt_index(i, XEN_VIRT_START); + + if ( index !=3D xen_index ) + { + pgtbl[index].pte =3D 0; + break; + } + + pgtbl =3D &pgtbl[index]; + } + } } =20 /* diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S index 69f3a24987..582078798a 100644 --- a/xen/arch/riscv/riscv64/head.S +++ b/xen/arch/riscv/riscv64/head.S @@ -31,6 +31,36 @@ ENTRY(start) =20 jal calc_phys_offset =20 + jal setup_initial_pagetables + + jal enable_mmu + + /* + * Calculate physical offset + * + * We can't re-use a value in phys_offset variable here as + * phys_offset is located in .bss and this section isn't + * 1:1 mapped and an access to it will cause MMU fault + */ + li t0, XEN_VIRT_START + la t1, start + sub t1, t1, t0 + + /* 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 + tail start_xen =20 ENTRY(reset_stack) 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 Wed May 29 05:27:09 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=1686081356; cv=none; d=zohomail.com; s=zohoarc; b=afTU6oAGmPFYXJmVH22aLSyU0tM+xCDRC94HX82sAViRzPa8qoOgxxRpFwcPh5rbDEjY/sVVRU1AhW//JMl3f/jSVVrU6r3QWDHRDH2KAtVIGdw1BCfvsJDgkxh5LF6dMT2aR10J8gppyizBS4huSsGd0buhhs9TqEeOUx8IEu0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686081356; 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=Wh8BJIh+57sl7bOo0QhYsWa0pXdWsiCtmsxwnxt2RAU=; b=SV//kfhmHyh4PMy0MmqLjC0YL//B5FNhB+izU00KyrwRA9DFPz5k2whnumMkbibbqr/giHi/QXMc1Ov8hlCFWnQrnxUNeY6rbfRE1HxDs52UYFxD8fOWRVjCC1dBHGOTahfFVN//BTYLk1kE6BtHknDVtA14mlj/kTCoCfnEOH8= 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 1686081356010406.78941029318605; Tue, 6 Jun 2023 12:55:56 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.544190.849821 (Exim 4.92) (envelope-from ) id 1q6cm9-0004EL-5L; Tue, 06 Jun 2023 19:55:29 +0000 Received: by outflank-mailman (output) from mailman id 544190.849821; Tue, 06 Jun 2023 19:55:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1q6cm9-0004E7-1A; Tue, 06 Jun 2023 19:55:29 +0000 Received: by outflank-mailman (input) for mailman id 544190; Tue, 06 Jun 2023 19:55:27 +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 1q6cm7-0002er-2B for xen-devel@lists.xenproject.org; Tue, 06 Jun 2023 19:55:27 +0000 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [2a00:1450:4864:20::12a]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 1376451d-04a4-11ee-8611-37d641c3527e; Tue, 06 Jun 2023 21:55:24 +0200 (CEST) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4f62b512fe2so3358224e87.1 for ; Tue, 06 Jun 2023 12:55:24 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id j29-20020ac2551d000000b004f1383d57ecsm1563284lfk.202.2023.06.06.12.55.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 12:55:23 -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: 1376451d-04a4-11ee-8611-37d641c3527e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686081324; x=1688673324; 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=Wh8BJIh+57sl7bOo0QhYsWa0pXdWsiCtmsxwnxt2RAU=; b=OSf8GtFqo2NuhZtcfIkC5FDn0ebuqJ1uQ7XzI6k3YI5keBWCuq9M2u4IyY7MPhvifJ t9P+Unj9Do1Vv0q570IxL+3snR23gk601FSsU5RGhzuSEZlMwRgfmMke9h2VcBD0d0Qq QAMaRW9r92Ind9Nued7KPU36F1bZdwJRmEodOIYP/Ck9DQ3HQ+W5Kqf/hJNVwsgFiBIQ NLahdPMnJ/xo1F+xZOb40fT5Zr2kvYPvnHZcrOZ0hTTahPclSVxkfkSsr0yhskFStN0d 0iON0sDj0jujKz12uzRbavsPR92hompWo6Fj/neSMErhluLfIW6FyjycSBqYddpXa4EW Dwjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686081324; x=1688673324; 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=Wh8BJIh+57sl7bOo0QhYsWa0pXdWsiCtmsxwnxt2RAU=; b=ibpWWxE2hkbEfwm1K1Liz4MRGgd1HPF78CcNa0a/QZ9IC+mi0fXR/9VyMVlOvxNJ8Q H+iHALOMqF8q0QIFOB6mK4tvTyOHB9u6dD90RgYDrDRTQfppXj1kQ8lQ1reDArKbxuvz gO7GtcAN6MOJ1nmA0AOh9s8gZYZjWdtC+yO5px5xidCPaDfKFJQIlRRBtkvvpf7eU9yl Jm3QtRnvA/QLv7sanPMHcNiESdaMoPsyp2srPFeTK1qJykKypyxUZRZwBLwmaDvfxwpO bGWEgjA33xtdeJqO66VIiSVhpZdmzsrnwk7aL88NC3W8hmdTbujMj3gJiKc9VRgd5Dj7 +Uog== X-Gm-Message-State: AC+VfDzvBK3Pe8EeEJ/t3MjC3nFTUpjN2NzMHSk+T0e5jKImbklo72SM XVvZa1N5mNHrK/PWRsC9Z7hRV6LSNQ4= X-Google-Smtp-Source: ACHHUZ7ntaUUio4KqesGs58TcVUdN7fp9cmIMj6BHSnc/mxy+bAhUnPCb+zwH0hWVqW0u7H9Bk9iaA== X-Received: by 2002:ac2:519a:0:b0:4f3:aa73:562 with SMTP id u26-20020ac2519a000000b004f3aa730562mr1307466lfi.2.1686081323644; Tue, 06 Jun 2023 12:55:23 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , Oleksii Kurochko , Bob Eshleman , Alistair Francis , Connor Davis Subject: [PATCH v1 6/8] xen/riscv: add SPDX tags Date: Tue, 6 Jun 2023 22:55:14 +0300 Message-Id: <1034fa44a9b589a18f89b7849877c00ee0a362d5.1686080337.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: 1686081357551100011 Content-Type: text/plain; charset="utf-8" Signed-off-by: Oleksii Kurochko --- xen/arch/riscv/include/asm/config.h | 2 ++ 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 ++ 10 files changed, 20 insertions(+) diff --git a/xen/arch/riscv/include/asm/config.h b/xen/arch/riscv/include/a= sm/config.h index 38862df0b8..3ae35f57b3 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-or-later */ + #ifndef __RISCV_CONFIG_H__ #define __RISCV_CONFIG_H__ =20 diff --git a/xen/arch/riscv/include/asm/current.h b/xen/arch/riscv/include/= asm/current.h index d87e6717e0..b08f204df4 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-or-later */ + #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..c11693bbe1 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-or-later */ + #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..3b04131628 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-or-later */ + #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..94190b3c61 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-or-later */ + #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 a7e2eee964..8e8ec9ee36 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-or-later */ + #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..2e896e0913 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-or-later */ + #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..7505663efe 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-or-later */ + #ifndef __RISCV_TYPES_H__ #define __RISCV_TYPES_H__ =20 diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c index ab790f571d..b50641a80e 100644 --- a/xen/arch/riscv/mm.c +++ b/xen/arch/riscv/mm.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + #include #include #include diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index c4ef0b3165..befbd07fde 100644 --- a/xen/arch/riscv/setup.c +++ b/xen/arch/riscv/setup.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + #include #include =20 --=20 2.40.1 From nobody Wed May 29 05:27:09 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=1686081363; cv=none; d=zohomail.com; s=zohoarc; b=XGrielLjlZWws6WIEzsqlBrOPmz5TAtcprHwVMoUm/mhYdU3UXxVKMf9FCElS3xfXVGBPWdu4lmQZ6/V+NzjRcLzV396EdCVwqfHsTRwaQGA6MgXvjim40YTYrLJv8pTZhdRF4FnsmCkfOZPOXbAKxxNucI0DxLstZqu5bIqo4M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686081363; 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=+EcH5kcQKxxsGaNTd34XZ5jD66PVUtcw5BEPk5sk3Zo=; b=RQwGT6IVLt38nLy3S3Yh+x4VoDuGDBj8y+ahDH4P7QtFkgKDqUdKP4A8lXWwnao6FFVn2VjNLQ2ggANuR7WgEDHo6Z3nUcJXzN5oMvGll56g2eXtnLwNIC1yZM2w/OupT2v88NdNFfE5kZtD7QFxM+TJeVocC3NFBEC5NFBf6ks= 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 1686081363410332.53031631961926; Tue, 6 Jun 2023 12:56:03 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.544191.849825 (Exim 4.92) (envelope-from ) id 1q6cm9-0004H9-JJ; Tue, 06 Jun 2023 19:55:29 +0000 Received: by outflank-mailman (output) from mailman id 544191.849825; Tue, 06 Jun 2023 19:55:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1q6cm9-0004Gf-C3; Tue, 06 Jun 2023 19:55:29 +0000 Received: by outflank-mailman (input) for mailman id 544191; Tue, 06 Jun 2023 19:55:28 +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 1q6cm8-0002er-2C for xen-devel@lists.xenproject.org; Tue, 06 Jun 2023 19:55:28 +0000 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [2a00:1450:4864:20::12a]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 1411477f-04a4-11ee-8611-37d641c3527e; Tue, 06 Jun 2023 21:55:25 +0200 (CEST) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4f6195d2b3fso4971252e87.1 for ; Tue, 06 Jun 2023 12:55:25 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id j29-20020ac2551d000000b004f1383d57ecsm1563284lfk.202.2023.06.06.12.55.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 12:55:24 -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: 1411477f-04a4-11ee-8611-37d641c3527e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686081324; x=1688673324; 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=+EcH5kcQKxxsGaNTd34XZ5jD66PVUtcw5BEPk5sk3Zo=; b=KJtpN5WDntZQgXJogrcQsPMis5suzLL0SLmEgaWEi22vWDVOv3Bpb5PVNwWtPgt4BF St2cD6/IOhij+eOJS9ADx+HetjbAJ++T53Mno7FDKIKbESTq3skRfX2o9uhfABX7su7c +8MVBnbhnNsreAGTP09p1IZtrK57fjTep27eYAzq2xUqYgX3Fdpt+MxNH57k9QwmaLVv va/ZQsGfC21RG00Vc+Bsf4vhP0hyfwlu7F7S/PKtuVyqsKDgQjQtyzxqej22C7EhPsWO 4Ph+w7cuaenaYB6DSBf6w8O6UI/vEPYTFtfJHSN2JBsFchDO7i3nMegcEmijrsuZ/7ra tovQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686081324; x=1688673324; 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=+EcH5kcQKxxsGaNTd34XZ5jD66PVUtcw5BEPk5sk3Zo=; b=TN6tf5S6gh9tnm2D0R4Kgt8lalstoxLEYhYdqEhK9tzQUlPpsnSpJJKGCBgrwvjORF Z0CLbL1SQrbK/ZslG6qWs/k2+QYFjL6b4qY5tRI1+MvXAFg6J3rSRfPgG9ZwMdUgMufh +3kT0t/hwSi93QZhhF3PfFMfQnW9bJGMo1h8uWp4rqzTfLeG0zM1aGKZHHSdvjE55J2W 5h2WBmQGa2IP+y2Ss19gc3ZAwvrwxBNoNIMbU2FnMpa5/FiQ4zakINKM0IGgDlfE/wem whSkd2PXjTJ783ztZ7mvVgBSw7RTfM7KWrv3IZd19P4j1Q3cJo9Z4OX6dy+W70FIRQi9 A1bw== X-Gm-Message-State: AC+VfDyTqSICThWaJyhOSVm9nLMWlwCdbiFnH//F0qorQixs4eoofQSK 6Jsl68ZgnKvchxQ74Uw3tFT8/HsocSk= X-Google-Smtp-Source: ACHHUZ5oZksC0xqC4aMn5c8xPi0PD3LcmIk7XGGr3hG0ChIOf7A7YAiWxUtT2YhBvjCN3CqOmwUgAw== X-Received: by 2002:ac2:4c14:0:b0:4e9:bafc:88d0 with SMTP id t20-20020ac24c14000000b004e9bafc88d0mr1583584lfq.23.1686081324490; Tue, 06 Jun 2023 12:55:24 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , Oleksii Kurochko , Bob Eshleman , Alistair Francis , Connor Davis Subject: [PATCH v1 7/8] xen/riscv: add __ASSEMBLY__ guards Date: Tue, 6 Jun 2023 22:55:15 +0300 Message-Id: <298e8876fca284eac7caf7e62339ead177da9609.1686080337.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: 1686081363716100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Oleksii Kurochko Acked-by: Alistair Francis --- xen/arch/riscv/include/asm/page.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm= /page.h index 8e8ec9ee36..1c6add70a5 100644 --- a/xen/arch/riscv/include/asm/page.h +++ b/xen/arch/riscv/include/asm/page.h @@ -3,6 +3,8 @@ #ifndef _ASM_RISCV_PAGE_H #define _ASM_RISCV_PAGE_H =20 +#ifndef __ASSEMBLY__ + #include #include =20 @@ -60,4 +62,6 @@ static inline bool pte_is_valid(pte_t p) return p.pte & PTE_VALID; } =20 +#endif /* __ASSEMBLY__ */ + #endif /* _ASM_RISCV_PAGE_H */ --=20 2.40.1 From nobody Wed May 29 05:27:09 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=1686081362; cv=none; d=zohomail.com; s=zohoarc; b=ggMndu5qIGqXk/stY0tI+URD23zX22sOVvXubMOB0/upj7FjeHw74/T4KGUrt9vNizW0zVbRyigXPr5OazRRnOlRb0/eIFH1ga2i2JsL44k05JiZyO+1ZlZE92d4in7nJok6RyhyuoFLGw2nUCTCMeif27t4vTHmlEpQhRSfcfk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686081362; 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=adjWBIjLafrAFiXOiNb5AAc0fFbNojcht2Nhfx9j3rY=; b=nCwtiQgCoZbdTOhfHP24B0aUd0TnElmtgAZw5c6SfJoaUj/uWvdvt7Tamu8HOEwZwKXdoOKuvBv+yAbZv+Nmq4e3t1aWQ6jumbNqnSAoLHmQ9ZSkH5ryPHCjFtfufhwBYtdUHgv5Q/uxzIsFZp7PL/AlS4CmdRhzxo7sYjRxDo4= 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 1686081362672984.9606900275128; Tue, 6 Jun 2023 12:56:02 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.544192.849841 (Exim 4.92) (envelope-from ) id 1q6cmB-0004kk-2R; Tue, 06 Jun 2023 19:55:31 +0000 Received: by outflank-mailman (output) from mailman id 544192.849841; Tue, 06 Jun 2023 19:55: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 1q6cmA-0004ji-S1; Tue, 06 Jun 2023 19:55:30 +0000 Received: by outflank-mailman (input) for mailman id 544192; Tue, 06 Jun 2023 19:55: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 1q6cm9-0002er-2M for xen-devel@lists.xenproject.org; Tue, 06 Jun 2023 19:55:29 +0000 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [2a00:1450:4864:20::129]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 144bf0ef-04a4-11ee-8611-37d641c3527e; Tue, 06 Jun 2023 21:55:25 +0200 (CEST) Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-4f62b552751so3270312e87.3 for ; Tue, 06 Jun 2023 12:55:25 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id j29-20020ac2551d000000b004f1383d57ecsm1563284lfk.202.2023.06.06.12.55.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 12:55:24 -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: 144bf0ef-04a4-11ee-8611-37d641c3527e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686081325; x=1688673325; 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=adjWBIjLafrAFiXOiNb5AAc0fFbNojcht2Nhfx9j3rY=; b=lLlE/Lkij5rFq1/swnQoTR/UnZJQUo2DNCfhq+FuydN0XGEcQCBCzeQudJxwRbtqFw cCWF0IHBvJkM3Ja/hbU3SSXSR4MBwgkgywR49W0FC4ISBLfVF+XFFndNNg1QO3Z2VHyU tgrMW4wePwhSIllB7WAUJck6VNsXiC4CbFLMv3k8qf8olqIL/MWPQVdGGrarwAWRhEus F4ftcQrY7w6WeICbhEbeUGHCsfri9C+hvymcstaifuOOuSpejhre30mZ8L3dy8LLV76h n79zx4qAE/j8H/kF9IR0PCuleFACwzY7IAFvKMwfcwKDD0Xp573LTo2czdFY8MZ7iyM+ 8z6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686081325; x=1688673325; 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=adjWBIjLafrAFiXOiNb5AAc0fFbNojcht2Nhfx9j3rY=; b=CwLEGPnjvnbRP0rv5HeNBgZSEqpMc44RQqANgKLoFytEsaBGvBghV6ISAlvTCPbkK9 kI3uwgWeC/rQuuHDb6b0ENxv9BxP4m2aRj9RlXwMIKKmAJE/6Gq2CQISCeFgmtHAQ1OO 806q603HICL+NTL30/OJLhloqD5/LuKCptxw87tjEtl5bp+7cpttVowUoH0k92u5Tz2d 4k4ecsz7n9m5a486mNjlwKdKFPuueSwkO0BgRTyio/VG7bxNaLY40CnoKYNKUqZKR8DA oNLE6jKFvz/gqkzueBHN0X2bH0234a/62AGedRpicAK9PZlOzbtfdzBCb5zwUFPSnHow Jndg== X-Gm-Message-State: AC+VfDxjvnXSbqSZO6BuskXKm5wKVA0381xJAcVe9qjVjTssCV0c2G4b gxasLrHzZ7ULhqy6JIDAOHEZbyuPRIY= X-Google-Smtp-Source: ACHHUZ5S3DssVanCU7X8GAZ1N4I05W+hlWQgRzwYEaGaONJ5RY9mmFBjBatvPLclkbh7M3F93PaCVg== X-Received: by 2002:a19:f809:0:b0:4f6:3677:54e with SMTP id a9-20020a19f809000000b004f63677054emr1178416lff.36.1686081325083; Tue, 06 Jun 2023 12:55:25 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , Oleksii Kurochko , Bob Eshleman , Alistair Francis , Connor Davis Subject: [PATCH v1 8/8] xen/riscv: move extern of cpu0_boot_stack to header Date: Tue, 6 Jun 2023 22:55:16 +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: 1686081363623100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Oleksii Kurochko --- 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 3b04131628..fc3afa5521 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 b50641a80e..56d3bbb422 100644 --- a/xen/arch/riscv/mm.c +++ b/xen/arch/riscv/mm.c @@ -19,8 +19,6 @@ struct mmu_desc { pte_t *pgtbl_base; }; =20 -extern unsigned char cpu0_boot_stack[STACK_SIZE]; - static unsigned long phys_offset; =20 #define LOAD_TO_LINK(addr) ((unsigned long)(addr) - phys_offset) --=20 2.40.1