Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5762160rdb; Wed, 13 Dec 2023 20:45:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IH7G9zCXx4hQKhPoyugUHwt3tCog8DZYXUbrNfkiAvtRyCB/zQxpoct1Pf5a9Xd+YeNNKsZ X-Received: by 2002:a05:6a20:7344:b0:18f:97c:b9f4 with SMTP id v4-20020a056a20734400b0018f097cb9f4mr5774981pzc.78.1702529151617; Wed, 13 Dec 2023 20:45:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702529151; cv=none; d=google.com; s=arc-20160816; b=VzVLs/D6w3jvt2Da8OHY8R4hwoXWI7G8O9ozZMF8u9K3XzHSv9MsjMfiVs0Hfg/Kpu Xzm4EznaWft+dfXoUMUWXIsMHbH4tQhnMpElFX6eYa9ylHmDvhF9ieuXXR4uc7i/2ifn vPsHb7Qtk68fo2dhC6GxvHe05vwgyIWtm90EhJET/vi12piMeJ9ynIsP2hG9wFgTlCIX akFRip1nMUdA4ITo/N7cv6935fR1tJZem+ipr8gXvAjGAM83FPwJyjoHNL2JEoEDx2Mf 5J+ym8WGZwPyHoqEOniRMHmtJBTL54zT0vmNzf2vT6pp9OGeYmhZ0HY5V3FKfpC8I/tN z0+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=t7B9if0LOImFnd/AnccoK9V4d+WmshLVNwjLPY+Ohl0=; fh=cOSYQt/BIJW0za6wLdAh97UdmJOhIDrQ0MURVW17mP4=; b=PcKMFtUokLYaPfH0bPckW5mA+2HWka4aYtwJPZzs8TLIXCbfSFcICJa40GmREYHYNx J7j6t8sDInbT+lftzizACWy0X6c1e99TfgfLdQYbVS3dwUwLUh3/xOfDedt1m5caoS+e O71qYkLGsFOZGRla81yS/0pR9quOIxLVHSXcqV3oP8kXd35dVA6etrR2Ee0CuIFzC9AT mkmAuUrhHusq14J9P1J3uAM+ZhpKAFrDqhj4l2EJLa9s9zErQm6Q6J0mqI+qhBAjegiB v9tOw49AWfpko/IxIl+uE9IhxPkczB6cnxZhlKq6pi18V1nyw1Bjnm1F4jE7Ci2xPJce fwUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=PHvb5rAy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id e5-20020a17090301c500b001b894687ec9si10316000plh.462.2023.12.13.20.45.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 20:45:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=PHvb5rAy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 0CA68802912C; Wed, 13 Dec 2023 20:45:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231375AbjLNEpU (ORCPT + 99 others); Wed, 13 Dec 2023 23:45:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230034AbjLNEpT (ORCPT ); Wed, 13 Dec 2023 23:45:19 -0500 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C773DB9; Wed, 13 Dec 2023 20:45:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1702529123; bh=t7B9if0LOImFnd/AnccoK9V4d+WmshLVNwjLPY+Ohl0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=PHvb5rAyITybLJhslCdr+FPB6weuYhVdwGVqwI6pjC0ArKwZkSJyMqDVTRdcLTEp8 CMM1zL432KtNyUzA4mhWgDTmzmIB20cDIEs1vpR4XVIlFKEuLTFGJUgQi2gSEUC13j mfFynirXmkKm9bE2EICqv9unlGx62DyfXiv5i2BtZBd3f6O85asjT6i+pBGfgfPjyp tkCdZSOpErcp/BMZpdsjN71xdXgGO4HsDEkHk/a+gxWH2FD87Y65cYU3IpDwO2jYA7 PzUo9wW0hAbsQZZzGnqcxC0mqh1VvcVv56nNl78AXywD3K6/8BH+V8bphra6maMQo3 RX1/dzF6mo1TA== Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4SrKXf0VB5z4wcH; Thu, 14 Dec 2023 15:45:21 +1100 (AEDT) From: Michael Ellerman To: Samuel Holland Cc: linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, linux-riscv@lists.infradead.org, Christoph Hellwig , Timothy Pearson Subject: Re: [RFC PATCH 10/12] drm/amd/display: Use ARCH_HAS_KERNEL_FPU_SUPPORT In-Reply-To: <7ed20fcf-8a9d-40d5-b913-b5d2da443cd6@sifive.com> References: <20231208055501.2916202-1-samuel.holland@sifive.com> <20231208055501.2916202-11-samuel.holland@sifive.com> <87h6kpdj20.fsf@mail.lhotse> <7ed20fcf-8a9d-40d5-b913-b5d2da443cd6@sifive.com> Date: Thu, 14 Dec 2023 15:45:21 +1100 Message-ID: <87bkatxuhq.fsf@mail.lhotse> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 13 Dec 2023 20:45:49 -0800 (PST) Samuel Holland writes: > On 2023-12-11 6:23 AM, Michael Ellerman wrote: >> Hi Samuel, >> >> Thanks for trying to clean all this up. >> >> One problem below. >> >> Samuel Holland writes: >>> Now that all previously-supported architectures select >>> ARCH_HAS_KERNEL_FPU_SUPPORT, this code can depend on that symbol instead >>> of the existing list of architectures. It can also take advantage of the >>> common kernel-mode FPU API and method of adjusting CFLAGS. >>> >>> Signed-off-by: Samuel Holland >> ... >>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c >>> index 4ae4720535a5..b64f917174ca 100644 >>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c >>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c >>> @@ -87,20 +78,9 @@ void dc_fpu_begin(const char *function_name, const int line) >>> WARN_ON_ONCE(!in_task()); >>> preempt_disable(); >>> depth = __this_cpu_inc_return(fpu_recursion_depth); >>> - >>> if (depth == 1) { >>> -#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH) >>> + BUG_ON(!kernel_fpu_available()); >>> kernel_fpu_begin(); >>> -#elif defined(CONFIG_PPC64) >>> - if (cpu_has_feature(CPU_FTR_VSX_COMP)) >>> - enable_kernel_vsx(); >>> - else if (cpu_has_feature(CPU_FTR_ALTIVEC_COMP)) >>> - enable_kernel_altivec(); >> >> Note altivec. >> >>> - else if (!cpu_has_feature(CPU_FTR_FPU_UNAVAILABLE)) >>> - enable_kernel_fp(); >>> -#elif defined(CONFIG_ARM64) >>> - kernel_neon_begin(); >>> -#endif >>> } >>> >>> TRACE_DCN_FPU(true, function_name, line, depth); >>> diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile >>> index ea7d60f9a9b4..5aad0f572ba3 100644 >>> --- a/drivers/gpu/drm/amd/display/dc/dml/Makefile >>> +++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile >>> @@ -25,40 +25,8 @@ >>> # It provides the general basic services required by other DAL >>> # subcomponents. >>> >>> -ifdef CONFIG_X86 >>> -dml_ccflags-$(CONFIG_CC_IS_GCC) := -mhard-float >>> -dml_ccflags := $(dml_ccflags-y) -msse >>> -endif >>> - >>> -ifdef CONFIG_PPC64 >>> -dml_ccflags := -mhard-float -maltivec >>> -endif >> >> And altivec is enabled in the flags there. >> >> That doesn't match your implementation for powerpc in patch 7, which >> only deals with float. >> >> I suspect the AMD driver actually doesn't need altivec enabled, but I >> don't know that for sure. It compiles without it, but I don't have a GPU >> to actually test. I've added Timothy on Cc who added the support for >> powerpc to the driver originally, hopefully he has a test system. > > I tested this series on a POWER9 system with an AMD Radeon RX 6400 GPU (which > requires this FPU code to initialize), and got functioning graphics output. Awesome. >> Anyway if that's true that it doesn't need altivec we should probably do >> a lead-up patch that drops altivec from the AMD driver explicitly, eg. >> as below. > > That makes sense to me. Do you want to provide your Signed-off-by so I can send > this patch with your authorship? Yeah that'd be great. Patch below. Feel free to adjust the commit message as you see fit. cheers From c8a2862d2ebe76a023eceb3267fd85262925c0ba Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Thu, 14 Dec 2023 15:39:05 +1100 Subject: [PATCH] drm/amd/display: Only use hard-float, not altivec on powerpc The compiler flags enable altivec, but that is not required, hard-float is sufficient for the code to build and function. Drop altivec from the compiler flags and adjust the enable/disable code to only enable FPU use. Signed-off-by: Michael Ellerman --- drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c | 12 ++---------- drivers/gpu/drm/amd/display/dc/dml/Makefile | 2 +- drivers/gpu/drm/amd/display/dc/dml2/Makefile | 2 +- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c index 4ae4720535a5..0de16796466b 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c @@ -92,11 +92,7 @@ void dc_fpu_begin(const char *function_name, const int line) #if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH) kernel_fpu_begin(); #elif defined(CONFIG_PPC64) - if (cpu_has_feature(CPU_FTR_VSX_COMP)) - enable_kernel_vsx(); - else if (cpu_has_feature(CPU_FTR_ALTIVEC_COMP)) - enable_kernel_altivec(); - else if (!cpu_has_feature(CPU_FTR_FPU_UNAVAILABLE)) + if (!cpu_has_feature(CPU_FTR_FPU_UNAVAILABLE)) enable_kernel_fp(); #elif defined(CONFIG_ARM64) kernel_neon_begin(); @@ -125,11 +121,7 @@ void dc_fpu_end(const char *function_name, const int line) #if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH) kernel_fpu_end(); #elif defined(CONFIG_PPC64) - if (cpu_has_feature(CPU_FTR_VSX_COMP)) - disable_kernel_vsx(); - else if (cpu_has_feature(CPU_FTR_ALTIVEC_COMP)) - disable_kernel_altivec(); - else if (!cpu_has_feature(CPU_FTR_FPU_UNAVAILABLE)) + if (!cpu_has_feature(CPU_FTR_FPU_UNAVAILABLE)) disable_kernel_fp(); #elif defined(CONFIG_ARM64) kernel_neon_end(); diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile index 6042a5a6a44f..554c39024a40 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/Makefile +++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile @@ -31,7 +31,7 @@ dml_ccflags := $(dml_ccflags-y) -msse endif ifdef CONFIG_PPC64 -dml_ccflags := -mhard-float -maltivec +dml_ccflags := -mhard-float endif ifdef CONFIG_ARM64 diff --git a/drivers/gpu/drm/amd/display/dc/dml2/Makefile b/drivers/gpu/drm/amd/display/dc/dml2/Makefile index acff3449b8d7..7b51364084b5 100644 --- a/drivers/gpu/drm/amd/display/dc/dml2/Makefile +++ b/drivers/gpu/drm/amd/display/dc/dml2/Makefile @@ -30,7 +30,7 @@ dml2_ccflags := $(dml2_ccflags-y) -msse endif ifdef CONFIG_PPC64 -dml2_ccflags := -mhard-float -maltivec +dml2_ccflags := -mhard-float endif ifdef CONFIG_ARM64 -- 2.43.0