From patchwork Wed Mar 13 10:58:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 13591244 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 B8F75C54791 for ; Wed, 13 Mar 2024 10:59:06 +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=H/i5u0m0SFqtr6 xSStA33IZXq/RhUmPHB5iV/ZpdL5fWn/XS33qGd7jNWyuAGj45b3NlH12kEeJZm4by87OnICn3jQz jgjGvGVHr1lrJAv5oNXnJ1ZwDmHiYYFS/tgH3k8VP1wTe2AFFxQYshli53m7MooftRHRzfKHC2VE1 x9uqgGQW7f7tKaDvUTqX3Dd/Thg2Y7KUwXRngQ+NQXaeYQ+DR9TU0Nff+Cg1CJRgfCrN46goQ1lrp HkKvtYF8Ks67IEPzEjTAAxnTjbYxE9Hkn/lTlXWW+2v4ONZ2mA5O4q9G1CA4CzFowSOKXOMzmBFix Bgp2f4ldM4JvSYjb7LPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkMJv-00000009lTT-1xCM; Wed, 13 Mar 2024 10:58:51 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkMJq-00000009lQL-1PcS; Wed, 13 Mar 2024 10:58:48 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id B02D0CE1AD6; Wed, 13 Mar 2024 10:58:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F2FBC433A6; Wed, 13 Mar 2024 10:58:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710327524; bh=fjgTQUcExh1iJN93AN1TOYbTttNnPvt1KtONXArKbVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NDE403aYJxTfmtcvNmGiBxyYVhAWw4vBrWslmk+SQgqAFAnpqWDh3JAjdAK4pi23x Ijzds15pTvw6eUlaFZiCqYCf/BeBaRgkG/5bM4ezJqh6H2xv2FDy2yUTMeiIOUMcGK d7u0V+OdeNzM9RiYy/t/cX+nEIe7UD1XZ4Q4dWZIKOeg1pXOerZOFcliE63+e/4Pyb uAh4Qf9fI8ZL24pZuzU+Qh0uf6ZipBG1DnPOs3Ib++1ptoVP4qD478v81MEmMZzvU/ +g4W/6YNby72nF11givw9j0rbW5OOxFQNEHN3dhTowmWF+ywGVyN66pBfM9eolWwQw 6nPRWMiksknSA== 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 v3 8/9] PCI: rockchip-ep: Set a 64-bit BAR if requested Date: Wed, 13 Mar 2024 11:58:00 +0100 Message-ID: <20240313105804.100168-9-cassel@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240313105804.100168-1-cassel@kernel.org> References: <20240313105804.100168-1-cassel@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240313_035846_609102_55055D1A X-CRM114-Status: GOOD ( 14.32 ) 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 Reviewed-by: Manivannan Sadhasivam --- 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;