Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4182029imm; Tue, 25 Sep 2018 12:47:25 -0700 (PDT) X-Google-Smtp-Source: ACcGV61+0eF3sP471Cyrp71vbZH6A22zGBgtSEI5WYlMAFwNqnlmRaSCI7Q+W4uD4ccNmAfv5tA2 X-Received: by 2002:a17:902:2d24:: with SMTP id o33-v6mr2529090plb.211.1537904845843; Tue, 25 Sep 2018 12:47:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537904845; cv=none; d=google.com; s=arc-20160816; b=hb9chM7+/Ws2rbrUO4UdR6RyGmDzILyjke9BiOkWxzz+cENffOjzwvu6mMtwnFQhXN eEzZr8iUdGtl6Gx2eIFAmBweBfVjKfKWuEuggTYxbjBCto+B9iL/Hi4CygyHQrwh1+xp 4SE+mJYKTdSUqsHATipDFhMajtNo33C/lNLAOqtan2P3Xhf6WlE6c3mtRZamGJw8opG5 SMJWjx8p9PVIJ0FcvFZ/UmhjKeKjnknhfFyjXZKV1BqtlMI4wQCWgkSSEW+S7X/RNUln GTUSRMiHI1WSQ4ORtC//Ipg1IUzNsyI5iBqZP/69ZtBlKnZCwsLPQWftoHl6Y+hJlF0N plkg== 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=2MKpZTQbQtPMjDkxZ8j019ksxj6VPDzn9400A/bKfso=; b=wFhBsVWRp9kKB6PAWkjkTLZloYJtFnUQySsKK9+PR71CBd+z0KQ5H99ffV4jSTULUz nbVMwo80xisxzX1W8DwCpz82Evx1HqUSXVSqWTaeCIUtLDV+GSYNmCCrpVNLKQ0kfBpC RAgschQVl+fb4qIwWGptKoBLI5IMtp9BQ8wBAifXzQfaEHHh4DbFEriu42ewhs2+UV/w DSTeIplCqlZZAww/KxTjxOYxGamFppCF5QXDERqcfaRCaONrxqGwPwpn8zpMfS6NR+bQ 5EgWYle6M4fG/Pyp/x/+TIM9ZYQkFnv0+6fEmtsvtivPo3QTQM/kyNhjeNMVJOgu9aNb 2pxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lixom-net.20150623.gappssmtp.com header.s=20150623 header.b=rCkL9xyI; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z11-v6si2933375pgv.138.2018.09.25.12.47.10; Tue, 25 Sep 2018 12:47:25 -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; dkim=pass header.i=@lixom-net.20150623.gappssmtp.com header.s=20150623 header.b=rCkL9xyI; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727719AbeIZBzZ (ORCPT + 99 others); Tue, 25 Sep 2018 21:55:25 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:37882 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727445AbeIZBzY (ORCPT ); Tue, 25 Sep 2018 21:55:24 -0400 Received: by mail-lj1-f194.google.com with SMTP id v9-v6so22943348ljk.4 for ; Tue, 25 Sep 2018 12:46:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lixom-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2MKpZTQbQtPMjDkxZ8j019ksxj6VPDzn9400A/bKfso=; b=rCkL9xyIm2aCZt2XNXiVJIX6709Ud103Qyn6iuAcKzPiATlgPkIGPkiFxbNblwpXPH 7xF3U40+vjWjVQ0qkQxqetMmOq4A8eSTVLlGVEWHHr5EYQgChx7c9+7qV4T5X9G4pRtg hV7ATSbNNkwkn8VrE/RnMiaUMv7fUv83gToc6xznjvwQgVmTGTgd/7YzA5PtB0bF6ywo 1N9q56dAtrVU/JhCgWm5AFpE7r1A7dFQG8JkQCATIxYIFyKMPB1VUy44lx8I3FZBv27z Ut0S1zAKYo3KsCbLgCW/TfGTGKdgO2C8npKWYPoSIfir96lNnEgxVWRMaR6MzBzQ+sf8 zp8A== 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=2MKpZTQbQtPMjDkxZ8j019ksxj6VPDzn9400A/bKfso=; b=lblIrnKVqbraxS9yWI6NKOIZzcXKEN2ds2U+/yfNw211Eqp+dRFsLXRs9cCdjWv0QZ wzWe25feDy68+YXZ5ITd3APs2Mb/c89vjls9bYSVKsmx40DKu2ZZkMVIDteCyifA/nZ2 SWkloLaDkxhj2bnIZhmB2mIbdnLLQH+hTXkhvs48MpNOrGP+E7kOoFszadmv/pTmvZAm ODUDokAD1ws21cnMKm/C7xg7ggNhHr7gQjVsnHYadtOmgUaMPDl5BIX+NYnZYuTdW+FG ysEXMLFSrsOuRBf11Bs/DUhM026K57hCAVbffdeKhsj9XsO3nn2s6ECtE5MzkcaqzlVa XizQ== X-Gm-Message-State: ABuFfoiiTgUAF6sAq3dNSztCDIyHjizfmMbeiHhbxVFKkjY1X5Ml4TDe Yin+gIO/TRVNiB29mbLWCXK++t7BfOKtlMRXxuxBMvdsYDtGSw== X-Received: by 2002:a2e:2c10:: with SMTP id s16-v6mr1978341ljs.88.1537904775401; Tue, 25 Sep 2018 12:46:15 -0700 (PDT) MIME-Version: 1.0 References: <20180823213600.23426-1-alexandre.belloni@bootlin.com> In-Reply-To: <20180823213600.23426-1-alexandre.belloni@bootlin.com> From: Olof Johansson Date: Tue, 25 Sep 2018 21:45:56 +0200 Message-ID: Subject: Re: [PATCH 1/2] soc: fsl: qbman: qman_portal: defer probing when qman is not available To: Alexandre Belloni Cc: Li Yang , Roy Pledge , linuxppc-dev , Linux ARM Mailing List , Linux Kernel Mailing List 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 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. -Olof