Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3078546pxk; Mon, 7 Sep 2020 02:31:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGGC6gOm2zuiaXmutStLCJI5DZgqqo7oF4ytdsXl8GBL/wM2XW4usTH3osoG8TTM0YHHIU X-Received: by 2002:aa7:c148:: with SMTP id r8mr21433460edp.210.1599471060891; Mon, 07 Sep 2020 02:31:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599471060; cv=none; d=google.com; s=arc-20160816; b=Ge6WW7/oVGVKWnN1wQyDsBduRx0ynjPVpsQj9yfGP8FB7dTckwiDd7hSWV/a21UrrK 1iVVPG+C8DiVOJvy4CJaRm9Ngw89FAV2aNf/AREV7LOd3L6ws1GDFlptHlxgEHlIKLlT Ul9OA/6R6uTrEWGQHsY+cETuv3MXv57GheFu3SUFUe9pBN/uVQ3qPSMFrF7etZMxzIiF 06K2NGsvS/5jTUhs6FsaMsp1F2KLQTMoEcvY3ul+EamQcYV6N2I73vuWbJqEuUSxGJ36 Md/xCG8RbMr6elvUtMKPMGz+RIPaVzU8jjs32Ek44Uf38dtE3B+IHTXbb7r0loeoId4u i2uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=NMW798GtbxMhgUD9l9VCMBO9ljoudSqUuTeuWwmoTp4=; b=kNW6rxFGLV3paIOjYVMp4eN6bR9Rlq53l3xE/VU5T/ODLQi5sKsDJ4BKmhs6WDdBdV mlLKlmGVLD8/YUR1yAFCkMJGTcsvCGesAcvcBup9acLdnpIMCKo7c7vWQei4xYGHaPDB N5phAtA+J00FdUyb/zkd0e4Nu8n6/K44gyLnqbFpI41EdVFMtGhfuXB/woyZQswB3+rt jOY8zth//nnD1PCTtg0ABFl8Ibm2oHLWM6pFTQVd0ExUJUMhPUQWPt3BK/0s4CwGi3FW ri7iF4//VMm/MqOQZazJDKUhwBu/aPQM705vSoS6qRbqIfAaXulefi50YfxIjPDS9wlG r8hA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h12si9195377eji.301.2020.09.07.02.30.38; Mon, 07 Sep 2020 02:31: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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728374AbgIGJ2v (ORCPT + 99 others); Mon, 7 Sep 2020 05:28:51 -0400 Received: from foss.arm.com ([217.140.110.172]:58614 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728316AbgIGJ2q (ORCPT ); Mon, 7 Sep 2020 05:28:46 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3E62B30E; Mon, 7 Sep 2020 02:28:45 -0700 (PDT) Received: from e121166-lin.cambridge.arm.com (e121166-lin.cambridge.arm.com [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 24AE93F66E; Mon, 7 Sep 2020 02:28:44 -0700 (PDT) Date: Mon, 7 Sep 2020 10:28:41 +0100 From: Lorenzo Pieralisi To: Zhiqiang Hou Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, robh@kernel.org, bhelgaas@google.com, amurray@thegoodpenguin.co.uk, jingoohan1@gmail.com, gustavo.pimentel@synopsys.com Subject: Re: [PATCHv2] PCI: designware-ep: Fix the Header Type check Message-ID: <20200907092841.GB6428@e121166-lin.cambridge.arm.com> References: <20200818092746.24366-1-Zhiqiang.Hou@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200818092746.24366-1-Zhiqiang.Hou@nxp.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 18, 2020 at 05:27:46PM +0800, Zhiqiang Hou wrote: > From: Hou Zhiqiang > > The current check will result in the multiple function device > fails to initialize. So fix the check by masking out the > multiple function bit. > > Fixes: 0b24134f7888 ("PCI: dwc: Add validation that PCIe core is set to correct mode") > Signed-off-by: Hou Zhiqiang > --- > V2: > - Add marco PCI_HEADER_TYPE_MASK and print the masked value. > > drivers/pci/controller/dwc/pcie-designware-ep.c | 3 ++- > include/uapi/linux/pci_regs.h | 1 + > 2 files changed, 3 insertions(+), 1 deletion(-) Applied to pci/dwc, thanks. Lorenzo > diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c > index 4680a51c49c0..0634bd3a0b96 100644 > --- a/drivers/pci/controller/dwc/pcie-designware-ep.c > +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c > @@ -653,7 +653,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 f9701410d3b5..57a222014cd2 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.17.1 >