Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp659759pxv; Thu, 15 Jul 2021 12:44:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYA6uFGIeRK4LyleA+EKHnd55rcxPrlG2I4YEK1zu3ggfprgkAIEwPN/2PBzhWjuwkYYAm X-Received: by 2002:aa7:c689:: with SMTP id n9mr9362146edq.151.1626378295289; Thu, 15 Jul 2021 12:44:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626378295; cv=none; d=google.com; s=arc-20160816; b=mnrr8EYrlrPMOM/44L5VtQbOrvG/gZJysFNC+DKTo3b2jrD9dKs26iNeBmd93vvC+r lR+Fkevs3OFwZhSChxBKUH9LjFTR2l+O+d+scdNvRC1EvFyszde2chpUDNPON1yNFM+a fwCu1tEoiBga11gIzH+/Zv0qkfDFfJdDxQ0ISL7uVrVxfZl2/51LcffA5YNHGrGG+cEt BZ06IDIqdCpTkBH2yyRSfQi9x+Qw/soaSUgsAzaXnRXSIEDCyU4x/moQENFx2HX+SILB RSy+8TbnD2rWiaJMqHhsdJgZV8WLLxFHgzOpiMUddqJKvmHk52ixGShcAzvVGk7rHwNj mmzQ== 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=RziNBciyK+/T9XV4W1lZfDs5/n5x7QyZ3tHwW/GiTqc=; b=WMky2Z1uAiW6sM31+K5lNNwT5xt264ohU6US6UUl0jPuIESsLWsyVyMEVFtznCofae kUdZkh8cspGBu5M87QyveGbc9NqgXr0VGSBH5YqSP9yIvh0fepl8FxwaYuh9qAks0N2r fZnyGf+TTmNL2Ja/mnQueOJj8XR3y5ZkVpdlc9cXLogQZYxwgehGtmHis5ZuWibyw3XB ffSG7oqewZ3mIqkN4svZ3IobsVZqDNNL8z6RnLcZAonEv/MUJu9a5yDIemGIv1tsOftB 9PYkTkmAVlbJAYNN4bUD3qxra+6DlR4bonOE0KEKNuSR+n0e5HMPE+5WKgsf+eqEXTuK Azag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="bHHv/kRs"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s20si8358121ejb.555.2021.07.15.12.44.32; Thu, 15 Jul 2021 12:44:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="bHHv/kRs"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1344056AbhGOTnf (ORCPT + 99 others); Thu, 15 Jul 2021 15:43:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:51040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244588AbhGOTO6 (ORCPT ); Thu, 15 Jul 2021 15:14:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 84CEB61404; Thu, 15 Jul 2021 19:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626376246; bh=TfcyZbHDtm0negA0mJ3ob4L1Yy1Cygyt+vDwe+UK9HI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bHHv/kRsvf7bqDJ4uLDc9hNk7V6GMFTQu3yIunCuW2Qos1Bpe5CE7Muu1IU0zTF4X oMHieZw3/YK955VQfwf31dnV64elWq2ZVBR5fHKC9PTnP329zyRrnC49DOY1WpESM9 VrHEQdamhu6RduP/1T0CdZWD59x/fjjm2plqAaR0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Evan Quan , Lijo Lazar , Alex Deucher Subject: [PATCH 5.13 189/266] drm/amdgpu: fix the hang caused by PCIe link width switch Date: Thu, 15 Jul 2021 20:39:04 +0200 Message-Id: <20210715182644.422456016@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182613.933608881@linuxfoundation.org> References: <20210715182613.933608881@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Evan Quan commit adcf949e664a8b04df2fb8aa916892e58561653c upstream. SMU had set all the necessary fields for a link width switch but the width switch wasn't occurring because the link was idle in the L1 state. Setting LC_L1_RECONFIG_EN=0x1 will allow width switches to also be initiated while in L1 instead of waiting until the link is back in L0. Signed-off-by: Evan Quan Reviewed-by: Lijo Lazar Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h | 1 + drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c | 13 +++++++++++++ drivers/gpu/drm/amd/amdgpu/nv.c | 3 +++ 3 files changed, 17 insertions(+) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h @@ -94,6 +94,7 @@ struct amdgpu_nbio_funcs { bool enable); void (*program_aspm)(struct amdgpu_device *adev); void (*apply_lc_spc_mode_wa)(struct amdgpu_device *adev); + void (*apply_l1_link_width_reconfig_wa)(struct amdgpu_device *adev); }; struct amdgpu_nbio { --- a/drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c +++ b/drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c @@ -490,6 +490,18 @@ static void nbio_v2_3_apply_lc_spc_mode_ } } +static void nbio_v2_3_apply_l1_link_width_reconfig_wa(struct amdgpu_device *adev) +{ + uint32_t reg_data = 0; + + if (adev->asic_type != CHIP_NAVI10) + return; + + reg_data = RREG32_PCIE(smnPCIE_LC_LINK_WIDTH_CNTL); + reg_data |= PCIE_LC_LINK_WIDTH_CNTL__LC_L1_RECONFIG_EN_MASK; + WREG32_PCIE(smnPCIE_LC_LINK_WIDTH_CNTL, reg_data); +} + const struct amdgpu_nbio_funcs nbio_v2_3_funcs = { .get_hdp_flush_req_offset = nbio_v2_3_get_hdp_flush_req_offset, .get_hdp_flush_done_offset = nbio_v2_3_get_hdp_flush_done_offset, @@ -512,4 +524,5 @@ const struct amdgpu_nbio_funcs nbio_v2_3 .enable_aspm = nbio_v2_3_enable_aspm, .program_aspm = nbio_v2_3_program_aspm, .apply_lc_spc_mode_wa = nbio_v2_3_apply_lc_spc_mode_wa, + .apply_l1_link_width_reconfig_wa = nbio_v2_3_apply_l1_link_width_reconfig_wa, }; --- a/drivers/gpu/drm/amd/amdgpu/nv.c +++ b/drivers/gpu/drm/amd/amdgpu/nv.c @@ -1197,6 +1197,9 @@ static int nv_common_hw_init(void *handl if (adev->nbio.funcs->apply_lc_spc_mode_wa) adev->nbio.funcs->apply_lc_spc_mode_wa(adev); + if (adev->nbio.funcs->apply_l1_link_width_reconfig_wa) + adev->nbio.funcs->apply_l1_link_width_reconfig_wa(adev); + /* enable pcie gen2/3 link */ nv_pcie_gen3_enable(adev); /* enable aspm */