Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1978561pxb; Fri, 5 Mar 2021 04:38:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJyegbmgG1+82gZzQhIj+ymQps507sHGqRh16MJcj9+MMG2oTM7oLvgI3DaEoUZi2mGCGo6o X-Received: by 2002:a17:906:cf90:: with SMTP id um16mr2070682ejb.389.1614947906298; Fri, 05 Mar 2021 04:38:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614947906; cv=none; d=google.com; s=arc-20160816; b=bJGXMSE8oMQ1PY6t4KOf9JFVLGZPaKXsLTnQnlGHaW+uBFu89IS3saLNj9Nxw/s88S xsJ72ozfny9XiGWdOJagz6ljvdBssuUtJs5uDbPnusBhi43nSAGNwjTZmjHBmdkAWU+h lgJDg0WHnGrxgm1hcrCbLV3qq6W4j03nhfJ7Uxbhvsk4CKJrM8eRhf/rjg7aAq6yyeKz CcZxSC4/TViC+kFgVktoZYfdFJFlHEGlnNCnqh/88Kn4Em6lXzUQbqupDTrJs3U/dqnC d2izMZYCTYxIi8rc8cKVn1SNYJmiwh2QAdidYClTy1E8+zio7LqZq8Z4mKYCN6cDDNUi 8+jQ== 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=v/+m6cxmu6DYWZ4Bjvy+lVmA5mD0+HjLSWCXtNljhUw=; b=iXWh4DjWhf548DkxPV93qCc0OxEiiKczjpzTiukSFIDs8cDbQSg0XfGPpu1O/oH19f cjeZOGahQA01wlQZFcL6ZBKwYonx96uCWDWdIltxLhdNwoQRyjnOt2KJhl4cRIAu/A/y a/4QGAFZ2JToyLhF2C1l4epznJTi1ll9p3ybLOnq8AcP2ykarBIyrzCaWOogN976F0ga vdU33TSos3z09i9I4yv6RMZ9RSGQkUv/hqWocDEQgNGwWuM9isGw+S7DIUHmqLjE/6Hc YHSCcjOyODapAUJHNmAmnXLWuMmYKy7oGuQ5Y+1QV2aZ0Jmzb0A4jJjNtpEqkkenlAyQ Pz5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iPO4ZKoY; 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 by3si1391553edb.496.2021.03.05.04.38.03; Fri, 05 Mar 2021 04:38:26 -0800 (PST) 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=iPO4ZKoY; 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 S231820AbhCEMfJ (ORCPT + 99 others); Fri, 5 Mar 2021 07:35:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:46366 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232221AbhCEMei (ORCPT ); Fri, 5 Mar 2021 07:34:38 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7AC9065014; Fri, 5 Mar 2021 12:34:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614947678; bh=Cl+Kl2glq65QPMgZMPO+yyfr7XnvbsDnnNP90wzVJqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iPO4ZKoYeC2n2KipYt1CKiDmyDZStu6YZ4dJdmvEeX5nlxonT1XGWkG3d92IZX7wb yj4xa5BSN3DEl3HGt3q5oA/ALFnZPXlckmIaQn7HRoUdEqjV5DhxWDIDW7t5JuVofG YTw37HBz0Hs4wR9BaMyxg+h6YDWX8bO0g7Y3z6us= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Christian=20K=C3=B6nig?= , Nirmoy Das , Bjorn Helgaas , Sasha Levin Subject: [PATCH 5.4 44/72] PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse Date: Fri, 5 Mar 2021 13:21:46 +0100 Message-Id: <20210305120859.501084746@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210305120857.341630346@linuxfoundation.org> References: <20210305120857.341630346@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: Nirmoy Das [ Upstream commit 907830b0fc9e374d00f3c83de5e426157b482c01 ] RX 5600 XT Pulse advertises support for BAR 0 being 256MB, 512MB, or 1GB, but it also supports 2GB, 4GB, and 8GB. Add a rebar size quirk so that the BAR 0 is big enough to cover complete VARM. Signed-off-by: Christian König Signed-off-by: Nirmoy Das Acked-by: Bjorn Helgaas Link: https://patchwork.kernel.org/project/dri-devel/patch/20210107175017.15893-5-nirmoy.das@amd.com Signed-off-by: Sasha Levin --- drivers/pci/pci.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 89dece8a4132..9add26438be5 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -3471,7 +3471,14 @@ u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar) return 0; pci_read_config_dword(pdev, pos + PCI_REBAR_CAP, &cap); - return (cap & PCI_REBAR_CAP_SIZES) >> 4; + cap &= PCI_REBAR_CAP_SIZES; + + /* Sapphire RX 5600 XT Pulse has an invalid cap dword for BAR 0 */ + if (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x731f && + bar == 0 && cap == 0x7000) + cap = 0x3f000; + + return cap >> 4; } /** -- 2.30.1