From patchwork Thu Nov 25 12:45:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12693650 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 99BB5C433F5 for ; Thu, 25 Nov 2021 12:48:59 +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=iYLA6xZeaEID1yNpklE9zhLlYV5X9XXdvvkDqqQgoo8=; b=j2JkIUB3kIUehy Od2l/zd1MP+d0WSqIFq7lYjzjNGedQ3YvARlBc8MGC9unfdVTpZ5Am10FJFcDamDQ0bCxoE6tw1WZ uUcOE5d7iDdn8XoxPdGPAVoU7zxb5HGp3n4v4v8L4eDTQ9PqHlAE5X1kxSmM3LiUoHEUcMOtcxYQ7 u0s90vlU7NGnHAe7vNlHt5LEs6tShV5jZgJ4bdW/b7HC2dnF5LRujWySAwWqWEIz6ek1cDpLQgi51 RYOTtrLPuUpxAIKYcnYkmmelVW+7E+dPbhSrGD9l3qDOTbILtgMHEEYhpWfTkPhEAAyFN8NIh4/aI NyHVbAWuDwzgk6DPAQPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mqE9a-007SzL-KY; Thu, 25 Nov 2021 12:47:06 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mqE94-007SnZ-Cy for linux-arm-kernel@lists.infradead.org; Thu, 25 Nov 2021 12:46:37 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 632F9610F8; Thu, 25 Nov 2021 12:46:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637844393; bh=CFRpIIvV+dRawyP1HEAT1CWwpAzBUW1TAumtSAX1zdE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PPR7zYq10qu2cCGOR1Su7Z7FMC7TwAqk3pyARxezKNxK3nDejX3oj3OJVfu8QG2dd jtonb2lywy0K2v0aTMKnkrgwmzOOPVFXGaFTTcEiu4dkeuLP36ojWnOr1fcR5lHS3H +iH/qJF5T//9r5r0eod1KccMscu/jmqzSqvO7Te2CVLVDCCHNf7rfi0tZeGImv8+SD twfoldtaNiVR3vOmivZ/qgiIxmLxMsKGwWqiYoBCiUD/bFtfJugL2m8OXXuO5faxnF W4WpTDG0mo6V3C1LECIKoSJUBprj5f95H3Z+oHUDiuupZywnGiB8bZ2FQ5MVI8mobG H7x6B0DboyCIQ== Received: by pali.im (Postfix) id 21E8EFB1; Thu, 25 Nov 2021 13:46:33 +0100 (CET) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Thomas Petazzoni , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas , =?utf-8?q?Marek_Beh=C3=BAn?= Cc: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/15] PCI: mvebu: Check that PCI bridge specified in DT has function number zero Date: Thu, 25 Nov 2021 13:45:53 +0100 Message-Id: <20211125124605.25915-4-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211125124605.25915-1-pali@kernel.org> References: <20211125124605.25915-1-pali@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211125_044634_504676_6EF56E58 X-CRM114-Status: GOOD ( 10.72 ) 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 Driver cannot handle PCI bridges at non-zero function address. So add appropriate check. Currently all in-tree kernel DTS files set PCI bridge function to zero. Signed-off-by: Pali Rohár Cc: stable@vger.kernel.org --- drivers/pci/controller/pci-mvebu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c index 6197f7e7c317..08274132cdfb 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -864,6 +864,11 @@ static int mvebu_pcie_parse_port(struct mvebu_pcie *pcie, port->devfn = of_pci_get_devfn(child); if (port->devfn < 0) goto skip; + if (PCI_FUNC(port->devfn) != 0) { + dev_err(dev, "%s: invalid function number, must be zero\n", + port->name); + goto skip; + } ret = mvebu_get_tgt_attr(dev->of_node, port->devfn, IORESOURCE_MEM, &port->mem_target, &port->mem_attr);