From nobody Sun Apr 28 14:41:39 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=1677839087; cv=none; d=zohomail.com; s=zohoarc; b=W0cD7cxNwCFgXMYZyLWoyyIbODVgP6y6ldjg/gP9LD++guLO3YkbK3fvzD7768pieBvbYnMUQvbOLfR0arTC4JrOu/qRhnhULvjbJWLK4BLZ9DrzThALmY0yOOnYosgW0STuZx/YIYinySjboLI3Crmsd9Ng3/JbnQuBO0q4SHg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677839087; 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=8hWSEJWaX2x45VFZiclMK6V02iZ6pYreDLKtpiIaFEE=; b=IEj46Zv42AGZRmu5x3NRirdgQka4TjrsWsT922bdIzNqGM1KapZWu0jbaAWgK5sruVHWvMyjECjJb79D49yLvr/ZcKHZ55zCZibjrpMvhKiu+DVtLfKJ3F+lsBJ6zbSx/wSSlr3nnEw8ypVAeZgSPW9EUxfA5gj8L7E/6M1zJ7Y= 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 1677839087631328.8751997327121; Fri, 3 Mar 2023 02:24:47 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.505761.778691 (Exim 4.92) (envelope-from ) id 1pY2aW-00008v-HY; Fri, 03 Mar 2023 10:24:32 +0000 Received: by outflank-mailman (output) from mailman id 505761.778691; Fri, 03 Mar 2023 10:24:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pY2aW-00008k-ES; Fri, 03 Mar 2023 10:24:32 +0000 Received: by outflank-mailman (input) for mailman id 505761; Fri, 03 Mar 2023 10:24:30 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pY2aU-0008Jc-Sb for xen-devel@lists.xenproject.org; Fri, 03 Mar 2023 10:24:30 +0000 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [2a00:1450:4864:20::230]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 956307ef-b9ad-11ed-96af-2f268f93b82a; Fri, 03 Mar 2023 11:24:30 +0100 (CET) Received: by mail-lj1-x230.google.com with SMTP id x6so1842866ljq.1 for ; Fri, 03 Mar 2023 02:24:30 -0800 (PST) Received: from fedora.. (46.204.108.203.nat.umts.dynamic.t-mobile.pl. [46.204.108.203]) by smtp.gmail.com with ESMTPSA id j22-20020a2e3c16000000b00295a36fedadsm239600lja.26.2023.03.03.02.24.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 02:24:29 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 956307ef-b9ad-11ed-96af-2f268f93b82a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1677839070; 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=8hWSEJWaX2x45VFZiclMK6V02iZ6pYreDLKtpiIaFEE=; b=DJtBoNyFaPY6Y8DyhtlVv5Wexjw/KD5WP54xvy0rew+0Oxi6sVywT5imDVMCpnloRX zoowAylmc66Gb98GPvMCD6Z2Qxe/8XHxjg0EPWm018AEAZUiTlWyZ1eM3yA7f4TFearY NN+xDvuwLp4wZ16va9WQL8US2kURVt0Ma+k0ngP/GhnXJB4Ic9n6yQGX15+VtpDgWahP IU9sR3X0UdWLPGvmnW4aHao3jZuMgZL8j6MrBwiRv6rE92Bq5/kqb0mgXj/Cui6UGXV5 Alunl4NBfJoKypEcR/iTmBWutJgveWV7Lzq9Lfhr+lcgzUSGPKClscrLkx8tIRR5GAqD /aGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677839070; 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=8hWSEJWaX2x45VFZiclMK6V02iZ6pYreDLKtpiIaFEE=; b=XWHcNWxVth0sigScG0SbyiyVWfzkbanD1jDDwnyCKRgrUQmElUm0iCnRzYYuQvNUGH oCTD4PKGwXd0wO5tO07FQS01FVLiVbiwX80UufwrpaA2xa9P1cxsbp2CeKQnBDXm9yR2 ofalv+nhvSvEXkjXtbGs5zo0btYnBrAzCzEeUOz/j/U6YLkF5wV8ciqBLU6dTv+Bszij 2M37qBvo2vrde+HnTGRpWya6eEpJ6QmG6w0iS7aW5nnYIeYZT8Hgbx4XPQLquOTC24I/ 6vEBhEAVGrgQJy1QoJ0NUkIjYB6AJzA6a5KAyJffmGc4d0eSb1hkBNOaN3z8wC39QxWY dnsw== X-Gm-Message-State: AO0yUKX198+ku05Fz79FxfvsY+SWVlNUGMtvObWBnmmQ2+/tqQYeY4z6 KdN4ovqWMIcNoiSStWgan/Nl6IXecXM= X-Google-Smtp-Source: AK7set+fSh/GHl42poB+55Nk4PbUJa0DzugZ3Cmcz6LJpvrxYddqCr8zJzQZJ8SFWUCOW9Qp+TgwCw== X-Received: by 2002:a05:651c:2110:b0:293:38e0:cac8 with SMTP id a16-20020a05651c211000b0029338e0cac8mr588442ljq.16.1677839069820; Fri, 03 Mar 2023 02:24:29 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , Stefano Stabellini , Gianluca Guida , Oleksii Kurochko , Bob Eshleman , Alistair Francis , Connor Davis Subject: [PATCH v3 1/3] xen/riscv: disable fpu Date: Fri, 3 Mar 2023 12:24:22 +0200 Message-Id: <1fe0c827b9e5c2fef569e25ad7ca377111228d29.1677838213.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1677839088033100001 Content-Type: text/plain; charset="utf-8" Disable FPU to detect illegal usage of floating point in kernel space. Signed-off-by: Oleksii Kurochko Acked-by: Andrew Cooper Acked-by: Bobby Eshleman Reviewed-by: Bobby Eshleman --- xen/arch/riscv/riscv64/head.S | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S index ffd95f9f89..52fa41c778 100644 --- a/xen/arch/riscv/riscv64/head.S +++ b/xen/arch/riscv/riscv64/head.S @@ -6,6 +6,13 @@ ENTRY(start) /* Mask all interrupts */ csrw CSR_SIE, zero =20 + /* + * Disable FPU to detect illegal usage of + * floating point in kernel space + */ + li t0, SSTATUS_FS + csrc CSR_SSTATUS, t0 + la sp, cpu0_boot_stack li t0, STACK_SIZE add sp, sp, t0 --=20 2.39.0 From nobody Sun Apr 28 14:41:39 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=1677839083; cv=none; d=zohomail.com; s=zohoarc; b=Hx5dZGbAcWQIKlDkH8C9D7ylK6ebfVQ1Gk2mEwK36VoXeiGL4xepkdvs1oZ4PUcNof42TL+AJfj1SoF4Ue0oPOjWbFZm7gBFIlaeX+A4kOBRFdR2l6XeIdT8WIQcTE4kI7Xj5+04OzT0rkWXOPIL/B44SqMfwi4wxaoFQLY6DeQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677839083; 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=RUJgy0TiNB7fw4SRdJCyFwL3kkJhzok7rx37wlxII5E=; b=e44V19uZVc33BqCEmMP7tG9Jk7R2pyGYqbCjdL/HcZYz/fuc5MgbQJV0vmXR3F8M2sS8wP/zEhOtHBcoiX0/U4RNXdlOZSMFLwNGfbNs2rgG2r2jX/RM4PXu+BnmoL8b7dK07bhHVaZPu0yKDkHjJGvMqAe9w+5C7NFIJX3YGgI= 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 1677839083645207.82401733952838; Fri, 3 Mar 2023 02:24:43 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.505762.778701 (Exim 4.92) (envelope-from ) id 1pY2aX-0000QF-RS; Fri, 03 Mar 2023 10:24:33 +0000 Received: by outflank-mailman (output) from mailman id 505762.778701; Fri, 03 Mar 2023 10:24:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pY2aX-0000Py-Nb; Fri, 03 Mar 2023 10:24:33 +0000 Received: by outflank-mailman (input) for mailman id 505762; Fri, 03 Mar 2023 10:24:33 +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 1pY2aX-0000IE-8F for xen-devel@lists.xenproject.org; Fri, 03 Mar 2023 10:24:33 +0000 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [2a00:1450:4864:20::229]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 95de3337-b9ad-11ed-a550-8520e6686977; Fri, 03 Mar 2023 11:24:31 +0100 (CET) Received: by mail-lj1-x229.google.com with SMTP id b13so1815322ljf.6 for ; Fri, 03 Mar 2023 02:24:31 -0800 (PST) Received: from fedora.. (46.204.108.203.nat.umts.dynamic.t-mobile.pl. [46.204.108.203]) by smtp.gmail.com with ESMTPSA id j22-20020a2e3c16000000b00295a36fedadsm239600lja.26.2023.03.03.02.24.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 02:24:30 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 95de3337-b9ad-11ed-a550-8520e6686977 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1677839071; 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=RUJgy0TiNB7fw4SRdJCyFwL3kkJhzok7rx37wlxII5E=; b=Z0EUPm7wBqkCsAtpRLL7Ekpyyg5vrju7Ivbas+9/sWfmVC013VgMlzo8nJjvMS/yqR iMSooWRajFkmvyFXKWe92/uFKKbmwxF/xg05MqX+yB2eMI8lNhP1IRBGtGFq+UJl/m4k QXSD07rFttuj12x1ATEEfHk5GWfthcDFzVhHUaWupqWybhiGMWb8+IX5yicYHgFUXCwg fVlRNSa0XpRpym+0wgrKHk2/kUIyVxqjcVv4hJTcHBhs5oEJ0Pl35Y1/6rYaj8iiKqNw 3W6w8LQqvycR8AqXqjz1G5oUgQULtq1zUi40xKZjFT7XEBaeQzuyKckQsHxFvcKeb0pV 1LPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677839071; 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=RUJgy0TiNB7fw4SRdJCyFwL3kkJhzok7rx37wlxII5E=; b=t3No4xwzCHxnY4tshCxfLEoY+Xp9eBXlg9s9r9xy5tyWFRiUzzuYUrT71Z7xP1JIXH UjT+i7tp8T+hZqjvWo8Va+xX2akkwrq5qg1zE26S+TKHjTqsvlPj5LYTpdzP9+gID3fu 50Yaa29xJCNn74rjrOIdJ2NAsMLeuqIpWmasYV870LG5TiqFiqc1IOaAeXIMitxFCZ/o 7l7kTlCBhh1cPQYcN+dc5FqKF2NwU+7j4l08KU0pcqMTF5A6vyw/VWw4+s4s0cx8Mhu9 TIATmpQOBatobeWoy4OEQpioI3+BAmKFikVHPsBBMNQHqHl5t5MJ50AMxO3oGYCnOwZm pKVQ== X-Gm-Message-State: AO0yUKWD0um18NJVcWv81Yb0L7OnU8QOgqTZazHyAxllODi9g+XCbmdW QZF28BQwE/VN5pWBd78l8GT0HwUuGIU= X-Google-Smtp-Source: AK7set88QvL0fF8KY169jbRRQKhif+7BiovH1rOpcaAUUcyL3qvrh8FQ1y+VfhVr6ao3aZkAkQsdNw== X-Received: by 2002:a2e:b051:0:b0:295:9d9c:24aa with SMTP id d17-20020a2eb051000000b002959d9c24aamr452589ljl.11.1677839070926; Fri, 03 Mar 2023 02:24:30 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , Stefano Stabellini , Gianluca Guida , Oleksii Kurochko , Bob Eshleman , Alistair Francis , Connor Davis Subject: [PATCH v3 2/3] xen/riscv: read/save hart_id and dtb_base passed by bootloader Date: Fri, 3 Mar 2023 12:24:23 +0200 Message-Id: <43aaa58fac47029b7d11f1d80d310786d7a078a6.1677838213.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1677839084038100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Oleksii Kurochko Reviewed-by: Andrew Cooper , although it Reviewed-by: Bobby Eshleman --- Changes since v2: * Add the comment for start() function with the explanation what and how OpenSBI pass to start() function. * Clean up start() code related to read&save hart_id & dtb_base. =20 --- Changes since v1: * read/save/pass of hart_id and dtb_base passed by a bootloader were moved to head.S.=20 * Update start_xen() to recieve hard_id & dtb_base --- xen/arch/riscv/riscv64/head.S | 5 +++++ xen/arch/riscv/setup.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S index 52fa41c778..adf5d6c74a 100644 --- a/xen/arch/riscv/riscv64/head.S +++ b/xen/arch/riscv/riscv64/head.S @@ -2,6 +2,11 @@ =20 .section .text.header, "ax", %progbits =20 + /* + * OpenSBI pass to start(): + * a0 -> hart_id ( bootcpu_id ) + * a1 -> dtb_base=20 + */ ENTRY(start) /* Mask all interrupts */ csrw CSR_SIE, zero diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index 1c87899e8e..d9723fe1c0 100644 --- a/xen/arch/riscv/setup.c +++ b/xen/arch/riscv/setup.c @@ -7,7 +7,8 @@ unsigned char __initdata cpu0_boot_stack[STACK_SIZE] __aligned(STACK_SIZE); =20 -void __init noreturn start_xen(void) +void __init noreturn start_xen(unsigned long bootcpu_id, + unsigned long dtb_base) { early_printk("Hello from C env\n"); =20 --=20 2.39.0 From nobody Sun Apr 28 14:41:39 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=1677839093; cv=none; d=zohomail.com; s=zohoarc; b=SvRmQ8egTXGKEp+MORPl2z1KEgLPi9oyIdcsE8bs3TpXC4Xhseo+v8CFRvQllxExgt95TS8pUL5xIsCL7sj9CcVlUIAUg3W0Hyp4+lIv61tI7VWlEMPXZ+eKcvInfHldqf1kPAum7vARK7IEh7BC9pfR8HrHN96KGYPBEAK/2qM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677839093; 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=UQMX7LcJmPbPR7mQNYR7UFrgssX/7qk0j9FHn0813I0=; b=eUw6Cf051e65n532w6jB6NXDDfE0ocJJcifPza07evU93euuZv6pRuFEJsSS6PTzZssPmU28WqAmd+ImLsdaplyE8tDsW2mWBg5bAUxPFIP3lfHz/xdaBpiXLFSR7dBpa5rktX7azjNmerw+J8fxDn6aP9YyuMgsG/no6colgQM= 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 1677839093294747.0172975100348; Fri, 3 Mar 2023 02:24:53 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.505763.778711 (Exim 4.92) (envelope-from ) id 1pY2aZ-0000h5-3b; Fri, 03 Mar 2023 10:24:35 +0000 Received: by outflank-mailman (output) from mailman id 505763.778711; Fri, 03 Mar 2023 10:24:35 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pY2aZ-0000gl-02; Fri, 03 Mar 2023 10:24:35 +0000 Received: by outflank-mailman (input) for mailman id 505763; Fri, 03 Mar 2023 10:24:34 +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 1pY2aY-0000IE-4A for xen-devel@lists.xenproject.org; Fri, 03 Mar 2023 10:24:34 +0000 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [2a00:1450:4864:20::22e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 969a1106-b9ad-11ed-a550-8520e6686977; Fri, 03 Mar 2023 11:24:32 +0100 (CET) Received: by mail-lj1-x22e.google.com with SMTP id h9so1835599ljq.2 for ; Fri, 03 Mar 2023 02:24:32 -0800 (PST) Received: from fedora.. (46.204.108.203.nat.umts.dynamic.t-mobile.pl. [46.204.108.203]) by smtp.gmail.com with ESMTPSA id j22-20020a2e3c16000000b00295a36fedadsm239600lja.26.2023.03.03.02.24.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 02:24:31 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 969a1106-b9ad-11ed-a550-8520e6686977 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1677839072; 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=UQMX7LcJmPbPR7mQNYR7UFrgssX/7qk0j9FHn0813I0=; b=EGZSPfb1qxBJ8gSajlUU26oC52NZvWutZSTIuKkylFl5aDMVqaxG2V7xo8amflWTNh grUC6q9Qd9QzTLGPewN4l8tWRkGnjgi3gi7Al44XLxrIcBHpeQ6hAyuGYI9DXG+awqSn Ea0lyaH18gC+PHbLqEY6IywAnE5pqetDU5sWbRdlxFYh5ke4HUsbDA8aweBzbwLIGVLB Ix3iyNGyu6lGxL8yJC0w/gig7vwVByLonKuFUyZ1pZFiRnWCSEwO+eN3lWxHoIBIlccW Hsp6RTnJBJXugZZsonrX0cpF9Ki5zsnzqbUzud34r9qvSzMYjpbA6AID0GDm0fjB1wVf V2wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677839072; 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=UQMX7LcJmPbPR7mQNYR7UFrgssX/7qk0j9FHn0813I0=; b=LkG4y2ds3xsDiXnxlJaqlFlFHMKflnS3xSquVKu68BOBlt4Uwxi+4O5ybKxhfJHiOA sNSUUnhH4zdSkzz9RNLLRrqWmqTVao0W5YHVSGZnfXn5JJAUYDpddR2ymQl0ZiT/s9wB 3vc6bh9uaHM3XeosssU4hsCJIfooO2rNs754vYi5q672kLrijNQMKPNWWpqUziSW92hQ B3u6I2sFOEnnghCmLw9WOnC9L3ZhqDaRIGpLOp8ja36Z6P+Hct9FSOzIiX9Ddn8LzKD7 d5yJCvSA/pX9QyX3VK194X1rheF6Ijc4WLNI2vdWeuGWJO8QIEp1JIDIrCJPiS2/sfVc ZzzQ== X-Gm-Message-State: AO0yUKW4C4UOUqOkSfDi8lgFIOtf9KkOmNCD1b+T+5eWzGXSKziBZ5R+ NBBTv8tvIjGB3Bn9ubXIvkGN1MbSV5E= X-Google-Smtp-Source: AK7set+q2kWlmMtFb/0gUj+GDQ7jyqmb93rbVx/KMuCSDOgzUyYIe7riMnOTcJ6H9ZQtPDODt9rKMg== X-Received: by 2002:a05:651c:221f:b0:293:4e43:c276 with SMTP id y31-20020a05651c221f00b002934e43c276mr541225ljq.22.1677839072032; Fri, 03 Mar 2023 02:24:32 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , Stefano Stabellini , Gianluca Guida , Oleksii Kurochko , Bob Eshleman , Alistair Francis , Connor Davis Subject: [PATCH v3 3/3] xen/riscv: initialize .bss section Date: Fri, 3 Mar 2023 12:24:24 +0200 Message-Id: <16fb328e06f6b99d967fa7d186a4c0aaa986050e.1677838213.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1677839094095100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Oleksii Kurochko Reviewed-by: Andrew Cooper Reviewed-by: Bobby Eshleman --- xen/arch/riscv/riscv64/head.S | 9 +++++++++ xen/arch/riscv/setup.c | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S index adf5d6c74a..8887f0cbd4 100644 --- a/xen/arch/riscv/riscv64/head.S +++ b/xen/arch/riscv/riscv64/head.S @@ -1,3 +1,4 @@ +#include #include =20 .section .text.header, "ax", %progbits @@ -18,6 +19,14 @@ ENTRY(start) li t0, SSTATUS_FS csrc CSR_SSTATUS, t0 =20 + /* Clear the BSS */ + la t3, __bss_start + la t4, __bss_end +.L_clear_bss: + REG_S zero, (t3) + add t3, t3, __SIZEOF_POINTER__ + bltu t3, t4, .L_clear_bss + la sp, cpu0_boot_stack li t0, STACK_SIZE add sp, sp, t0 diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index d9723fe1c0..929565720b 100644 --- a/xen/arch/riscv/setup.c +++ b/xen/arch/riscv/setup.c @@ -7,6 +7,14 @@ unsigned char __initdata cpu0_boot_stack[STACK_SIZE] __aligned(STACK_SIZE); =20 +/* =20 + * To be sure that .bss isn't zero. It will simplify code of + * .bss initialization. + * TODO: + * To be deleted when the first real .bss user appears + */ +int dummy_bss __attribute__((unused)); + void __init noreturn start_xen(unsigned long bootcpu_id, unsigned long dtb_base) { --=20 2.39.0