Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp17792875rwd; Tue, 27 Jun 2023 07:38:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4FLzQVpEGlrtyylkrcctdybAcFZUe0DQ7gKQCp57ZmUEEbjZtq4qe8X4Kq+qAy5Y4FJ89/ X-Received: by 2002:a17:906:da0b:b0:98e:16b9:6c8c with SMTP id fi11-20020a170906da0b00b0098e16b96c8cmr6117916ejb.14.1687876738770; Tue, 27 Jun 2023 07:38:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687876738; cv=none; d=google.com; s=arc-20160816; b=Ja2LclGAn2bNZZjCB79NyD2s2lSoPy5q3u6o/Ot73g8iQ1LtNJl1DdTmmAt/osnhQA 9DclsxGphgaVPLoq8sllJGSYLxX8zOS0qt/yFT5avlmsLuj1r++cdBy5kpRYmmvQ7EhY 2Bmd4ORFkiAEOHt0liW/1KmmQ3UGZDIJ3Q/O9VZkDZe6MR1zHpVTpsdmljHSjaHo3XYF ah4MOxjYaMLhkTHtkUxPJ8L064VWd8slUnL8cXTIJ3oRoe5al3u+aPfudK9hq+Uxsl7r M/kjhf7jfmjvKwzBCtJvdGSO2Nrfc1WUk/HJVFApYEgq88JYJU3qmNx9jxb7lY3aQg1O cE3A== 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:dkim-signature; bh=EKnkGi4R/oNGmkho/sS4/hhFqwUUmiaELEsFYg/kbR0=; fh=8JBGG9KSNckqQm32uUueG4jD8+r5ddUWbl4Fr2OQIw8=; b=dC2+WEM9vx/QMD65jd+AV71JxchLTxjZCapL4d9FOYM9flMAJQZCKYKFHp7FlKQ1uY ualrPF1943bl5+V7Ww4y4BqOEVx48Des5G4UnzATZHiiOFoisCqmNsa67WXSBRCGaoKv et7bcV/yPl75csCXHgqslIEWXqggcEmfv2vqqUqpS/fLc03Wmx5K/VE53io2Fb+Dd4y2 zFQTLgigl93nU4LNfLmwYwSWahGhwJqrR+kRovYxHAxw1/4hDnK5q2+NjaVjawTcHPhW 6vA+1XOiZwiQKCWcdO/Cbgwlx00aRX11E/LIY7xpYc6e705GoWM3WQ6i2ithxCRYjFPf 5VMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Hly1BbE3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g8-20020a170906348800b0098d2f715b83si4189025ejb.626.2023.06.27.07.38.33; Tue, 27 Jun 2023 07:38:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Hly1BbE3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231540AbjF0OhJ (ORCPT + 99 others); Tue, 27 Jun 2023 10:37:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231496AbjF0OhA (ORCPT ); Tue, 27 Jun 2023 10:37:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36901359D; Tue, 27 Jun 2023 07:36:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A5BE0611BC; Tue, 27 Jun 2023 14:36:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1649BC433C8; Tue, 27 Jun 2023 14:36:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687876597; bh=Aa67Wy9ttMGQmXrreabIOo5dIAtA9DW58DMmzxgDC7c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Hly1BbE3CwP1kJGoLaZ6jljJPt2pb1eYpChb81JLTluzMHguYxD8j3huO9VjPtbdK OPuj3u5t9Xk+58DFJMX37XYA6fwbYO6LnSOdhyhi1y+rwhR6uetPrJfIig21sP0A77 OvHOzvnzcMMyMHY8r3HyXh2xzL/L0eCAcGE43BKMrqO/C2WNjXLSJCluAoJ6/RDGL2 zdrDAmckpsnTnfI0GgEY5OhlxvUC8vrBJQv6UWbgnaArgcD1UIrMhe83G7JFySSpGy 4rjLZ+0jzTjX7fQJwTK83StuovkirIltIWs+GzLzLdaFzKWXAA2RPjJLKfXBgdEES9 wH4RyLtpsq3sA== Date: Tue, 27 Jun 2023 20:06:23 +0530 From: Manivannan Sadhasivam To: Krishna Chaitanya Chundru Cc: manivannan.sadhasivam@linaro.org, quic_vbadigan@quicinc.com, quic_ramkri@quicinc.com, linux-arm-msm@vger.kernel.org, konrad.dybcio@linaro.org, Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Kishon Vijay Abraham I , Bjorn Helgaas , "open list:PCI ENDPOINT SUBSYSTEM" , open list Subject: Re: [PATCH RFC v1 1/3] PCI: endpoint: Add wakeup host API to EPC core Message-ID: <20230627143623.GF5490@thinkpad> References: <1686754850-29817-1-git-send-email-quic_krichai@quicinc.com> <1686754850-29817-2-git-send-email-quic_krichai@quicinc.com> <20230623054313.GB5611@thinkpad> <3291d4f1-1cb8-ad7e-3dd4-5b9cab9e22c7@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3291d4f1-1cb8-ad7e-3dd4-5b9cab9e22c7@quicinc.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Mon, Jun 26, 2023 at 07:10:53PM +0530, Krishna Chaitanya Chundru wrote: > > On 6/23/2023 11:13 AM, Manivannan Sadhasivam wrote: > > On Wed, Jun 14, 2023 at 08:30:47PM +0530, Krishna chaitanya chundru wrote: > > > Endpoint cannot send any data/MSI when the device state is in > > > D3cold or D3hot. Endpoint needs to bring the device back to D0 > > > to send any kind of data. > > > > > > For this endpoint can send inband PME the device is in D3hot or > > > toggle wake when the device is D3 cold. > > > > > Are you referring to "host" as the "device"? If so, then it is a wrong > > terminology. > I will correct this in next series. > > > > > To support this adding wake up host to epc core. > > > > > Commit message should be imperative. > > > > > Signed-off-by: Krishna chaitanya chundru > > > --- > > > drivers/pci/endpoint/pci-epc-core.c | 29 +++++++++++++++++++++++++++++ > > > include/linux/pci-epc.h | 3 +++ > > > 2 files changed, 32 insertions(+) > > > > > > diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c > > > index 46c9a5c..d203947 100644 > > > --- a/drivers/pci/endpoint/pci-epc-core.c > > > +++ b/drivers/pci/endpoint/pci-epc-core.c > > > @@ -167,6 +167,35 @@ const struct pci_epc_features *pci_epc_get_features(struct pci_epc *epc, > > > EXPORT_SYMBOL_GPL(pci_epc_get_features); > > > /** > > > + * pci_epc_wakeup_host() - interrupt the host system > > s/interrupt the host system/Wakeup the host > > > > > + * @epc: the EPC device which has to interrupt the host > > s/interrupt/wake > > > > > + * @func_no: the physical endpoint function number in the EPC device > > > + * @vfunc_no: the virtual endpoint function number in the physical function > > > + * > > > + * Invoke to wakeup host > > > + */ > > > +int pci_epc_wakeup_host(struct pci_epc *epc, u8 func_no, u8 vfunc_no) > > > +{ > > > + int ret; > > > + > > > + if (IS_ERR_OR_NULL(epc) || func_no >= epc->max_functions) > > > + return -EINVAL; > > > + > > > + if (vfunc_no > 0 && (!epc->max_vfs || vfunc_no > epc->max_vfs[func_no])) > > > + return -EINVAL; > > > + > > Use proper errno for both of the above. > > > > - Mani > > raise_irq functions also using errno can you please suggest correct value. > Let's keep it as it is, we can change all later. - Mani > - KC > > > > + if (!epc->ops->wakeup_host) > > > + return 0; > > > + > > > + mutex_lock(&epc->lock); > > > + ret = epc->ops->wakeup_host(epc, func_no, vfunc_no); > > > + mutex_unlock(&epc->lock); > > > + > > > + return ret; > > > +} > > > +EXPORT_SYMBOL_GPL(pci_epc_wakeup_host); > > > + > > > +/** > > > * pci_epc_stop() - stop the PCI link > > > * @epc: the link of the EPC device that has to be stopped > > > * > > > diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h > > > index 301bb0e..a8496be 100644 > > > --- a/include/linux/pci-epc.h > > > +++ b/include/linux/pci-epc.h > > > @@ -59,6 +59,7 @@ pci_epc_interface_string(enum pci_epc_interface_type type) > > > * @start: ops to start the PCI link > > > * @stop: ops to stop the PCI link > > > * @get_features: ops to get the features supported by the EPC > > > + * @wakeup_host: ops to wakeup the host > > > * @owner: the module owner containing the ops > > > */ > > > struct pci_epc_ops { > > > @@ -88,6 +89,7 @@ struct pci_epc_ops { > > > void (*stop)(struct pci_epc *epc); > > > const struct pci_epc_features* (*get_features)(struct pci_epc *epc, > > > u8 func_no, u8 vfunc_no); > > > + int (*wakeup_host)(struct pci_epc *epc, u8 func_no, u8 vfunc_no); > > > struct module *owner; > > > }; > > > @@ -232,6 +234,7 @@ int pci_epc_start(struct pci_epc *epc); > > > void pci_epc_stop(struct pci_epc *epc); > > > const struct pci_epc_features *pci_epc_get_features(struct pci_epc *epc, > > > u8 func_no, u8 vfunc_no); > > > +int pci_epc_wakeup_host(struct pci_epc *epc, u8 func_no, u8 vfunc_no); > > > enum pci_barno > > > pci_epc_get_first_free_bar(const struct pci_epc_features *epc_features); > > > enum pci_barno pci_epc_get_next_free_bar(const struct pci_epc_features > > > -- > > > 2.7.4 > > > -- மணிவண்ணன் சதாசிவம்