From patchwork Fri Mar 29 07:18:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 13610356 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 2FA05CD128D for ; Fri, 29 Mar 2024 08:34:20 +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=2S6xCqhfO73zONc00PqVQ7Be/LubLP5EmAszLDNcG8M=; b=twn+fQmuACYBOu e4paCen9N7hxG31T8Nsih8hUruYEtTV+q34fFoMcNVC0G+gfPKfBvH3M675BiPiNSi8gWUKrQDuLk fZoUXnyd3wx1tez3VlaXYj3rygFtJwb8kAsLiEmqIsQM/ZxNb00OJXD3Vy90qtwiciajie598xRAx 7Bl4TbecROCgEph/3YrNeOuwoVlqSRwjRJH1UBsfMeecKzjHZpzqPAzxkggVJS3shpBOhq8Cv7JZJ dp+/79HXeCT2tp/HoI0uVmqUI+ye8Ec4LGZkHdRqOr3Cb4/x9ivAaSaxmq9FisF/r4rG+Rng4wmUD IM6INM3LpSlvVvagR0qw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rq7ge-0000000HKc7-3OTQ; Fri, 29 Mar 2024 08:34:08 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rq6bj-0000000H8e8-0m0W for linux-arm-kernel@bombadil.infradead.org; Fri, 29 Mar 2024 07:24:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=F18yE3QV4MW8RCzD1e25jw8k09/j20Bb+PnplrzhdA4=; b=WJe+UgjFUuiIToPVsZKBothm+7 MyqSy1d8Dcmsr4vA2fkZA4fNs/qKk6yyB+FsD9Cz+unZrmtKXwuMN0U/vsnADA7goAXVW5BHGzP0B cE8E47zW6hlBmG3XTsjLwbmhE5ugg/O8QsIXxKT7dBbWPs+pY5k+CMCh5aUJJeE56vIABDp/JHtKv SeI86YYJ6epX6bnrl/S4SSBnhqooNcL2WCZ8KcB85CpJOspIwIAzGT9o0ZJqjQ3AMwLJP2buFYZ4Z X7E2/tW9b4R8WjKy+z3KgzdMxWLDA7snKHSY8fnaVIKJ8Thwf/rpmKBVgD030Um5zSyUyH7IkdQBU Y4+19ZZQ==; Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rq6be-00000001QqO-195K for linux-arm-kernel@lists.infradead.org; Fri, 29 Mar 2024 07:24:57 +0000 Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-5d8b519e438so1258887a12.1 for ; Fri, 29 Mar 2024 00:24:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1711697092; x=1712301892; 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=F18yE3QV4MW8RCzD1e25jw8k09/j20Bb+PnplrzhdA4=; b=Cj0KXSlw+sd4e2g0lmtQtL12wgmcoGQFIpUtognY/FeJDsuevRfGodaiqSo7H5n3VG g9vh23pixD75i+mOybqGWu0TGAYxR81w5vHkb5ZE4rtu72Rf8zoXOKQmc1EMMfcpO7WJ zu3ijwSA+gLmlvqmc/R3lbolrxm+HvDT8zdcLeAZjrxz+xFiBUA7DMdX+x50psrp+L00 mKbvns+SGQErZ4IJj/ixp3KC1w8z9VDok1PYvyKzPCEiUZlmqicMmCz8T06zTVARyPig hPoItwLHivHFSFzqgX6CBFLILoWHVFg29NOmQDuHJKjlXRwdpP08J4BV/HzNICmDc7hM LADg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711697092; x=1712301892; 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=F18yE3QV4MW8RCzD1e25jw8k09/j20Bb+PnplrzhdA4=; b=vs6umnZ7eEQ9j4RNPmlvpVHsTUsSD0zv/FUn6vWevFrE59Pwshk4pRvSJqGJEcrVv2 2wk7+ooTj63GsEsgGVx1OFKNaQb1CT/oXpJ+FtHHWtx40U4xgqFwRJHoytStKypfKf1m IPKJkci4FaK3AEgvhEDc6MBNjAkO02Aitaxi8rk3hG3jHVCD1AfARVsRqcZ0uwMdziYS hYr4/akiQZsM44I4FIXZP+aDg6y6lQKeTzL8szEsp4D/WPUXNEY5V9REwnfka9KzwyKo NlfMw258FYJdPcRhTd/GvjebD/F+It+opD5INe/zZDifspp/rp84pqUFysOj0Nhfm3js e/fA== X-Forwarded-Encrypted: i=1; AJvYcCWBgXiCtBDBVJh7lE+uyPad5ioDtmwIlsOVykSXfnfoB/5uwQqOVe59xLHbQ8aeHEjj8iermq/nWsW6kf9from/qa9k+YpZEQpZ2dqoiC5wmMk9nAk= X-Gm-Message-State: AOJu0YzCBLufhz6w4s5zxMkqKTkz2h6FHq+dFz8vGaCl/ZA1yWi3UOZS BU/FjM7DteuIxsGi66chqpv3Xl7Wp8pA1Vr6ALB53Y3NMeO4+FNZvtpILrF/970= X-Google-Smtp-Source: AGHT+IFY/yzEzRZYFdEySbj/sKHZJd/DWAHR82okZCfCkYYQ9Rz+9YBmaRZXyDE1LpyvvN0Ey140hg== X-Received: by 2002:a17:90a:fe85:b0:29f:ea48:25dd with SMTP id co5-20020a17090afe8500b0029fea4825ddmr1492025pjb.33.1711697092415; Fri, 29 Mar 2024 00:24:52 -0700 (PDT) Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id b8-20020a17090a010800b0029ddac03effsm4971798pjb.11.2024.03.29.00.24.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 00:24:52 -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 v4 07/15] LoongArch: Implement ARCH_HAS_KERNEL_FPU_SUPPORT Date: Fri, 29 Mar 2024 00:18:22 -0700 Message-ID: <20240329072441.591471-8-samuel.holland@sifive.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240329072441.591471-1-samuel.holland@sifive.com> References: <20240329072441.591471-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-20240329_072454_504891_485DD739 X-CRM114-Status: GOOD ( 13.47 ) 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 --- (no changes since v3) 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);