Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp417308pxb; Wed, 24 Feb 2021 05:51:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJxnVsc9zZFRLnfbuWBR8Yo7p4lxbNQqWiS4S0AfM89eEUzc2fbXw0/RgmENMowH+1wCora3 X-Received: by 2002:a17:906:30da:: with SMTP id b26mr30730848ejb.376.1614174710747; Wed, 24 Feb 2021 05:51:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614174710; cv=none; d=google.com; s=arc-20160816; b=An+ZKm05mO2ic/wLLeMNyYBR4qGMrEq/l28gV4GIUGBOt9FyXrS/kTMTzTb4m2WWl/ Hjtn7q4mHphelBVyCZdmmloczjMHPvSFeZSUPj+6bGEVhW1CkHqQn1DHOiN67rR7NjoH IGYhi36Nmi0PYLwNj2w9kByEexm/kQPu4HQvKKAFw0wA59lgTY/64AjHYLeDb8Mzs/ke gIUEZ0Z4Jcm8ixeQTTnyKE13ZbcI55l+bglgyUyE7lOfXF35w008+KmFdOjFZKdw89PT pEPAuo14tzHi9G20MRmk6xB5ITaLCnby7InBUjmgUrmmhKdEvj+zGQ+H/ZD4NWpN9lQ+ AcgQ== 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=vvmvUIcFH9n9qBbvkeiYcvE+QeiNBkDkFlXrSOGJ3gw=; b=Wl5A3aiHBKY6Xym+fBR1AhhDWhSUDrALhL7ZSidc0ZKpQcB8wzMrvZA1W/hXaZO6bv gIqSQlqMCoWokeFYxGjV/YQ5uh7n3+eDROzsqthBP+6DogW69I+5nHLieWTKPDWUe9Z+ t5tnrqp/aYLb2PMWFxjnMbSH4LmCU07RTVqb09O6nb75WAKEu6gVlVbcdPDm1sIZ29Yc 3+vbyT+EDvOXJAd713idNaQHNRJ3kG2BNMDdGv60I1A8RrQfGWohODcAEP8lkf8eELRc D8twmIkrHVBdzbyz7alj2HTTZ3fzumJoa9h/yaebUx3xMXBOus1wrqy2kBfKDJydFS4z R4jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aO9UyDjv; 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 hp6si1469593ejc.532.2021.02.24.05.51.04; Wed, 24 Feb 2021 05:51:50 -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=aO9UyDjv; 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 S237738AbhBXNmp (ORCPT + 99 others); Wed, 24 Feb 2021 08:42:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:58440 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235711AbhBXNFC (ORCPT ); Wed, 24 Feb 2021 08:05:02 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4EA0164F0C; Wed, 24 Feb 2021 12:54:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614171245; bh=jPsq3J9/D2wOHozzocjy3q2zdqHC4KN9+rJAmaGqfog=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aO9UyDjvMfaxrFFr8BJL3qsZLXG0D6usVwyQuOmIaCS2nbILJkK/vFT2FQOkHAES0 5aPDVTB+G7FKhw3uGa4S0VyI/EF9PB/IfRSGurdI77HUCdHM0DiFKHvLhCkVPOmW5A W3vj1aeuyjaranITGe7Kj6u98KcQXy+IpDSJU5+N/THcoywvz/R1kXSgYVxFCrUghP VaJrMCD/i8OEdf47jVWMH9Rdv1+RPlvtiu6t+fz8UFSDiSGDsJAa+HmNdDVZYKeHio azLKlzwn9DTbxeslpWEPBwvggexnpNUgHrF3mmjKWHALekcn3gBlxyhwurHfbPd/de 227gv9JdpjICQ== 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 5.4 18/40] PCI: Add a REBAR size quirk for Sapphire RX 5600 XT Pulse Date: Wed, 24 Feb 2021 07:53:18 -0500 Message-Id: <20210224125340.483162-18-sashal@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224125340.483162-1-sashal@kernel.org> References: <20210224125340.483162-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 89dece8a41321..9add26438be50 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.27.0