From patchwork Tue Mar 12 10:51:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 13589842 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 432F1C54E66 for ; Tue, 12 Mar 2024 10:53:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6xB6Xgk+JtrmMAu+gRYYa5sDa9zeYJ7F6TB5yxFaQNA=; b=v1Q9uOz8KpFz1k BxcWbHptLMkmmKFXo9fGsLwXGG9qmDp2a11kQFv6Nf2+i+JtA5iFWw/jZsqgYIP9lUyf8WKPtXtM4 271DRWtBI/2iIDlANmXZLg2+KGv/Fl3XhZLpzOHhr2Ny/pVL9JXSTixeTYSK1RCv5YbW25aCtWh2o 2VQxk5OX8zI8+08B58HBCbV2173g7GZq3APu5V9F4B8T7uEQKd/pOzPQcgtQLv9JFoCCeEbQtyGYM ja7BkHsvqpP3t3dVll+sBaPUmMw3VtQ3k4KFl2jdaT5WA5js6Q/oEcNTNXbq7HtO0ooGZScAvi6pX 3UYfn4AqC395K6xcECBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rjzkb-00000005QcZ-0kKI; Tue, 12 Mar 2024 10:52:53 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rjzkY-00000005QZx-18Sh; Tue, 12 Mar 2024 10:52:51 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 4C24661180; Tue, 12 Mar 2024 10:52:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AC6CC43394; Tue, 12 Mar 2024 10:52:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710240769; bh=fjgTQUcExh1iJN93AN1TOYbTttNnPvt1KtONXArKbVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kAsP5egwKN40NjrnJhDP0W3+HObFATvnEt3jC0BzqO3W2sFcu0m3iLBnos5xWobu7 VCre9dtEf/uQYi9jIxNggTdfvpnyjsy+IFlp9nm0E5bU0eqtaqPVuOhECKstdRsFW0 ZOapTVEAoIa+9jAkHCmht5nRxudsygtbFRmYbCp9sGxMkliCzgGHj4lCGjn8qzjkeJ 0KNKjJ8/Cc+HMl3TAqJAc+04p7G13lys5nBmS1p6JLG0wax+bK4NpYyOHvhf9tZyFM icHK7xnI0DtglTFq5uoWJj/oNlyxPsJPHosNPwmEi1w5QiOACJSEcAZlnjanFmcDC6 z1h101eQCX8tw== From: Niklas Cassel To: Manivannan Sadhasivam , Shawn Lin , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Bjorn Helgaas , Heiko Stuebner Cc: Shradha Todi , Damien Le Moal , Niklas Cassel , linux-pci@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 8/9] PCI: rockchip-ep: Set a 64-bit BAR if requested Date: Tue, 12 Mar 2024 11:51:48 +0100 Message-ID: <20240312105152.3457899-9-cassel@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240312105152.3457899-1-cassel@kernel.org> References: <20240312105152.3457899-1-cassel@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240312_035250_384721_B66E6CCC X-CRM114-Status: GOOD ( 14.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Ever since commit f25b5fae29d4 ("PCI: endpoint: Setting a BAR size > 4 GB is invalid if 64-bit flag is not set") it has been impossible to get the .set_bar() callback with a BAR size > 4 GB, if the BAR was also not requested to be configured as a 64-bit BAR. It is however possible that an EPF driver configures a BAR as 64-bit, even if the requested size is < 4 GB. Respect the requested BAR configuration, just like how it is already repected with regards to the prefetchable bit. Signed-off-by: Niklas Cassel --- drivers/pci/controller/pcie-rockchip-ep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/pcie-rockchip-ep.c b/drivers/pci/controller/pcie-rockchip-ep.c index c9046e97a1d2..57472cf48997 100644 --- a/drivers/pci/controller/pcie-rockchip-ep.c +++ b/drivers/pci/controller/pcie-rockchip-ep.c @@ -153,7 +153,7 @@ static int rockchip_pcie_ep_set_bar(struct pci_epc *epc, u8 fn, u8 vfn, ctrl = ROCKCHIP_PCIE_CORE_BAR_CFG_CTRL_IO_32BITS; } else { bool is_prefetch = !!(flags & PCI_BASE_ADDRESS_MEM_PREFETCH); - bool is_64bits = sz > SZ_2G; + bool is_64bits = !!(flags & PCI_BASE_ADDRESS_MEM_TYPE_64); if (is_64bits && (bar & 1)) return -EINVAL;