Message ID | 20230519144215.25167-5-manivannan.sadhasivam@linaro.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Add support for MHI Endpoint function driver | expand |
> @@ -72,11 +72,13 @@ struct pci_epf_ops { > * @core_init: Callback for the EPC initialization complete event > * @link_up: Callback for the EPC link up event > * @link_down: Callback for the EPC link down event > + * @bme: Callback for the EPC BME (Bus Master Enable) event > */ > struct pci_epc_event_ops { > int (*core_init)(struct pci_epf *epf); > int (*link_up)(struct pci_epf *epf); > int (*link_down)(struct pci_epf *epf); > + int (*bme)(struct pci_epf *epf); I posted a doorbell from host to EP at https://lore.kernel.org/imx/20230426203436.1277307-2-Frank.Li@nxp.com/T/#u Can we consider consolidate these notification to one function and distinguished by EVENT_ID in future? Best regards Frank Li > }; > > /** > -- > 2.25.1
On Fri, May 19, 2023 at 06:19:44PM +0000, Frank Li wrote: > > > @@ -72,11 +72,13 @@ struct pci_epf_ops { > > * @core_init: Callback for the EPC initialization complete event > > * @link_up: Callback for the EPC link up event > > * @link_down: Callback for the EPC link down event > > + * @bme: Callback for the EPC BME (Bus Master Enable) event > > */ > > struct pci_epc_event_ops { > > int (*core_init)(struct pci_epf *epf); > > int (*link_up)(struct pci_epf *epf); > > int (*link_down)(struct pci_epf *epf); > > + int (*bme)(struct pci_epf *epf); > > I posted a doorbell from host to EP at > https://lore.kernel.org/imx/20230426203436.1277307-2-Frank.Li@nxp.com/T/#u > > Can we consider consolidate these notification to one function and distinguished by > EVENT_ID in future? > My preference is to keep a separate callback for each event as it makes the code look better instead of clubbing everything in a single callback separated by a switch case. - Mani > Best regards > Frank Li > > > }; > > > > /** > > -- > > 2.25.1 >
> > > > Can we consider consolidate these notification to one function and > distinguished by > > EVENT_ID in future? > > > > My preference is to keep a separate callback for each event as it makes the > code > look better instead of clubbing everything in a single callback separated by a > switch case. > Okay, that is not big deal. I hope these can be merged into pci tree soon. So I can add more notification at layerscape platform. > - Mani > > > Best regards > > Frank Li > > > > > }; > > > > > > /** > > > -- > > > 2.25.1 > > > > -- > மணிவண்ணன் சதாசிவம்
diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c index 1ecbe2b1d3bd..ca8f838fa51f 100644 --- a/drivers/pci/endpoint/pci-epc-core.c +++ b/drivers/pci/endpoint/pci-epc-core.c @@ -758,6 +758,32 @@ void pci_epc_init_notify(struct pci_epc *epc) } EXPORT_SYMBOL_GPL(pci_epc_init_notify); +/** + * pci_epc_bme_notify() - Notify the EPF device that the EPC device has received + * the BME event from the Root complex + * @epc: the EPC device that received the BME event + * + * Invoke to Notify the EPF device that the EPC device has received the Bus + * Master Enable (BME) event from the Root complex + */ +void pci_epc_bme_notify(struct pci_epc *epc) +{ + struct pci_epf *epf; + + if (!epc || IS_ERR(epc)) + return; + + mutex_lock(&epc->list_lock); + list_for_each_entry(epf, &epc->pci_epf, list) { + mutex_lock(&epf->lock); + if (epf->event_ops && epf->event_ops->bme) + epf->event_ops->bme(epf); + mutex_unlock(&epf->lock); + } + mutex_unlock(&epc->list_lock); +} +EXPORT_SYMBOL_GPL(pci_epc_bme_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 63a6cc5e5282..5cb694031072 100644 --- a/include/linux/pci-epc.h +++ b/include/linux/pci-epc.h @@ -205,6 +205,7 @@ int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf, 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_bme_notify(struct pci_epc *epc); 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, u8 vfunc_no, diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h index f8e5a63d0c83..f34b3b32a0e7 100644 --- a/include/linux/pci-epf.h +++ b/include/linux/pci-epf.h @@ -72,11 +72,13 @@ struct pci_epf_ops { * @core_init: Callback for the EPC initialization complete event * @link_up: Callback for the EPC link up event * @link_down: Callback for the EPC link down event + * @bme: Callback for the EPC BME (Bus Master Enable) event */ struct pci_epc_event_ops { int (*core_init)(struct pci_epf *epf); int (*link_up)(struct pci_epf *epf); int (*link_down)(struct pci_epf *epf); + int (*bme)(struct pci_epf *epf); }; /**