From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Kishon Vijay Abraham I <kishon@ti.com>
Cc: lorenzo.pieralisi@arm.com, bhelgaas@google.com,
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] PCI: endpoint: Add custom notifier support
Date: Tue, 15 Jun 2021 20:41:58 +0530 [thread overview]
Message-ID: <20210615151158.GA93671@thinkpad> (raw)
In-Reply-To: <9021212f-aa5d-770d-c455-c632dd79e7f8@ti.com>
Hi Kishon,
On Tue, Jun 15, 2021 at 08:31:48PM +0530, Kishon Vijay Abraham I wrote:
> Hi Manivannan,
>
> On 15/06/21 7:07 pm, Manivannan Sadhasivam wrote:
> > Add support for passing the custom notifications between the endpoint
> > controller and the function driver. This helps in passing the
> > notifications that are more specific to the controller and corresponding
> > function driver. The opaque `data` arugument in pci_epc_custom_notify()
> > function can be used to carry the event specific data that helps in
> > differentiating the events.
> >
> > For instance, the Qcom EPC device generates specific events such as
> > MHI_A7, BME, DSTATE_CHANGE, PM_TURNOFF etc... These events needs to be
> > passed to the function driver for proper handling. Hence, this custom
> > notifier can be used to pass these events.
>
> Bus master enable and PME events sounds generic events and not QCOM
> specific.
Yes, that's correct! I thought about adding the notifiers for them but not sure
about the convetion in EP stack. So went with an opaque notifier but I don't
have any issue in adding them.
> Also this patch should be sent along with how it's going to be
> used in function driver.
>
The function driver which is going to use this notifier is under development but
I can share a snippet if that helps.
> In general my preference would be to add only well defined notifiers
> given that the endpoint function drivers are generic.
>
Not all functions are generic ones. For example, on Qcom modems there is a MHI
function driver which transports the IP packets to the host and talks to the
MHI host stack[1].
So for sure we need to have a custom notifier for vendor specific events.
Thanks,
Mani
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/bus/mhi
> Thanks
> Kishon
>
> >
> > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> > ---
> > drivers/pci/endpoint/pci-epc-core.c | 19 +++++++++++++++++++
> > include/linux/pci-epc.h | 1 +
> > include/linux/pci-epf.h | 1 +
> > 3 files changed, 21 insertions(+)
> >
> > diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
> > index adec9bee72cf..86b6934c6297 100644
> > --- a/drivers/pci/endpoint/pci-epc-core.c
> > +++ b/drivers/pci/endpoint/pci-epc-core.c
> > @@ -658,6 +658,25 @@ void pci_epc_init_notify(struct pci_epc *epc)
> > }
> > EXPORT_SYMBOL_GPL(pci_epc_init_notify);
> >
> > +/**
> > + * pci_epc_custom_notify() - Notify the EPF device about the custom events
> > + * in the EPC device
> > + * @epc: EPC device that generates the custom notification
> > + * @data: Data for the custom notifier
> > + *
> > + * Invoke to notify the EPF device about the custom events in the EPC device.
> > + * This notifier can be used to pass the EPC specific custom events that are
> > + * shared with the EPF device.
> > + */
> > +void pci_epc_custom_notify(struct pci_epc *epc, void *data)
> > +{
> > + if (!epc || IS_ERR(epc))
> > + return;
> > +
> > + atomic_notifier_call_chain(&epc->notifier, CUSTOM, data);
> > +}
> > +EXPORT_SYMBOL_GPL(pci_epc_custom_notify);
> > +
> > /**
> > * pci_epc_destroy() - destroy the EPC device
> > * @epc: the EPC device that has to be destroyed
> > diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h
> > index b82c9b100e97..13140fdbcdf6 100644
> > --- a/include/linux/pci-epc.h
> > +++ b/include/linux/pci-epc.h
> > @@ -203,6 +203,7 @@ 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_init_notify(struct pci_epc *epc);
> > +void pci_epc_custom_notify(struct pci_epc *epc, void *data);
> > void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf,
> > enum pci_epc_interface_type type);
> > int pci_epc_write_header(struct pci_epc *epc, u8 func_no,
> > diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h
> > index 6833e2160ef1..8d740c5cf0e3 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,
> > + CUSTOM,
> > };
> >
> > enum pci_barno {
> >
prev parent reply other threads:[~2021-06-15 15:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-15 13:37 [PATCH] PCI: endpoint: Add custom notifier support Manivannan Sadhasivam
2021-06-15 15:01 ` Kishon Vijay Abraham I
2021-06-15 15:11 ` Manivannan Sadhasivam [this message]
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=20210615151158.GA93671@thinkpad \
--to=manivannan.sadhasivam@linaro.org \
--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=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).