Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp480665pxx; Wed, 28 Oct 2020 09:17:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOsBIqCljNIj1jmC5VPNtjV9cZ368RK9i2E9qBLcLHYB2Vc4AtU0CMv8OKeNw1Cx5gxWdX X-Received: by 2002:a17:906:d0cc:: with SMTP id bq12mr2743559ejb.127.1603901820832; Wed, 28 Oct 2020 09:17:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603901820; cv=none; d=google.com; s=arc-20160816; b=WzXZeZMyedXzEi3cm0Aw/JGSdrEZ/WYoMmtWRUevBJjur2BsU0Wh5PkUBnxUWrLs6x Tt7QHQUtWSqF24Vm/3ChB0fZvhMIfLIvlpN43KP2YegJiQrTpoF7xGosjMlRj3ngtJuz d2fBny9OGg1q/lkhWu7RzT1QN82vb0FM82Md2gwxrEUiARzB6QzvWx2NHPVn4mEJ7FQV EYClzREDovevw888xlhi3JzmygEHFgM3rVRUaxlraqt6GuRzIqCjJPslr8fLlPxQZbpU Igrfhtgf2wOE9/cGAPhk09YuA6Pq/aY74m0QjOgGQaw32mU8wlnogdI0HKccf1kmYoHw ZEEw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Hmsu5+hHFFkv+r5t/gVlxeTTo/fNX4Hx8fsEJGOSL/U=; b=syePGyPu0NbuJS2JdDPBRnKQFF/1CJf59hgWnTZwg13cwRPveHSMAR2EPbYi3saHkH unyijQY+lpStf1gReH5HJdpVaZ1I6WW7grO7tpwq/xRDwfriQ5CEpfPLaEKDqDA8M9lO LJTMipSwrX71nIYz8a5cnXc0PmfNk4PAd9naGhdR+XeKLof2uOF/F/6t2lTfGnrvKTJs clQdEVk4RR8DfLyvEcWZZcBceXfvef3HNRTU7AOkg5FWesBeNpDaFVA/KzB19AnfeOGF 4icvTAdqy7iIBqGGTxhex0uJNej4BdebE+uCJOBVt1IPYiMG9StbAcM/uWTozFwQ7PpU F0rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="dyVT9iY/"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r8si4207577edw.268.2020.10.28.09.16.39; Wed, 28 Oct 2020 09:17:00 -0700 (PDT) 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=default header.b="dyVT9iY/"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1815558AbgJ0RDN (ORCPT + 99 others); Tue, 27 Oct 2020 13:03:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:42392 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1793641AbgJ0PHf (ORCPT ); Tue, 27 Oct 2020 11:07:35 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2E6CA20657; Tue, 27 Oct 2020 15:07:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811254; bh=y8bsv20wAs4Uk38UdpAxJPZ65OGYVZhayoDglNn7Bbw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dyVT9iY/5nxZ7v0bPivt854T0s7ta63BIE/d7HpzcMDUZcyUhi+29ktRv9om49CEM oJSDWalSX98jbHtbSzvuiesuTcHfi9x5BE6FJT+onrHXGllyyi050ZEmuTDGSyJmZK v0UswFId6By8WkcmB5n4/iujgCxg5OHsMcl71u0A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hou Zhiqiang , Lorenzo Pieralisi , Rob Herring , Sasha Levin Subject: [PATCH 5.8 429/633] PCI: designware-ep: Fix the Header Type check Date: Tue, 27 Oct 2020 14:52:52 +0100 Message-Id: <20201027135542.847798241@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hou Zhiqiang [ Upstream commit 16270a92355722e387e9ca19627c5a4d7bae1354 ] The current check will result in the multiple function device fails to initialize. So fix the check by masking out the multiple function bit. Link: https://lore.kernel.org/r/20200818092746.24366-1-Zhiqiang.Hou@nxp.com Fixes: 0b24134f7888 ("PCI: dwc: Add validation that PCIe core is set to correct mode") Signed-off-by: Hou Zhiqiang Signed-off-by: Lorenzo Pieralisi Reviewed-by: Rob Herring Signed-off-by: Sasha Levin --- drivers/pci/controller/dwc/pcie-designware-ep.c | 3 ++- include/uapi/linux/pci_regs.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c index 5e5b8821bed8c..ce1c00ea5fdca 100644 --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -505,7 +505,8 @@ int dw_pcie_ep_init_complete(struct dw_pcie_ep *ep) u32 reg; int i; - hdr_type = dw_pcie_readb_dbi(pci, PCI_HEADER_TYPE); + hdr_type = dw_pcie_readb_dbi(pci, PCI_HEADER_TYPE) & + PCI_HEADER_TYPE_MASK; if (hdr_type != PCI_HEADER_TYPE_NORMAL) { dev_err(pci->dev, "PCIe controller is not set to EP mode (hdr_type:0x%x)!\n", diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h index f9701410d3b52..57a222014cd20 100644 --- a/include/uapi/linux/pci_regs.h +++ b/include/uapi/linux/pci_regs.h @@ -76,6 +76,7 @@ #define PCI_CACHE_LINE_SIZE 0x0c /* 8 bits */ #define PCI_LATENCY_TIMER 0x0d /* 8 bits */ #define PCI_HEADER_TYPE 0x0e /* 8 bits */ +#define PCI_HEADER_TYPE_MASK 0x7f #define PCI_HEADER_TYPE_NORMAL 0 #define PCI_HEADER_TYPE_BRIDGE 1 #define PCI_HEADER_TYPE_CARDBUS 2 -- 2.25.1