Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp438062pxb; Wed, 24 Feb 2021 06:18:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJx8bf7KFWjeRiDWPyWMbrzHnI/zUvMQn/KJLxfCldLymErkwaJdY9x1AWtKfY0S129p/Y2g X-Received: by 2002:a05:6402:1f3:: with SMTP id i19mr33246678edy.217.1614176314103; Wed, 24 Feb 2021 06:18:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614176314; cv=none; d=google.com; s=arc-20160816; b=FU2ND2fGWIcysQ0u7ixBoDxkcRQhzEx7BF2omLS1as4VkWzyXNigRWlDrXA+2uPiA4 N0Qgto6VIE/qPopaRotrmcSVFz8C/XO0rsy0Eam4BO9Wi6tjDbrqj5m+xoHu9byD+Auv /RFVecDDD2Xk712Vid/U6JP56eTWjvURGK6Gxb9qW57PT3y8BIgyWYYPwEzcTqD2TXl0 SQsxRuj41iqQJlE82Msf/p7FarLkhiOaWujepj7AkYsylZPBqMloZP3mC7rKqYxBkL93 gDBD3uyh3VWuZehSCYoy/G4UtgDowI+ykgJyB6t/LPAA/aGaE5lv+B6RCNhjxlDvww0y i17Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PACPkGlzCajYmS6ZX2bS2UoH1xJu+6STX1VbWWytOmY=; b=JF05CY+qjOKWdXYj+wLGp2izFX84a+QA+OBOmiJMNKIX523SVNNOENGH/raVS/VkYt XtW977kFBmDG92caaM6nsa7vcmYcnK/ubZq+DOmQSIfOA7FaCsMJ8EA4i2C1YALpfwOR gjn+3Gj9ToLubAkxJq7eUFC577L/qmc0M6jALovIiha50pwafhBReEhSuzWfJztkBOuD 5JQTJStCSZJbS7DzWsXnIM/kEa9LvpNj0vjZoe0udypO3eIzueW9ZsZzBdB+kRGgIKRN UGQ3ynzQEsvs5hIcd73A0sxOoijNc2Z8cQjfh6KX/IRbCD3GG9ZhQhr5OTlZ3+WD4Wdb sBxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nFX6TP2J; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g6si1327314ejo.534.2021.02.24.06.17.44; Wed, 24 Feb 2021 06:18:34 -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=@kernel.org header.s=k20201202 header.b=nFX6TP2J; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234878AbhBXOLs (ORCPT + 99 others); Wed, 24 Feb 2021 09:11:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:58432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233243AbhBXNIh (ORCPT ); Wed, 24 Feb 2021 08:08:37 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8647664F1C; Wed, 24 Feb 2021 12:54:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614171292; bh=da9ChTYSvCz4YEkN7VbziXyvJ7IFQdyS+vovBZvPfEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nFX6TP2JqHp6kxf6BZbxKc2bh8PADxdBbvnhl5dQrh8RL4lj6k8WEmYaT/qt9S6pE 4GHzYab0muhMHPtjTe/+ILbCTIdxl2b0bzPozdZIX/inmUEdHs1m3Wb1eg4AwejFIK 9BulfOt4r/IN74gbTvDXP3TlxdVyO0nTk2iauuf6uQWljpF7tk1Ao2Lcd5EFaOAVCP 9sbLdvW1+TJfqInYynjxkdNw1U0xf9rxjFrp9PJKBv+70Kww51Edf/tpYuKtiaMKQz Im9cs/Lr+jfrNWq4nu/caHx9PXCpva6u5EvsytEc+u4IBPvtrqAej9xDdxMtj3cHcT XciW/hHcSnJtw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nirmoy Das , =?UTF-8?q?Christian=20K=C3=B6nig?= , Bjorn Helgaas , Sasha Levin , linux-pci@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 13/26] PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse Date: Wed, 24 Feb 2021 07:54:21 -0500 Message-Id: <20210224125435.483539-13-sashal@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224125435.483539-1-sashal@kernel.org> References: <20210224125435.483539-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore 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 cd628dd73719b..83fda1987d1f9 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.27.0