From patchwork Thu Mar 2 13:23:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13157333 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7B700C6FA8E for ; Thu, 2 Mar 2023 13:23:45 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.504924.777399 (Exim 4.92) (envelope-from ) id 1pXiuC-0000jP-QO; Thu, 02 Mar 2023 13:23:32 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 504924.777399; Thu, 02 Mar 2023 13:23: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 1pXiuC-0000jI-Ng; Thu, 02 Mar 2023 13:23:32 +0000 Received: by outflank-mailman (input) for mailman id 504924; Thu, 02 Mar 2023 13:23:31 +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 1pXiuB-0008Qd-F8 for xen-devel@lists.xenproject.org; Thu, 02 Mar 2023 13:23:31 +0000 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [2a00:1450:4864:20::230]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 6c241d3d-b8fd-11ed-a550-8520e6686977; Thu, 02 Mar 2023 14:23:29 +0100 (CET) Received: by mail-lj1-x230.google.com with SMTP id j17so17539071ljq.11 for ; Thu, 02 Mar 2023 05:23: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 s8-20020a05651c048800b00290679ebac1sm2109551ljc.9.2023.03.02.05.23.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 05:23:29 -0800 (PST) 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: 6c241d3d-b8fd-11ed-a550-8520e6686977 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1677763409; 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=g8MaW6bU1cbVIh9lyUx2jnADjWazCTCDdecZrd3onsY=; b=N2oonot0HbSfj0KLZHIlG8/Ef4uXJfhbDIqmYh6UQhCqZFQfjlCq1+l8hsMV5gyb0T PqCrc3dHg7seaDgB5Kwz0diWaMzEy+F/tAOV03lZyR7cZpKRRAZmMXxn0x4Vo7n8EXmp JBeomU3BM9IOulJD6e5ncwg5OXQUJnOKWqAcJ5fUIBLabSZYF5/XJ/qfq0IEG7t77CHr ecfv07jzC5DGS7W+s6FhY5zzaXqH/S4YKtQnMpZhistDtbvdCxhrbEvVMLqrqoqJX1mH jrBh6J+FRXSFE+iwJlb+3OYV65Z2g8Ce1cjBsPAPJNSXhXrYYVgad4gM6XB0Rb3U2NZm 4sHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677763409; 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=g8MaW6bU1cbVIh9lyUx2jnADjWazCTCDdecZrd3onsY=; b=aBoCo2fM/PH43DvVeozQ6rr9TictXdoxXpMV/pS1pIhmIJWzaKy60AiLegcKgBZ+Qd zK2wdaCm5S+9IKOKKCKMowvoFYRKB3pjmXnW8Vr812fdzbu+czWitVacxl6fnyxjc9DH 5dGfJzkBJFPfwIda7AS838+MylmmTxto4/Sl4+tlq/pkWdRPbRug2KgTF8eir/Gty43X X3R116sZKwLx3DjE1LkhbOpx+rjLOikFY8HqutTeTuxvKaAGWDEn9GTEJvJP7i1XTqr/ I9SF82NFmlXGzkqaW9poJZVnZ0jUOzLImelRZ36G53OUx/0DRb1rqAkAFImt7BnJS7Je sGXQ== X-Gm-Message-State: AO0yUKU4NkIR4+6wE8BMCeOoSOfxzqLG2VciLFgYw+tDTmUaifBb3hYQ ctSMAMpl93l6njPZcbTiESbAO3YJTD4= X-Google-Smtp-Source: AK7set+Pl1tPpShibOMgKeLVaLNrRDdLBx4Hz7FkN7FO99uaWL2VCOe8CKd0uFc1W14fnXWEfXw0Zg== X-Received: by 2002:a05:651c:cb:b0:290:6d3b:79dd with SMTP id 11-20020a05651c00cb00b002906d3b79ddmr2945347ljr.20.1677763409433; Thu, 02 Mar 2023 05:23: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 v2 3/3] xen/riscv: disable fpu Date: Thu, 2 Mar 2023 15:23:20 +0200 Message-Id: X-Mailer: git-send-email 2.39.0 In-Reply-To: References: MIME-Version: 1.0 Disable FPU to detect illegal usage of floating point in kernel space. Signed-off-by: Oleksii Kurochko --- Changes since v1: * Rebase on top of two previous patches. --- xen/arch/riscv/setup.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index d9723fe1c0..23d60ed7f0 100644 --- a/xen/arch/riscv/setup.c +++ b/xen/arch/riscv/setup.c @@ -1,15 +1,23 @@ #include #include +#include #include /* Xen stack for bringing up the first CPU. */ unsigned char __initdata cpu0_boot_stack[STACK_SIZE] __aligned(STACK_SIZE); +static void __init disable_fpu(void) +{ + csr_write(CSR_SSTATUS, SSTATUS_FS); +} + void __init noreturn start_xen(unsigned long bootcpu_id, unsigned long dtb_base) { + disable_fpu(); + early_printk("Hello from C env\n"); early_printk("All set up\n");