Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1923622lql; Wed, 13 Mar 2024 11:59:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXRJraJnfm+YtZEwdrwXjlrOP1HL8NkCJdwTZu17KX/rn0WMwCLSG0oCTEiZBEHr2RnNptZKEnXvJjGilEu8UWO+gpcuNxMZ7AeODVHiw== X-Google-Smtp-Source: AGHT+IHUFuGJeXi4chGJemZWJ5XRatcTOLl9bAmfVTIHBo1dDtQHp+1Rv6z1jKe5kIyOi98DApED X-Received: by 2002:a05:6a20:d492:b0:1a2:c3e4:a516 with SMTP id im18-20020a056a20d49200b001a2c3e4a516mr7040516pzb.27.1710356380024; Wed, 13 Mar 2024 11:59:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710356380; cv=pass; d=google.com; s=arc-20160816; b=xTL1leTwx1FwkU+y0kYoLuhjyAruiLRTmtLoygijLoKK55wrRdHYJRZeSjpntTrta0 vhFYOxHIVJt50yWuHGuqBTltY2TwILWMuagCm6W4LIUpKI+BY4q2UlDJAHcUDT2UkbMd IDBnt6ozi5NG0Wc+AE1nIprEKIeSjG7QZlyWKYPuwyFN7xUe8o9tV9w6WxwRr1np4/80 qOpC/hMHT3aljgiZUQZ9zFvnQOfiql8ze1eAgzfOhOtLg1aJPH1pmgQUo8d/tVuoA7G3 xs/LhrSVRSOq3Z4FnJiwUfzUI+BduqKvg5slDYtZfO3oh0Nap+wYOmIUIlDvciJHuVZ3 4dog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=P42L0V1byhnm9xVh8nwf+gtaXnbnBXKB7y3o50DEnDg=; fh=91YxgHB0C16jJwsRk3f5oaoIC5+IX8mfnn4hvC7KVPM=; b=mUYlQYhiELOwiZADkG0X+1Vvd73SvA78d5nw9OcSuBnCibcgmtqKzZHjAnUq9PqHr0 6lz5PnPKOb9GaaVNcgcrqh8eAQT/efdAhLMh60HUn/AZ5e1vhMMvOCj1sjThJowQcs/2 773mQP1Kwk7pl5qo8nKnDybmuCkANH7hOJoXcLbmziz0P6S1ANRVlAvVEgRXfOdjUx34 QInSV1YWH9FGLF/VSNhujfFY35J/l+w2sm/UEOafYVUT0lLoTV5Rtw3KK4JBmVo0j8yT GRUcQkNtptJjbZ68ML7lHottw5sEXOBm3cn7wMaaHv5+w+Netu2qGRi8ib6NCA8feAv4 0cAQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D8zvQJOD; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-102317-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102317-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n8-20020a170902d2c800b001dcfc23a7ffsi9976263plc.578.2024.03.13.11.59.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 11:59:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102317-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D8zvQJOD; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-102317-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102317-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C94872843F2 for ; Wed, 13 Mar 2024 18:55:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7FC2D5811C; Wed, 13 Mar 2024 17:53:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="D8zvQJOD" Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A9F6D5823C for ; Wed, 13 Mar 2024 17:53:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710352431; cv=none; b=dMx2jY1nmJT5qT0jsW8fBsv1ej1Aq9a41uKaD/kOonWEAAifhNzBzwvjdbWTEe0Vp2A6pn7PyBLbACscT2DXHxymRftNmzvDkQs0mq1FO1Nt2G7pPeJ0FUlp//Vq6kKY00R1tvYpNqHMC/CITO52aWz6DT5t1b4WCfY8CzcPtIc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710352431; c=relaxed/simple; bh=ikP1SQZvK81WwtXopq3dHhyUueLGCn0F9tCceqEbyeU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ryF9tGxDcwfh5wdIe6n/dPmuRwMBEEGQKsH2Y6C0qs35938UPHICLdlXZDWitGGK2q+FtegIbUAl60GWv46CucFis5A6yx3ZE2MA8WMezMpfXCnFy1GCTfK1W81yQ0Uxrgodu2jfaHKO8UCMJnpcKn6ZFqAvYcTeAybWsy3SOEQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=D8zvQJOD; arc=none smtp.client-ip=209.85.210.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-6e6c10bdd2fso163779b3a.3 for ; Wed, 13 Mar 2024 10:53:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710352429; x=1710957229; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=P42L0V1byhnm9xVh8nwf+gtaXnbnBXKB7y3o50DEnDg=; b=D8zvQJODpgv7AIuJtS6cE34ZEwNLkubA98YOSqTLCzC69KQKzO2f3zGeK+Z5DUDzxi o+MhH1fXsTzC5+MTFYVzZwM9TKWdDIfSl1AGH4LSzvVuBGbMD9jG+UhqXrHUxeFvsP3d 9TbKrEZk62XKsAq5v22pZCQ97JzVgSroarKzmG+MUpGNK6RQn37mVHRtnV5W2hzV27QY PmCrm+BjGNdDurv7SBFLacgCV6vRcD2ofQILGoRLKueVEbpbDvkB323zb0PN2kMXj9gt xqGrrJBdBocY31UygcoLPWUorr0DO9CcXcsP4/rt5f53tS9eMDhWoE2TfEfjPvuLDUo/ vIjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710352429; x=1710957229; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=P42L0V1byhnm9xVh8nwf+gtaXnbnBXKB7y3o50DEnDg=; b=HtwlUPXeboTsiFBXgZnB626WB3rtz7ivbIZlhi26hOHKSS6n5OdeWdyVNGlrK8KYaz OhYPYQafx1QRp5CebOjo/qpuFKfnOl6nFOe4VsBUoFPO5z9T+0z1C+L22XRB8d0ABNTn y8HgjX/jcaF7MORZVgOEcyqxghhGFeUuAlJNpQiPPdEoFUb03YdQJmu6NoglUJttZqGR SxIMRj7Ut/kGljmOXpEC8yuweyPWZB/hq7pNoFGgh58vq2Kb5mUUBeBv9SHl6X210VDq cEsdrL0xKeU2YCsW1zjCz1DqG5E5KIY6txC1WfIKSR/z29Pq4FRXOFINq5VTZGzul5dK YSew== X-Forwarded-Encrypted: i=1; AJvYcCV2M2/AlDRgeIP0ReKKM73TZsoveSlucukubCGcxMjf7qzhk3DBvTSIJ6AhnPAk1bhBIUAFf34FLWRb56yMWyNx7f9sU+hHsGRn9Mmc X-Gm-Message-State: AOJu0YzPaZQxT4NUnXmjrssiKKYDO9cBSLtjD4t2POhUhfvHvC55Gu73 HL5DdiHmivULtCScxCwunQxJXNXDtbMG51FO1/e8jDnA3K41KWRr9iUwyWhINw== X-Received: by 2002:a05:6a20:12c9:b0:1a3:113a:bbd5 with SMTP id v9-20020a056a2012c900b001a3113abbd5mr5892663pzg.40.1710352428857; Wed, 13 Mar 2024 10:53:48 -0700 (PDT) Received: from thinkpad ([117.213.99.94]) by smtp.gmail.com with ESMTPSA id r6-20020a63e506000000b005dbd0facb4dsm7803062pgh.61.2024.03.13.10.53.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 10:53:48 -0700 (PDT) Date: Wed, 13 Mar 2024 23:23:33 +0530 From: Manivannan Sadhasivam To: Niklas Cassel Cc: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Marek Vasut , Yoshihiro Shimoda , Thierry Reding , Jonathan Hunter , Kishon Vijay Abraham I , Vidya Sagar , Vignesh Raghavendra , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Minghuan Lian , Mingkai Hu , Roy Zang , Kunihiko Hayashi , Masami Hiramatsu , Kishon Vijay Abraham I , Jesper Nilsson , Srikanth Thokala , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@axis.com, Frank Li Subject: Re: [PATCH v9 07/10] PCI: dwc: ep: Remove "core_init_notifier" flag Message-ID: <20240313175333.GA126027@thinkpad> References: <20240304-pci-dbi-rework-v9-0-29d433d99cda@linaro.org> <20240304-pci-dbi-rework-v9-7-29d433d99cda@linaro.org> <20240311144559.GA2504@thinkpad> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Mon, Mar 11, 2024 at 10:54:28PM +0100, Niklas Cassel wrote: > On Mon, Mar 11, 2024 at 08:15:59PM +0530, Manivannan Sadhasivam wrote: > > > > > > I would say that it is the following change that breaks things: > > > > > > > - if (!core_init_notifier) { > > > > - ret = pci_epf_test_core_init(epf); > > > > - if (ret) > > > > - return ret; > > > > - } > > > > - > > > > > > Since without this code, pci_epf_test_core_init() will no longer be called, > > > as there is currently no one that calls epf->core_init() for a EPF driver > > > after it has been bound. (For drivers that call dw_pcie_ep_init_notify() in > > > .probe()) > > > > > > > Thanks a lot for testing, Niklas! > > > > > I guess one way to solve this would be for the EPC core to keep track of > > > the current EPC "core state" (up/down). If the core is "up" at EPF .bind() > > > time, notify the EPF driver directly after .bind()? > > > > > > > Yeah, that's a good solution. But I think it would be better if the EPC caches > > all events if the EPF drivers are not available and dispatch them once the bind > > happens for each EPF driver. Even though INIT_COMPLETE is the only event that is > > getting generated before bind() now, IMO it is better to add provision to catch > > other events also. > > > > Wdyt? > > I'm not sure. > What if the EPF goes up/down/up, it seems a bit silly to send all those > events to the EPF driver that will alloc+free+alloc. > > Do we know for sure that we will want to store + replay events other than > INIT_COMPLETE? > > And how many events should we store? > > > Until we can think of a good reason which events other than UP/DOWN we > can to store, I think that just storing the state as an integer in > struct pci_epc seems simpler. > Hmm, makes sense. > > Or I guess we could continue with a flag in struct pci_epc_features, > like has_perst_notifier, which would then require the EPC driver to > call both epc_notify_core_up() and epc_notify_core_down() when receiving > the PERST deassert/assert. > For a driver without the flag set, the EPC core would call > .epc_notify_core_up() after bind. (And .epc_notify_core_down() would never > be called, or it could call it before unbind().) > That way an EPF driver itself would not need any different handling > (all callbacks would always come, either triggered by an EPC driver that > has PERST GPIO irq, or triggered by the EPC core for a driver that lacks > a PERST GPIO). > For simplicity, I've just used a flag in 'struct pci_epc' to track the core_init and call the callback during bind(). But the series has grown big, so I decided to split it into two. One to address the DBI access issue and also remove the 'core_init_notifier' flag and another one to make EPF drivers more robust to handle the host reboot scenario. - Mani -- மணிவண்ணன் சதாசிவம்