Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1981173pxb; Fri, 5 Mar 2021 04:42:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJx3JWfOmU+Apt84YGUqOsKfz2FdA+oMfaptoi61AkCnby/zBhigmrY1kH7ktZu1oxrvjWx+ X-Received: by 2002:a17:907:7249:: with SMTP id ds9mr2087179ejc.9.1614948152373; Fri, 05 Mar 2021 04:42:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614948152; cv=none; d=google.com; s=arc-20160816; b=mMrOpbEHfDFGQ20o0jNpccWQ9nbSyGHjp3AOLLDpRq6KwWgzksOOndPe5b/OSMq7SC U6Oy7ETTPMobjv1iGBOoiSnFgfablMpHajUb5vqKIADNWCMrpyRgIM1k3Svgkodlo7Xw gG+BSAnL22YwOoELajFTIQwBZUP7rs4+AsXdTfl3r7YbxTQGdAfI/ngIFxPqxswz7XVV 2Bd8KtAzqYyFDP8SZ/JPdNUKYArKkpiUxvnVIYH+2AmHKTFMRZJq7JTtD6R+T8sxxVnG xDDrhhOGCnCp5x4xb9wU6G4zqKhc6TwVtepetvQbZD/BXbocYuYYiwpm/DlXE4c1rzjg hJDA== 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=h/DaHk7JIn65HxrzKneIg0d1E+kS8KbPN6YUbd64W4U=; b=h4jCnlQ7WyBHoZdFIdtbqCMyZ6MfblgC0vwTo4hEzo+C+ZT1xH0/LZsKOJZ14YEzaY r8xA3UzpPAYCj4w0cY57MIiJQyw/9RtJQ/59kb1ar2NZkx4RNcvrLx55o8/9QX13b7K/ g9Ekswi+8P7R2A79OGOR3LedJomLndTuc4Spql7KJWqtxK6U/A8lZSLfmEiXNGztgyA1 1fvMSUO/BMtvm7FUaeI+sHpjFkzWlR8PRZo3J4gopffaC/YwJ/joCAOQT4NjWO0xJfmY kXJ5YNRtCvdx9dgdFL/BOMNoDdoLOlDhNPd7sTW13RDh7KjCyoM1kdArb0gXZ6etyxsP 5W4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LJcX1Pow; 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 z7si1168364eja.451.2021.03.05.04.42.09; Fri, 05 Mar 2021 04:42:32 -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=LJcX1Pow; 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 S233270AbhCEMjK (ORCPT + 99 others); Fri, 5 Mar 2021 07:39:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:52078 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233042AbhCEMia (ORCPT ); Fri, 5 Mar 2021 07:38:30 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A5C6465004; Fri, 5 Mar 2021 12:38:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614947910; bh=pOnXyIopRqSAaIIHCd2ZdSWwnUnSrpl281czLHeUJdw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LJcX1PowKyTLxasgS+VR/i0FQe+YEoGEUAB43HbG+EuPt8Sug/et915n9uRQfuqK1 ck+l1O7Zp2NLHc/vLkr98in6x5S8iMQe9RlCp/tl/VsMl4ZwQfghdwuV88LtXwLQfm a19YQA3A6T9ammKZ+4D8iwidhViVfeUL6Zs8/BXo= 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 4.19 32/52] PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse Date: Fri, 5 Mar 2021 13:22:03 +0100 Message-Id: <20210305120855.244517669@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210305120853.659441428@linuxfoundation.org> References: <20210305120853.659441428@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 cd628dd73719..83fda1987d1f 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -3361,7 +3361,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