linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Om Prakash Singh <omp@nvidia.com>
To: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	<kishon@ti.com>, <lorenzo.pieralisi@arm.com>,
	<bhelgaas@google.com>
Cc: <linux-pci@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-msm@vger.kernel.org>, <hemantk@codeaurora.org>,
	<smohanad@codeaurora.org>
Subject: Re: [PATCH 1/5] PCI: endpoint: Add linkdown notifier support
Date: Wed, 16 Jun 2021 23:52:28 +0530	[thread overview]
Message-ID: <443ec752-08e2-83dd-2b6f-b5e74c7bd8e5@nvidia.com> (raw)
In-Reply-To: <20210616115913.138778-2-manivannan.sadhasivam@linaro.org>



On 6/16/2021 5:29 PM, Manivannan Sadhasivam wrote:
> External email: Use caution opening links or attachments
> 
> 
> Add support to notify the EPF device about the linkdown event from the
> EPC device.
> 
> Usage:
> ======
> 
> EPC
> ---
> 
> ```
> static irqreturn_t pcie_ep_irq(int irq, void *data)
> {
> ...
>          case PCIE_EP_INT_LINK_DOWN:
>                  pci_epc_linkdown(epc);
>                  break;
Can you provide use case/scenario when epc will get LINK_DOWN interrupt?

> ...
> }
> ```
> 
> EPF
> ---
> 
> ```
> static int pci_epf_notifier(struct notifier_block *nb, unsigned long val,
>                              void *data)
> {
> ...
>          case LINK_DOWN:
>                  /* Handle link down event */
>                  break;
> ...
> }
> ```
> 
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
>   drivers/pci/endpoint/pci-epc-core.c | 17 +++++++++++++++++
>   include/linux/pci-epc.h             |  1 +
>   include/linux/pci-epf.h             |  1 +
>   3 files changed, 19 insertions(+)
> 
> diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
> index adec9bee72cf..f29d78c18438 100644
> --- a/drivers/pci/endpoint/pci-epc-core.c
> +++ b/drivers/pci/endpoint/pci-epc-core.c
> @@ -641,6 +641,23 @@ void pci_epc_linkup(struct pci_epc *epc)
>   }
>   EXPORT_SYMBOL_GPL(pci_epc_linkup);
> 
> +/**
> + * pci_epc_linkdown() - Notify the EPF device that EPC device has dropped the
> + *                     connection with the Root Complex.
> + * @epc: the EPC device which has dropped the link with the host
> + *
> + * Invoke to Notify the EPF device that the EPC device has dropped the
> + * connection with the Root Complex.
> + */
> +void pci_epc_linkdown(struct pci_epc *epc)
> +{
> +       if (!epc || IS_ERR(epc))
> +               return;
> +
> +       atomic_notifier_call_chain(&epc->notifier, LINK_DOWN, NULL);
> +}
> +EXPORT_SYMBOL_GPL(pci_epc_linkdown);
> +
>   /**
>    * pci_epc_init_notify() - Notify the EPF device that EPC device's core
>    *                        initialization is completed.
> diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h
> index b82c9b100e97..23590efc13e7 100644
> --- a/include/linux/pci-epc.h
> +++ b/include/linux/pci-epc.h
> @@ -202,6 +202,7 @@ void pci_epc_destroy(struct pci_epc *epc);
>   int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf,
>                      enum pci_epc_interface_type type);
>   void pci_epc_linkup(struct pci_epc *epc);
> +void pci_epc_linkdown(struct pci_epc *epc);
>   void pci_epc_init_notify(struct pci_epc *epc);
>   void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf,
>                          enum pci_epc_interface_type type);
> diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h
> index 6833e2160ef1..e9ad634b1575 100644
> --- a/include/linux/pci-epf.h
> +++ b/include/linux/pci-epf.h
> @@ -20,6 +20,7 @@ enum pci_epc_interface_type;
>   enum pci_notify_event {
>          CORE_INIT,
>          LINK_UP,
> +       LINK_DOWN,
>   };
> 
>   enum pci_barno {
> --
> 2.25.1
> 

  reply	other threads:[~2021-06-16 18:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-16 11:59 [PATCH 0/5] PCI: endpoint: Add support for additional notifiers Manivannan Sadhasivam
2021-06-16 11:59 ` [PATCH 1/5] PCI: endpoint: Add linkdown notifier support Manivannan Sadhasivam
2021-06-16 18:22   ` Om Prakash Singh [this message]
2021-06-16 18:30     ` Manivannan Sadhasivam
2021-06-16 11:59 ` [PATCH 2/5] PCI: endpoint: Add BME " Manivannan Sadhasivam
2021-06-16 11:59 ` [PATCH 3/5] PCI: endpoint: Add PME " Manivannan Sadhasivam
2021-06-16 11:59 ` [PATCH 4/5] PCI: endpoint: Add D_STATE " Manivannan Sadhasivam
2021-06-16 11:59 ` [PATCH 5/5] PCI: endpoint: Add custom " Manivannan Sadhasivam
2021-06-16 19:12 ` [PATCH 0/5] PCI: endpoint: Add support for additional notifiers Om Prakash Singh
2021-06-17 17:05   ` Manivannan Sadhasivam
2021-08-19 13:06 ` Manivannan Sadhasivam
2021-08-19 14:15 ` Kishon Vijay Abraham I
2021-08-19 14:22   ` 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=443ec752-08e2-83dd-2b6f-b5e74c7bd8e5@nvidia.com \
    --to=omp@nvidia.com \
    --cc=bhelgaas@google.com \
    --cc=hemantk@codeaurora.org \
    --cc=kishon@ti.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=smohanad@codeaurora.org \
    /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;
as well as URLs for NNTP newsgroup(s).