Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp488792pxa; Fri, 14 Aug 2020 09:22:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5OXfGkOgKVZG15x5H35VmA3OR4OpS+f7Wv0M8mYT+Bb2WXHidIDSF1S9vZRVjLn253R+z X-Received: by 2002:a17:906:c7c8:: with SMTP id dc8mr2912364ejb.399.1597422132102; Fri, 14 Aug 2020 09:22:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597422132; cv=none; d=google.com; s=arc-20160816; b=AyNDX6RYCL13FTHiTbdJN1sxOga7OtfNPy1cueyNQdSsG2tF477RoT+umzSzphSzVt Zk1LkdbG8fIEt1lsEiPZJ/YZBttHUriwAlp1dHBIXPEn8a6j+WEu6yW5JcEqmNSA5qB5 xB107kd7XU+Ui5llwpKXFyao6LFcV0eAlWggyVoIxDZmZuNOYQc03heUkvSMDtKnAyWS PXFS3ddtLxbAByI7FIUD/aX5nC1GGeaNQiBWZPO3H1R6d+HRtR45ilAUNzGxPJTwWsNi dQvlgyAR+ss4SLjodOmS8ZyM+ImZ0LL//NVeex+WFXjaDeDgVUmuPWBoQgPyz/sSdgoN mZ1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=pXsioZl0guikPmZj90k4Y5+9JmirhzVleqO4PLPejfw=; b=KiUSRGLFlkPkfxXwtqynTV5Ck0Rha5Qdokq128iVYC9h5CNIJk8SzdzzqQsOwfLqhD ojgwudHiUmUsPsbRxaqiyXN9Uy+wiWAKmc0P+I+Al9g0rTvF4n8j1twpKYcvTXku1ifm d/oAx51f+KPFUM2abaVBF11DZxI4ZqIAVdVF6kL+ESIQjBTC7EhQcLxSbv6/uJyoErAZ qrvCO02EgVrAQUEW7yX6sFo9BG6ewiNsimhpplYQv8E/OYH3I8gjMe/L5PTbKYa3nHlo 8DTBDOf+K+2StMRHZfgNUF0Fi2OEyg79F01CUxCHSL5Pgpj2rx7GQxwnPG1Du5+6fP1o PNhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cGOiBQus; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x6si5273225ede.495.2020.08.14.09.21.48; Fri, 14 Aug 2020 09:22:12 -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=cGOiBQus; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727998AbgHNPvK (ORCPT + 99 others); Fri, 14 Aug 2020 11:51:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:41732 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726652AbgHNPvK (ORCPT ); Fri, 14 Aug 2020 11:51:10 -0400 Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 660DF2065C; Fri, 14 Aug 2020 15:51:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597420269; bh=Iz49/lPLFhH+6nCqxuxoI6YovUPNpCIHAW3SX/qxQYo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=cGOiBQusy6JKsx8U5w07zf2ZfdaFMUvpYbXzIIYMG3IJRHEab8cHamYLdPBckaowa A4SR37EgAMugOqf0GFkHpntz/eRLXhXFnt3NZ3hT0oGypmHuoDoRokcVVLxSFtgdyg R2dGt3o19QHOdBhNNSfZEM4im7sRxJajoA/LDOh4= Received: by mail-qt1-f179.google.com with SMTP id k18so7222906qtm.10; Fri, 14 Aug 2020 08:51:09 -0700 (PDT) X-Gm-Message-State: AOAM533AnUwJm9cW2q3CKT/1KsmsI3q+/mUneqMUmkF9QkYyJ/3ARst/ uC6ks0J45PhLgbZLJt8sjd0A4oJe9qNZCtIgJg== X-Received: by 2002:aed:24f2:: with SMTP id u47mr2591700qtc.137.1597420268638; Fri, 14 Aug 2020 08:51:08 -0700 (PDT) MIME-Version: 1.0 References: <20200814080813.8070-1-Zhiqiang.Hou@nxp.com> In-Reply-To: <20200814080813.8070-1-Zhiqiang.Hou@nxp.com> From: Rob Herring Date: Fri, 14 Aug 2020 09:50:52 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] PCI: designware-ep: Fix the Header Type check To: Zhiqiang Hou Cc: "linux-kernel@vger.kernel.org" , PCI , Lorenzo Pieralisi , Bjorn Helgaas , Andrew Murray , Jingoo Han , Gustavo Pimentel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 14, 2020 at 2:15 AM 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 > --- > drivers/pci/controller/dwc/pcie-designware-ep.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c > index 4680a51c49c0..4b7abfb1e669 100644 > --- a/drivers/pci/controller/dwc/pcie-designware-ep.c > +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c > @@ -654,7 +654,7 @@ int dw_pcie_ep_init_complete(struct dw_pcie_ep *ep) > int i; > > hdr_type = dw_pcie_readb_dbi(pci, PCI_HEADER_TYPE); > - if (hdr_type != PCI_HEADER_TYPE_NORMAL) { > + if (hdr_type & 0x7f != PCI_HEADER_TYPE_NORMAL) { Should have () around 'hdr_type & 0x7f'. > dev_err(pci->dev, > "PCIe controller is not set to EP mode (hdr_type:0x%x)!\n", > hdr_type); However, shouldn't the printed value be masked too? I'd just do: hdr_type = dw_pcie_readb_dbi(pci, PCI_HEADER_TYPE) & 0x7f; Perhaps add a #define too. '0x7f' is used in several places. Rob