Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp23603imm; Tue, 25 Sep 2018 15:13:01 -0700 (PDT) X-Google-Smtp-Source: ACcGV63xbZLa5FrAfvPCvSPC+voRVK6tjoB/sS1ZU3DrGaVv5nqRe4oYqD5aunuYRdTK4vSNVUfd X-Received: by 2002:a17:902:760e:: with SMTP id k14-v6mr3072697pll.185.1537913581294; Tue, 25 Sep 2018 15:13:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537913581; cv=none; d=google.com; s=arc-20160816; b=fxOWQXcevQ1XIOCm0MmL9HV5S2fY/1Fgjz/YXuOUBTpPZaXs+VHYjsaHJ+K8FXNfOm L7rBUQT/sde6lvje55ABce1MTH8CgGoImhzfPtuiZHLQMW6oBvUooJyjxseiSuwPMoRJ ODzZP/PDE+6Dnm05ujPy87EN0ojPh1lm5qwUx/v7wukgBs0V7ysHIYS2bW9JrorT6xPn FmTIOobhYDhvOl+M2mx4aYGa/WB71nBXiNgtzzZggvsIv0BJQLMIB5PApvVcvjmAML/w W7msRDmXGeV6D+/rKBldftWYYOk6NSxk/dGLue0AQO2t/GMAMeMxo5XNv5XxHjSAek3A gX2Q== 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; bh=CAiNAgN+dYL0PdpAZITu7basDKOzzCXwZer8dJER9E0=; b=O9vvCeSZW2w4MvHcS/7Y4xIP0r9iego60DzSNbGxZbAHowun55sHMl8ca70gx4z8B7 DYYt2+DXm30q9TPtRQ0B+E4Aq59TP33FblZgKI58U/IW9F7EzDh1ZIk16aBEoN9A2aao WOZUKdJAeO0cXDtPeiCH2JUEBd/qbqL7od4399wxn64gDbi8DQxNeaZTtGWBbFtdDXJM qHyXUdwUGCfTthB2MyLnWgQysugTeRGRW4u/zrRIBcEjduyAZv+OLKbYfHw4UD5j46L3 7lH8yY+VpGNwVBIxIe4dQmlEvJy2PRO0R/s3sC+7Ykoi8IuTlbxZLO3y9n9iQSYEFlf1 GP8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z13-v6si2727439pgc.119.2018.09.25.15.12.44; Tue, 25 Sep 2018 15:13:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726250AbeIZEVi (ORCPT + 99 others); Wed, 26 Sep 2018 00:21:38 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:40778 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725734AbeIZEVi (ORCPT ); Wed, 26 Sep 2018 00:21:38 -0400 Received: by mail-ot1-f68.google.com with SMTP id g14-v6so12467947otj.7 for ; Tue, 25 Sep 2018 15:11:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CAiNAgN+dYL0PdpAZITu7basDKOzzCXwZer8dJER9E0=; b=FjjAzPHFFvme6ASMCPFQpCAawzsdxBorwjFtYnbmTV1alPIW21Z+6yuaGk58bZvyL+ uyJ+YpH2ATGeO31xMt/6+wtD6CsJ2HF/SrcjYYFLOrqeTv6jsSqr5BvIqEIE80Jz6Oam 9GqGkamZ77/O3sTeL0zvB/0u6H+hEu5/xBXB0JabUsoMOBIL7wC0DhVU+0f2PKEHXGie InewriFOGrbeXrfFJy230sqkd2INcrddyRm9YoU970EAq/b4SDau6+ShR5pq2sMWdSLi dT3EDWXsABF5SDrKnBP1EVF5rcZi9LOA40FUu78yncgKFxTVKtmNh12n/mICpS8YXVH+ pL7g== X-Gm-Message-State: ABuFfoimPysXZaHbpCihQ5zhBvvhtNIQcbBGx9C1OhvZBeAQ0fpA5Xxi IyW4pgVN9WlMTQybQpdy8ml9Nu0nQ8Y= X-Received: by 2002:a9d:a6:: with SMTP id w35-v6mr2102173oti.109.1537913517416; Tue, 25 Sep 2018 15:11:57 -0700 (PDT) Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com. [209.85.210.54]) by smtp.gmail.com with ESMTPSA id d5-v6sm1102130oia.57.2018.09.25.15.11.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Sep 2018 15:11:57 -0700 (PDT) Received: by mail-ot1-f54.google.com with SMTP id h26-v6so26072106otl.9 for ; Tue, 25 Sep 2018 15:11:56 -0700 (PDT) X-Received: by 2002:a9d:1541:: with SMTP id z1-v6mr2096345otz.186.1537913516789; Tue, 25 Sep 2018 15:11:56 -0700 (PDT) MIME-Version: 1.0 References: <20180823213600.23426-1-alexandre.belloni@bootlin.com> In-Reply-To: From: Li Yang Date: Tue, 25 Sep 2018 17:11:44 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] soc: fsl: qbman: qman_portal: defer probing when qman is not available To: Olof Johansson Cc: alexandre.belloni@bootlin.com, Roy Pledge , linuxppc-dev , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , lkml 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 Tue, Sep 25, 2018 at 2:47 PM Olof Johansson wrote: > > Hi, > > > On Thu, Aug 23, 2018 at 11:36 PM Alexandre Belloni > wrote: > > > > If the qman driver (qman_ccsr) doesn't probe or fail to probe before > > qman_portal, qm_ccsr_start will be either NULL or a stale pointer to an > > unmapped page. > > > > This leads to a crash when probing qman_portal as the init_pcfg function > > calls qman_liodn_fixup that tries to read qman registers. > > > > Assume that qman didn't probe when the pool mask is 0. > > > > Signed-off-by: Alexandre Belloni > > --- > > drivers/soc/fsl/qbman/qman_portal.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/soc/fsl/qbman/qman_portal.c b/drivers/soc/fsl/qbman/qman_portal.c > > index a120002b630e..4fc80d2c8feb 100644 > > --- a/drivers/soc/fsl/qbman/qman_portal.c > > +++ b/drivers/soc/fsl/qbman/qman_portal.c > > @@ -277,6 +277,8 @@ static int qman_portal_probe(struct platform_device *pdev) > > } > > > > pcfg->pools = qm_get_pools_sdqcr(); > > + if (pcfg->pools == 0) > > + return -EPROBE_DEFER; > > This is quite late in the probe, after a bunch of resources have been claimed. > > Note that the ioremaps above this are doing unwinds, and you'll end up > doing duplicate ioremaps if you come in and probe again. > > You should probably unwind those allocations, or move them to devm_* > or do this check earlier in the function. Hi Roy, Is there any more straightforward indicator on if qman has been probed? So that we can check it at the begining of the probe? Regards, Leo