From patchwork Wed Mar 27 20:00:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 13607387 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 128CCC54E67 for ; Wed, 27 Mar 2024 20:03:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EfKkIPOYyWRhVgXvovof5WrIVmB/RVnppKXxu5Yoniw=; b=v1tmcLq+9NcOwX lVUCRpTPefQLUSeSdbOid0DneQ9L5xIcRCravLnZm742WCgH2m68oG2i3b7XOwWju7nXydXcSWTsM ynsrzGXG+bALlftLAxW+XamM0701slLWidpybbPQb6XeaFjmJgvYKNXCY8NtURdaWhfbNNwzdyCqV o4Ecz+crIWFS10PzXkQOPwyR2UDYSg9V1sWEY6aYYfen/MuHcs+rkjd8RPCDQ5bGj8EelFAJwnEKC sdOCQiBEZjjsCWWfBCfKI9K13NC27Vx4Gj385x+WciUpSTdlu3wU3ok9suV8NUI87ejY23Jvj6VG7 cJoxz/eUoW4LLS+QJMig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpZU4-0000000AuVF-2wLq; Wed, 27 Mar 2024 20:02:52 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpZTT-0000000Au62-2O4v for linux-arm-kernel@bombadil.infradead.org; Wed, 27 Mar 2024 20:02:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=CZE0ell9od5iMx/niXSnkXHAkP7o0Zji40W4vIuo5Ic=; b=Y0mTayhdUdwzp7TlvIjBfJ+WzZ yZCvdBd4iLy+hOH/a4K305W7wD2INRc2ZE3ZXMY2LFkp6EGCT9wEAJZdcri7hz5zaKLZ9CpJTet8o P8YDEdSxYeQBL/uGrrSKCs8UEYT3gKuJu/ittzWke4mOKjOI7ZXWJI4rml9ouR6s5WYbI0rjLsnom Q2/yyWWEQNXAfoqGD4/ZbvvVdTznXfJeEm+Gs6hS1nW2xywmaubXuvn7In49HIrenqQpfGhERAjK8 SYnTAIbdGHEhqP6+og/f5py25qwDUpGOM0NnSUA3GcWbS7L0O/21SUWpvP88j3h4gzPt9k/MJsbDn pZW0aGBA==; Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpZTQ-00000004dp0-1oPE for linux-arm-kernel@lists.infradead.org; Wed, 27 Mar 2024 20:02:14 +0000 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1e0000cdf99so2221215ad.0 for ; Wed, 27 Mar 2024 13:02:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1711569728; x=1712174528; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CZE0ell9od5iMx/niXSnkXHAkP7o0Zji40W4vIuo5Ic=; b=mkJJ0zMFHXHExZvekjH1i42sskThHkJ3vL+VGkbw6mdhRrKjgy74AvPCM338enDNRk MTCDzOnlxQtWVQWktqkx4GtlAF1/dh4j8hqCOQTqB8zall8YYO7eLByxDP3TRLxwbIM3 Jhy67pQsU40Y6ZC7mSLqvqaW4InyipEwQmBJwBsIaorcrbMeVbMeGFYH9InmfbSPY5wA zEiArvcXpGakHwPACrOp8wNj6Omx+8ZxMX9bGHGuPjUMngHDwzgdTncUxUSSwMZCuqqc a0LZLmHvFJkuatUyEm2umzCWCp6cUMXfGEnoH1DOZRgHrJ6rGl/TF63gB134kOOZBDWL KdZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711569728; x=1712174528; 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=CZE0ell9od5iMx/niXSnkXHAkP7o0Zji40W4vIuo5Ic=; b=Ro594JU5Xqde0eyY9Lqfi8TfsxCkGD1nLImTfEhErL6gQtVZZaLl/7BtGzGMKz4HHW r8R0dNBcWfMeWjYmXMr5107G4yYIo4HLbb80F5WKhMhhkTahudILqRQQ7RM6YA+5LVp9 bZ8MCyiEAjGqVl38JL3cW/HuRkdW+FucItfYqYs4dxsuWoAZG9k5k9H+PGgSaxcQDkBE tZwyVUsynytsxA49zySOFbHa750K/ayloaCQUiLIHUk2guCVpkUfOlqtyx5KTjcWG3WP my57b7h8UFgHG682ffjpRUYGIx6WMeLMv2R5LjALIYvondpT6cZB2iwcms2+w40ltwgX zevg== X-Forwarded-Encrypted: i=1; AJvYcCV9swqoWPKOG2vBOMo6P2jMGkXm47uiick77h1PJ1sZiANIW/qCrJ+wsNVF/JGN9VnooqYLdxjvhXTVrgsFT06gTa22f1sXp1NzPEMBvFku70zu36s= X-Gm-Message-State: AOJu0YyxxGYHJkVLIVIGzG4Y+RCLVve2eSVmwkkQ4JeU1BY2gEmi6Dwu wyEc9q+tKSz+baDjSXaXyvaKs3nT85pcLQq6gYESHVAmB8VQ533ZMx4rZmVtkhrGhn6sFXlrVQB 7 X-Google-Smtp-Source: AGHT+IGM9v2q1Bg0jHlsJFItc73WPBzqi9soPcoc57OB2ZggdclEbNRISa4ohk9keY4487ms+Vhuaw== X-Received: by 2002:a17:902:d4d0:b0:1de:fbc2:99f0 with SMTP id o16-20020a170902d4d000b001defbc299f0mr957547plg.2.1711569728307; Wed, 27 Mar 2024 13:02:08 -0700 (PDT) Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id u4-20020a170902e5c400b001dd0d0d26a4sm9446459plf.147.2024.03.27.13.02.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 13:02:07 -0700 (PDT) From: Samuel Holland To: Andrew Morton , linux-arm-kernel@lists.infradead.org, x86@kernel.org Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, Christoph Hellwig , loongarch@lists.linux.dev, amd-gfx@lists.freedesktop.org, Samuel Holland , WANG Xuerui , Huacai Chen Subject: [PATCH v3 07/14] LoongArch: Implement ARCH_HAS_KERNEL_FPU_SUPPORT Date: Wed, 27 Mar 2024 13:00:38 -0700 Message-ID: <20240327200157.1097089-8-samuel.holland@sifive.com> X-Mailer: git-send-email 2.43.1 In-Reply-To: <20240327200157.1097089-1-samuel.holland@sifive.com> References: <20240327200157.1097089-1-samuel.holland@sifive.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240327_200212_557924_2A487759 X-CRM114-Status: GOOD ( 12.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org LoongArch already provides kernel_fpu_begin() and kernel_fpu_end() in asm/fpu.h, so it only needs to add kernel_fpu_available() and export the CFLAGS adjustments. Acked-by: WANG Xuerui Reviewed-by: Christoph Hellwig Signed-off-by: Samuel Holland --- Changes in v3: - Rebase on v6.9-rc1 arch/loongarch/Kconfig | 1 + arch/loongarch/Makefile | 5 ++++- arch/loongarch/include/asm/fpu.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig index a5f300ec6f28..2266c6c41c38 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -18,6 +18,7 @@ config LOONGARCH select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_FORTIFY_SOURCE select ARCH_HAS_KCOV + select ARCH_HAS_KERNEL_FPU_SUPPORT if CPU_HAS_FPU select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE select ARCH_HAS_PTE_SPECIAL diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile index df6caf79537a..efb5440a43ec 100644 --- a/arch/loongarch/Makefile +++ b/arch/loongarch/Makefile @@ -26,6 +26,9 @@ endif 32bit-emul = elf32loongarch 64bit-emul = elf64loongarch +CC_FLAGS_FPU := -mfpu=64 +CC_FLAGS_NO_FPU := -msoft-float + ifdef CONFIG_UNWINDER_ORC orc_hash_h := arch/$(SRCARCH)/include/generated/asm/orc_hash.h orc_hash_sh := $(srctree)/scripts/orc_hash.sh @@ -59,7 +62,7 @@ ld-emul = $(64bit-emul) cflags-y += -mabi=lp64s endif -cflags-y += -pipe -msoft-float +cflags-y += -pipe $(CC_FLAGS_NO_FPU) LDFLAGS_vmlinux += -static -n -nostdlib # When the assembler supports explicit relocation hint, we must use it. diff --git a/arch/loongarch/include/asm/fpu.h b/arch/loongarch/include/asm/fpu.h index c2d8962fda00..3177674228f8 100644 --- a/arch/loongarch/include/asm/fpu.h +++ b/arch/loongarch/include/asm/fpu.h @@ -21,6 +21,7 @@ struct sigcontext; +#define kernel_fpu_available() cpu_has_fpu extern void kernel_fpu_begin(void); extern void kernel_fpu_end(void);