diff mbox series

[RFC,4.19.y-cip,28/50] PCI: endpoint: Add notification for core init completion

Message ID 20201012141933.9652-29-prabhakar.mahadev-lad.rj@bp.renesas.com
State Superseded
Headers show
Series Add PCIe EP support for Renesas R-Car Gen3 and RZ/G2x | expand

Commit Message

Lad Prabhakar Oct. 12, 2020, 2:19 p.m. UTC
From: Vidya Sagar <vidyas@nvidia.com>

commit 0ef22dcf0c1871888c4c0ee46a9d9c494f2fe997 upstream.

Add support to send notifications to EPF from EPC once the core
registers initialization is complete.

Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/pci/endpoint/pci-epc-core.c | 19 ++++++++++++++++++-
 include/linux/pci-epc.h             |  1 +
 include/linux/pci-epf.h             |  5 +++++
 3 files changed, 24 insertions(+), 1 deletion(-)

Comments

Pavel Machek Oct. 21, 2020, 7 p.m. UTC | #1
Hi!

> From: Vidya Sagar <vidyas@nvidia.com>
> 
> commit 0ef22dcf0c1871888c4c0ee46a9d9c494f2fe997 upstream.
> 
> Add support to send notifications to EPF from EPC once the core
> registers initialization is complete.

>  
> +/**
> + * pci_epc_init_notify() - Notify the EPF device that EPC device's core
> + *			   initialization is completed.
> + * @epc: the EPC device whose core initialization is completeds
> + *
> + * Invoke to Notify the EPF device that the EPC device's initialization
> + * is completed.
> + */
> +void pci_epc_init_notify(struct pci_epc *epc)
> +{
> +	if (!epc || IS_ERR(epc))
> +		return;
> +
> +	atomic_notifier_call_chain(&epc->notifier, CORE_INIT, NULL);
> +}
> +EXPORT_SYMBOL_GPL(pci_epc_init_notify);

Is this used somewhere? This adds symbol but noone calls this, and
AFAICT it is not used in the rest of the series, either.

We can merge it, anyway, I guess, but... explanation would be welcome.

Best regards,
								Pavel
Lad Prabhakar Oct. 21, 2020, 8:16 p.m. UTC | #2
Hi Pavel,

Thank you for the review.

> -----Original Message-----
> From: Pavel Machek <pavel@denx.de>
> Sent: 21 October 2020 20:01
> To: Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Cc: cip-dev@lists.cip-project.org; Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>; Pavel Machek <pavel@denx.de>; Biju Das
> <biju.das.jz@bp.renesas.com>
> Subject: Re: [RFC PATCH 4.19.y-cip 28/50] PCI: endpoint: Add notification for core init completion
> 
> Hi!
> 
> > From: Vidya Sagar <vidyas@nvidia.com>
> >
> > commit 0ef22dcf0c1871888c4c0ee46a9d9c494f2fe997 upstream.
> >
> > Add support to send notifications to EPF from EPC once the core
> > registers initialization is complete.
> 
> >
> > +/**
> > + * pci_epc_init_notify() - Notify the EPF device that EPC device's core
> > + *			   initialization is completed.
> > + * @epc: the EPC device whose core initialization is completeds
> > + *
> > + * Invoke to Notify the EPF device that the EPC device's initialization
> > + * is completed.
> > + */
> > +void pci_epc_init_notify(struct pci_epc *epc)
> > +{
> > +	if (!epc || IS_ERR(epc))
> > +		return;
> > +
> > +	atomic_notifier_call_chain(&epc->notifier, CORE_INIT, NULL);
> > +}
> > +EXPORT_SYMBOL_GPL(pci_epc_init_notify);
> 
> Is this used somewhere? This adds symbol but noone calls this, and
> AFAICT it is not used in the rest of the series, either.
> 
Yep none users (only dwc uses it mainline).

> We can merge it, anyway, I guess, but... explanation would be welcome.
>
Ill post it as part of non-RFC feel free to drop it.

Cheers,
Prabhakar
 
> Best regards,
> 								Pavel
> 
> --
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#5636): https://lists.cip-project.org/g/cip-dev/message/5636
Mute This Topic: https://lists.cip-project.org/mt/77461704/4520388
Group Owner: cip-dev+owner@lists.cip-project.org
Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129055/727948398/xyzzy [cip-dev@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-
diff mbox series

Patch

diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
index dc1c673534e0..0d22a377a0cf 100644
--- a/drivers/pci/endpoint/pci-epc-core.c
+++ b/drivers/pci/endpoint/pci-epc-core.c
@@ -540,10 +540,27 @@  void pci_epc_linkup(struct pci_epc *epc)
 	if (!epc || IS_ERR(epc))
 		return;
 
-	atomic_notifier_call_chain(&epc->notifier, 0, NULL);
+	atomic_notifier_call_chain(&epc->notifier, LINK_UP, NULL);
 }
 EXPORT_SYMBOL_GPL(pci_epc_linkup);
 
+/**
+ * pci_epc_init_notify() - Notify the EPF device that EPC device's core
+ *			   initialization is completed.
+ * @epc: the EPC device whose core initialization is completeds
+ *
+ * Invoke to Notify the EPF device that the EPC device's initialization
+ * is completed.
+ */
+void pci_epc_init_notify(struct pci_epc *epc)
+{
+	if (!epc || IS_ERR(epc))
+		return;
+
+	atomic_notifier_call_chain(&epc->notifier, CORE_INIT, NULL);
+}
+EXPORT_SYMBOL_GPL(pci_epc_init_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 8f9bbc4b7ad1..77e04ee1fe05 100644
--- a/include/linux/pci-epc.h
+++ b/include/linux/pci-epc.h
@@ -165,6 +165,7 @@  void devm_pci_epc_destroy(struct device *dev, struct pci_epc *epc);
 void pci_epc_destroy(struct pci_epc *epc);
 int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf);
 void pci_epc_linkup(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);
 int pci_epc_write_header(struct pci_epc *epc, u8 func_no,
 			 struct pci_epf_header *hdr);
diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h
index bcdf4f07bde7..0c628e30c582 100644
--- a/include/linux/pci-epf.h
+++ b/include/linux/pci-epf.h
@@ -15,6 +15,11 @@ 
 
 struct pci_epf;
 
+enum pci_notify_event {
+	CORE_INIT,
+	LINK_UP,
+};
+
 enum pci_barno {
 	BAR_0,
 	BAR_1,