Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Kishon Vijay Abraham I <kvijayab@amd.com>
To: Krishna chaitanya chundru <quic_krichai@quicinc.com>,
	manivannan.sadhasivam@linaro.org
Cc: quic_vbadigan@quicinc.com, quic_ramkri@quicinc.com,
	linux-arm-msm@vger.kernel.org, konrad.dybcio@linaro.org,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"open list:PCI ENDPOINT SUBSYSTEM" <linux-pci@vger.kernel.org>,
	"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH RFC v1 1/3] PCI: endpoint: Add wakeup host API to EPC core
Date: Mon, 19 Jun 2023 14:52:40 +0530	[thread overview]
Message-ID: <791ced92-6198-3b6b-3cb8-c6f413986f61@amd.com> (raw)
In-Reply-To: <1686754850-29817-2-git-send-email-quic_krichai@quicinc.com>

Hi Krishna,

On 6/14/2023 8:30 PM, 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.
> 
> To support this adding wake up host to epc core.
> 
> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
> ---
>   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
> + * @epc: the EPC device which has to interrupt the host
> + * @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;
> +
> +	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);

Which endpoint function driver uses this? And when does it have to be used?

Update Documentation for any new API's here
Documentation/PCI/endpoint/pci-endpoint.rst

Thanks,
Kishon
> +
> +/**
>    * 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

  reply	other threads:[~2023-06-19  9:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-14 15:00 [PATCH RFC v1 0/3] PCI: EPC: Add support to wake up host from D3 states Krishna chaitanya chundru
2023-06-14 15:00 ` [PATCH RFC v1 1/3] PCI: endpoint: Add wakeup host API to EPC core Krishna chaitanya chundru
2023-06-19  9:22   ` Kishon Vijay Abraham I [this message]
2023-06-23  5:43   ` Manivannan Sadhasivam
2023-06-26 13:40     ` Krishna Chaitanya Chundru
2023-06-27 14:36       ` Manivannan Sadhasivam
2023-06-14 15:00 ` [PATCH RFC v1 2/3] pci: dwc: Add wakeup host op to pci_epc_ops Krishna chaitanya chundru
2023-06-14 15:00 ` [PATCH RFC v1 3/3] PCI: qcom: ep: Add wake up host op to dw_pcie_ep_ops Krishna chaitanya chundru
2023-06-23  6:18   ` Manivannan Sadhasivam
2023-06-26 13:48     ` Krishna Chaitanya Chundru
2023-06-27 13:53       ` Manivannan Sadhasivam
2023-06-28  2:31         ` Krishna Chaitanya Chundru
2023-06-28  4:57           ` Manivannan Sadhasivam
2023-06-28  6:19             ` Krishna Chaitanya Chundru
2023-06-28  6:29               ` Manivannan Sadhasivam
2023-06-23  6:19 ` [PATCH RFC v1 0/3] PCI: EPC: Add support to wake up host from D3 states Manivannan Sadhasivam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=791ced92-6198-3b6b-3cb8-c6f413986f61@amd.com \
    --to=kvijayab@amd.com \
    --cc=bhelgaas@google.com \
    --cc=kishon@kernel.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=kw@linux.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=quic_krichai@quicinc.com \
    --cc=quic_ramkri@quicinc.com \
    --cc=quic_vbadigan@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox