Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3473198pxb; Mon, 4 Apr 2022 18:05:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlrubRfIVQizYGQxJI9y24+TT1J7uNcYjn5AiHOW/SPeljVCL1j61fmQlRJRPxfJcxQ5Gy X-Received: by 2002:a17:902:f242:b0:156:8e7c:e21e with SMTP id j2-20020a170902f24200b001568e7ce21emr977474plc.86.1649120711191; Mon, 04 Apr 2022 18:05:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649120711; cv=none; d=google.com; s=arc-20160816; b=Lj8pkYBb43z58+N54qSzF+StDjjuUh0XALSMsTTNYsAvdH4yJuRdLsyM+121+AAvdS mkY4pyqUjGSJNstieVYuLEmL8+7095RQPf9vHxzGFRKQI7G5MLl2HnW9tmiOXPic3VQB 760Nt/+2sXtk07MeWl8JkhlHLt628JIwi2Fg/ODZTWt6eDoDcYc0t1HBvReB1iUH+/T4 uXSZB8+6DNG9km/blCQt9aa9SCmkCPQ0+UWkA2aP6XYx2K03vOVb5f/wYH49H+d0m7eB Oq1g7vEPUpDm5REqHqmWl0b9BzjVngEZTR2uzYypxOeZ+Fz1Pl96Jkd67qd1k0wOXY2k WBeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=0vlRFIroYhAxAtt8b1uV208IEJmMxWXEuymzJQC0hzs=; b=paGVUkJo7EsCLWnomC/TpVQ66y6Tt1SuoyHPkRIsqA1sEa+gACj3obvm5lJ/Y0z8UE iYySnPIlECj/P8FUu2pASwpY0BquC66wsrmFMWiDFRlow3ITpto4Yp5mdvVAuWSpVDdI +XZb6f7zejM0m1ImR/A6Q3aIyJY5bPUZYa/Zgk+hEPOBhtjasr5ngc3rhRVgdpp/loVO 7w1q0e3asGwFQvWVzzoGwdwNaCf+m6eHP7ihEYQ+T2ZgHiTCEynMalDnhv4mS8j4bJVB GBg0wTv9kUVfW2BjLcvvd1cpZrQOVZpjBB5m7jUYP+3nv8ekRtvytdCKdIWgJqcGwx4V +Hrg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id b11-20020a170902d88b00b00153b2d165a5si10643410plz.429.2022.04.04.18.05.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 18:05:11 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4DC571342FE; Mon, 4 Apr 2022 17:04:12 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378263AbiDDOrj (ORCPT + 99 others); Mon, 4 Apr 2022 10:47:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379155AbiDDOoZ (ORCPT ); Mon, 4 Apr 2022 10:44:25 -0400 Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com [209.85.167.181]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 620663FD81; Mon, 4 Apr 2022 07:39:35 -0700 (PDT) Received: by mail-oi1-f181.google.com with SMTP id k10so10326948oia.0; Mon, 04 Apr 2022 07:39:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=0vlRFIroYhAxAtt8b1uV208IEJmMxWXEuymzJQC0hzs=; b=vOvkCwwENwRzsAqMwcDLhswRPtOybFEb5TQnwVkNSz+XUfgbwIXvfBgkaOW1RHFy/Z SL7uXML9vqr+52iJEWsFH3IFexCQ/pfBAjMgPYSt/xxBOIO5YmQlHv8gblokzbkfnhFZ 0NpT47hOPkIV6MventGN0YdY3V/uqd07Vu+76BqyzNPhsJjz4DBU7mBY7IADdo1ok2zS Q6r8NOQdUKWksQ+ZzEvrFg4vKAI8XETGztVjBSXqjUva6fBo9iOsDOQ0ejQnlVf/lBd/ Vk82f/GAMfRpFLlhADz0YX5AXjpa5UdCrhfbc9OwQpsAMiY+WtQJvQiRHb/q6BcWfgLj n3AQ== X-Gm-Message-State: AOAM531z5YZYxKRtrrJvUJfUaOfrdYHjLEZ4Uqgqj7/8r6NRw7TVGvzd Pdtkkwk8ZvMVh+baUYbghw== X-Received: by 2002:a05:6808:1a29:b0:2da:4dd3:a024 with SMTP id bk41-20020a0568081a2900b002da4dd3a024mr67329oib.35.1649083174445; Mon, 04 Apr 2022 07:39:34 -0700 (PDT) Received: from robh.at.kernel.org (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id m13-20020a056820050d00b003297b35bc63sm205368ooj.40.2022.04.04.07.39.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 07:39:33 -0700 (PDT) Received: (nullmailer pid 1281753 invoked by uid 1000); Mon, 04 Apr 2022 14:39:33 -0000 Date: Mon, 4 Apr 2022 09:39:33 -0500 From: Rob Herring To: Hongxing Zhu Cc: "l.stach@pengutronix.de" , "bhelgaas@google.com" , "broonie@kernel.org" , "lorenzo.pieralisi@arm.com" , "jingoohan1@gmail.com" , "festevam@gmail.com" , "francesco.dolcini@toradex.com" , "linux-pci@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "kernel@pengutronix.de" , dl-linux-imx Subject: Re: [PATCH v8 6/8] PCI: dwc: Add dw_pcie_host_ops.host_exit() callback Message-ID: References: <1645760667-10510-1-git-send-email-hongxing.zhu@nxp.com> <1645760667-10510-7-git-send-email-hongxing.zhu@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 02, 2022 at 03:03:00AM +0000, Hongxing Zhu wrote: > > -----Original Message----- > > From: Rob Herring > > Sent: 2022年4月2日 4:44 > > To: Hongxing Zhu > > Cc: l.stach@pengutronix.de; bhelgaas@google.com; broonie@kernel.org; > > lorenzo.pieralisi@arm.com; jingoohan1@gmail.com; festevam@gmail.com; > > francesco.dolcini@toradex.com; linux-pci@vger.kernel.org; > > linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; > > kernel@pengutronix.de; dl-linux-imx > > Subject: Re: [PATCH v8 6/8] PCI: dwc: Add dw_pcie_host_ops.host_exit() > > callback > > > > On Fri, Feb 25, 2022 at 11:44:25AM +0800, Richard Zhu wrote: > > > When the link never comes up after ->host_init(), some drivers, > > > especially those that don't support hotplug, want to turn off clocks > > > and power supplies. > > > > Isn't supporting hotplug or not a board level decision? And hotplug doesn't > > have to mean physical plug/unplug. For example, you could have a soldered > > down PCIe device which needs regulators, resets, clocks, etc. > > for that device to be initialized before the link comes up. If that device is > > handled by a module loaded some time later, then the link may be down when > > you probe. > > > > I think the way this all needs to work is with runtime PM. If that's all in place, > > then either you shutdown clocks/power on timeout or via sysfs suspend. If > > there's a child device, then that should prevent suspending. > Hi Rob: > Thanks a lot for your review comments. > Understand what you mean. > i.MX PCIe doesn't support hot-plug from chip design view. The scenario I described is not hotplug. > The ops.host_exit() callback is invoked only when the iMX PCIe driver hooked > callback ops->start_link return an error. > For the platforms, that support the hot-plug feature, they can just return one > zero from their own ops->start_link. You cannot have a per board start_link(). > In the current situation, i.MX PCIe does just return one zero when probe failed. > See the discussion and commit issued by Fabio below. > https://patchwork.kernel.org/project/linux-pci/patch/1641368602-20401-6-git-send-email-hongxing.zhu@nxp.com/ > https://patchwork.ozlabs.org/project/linux-pci/patch/20220106103645.2790803-1-festevam@gmail.com/ That's a stable fix and different discussion. > > > Add a new ->host_exit() callback in dw_pcie_host_ops so these drivers > > > can clean up if ->host_init() fails. > > > > I'm not really a fan of adding more ops nor the ops which aren't too specific > > about what they do. 'init' and 'exit' can be anything. I'd rather see more > > specific ops with the DWC core driver in charge of sequence of operations and > > the state. > Understand. You don't seem to... > i.MX PCIe can't handle the error exit properly in this case by itself. So I > add one more ops.host_exit() in this series. > > Best Regards > Richard Zhu > > > > Rob