Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5690153rdb; Wed, 13 Dec 2023 17:03:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IG4n6DKyx/VbdXLC1xcpez4ZVpNQs3em/sKCsHnwVF7+p/Zm8V+wPoWpmgzNr7a3T4Z06IA X-Received: by 2002:a05:6808:2225:b0:3b8:bb95:97ef with SMTP id bd37-20020a056808222500b003b8bb9597efmr10712574oib.48.1702515816268; Wed, 13 Dec 2023 17:03:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702515816; cv=none; d=google.com; s=arc-20160816; b=urlt3hpb/DciSi2/DGK5Qq9GXJUTuL8Un2cQq0DIiyYfN5/NpwZPv4rBeh7qSvpcaG X7iGqR/n+hJY5mp5PiJQoKSAgokOuX3iBuIQvsv3siZJP+XuvKf+xJguzMg0VK7ZXjJf U7R7mXkUxzfjBHq6qUUm/JETT3AkKwnNIE/1F/gryQd68ATM536jPOKZls6JUA+Bj1Zu L0svq9tM72owYJVgL81g/YGdOvNU+2vzUGZe/yDgQzqrga65e3/GMTAPpicEilZpSJE8 i+r7z9nDi2UspUzc3YqANRge9gzl+u38EqJw10UxDjQqjim/ZiOjEP7N35xyaHhnFj/V RFbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Kotqopmhql9RPm3S4FTj2FqpufLgCsxyuc5LZys4ifw=; fh=EIRicztEUp4M6bNZzRHEtGDAdI2fZnwP2VolfH0QrpM=; b=k+H3YfVuVtf7GPgi3uXnyQzbzy2XaVAwpIDxj0tUtQXPEtpaajZVuXx1CGYam3+GeL 7xbU7URIHbbamhzVsHIHF8O/oNW5ZOSasHbAJzAZkO/HccvoAgWV+eL8Qc5dTgL0qsGi DRPIwSdRoCipU8vjt4WfHtuMvzIny0zLszVeq8iXEs25RMLLqNxLpgfg6kuLNVfTzvju DLI/atQxQMRNuRK3pdXszrjxldaj6lIwDkztYKamy7aODAZIZsyo50iNrkydT94qLa2O 2bE+VPTbdYU5kx23NussDJaHDxouOUcRPrqKS3OsxERyOt0tP8XFcLHXgl3v/1ZofcSm Ecgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=luqCGhKQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id u7-20020a6540c7000000b005c658bf30aasi10378891pgp.412.2023.12.13.17.03.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 17:03:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=luqCGhKQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 418CE81C4A8D; Wed, 13 Dec 2023 17:03:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442919AbjLNBDS (ORCPT + 99 others); Wed, 13 Dec 2023 20:03:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229986AbjLNBDQ (ORCPT ); Wed, 13 Dec 2023 20:03:16 -0500 Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1DF7E0 for ; Wed, 13 Dec 2023 17:03:22 -0800 (PST) Received: by mail-qk1-x72a.google.com with SMTP id af79cd13be357-77f2f492a43so426231185a.2 for ; Wed, 13 Dec 2023 17:03:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1702515802; x=1703120602; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Kotqopmhql9RPm3S4FTj2FqpufLgCsxyuc5LZys4ifw=; b=luqCGhKQ+HP7bttcW5BLW+u5dk+GyIIWBl0ddK26FJ5ASe25ubZVhh2CbsNPQ351sd BoiQHVRT9Tc752acgKTKH+r7XksL2Mj7rCZRygP7dPCnACHCS8G8b/Qg7RLeJfOjATAr uF/HcQbao4P5ACi9/OpaaXIv56FzEfqnC5t00tx+wEhCkzQhSaxr+d9EbQNDrMk0vGP0 zY0hhe1aCmDEZPUfCkHSqHztn7oumkiiJSdRgXps66ygKaCYyK0svKWRpceyXUihGVEO cAhhpqbee4qU1bQTDjabLqAzys4/6CqQGcjjXQGpFe3skYZwoNnECpWbsvv1FH0zAWlw FQBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702515802; x=1703120602; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Kotqopmhql9RPm3S4FTj2FqpufLgCsxyuc5LZys4ifw=; b=QgerDb5eRqZrHtQR2o+iv6pAtmq3RzTJLkl7/y7tGA364yfpjdrM7yHPWt33eEGahE fN/oONVt6vpRx7gekSaznHir3sP0wc/IpdKg1dl0jHPLK5NigNTJ+sl65iIpZGkenFde P9lXDCkdQ8Z+tUyuMBnWybvv+70gy7ZjQ1SZ7JdUYtlxvupJ+8CSHd2TobogKRGvBxHg 0vJpLfCtzCnWRQIHKKO/hFQtIopRYZPp7eairbHk+vfFd6ukvGYSMCRIKFdu+uJujMLV qmc/BrMewtTN12ZMz/4gGI17wsGNzihfR8ehgdajT3T60fWBAkM54iNRxWYucTEICv41 kT3w== X-Gm-Message-State: AOJu0YyKq0K8xT7zK5fCPewxHosn18b21ZkTvGuZB2NJL17R6g0b94gs 6GpwY/1oYm+vgI349hTt8+pW6w== X-Received: by 2002:a05:620a:1034:b0:77f:2734:4c5d with SMTP id a20-20020a05620a103400b0077f27344c5dmr9834012qkk.130.1702515801849; Wed, 13 Dec 2023 17:03:21 -0800 (PST) Received: from ?IPV6:2600:1700:2000:b002:a1d1:dd74:a6de:fdf? ([2600:1700:2000:b002:a1d1:dd74:a6de:fdf]) by smtp.gmail.com with ESMTPSA id ul9-20020a05620a6d0900b0077f0d3bac3bsm4896980qkn.76.2023.12.13.17.03.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Dec 2023 17:03:21 -0800 (PST) Message-ID: <7ed20fcf-8a9d-40d5-b913-b5d2da443cd6@sifive.com> Date: Wed, 13 Dec 2023 19:03:20 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 10/12] drm/amd/display: Use ARCH_HAS_KERNEL_FPU_SUPPORT Content-Language: en-US To: Michael Ellerman 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 References: <20231208055501.2916202-1-samuel.holland@sifive.com> <20231208055501.2916202-11-samuel.holland@sifive.com> <87h6kpdj20.fsf@mail.lhotse> From: Samuel Holland In-Reply-To: <87h6kpdj20.fsf@mail.lhotse> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 pete.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 (pete.vger.email [0.0.0.0]); Wed, 13 Dec 2023 17:03:33 -0800 (PST) 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. > 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? Regards, Samuel > cheers > > > 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