Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp681659pxb; Tue, 5 Apr 2022 18:34:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzj4igG6hllIfGxR8WXZ3TpI1q2U8cJkvDKHLGlZDvZh0shJlBYZePTcz21q/PuYi1bHFuY X-Received: by 2002:a17:90b:1e04:b0:1ca:bc37:d132 with SMTP id pg4-20020a17090b1e0400b001cabc37d132mr7257876pjb.84.1649208852746; Tue, 05 Apr 2022 18:34:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649208852; cv=none; d=google.com; s=arc-20160816; b=0EqDYbFTs63xhkmkGC1m8DCGoz5QKiIj/0XVKI3Pu6IRJt0HHOh2gt8SY/e6+LLC5J h1CvgmcMFR9ngHMsVYnDENI2z4Q5XLVxx5CbRDwrs/uBV64R4SkYp9sxMG6ETIPa/33Y Uxfo/Las0qKy6Pn6ko9A8XehyM5oVwYVgdNG7ke5yJjv+EpJNFkHWA76jCKglFy+CPTX jgNSgFb3CBWOOwsCdND0ghaiNy6bgK1GfO6fk/jIMD1+EZQTgZJDRuAO2d0sdiIQjD2b /hib6jljq1tab16ieNHvauVVEypbfGZn6lF+OWYniusCkSn30gWjPTogHRVTqfby9yTm 7apw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JzCrum+cpSYl+saUuRIgz2ym86+DGBbz9/NGVKAdXiI=; b=MYsF/dGM/p/2iN0LbwocgD57qAWbtWO0pYHMhaLJiQyUQiKQ4Hf6m0vCFerTQAx/Sm ww9LnaGG9OqvbV2+Ea352tYwhN939VtW8LwV2WSTJ3Y4TtPQIQuu/AkwqTZ+Mu7ok5FV 9UrOYp0rwypGv7QvM9uq/FCMLBKgDC/4lT+fMyYsjsAye7/dG5TWVOMMLlAil+HRAW0j yMh/3haM+WGxVzz3dIB2ZoOFjpfAC1xAgthbqsndReqnIPDADUJ6Kjctn53dM7ShlrMh mbknjZLnDKKSAO67VTFRQgxiHxXBOshYaPGHqI9OqkUQsH0WG/0AtiPEZD10XBgmNqVt awrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Wtx2UWn6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e1-20020a631e01000000b003816ff8f842si14478332pge.415.2022.04.05.18.33.58; Tue, 05 Apr 2022 18:34:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Wtx2UWn6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348210AbiDEKqD (ORCPT + 99 others); Tue, 5 Apr 2022 06:46:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241517AbiDEIeF (ORCPT ); Tue, 5 Apr 2022 04:34:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B5F565BD; Tue, 5 Apr 2022 01:32:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0871DB81BB1; Tue, 5 Apr 2022 08:32:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50963C385A5; Tue, 5 Apr 2022 08:32:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649147522; bh=IUm2yfGBO7rEUNDX0xPbof/nJHCqzO3rRyRuqsdo2uU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wtx2UWn6ws7dlqhVxNerauz2IgCbBmmbHBJy29LLCPqlY9BsD2WayUmE6jNKCqdNm FlEalhetKMD4nOE0RuPoZ6OH4t4dB5p6MosW2UtgYMW51ofRvCDUgJDLMOEYeDmgW3 fND8Z0lMWRr8ZY13ombdgZ6IJZYlx1eMz/DZvp/o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Evan Quan , Alex Deucher , Mario Limonciello Subject: [PATCH 5.16 0026/1017] drm/amdgpu: move PX checking into amdgpu_device_ip_early_init Date: Tue, 5 Apr 2022 09:15:39 +0200 Message-Id: <20220405070354.953822658@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alex Deucher commit 901e2be20dc55079997ea1885ea77fc72e6826e7 upstream. We need to set the APU flag from IP discovery before we evaluate this code. Acked-by: Evan Quan Signed-off-by: Alex Deucher Signed-off-by: Mario Limonciello Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 13 +++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 11 ----------- 2 files changed, 13 insertions(+), 11 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -2070,6 +2071,8 @@ out: */ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev) { + struct drm_device *dev = adev_to_drm(adev); + struct pci_dev *parent; int i, r; amdgpu_device_enable_virtual_display(adev); @@ -2134,6 +2137,16 @@ static int amdgpu_device_ip_early_init(s break; } + if (amdgpu_has_atpx() && + (amdgpu_is_atpx_hybrid() || + amdgpu_has_atpx_dgpu_power_cntl()) && + ((adev->flags & AMD_IS_APU) == 0) && + !pci_is_thunderbolt_attached(to_pci_dev(dev->dev))) + adev->flags |= AMD_IS_PX; + + parent = pci_upstream_bridge(adev->pdev); + adev->has_pr3 = parent ? pci_pr3_present(parent) : false; + amdgpu_amdkfd_device_probe(adev); adev->pm.pp_feature = amdgpu_pp_feature_mask; --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c @@ -152,21 +152,10 @@ static void amdgpu_get_audio_func(struct int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) { struct drm_device *dev; - struct pci_dev *parent; int r, acpi_status; dev = adev_to_drm(adev); - if (amdgpu_has_atpx() && - (amdgpu_is_atpx_hybrid() || - amdgpu_has_atpx_dgpu_power_cntl()) && - ((flags & AMD_IS_APU) == 0) && - !pci_is_thunderbolt_attached(to_pci_dev(dev->dev))) - flags |= AMD_IS_PX; - - parent = pci_upstream_bridge(adev->pdev); - adev->has_pr3 = parent ? pci_pr3_present(parent) : false; - /* amdgpu_device_init should report only fatal error * like memory allocation failure or iomapping failure, * or memory manager initialization failure, it must