From patchwork Thu Dec 28 01:41:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 13505554 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 BEA29C46CD2 for ; Thu, 28 Dec 2023 01:43:53 +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=DrtGTJikGL3LFNv6laSX2lK1rEIyLcfnlKOwgrHV2es=; b=sUHlT3rQI+VT46 ikJL00O5LcBiaMueC9U/G/ReyJlTVAZqDfQYSyYNPggfh8mk0zk8Jq5cEFdeRqef+D+pOHGUmRLq2 W0WcjAC02L9Lu4zSjDS3d7cOGk3kfzKYmf4pm4OHUK4TYQ2ZXpfik6fb2jX7IyE0Q/yfdK/RY/z8T 8HKhdOMhyHlfzhoPXxDQbd5hvmvD3Jn5OTWNDHgEz3q8LdPFH4UvW3Jk8MklPXvwyBqpWV4hxWso1 wlCstfX+E4LFfXWF/EcgladRB4betvyY9/0KoCeB+yiToofTx2jE9+8r0B3xMIcrjpjZLVBQSVSkJ GkmQjbDtlsHRRlbJ/5xw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rIfQq-00FsaK-33; Thu, 28 Dec 2023 01:43:32 +0000 Received: from mail-oi1-x22f.google.com ([2607:f8b0:4864:20::22f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rIfPs-00Frpj-2m for linux-arm-kernel@lists.infradead.org; Thu, 28 Dec 2023 01:42:39 +0000 Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-3bbce1202ebso337411b6e.2 for ; Wed, 27 Dec 2023 17:42:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1703727751; x=1704332551; 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=h+RheApEuJN9kaaLRvICyPNbTjOVIvY5kEzb7DbTZjA=; b=gYq0zGHBDiwWm+J5Ja7/TOhF7zN1DqO8hhpKANKzIMxAjehe4zdaMKJD7qWNjhnxHT qzDQMnoiye7lG/OhlHcaB2zdqwIDy91eel4ZxSKonAsxNUx0J/+EiG5rHghtYL/8tGqe dyNIkRS7l66fgaU92FJrkbJjQlj+CL9EOOCMpAGmSGFVny2vgSz/obcEZ4YJX29TDQN+ Q7kihQp0VX+akE/M4/j8kt4PM5MABOX1zgL8nCWAoArG5bmE16kdJxj02O86rLa6MUnK GVNZWfGum4J+mv1STRv2PZPVeDxE4gxwSe/BqBPJBejpwW+HlcSmpLRl9yRUEvwT4zVE L7wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703727751; x=1704332551; 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=h+RheApEuJN9kaaLRvICyPNbTjOVIvY5kEzb7DbTZjA=; b=MB//hTtsPF77L53+3mhg6+6VPMXgNzXS3kxx0/Jnpsn4X+mz4alGvRt4T3FUNzzjiA riu7zf0cPNB7Af9mtf2Q2dEw85IA+zr360CL7rFaLCdOZRO7YozPJydzuUWumbe66XvD DfGYtNrlqIazTgV35qutoPnIGvrNk2+jLA/KCyY0kRGvNbTm4kMnq7DEZOydLqcsdRYF oAY3x6rCSz6qcrZFPpN4M56bFZLSay7fRpdBCJlrTL3G4te7n0nmZI08+LsDz9+55wEq nkFznsFqh0lPkSV7TzydXn6iNTGZJgU+CwqWPnaFiaPIugypR105EvUnJRgTqwQR7VD5 GOsg== X-Gm-Message-State: AOJu0Yx9ftyBnA6Zv7lc6FdgZDIA8uFijHEimyFSOBapSFSVnu5vc47d LBbZ1v4Nq5WaXDEu9wySHIUk3LHHaK9P6gKUppjVd/uANZhf2jwBigebRKdnH3vOKV1CSXnL1Tl ZeK3l0uLPc2H6P2+fHWIjeZJy0h+MZHNzhJl50tpDO8ThvZJTnThHGkHJG0rPSTTCYpujKVUKi6 yzhdvWG7gLTPzKJmJbZohyohWo33bn3yXySA== X-Google-Smtp-Source: AGHT+IFlYg0OgNqHd1istrtt2UTcBedE87vqCIVNtp3f0Z5ptnzM2zYPRY9OCADmqV6QIO1pVX8ZnQ== X-Received: by 2002:a05:6808:6544:b0:3bb:b063:1afe with SMTP id fn4-20020a056808654400b003bbb0631afemr7698441oib.113.1703727751522; Wed, 27 Dec 2023 17:42:31 -0800 (PST) Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id g24-20020aa78758000000b006d49ed3effasm7335440pfo.63.2023.12.27.17.42.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Dec 2023 17:42:31 -0800 (PST) From: Samuel Holland To: linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, linux-riscv@lists.infradead.org, Christoph Hellwig Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, linux-arch@vger.kernel.org, Samuel Holland , WANG Xuerui Subject: [PATCH v2 07/14] LoongArch: Implement ARCH_HAS_KERNEL_FPU_SUPPORT Date: Wed, 27 Dec 2023 17:41:57 -0800 Message-ID: <20231228014220.3562640-8-samuel.holland@sifive.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231228014220.3562640-1-samuel.holland@sifive.com> References: <20231228014220.3562640-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-20231227_174232_908642_9F31CC55 X-CRM114-Status: GOOD ( 12.00 ) 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 v1) 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 ee123820a476..65d4475565b8 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -15,6 +15,7 @@ config LOONGARCH select ARCH_HAS_CPU_FINALIZE_INIT 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 4ba8d67ddb09..1afe28feaba5 100644 --- a/arch/loongarch/Makefile +++ b/arch/loongarch/Makefile @@ -25,6 +25,9 @@ endif 32bit-emul = elf32loongarch 64bit-emul = elf64loongarch +CC_FLAGS_FPU := -mfpu=64 +CC_FLAGS_NO_FPU := -msoft-float + ifdef CONFIG_DYNAMIC_FTRACE KBUILD_CPPFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY CC_FLAGS_FTRACE := -fpatchable-function-entry=2 @@ -46,7 +49,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);