linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/4] PCI: endpoint: add D-state change notifier support
@ 2023-08-02  3:51 Krishna chaitanya chundru
  2023-08-02  3:51 ` [PATCH v5 1/4] PCI: endpoint: Add " Krishna chaitanya chundru
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Krishna chaitanya chundru @ 2023-08-02  3:51 UTC (permalink / raw)
  To: manivannan.sadhasivam
  Cc: helgaas, linux-pci, linux-arm-msm, linux-kernel, quic_vbadigan,
	quic_nitegupt, quic_skananth, quic_ramkri, quic_parass,
	krzysztof.kozlowski, Krishna chaitanya chundru

In this series we added support to nofity the EPF driver whenever there
is change in the D-state if the EPF driver registered for it.

Krishna chaitanya chundru (4):
  PCI: endpoint: Add D-state change notifier support
  PCI: qcom-ep: Add support for D-state change notification
  PCI: qcom-ep: Update the D-state log
  PCI: epf-mhi: Add support for handling D-state notify from EPC

 Documentation/PCI/endpoint/pci-endpoint.rst  |  4 ++++
 drivers/pci/controller/dwc/pcie-qcom-ep.c    |  9 ++++++++-
 drivers/pci/endpoint/functions/pci-epf-mhi.c | 11 +++++++++++
 drivers/pci/endpoint/pci-epc-core.c          | 27 +++++++++++++++++++++++++++
 include/linux/mhi_ep.h                       |  3 +++
 include/linux/pci-epc.h                      |  1 +
 include/linux/pci-epf.h                      |  1 +
 7 files changed, 55 insertions(+), 1 deletion(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v5 1/4] PCI: endpoint: Add D-state change notifier support
  2023-08-02  3:51 [PATCH v5 0/4] PCI: endpoint: add D-state change notifier support Krishna chaitanya chundru
@ 2023-08-02  3:51 ` Krishna chaitanya chundru
  2023-08-02  5:14   ` kernel test robot
  2023-08-03 17:48   ` Bjorn Helgaas
  2023-08-02  3:51 ` [PATCH v5 2/4] PCI: qcom-ep: Add support for D-state change notification Krishna chaitanya chundru
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 13+ messages in thread
From: Krishna chaitanya chundru @ 2023-08-02  3:51 UTC (permalink / raw)
  To: manivannan.sadhasivam
  Cc: helgaas, linux-pci, linux-arm-msm, linux-kernel, quic_vbadigan,
	quic_nitegupt, quic_skananth, quic_ramkri, quic_parass,
	krzysztof.kozlowski, Krishna chaitanya chundru, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam,
	Kishon Vijay Abraham I, Bjorn Helgaas, Jonathan Corbet,
	open list:DOCUMENTATION

Add support to notify the EPF device about the D-state change event
from the EPC device.

Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
---
 Documentation/PCI/endpoint/pci-endpoint.rst |  4 ++++
 drivers/pci/endpoint/pci-epc-core.c         | 27 +++++++++++++++++++++++++++
 include/linux/pci-epc.h                     |  1 +
 include/linux/pci-epf.h                     |  1 +
 4 files changed, 33 insertions(+)

diff --git a/Documentation/PCI/endpoint/pci-endpoint.rst b/Documentation/PCI/endpoint/pci-endpoint.rst
index 4f5622a..66f3191 100644
--- a/Documentation/PCI/endpoint/pci-endpoint.rst
+++ b/Documentation/PCI/endpoint/pci-endpoint.rst
@@ -78,6 +78,10 @@ by the PCI controller driver.
    Cleanup the pci_epc_mem structure allocated during pci_epc_mem_init().
 
 
+* pci_epc_dstate_notity()
+
+   Notify all the function drivers that the EPC device has changed its D-state.
+
 EPC APIs for the PCI Endpoint Function Driver
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
index 6c54fa5..4cf9c82 100644
--- a/drivers/pci/endpoint/pci-epc-core.c
+++ b/drivers/pci/endpoint/pci-epc-core.c
@@ -785,6 +785,33 @@ void pci_epc_bme_notify(struct pci_epc *epc)
 EXPORT_SYMBOL_GPL(pci_epc_bme_notify);
 
 /**
+ * pci_epc_dstate_notity() - Notify the EPF driver that EPC device D-state
+ *			has changed
+ * @epc: the EPC device which has change in D-state
+ * @state: the changed D-state
+ *
+ * Invoke to Notify the EPF device that the EPC device has D-state has
+ * changed.
+ */
+void pci_epc_dstate_notity(struct pci_epc *epc, pci_power_t state)
+{
+	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->dstate_notify)
+			epf->event_ops->dstate_notify(epf, state);
+		mutex_unlock(&epf->lock);
+	}
+	mutex_unlock(&epc->list_lock);
+}
+EXPORT_SYMBOL_GPL(pci_epc_dstate_notity);
+
+/**
  * 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 5cb6940..26a1108 100644
--- a/include/linux/pci-epc.h
+++ b/include/linux/pci-epc.h
@@ -251,4 +251,5 @@ void __iomem *pci_epc_mem_alloc_addr(struct pci_epc *epc,
 				     phys_addr_t *phys_addr, size_t size);
 void pci_epc_mem_free_addr(struct pci_epc *epc, phys_addr_t phys_addr,
 			   void __iomem *virt_addr, size_t size);
+void pci_epc_dstate_change(struct pci_epc *epc, pci_power_t state);
 #endif /* __LINUX_PCI_EPC_H */
diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h
index 3f44b6a..529075b 100644
--- a/include/linux/pci-epf.h
+++ b/include/linux/pci-epf.h
@@ -79,6 +79,7 @@ struct pci_epc_event_ops {
 	int (*link_up)(struct pci_epf *epf);
 	int (*link_down)(struct pci_epf *epf);
 	int (*bme)(struct pci_epf *epf);
+	int (*dstate_notify)(struct pci_epf *epf, pci_power_t state);
 };
 
 /**
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v5 2/4] PCI: qcom-ep: Add support for D-state change notification
  2023-08-02  3:51 [PATCH v5 0/4] PCI: endpoint: add D-state change notifier support Krishna chaitanya chundru
  2023-08-02  3:51 ` [PATCH v5 1/4] PCI: endpoint: Add " Krishna chaitanya chundru
@ 2023-08-02  3:51 ` Krishna chaitanya chundru
  2023-08-03 10:53   ` kernel test robot
  2023-08-02  3:51 ` [PATCH v5 3/4] PCI: qcom-ep: Update the D-state log Krishna chaitanya chundru
  2023-08-02  3:51 ` [PATCH v5 4/4] PCI: epf-mhi: Add support for handling D-state notify from EPC Krishna chaitanya chundru
  3 siblings, 1 reply; 13+ messages in thread
From: Krishna chaitanya chundru @ 2023-08-02  3:51 UTC (permalink / raw)
  To: manivannan.sadhasivam
  Cc: helgaas, linux-pci, linux-arm-msm, linux-kernel, quic_vbadigan,
	quic_nitegupt, quic_skananth, quic_ramkri, quic_parass,
	krzysztof.kozlowski, Krishna chaitanya chundru,
	Manivannan Sadhasivam, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas

Add support to pass D-state change notification to Endpoint
function driver.

Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
---
 drivers/pci/controller/dwc/pcie-qcom-ep.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
index 0fe7f06..22545ff 100644
--- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
+++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
@@ -561,6 +561,7 @@ static irqreturn_t qcom_pcie_ep_global_irq_thread(int irq, void *data)
 	struct device *dev = pci->dev;
 	u32 status = readl_relaxed(pcie_ep->parf + PARF_INT_ALL_STATUS);
 	u32 mask = readl_relaxed(pcie_ep->parf + PARF_INT_ALL_MASK);
+	pci_power_t state;
 	u32 dstate, val;
 
 	writel_relaxed(status, pcie_ep->parf + PARF_INT_ALL_CLEAR);
@@ -583,11 +584,17 @@ static irqreturn_t qcom_pcie_ep_global_irq_thread(int irq, void *data)
 		dstate = dw_pcie_readl_dbi(pci, DBI_CON_STATUS) &
 					   DBI_CON_STATUS_POWER_STATE_MASK;
 		dev_dbg(dev, "Received D%d state event\n", dstate);
+		state = dstate;
 		if (dstate == 3) {
 			val = readl_relaxed(pcie_ep->parf + PARF_PM_CTRL);
 			val |= PARF_PM_CTRL_REQ_EXIT_L1;
 			writel_relaxed(val, pcie_ep->parf + PARF_PM_CTRL);
+
+			state = PCI_D3hot;
+			if (gpiod_get_value(pcie_ep->reset))
+				state = PCI_D3cold;
 		}
+		pci_epc_dstate_notify(pci->ep.epc, state);
 	} else if (FIELD_GET(PARF_INT_ALL_LINK_UP, status)) {
 		dev_dbg(dev, "Received Linkup event. Enumeration complete!\n");
 		dw_pcie_ep_linkup(&pci->ep);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v5 3/4] PCI: qcom-ep: Update the D-state log
  2023-08-02  3:51 [PATCH v5 0/4] PCI: endpoint: add D-state change notifier support Krishna chaitanya chundru
  2023-08-02  3:51 ` [PATCH v5 1/4] PCI: endpoint: Add " Krishna chaitanya chundru
  2023-08-02  3:51 ` [PATCH v5 2/4] PCI: qcom-ep: Add support for D-state change notification Krishna chaitanya chundru
@ 2023-08-02  3:51 ` Krishna chaitanya chundru
  2023-08-03 17:58   ` Bjorn Helgaas
  2023-08-02  3:51 ` [PATCH v5 4/4] PCI: epf-mhi: Add support for handling D-state notify from EPC Krishna chaitanya chundru
  3 siblings, 1 reply; 13+ messages in thread
From: Krishna chaitanya chundru @ 2023-08-02  3:51 UTC (permalink / raw)
  To: manivannan.sadhasivam
  Cc: helgaas, linux-pci, linux-arm-msm, linux-kernel, quic_vbadigan,
	quic_nitegupt, quic_skananth, quic_ramkri, quic_parass,
	krzysztof.kozlowski, Krishna chaitanya chundru,
	Manivannan Sadhasivam, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas

Now that the state event is stored as pci_power_t, let's use the PCI helper
pci_power_name() to print the state event.

Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
---
 drivers/pci/controller/dwc/pcie-qcom-ep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
index 22545ff..0c69a61 100644
--- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
+++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
@@ -583,7 +583,6 @@ static irqreturn_t qcom_pcie_ep_global_irq_thread(int irq, void *data)
 	} else if (FIELD_GET(PARF_INT_ALL_DSTATE_CHANGE, status)) {
 		dstate = dw_pcie_readl_dbi(pci, DBI_CON_STATUS) &
 					   DBI_CON_STATUS_POWER_STATE_MASK;
-		dev_dbg(dev, "Received D%d state event\n", dstate);
 		state = dstate;
 		if (dstate == 3) {
 			val = readl_relaxed(pcie_ep->parf + PARF_PM_CTRL);
@@ -594,6 +593,7 @@ static irqreturn_t qcom_pcie_ep_global_irq_thread(int irq, void *data)
 			if (gpiod_get_value(pcie_ep->reset))
 				state = PCI_D3cold;
 		}
+		dev_dbg(dev, "Received %s event\n", pci_power_name(state));
 		pci_epc_dstate_notify(pci->ep.epc, state);
 	} else if (FIELD_GET(PARF_INT_ALL_LINK_UP, status)) {
 		dev_dbg(dev, "Received Linkup event. Enumeration complete!\n");
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v5 4/4] PCI: epf-mhi: Add support for handling D-state notify from EPC
  2023-08-02  3:51 [PATCH v5 0/4] PCI: endpoint: add D-state change notifier support Krishna chaitanya chundru
                   ` (2 preceding siblings ...)
  2023-08-02  3:51 ` [PATCH v5 3/4] PCI: qcom-ep: Update the D-state log Krishna chaitanya chundru
@ 2023-08-02  3:51 ` Krishna chaitanya chundru
  3 siblings, 0 replies; 13+ messages in thread
From: Krishna chaitanya chundru @ 2023-08-02  3:51 UTC (permalink / raw)
  To: manivannan.sadhasivam
  Cc: helgaas, linux-pci, linux-arm-msm, linux-kernel, quic_vbadigan,
	quic_nitegupt, quic_skananth, quic_ramkri, quic_parass,
	krzysztof.kozlowski, Krishna chaitanya chundru,
	Manivannan Sadhasivam, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Kishon Vijay Abraham I, Bjorn Helgaas,
	Jeffrey Hugo, open list:MHI BUS

Add support for handling D-state notify for MHI EPF.

Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
---
 drivers/pci/endpoint/functions/pci-epf-mhi.c | 11 +++++++++++
 include/linux/mhi_ep.h                       |  3 +++
 2 files changed, 14 insertions(+)

diff --git a/drivers/pci/endpoint/functions/pci-epf-mhi.c b/drivers/pci/endpoint/functions/pci-epf-mhi.c
index 9c1f5a1..ee91bfc 100644
--- a/drivers/pci/endpoint/functions/pci-epf-mhi.c
+++ b/drivers/pci/endpoint/functions/pci-epf-mhi.c
@@ -339,6 +339,16 @@ static int pci_epf_mhi_bme(struct pci_epf *epf)
 	return 0;
 }
 
+static int pci_epf_mhi_dstate_notify(struct pci_epf *epf, pci_power_t state)
+{
+	struct pci_epf_mhi *epf_mhi = epf_get_drvdata(epf);
+	struct mhi_ep_cntrl *mhi_cntrl = &epf_mhi->mhi_cntrl;
+
+	mhi_cntrl->dstate = state;
+
+	return 0;
+}
+
 static int pci_epf_mhi_bind(struct pci_epf *epf)
 {
 	struct pci_epf_mhi *epf_mhi = epf_get_drvdata(epf);
@@ -394,6 +404,7 @@ static struct pci_epc_event_ops pci_epf_mhi_event_ops = {
 	.link_up = pci_epf_mhi_link_up,
 	.link_down = pci_epf_mhi_link_down,
 	.bme = pci_epf_mhi_bme,
+	.dstate_notify = pci_epf_mhi_dstate_notify,
 };
 
 static int pci_epf_mhi_probe(struct pci_epf *epf,
diff --git a/include/linux/mhi_ep.h b/include/linux/mhi_ep.h
index f198a8a..c3a0685 100644
--- a/include/linux/mhi_ep.h
+++ b/include/linux/mhi_ep.h
@@ -8,6 +8,7 @@
 
 #include <linux/dma-direction.h>
 #include <linux/mhi.h>
+#include <linux/pci.h>
 
 #define MHI_EP_DEFAULT_MTU 0x8000
 
@@ -139,6 +140,8 @@ struct mhi_ep_cntrl {
 
 	enum mhi_state mhi_state;
 
+	pci_power_t dstate;
+
 	u32 max_chan;
 	u32 mru;
 	u32 event_rings;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v5 1/4] PCI: endpoint: Add D-state change notifier support
  2023-08-02  3:51 ` [PATCH v5 1/4] PCI: endpoint: Add " Krishna chaitanya chundru
@ 2023-08-02  5:14   ` kernel test robot
  2023-08-23  6:19     ` Manivannan Sadhasivam
  2023-08-03 17:48   ` Bjorn Helgaas
  1 sibling, 1 reply; 13+ messages in thread
From: kernel test robot @ 2023-08-02  5:14 UTC (permalink / raw)
  To: Krishna chaitanya chundru, manivannan.sadhasivam
  Cc: oe-kbuild-all, helgaas, linux-pci, linux-arm-msm, linux-kernel,
	quic_vbadigan, quic_nitegupt, quic_skananth, quic_ramkri,
	quic_parass, krzysztof.kozlowski, Krishna chaitanya chundru,
	Lorenzo Pieralisi, Krzysztof Wilczyński,
	Manivannan Sadhasivam, Kishon Vijay Abraham I, Jonathan Corbet,
	linux-doc

Hi Krishna,

kernel test robot noticed the following build warnings:

[auto build test WARNING on pci/next]
[also build test WARNING on pci/for-linus linus/master v6.5-rc4 next-20230801]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Krishna-chaitanya-chundru/PCI-endpoint-Add-D-state-change-notifier-support/20230802-115309
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next
patch link:    https://lore.kernel.org/r/1690948281-2143-2-git-send-email-quic_krichai%40quicinc.com
patch subject: [PATCH v5 1/4] PCI: endpoint: Add D-state change notifier support
config: loongarch-allyesconfig (https://download.01.org/0day-ci/archive/20230802/202308021312.obgu7FWM-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230802/202308021312.obgu7FWM-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308021312.obgu7FWM-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/pci/endpoint/pci-epc-core.c:795:6: warning: no previous prototype for 'pci_epc_dstate_notity' [-Wmissing-prototypes]
     795 | void pci_epc_dstate_notity(struct pci_epc *epc, pci_power_t state)
         |      ^~~~~~~~~~~~~~~~~~~~~


vim +/pci_epc_dstate_notity +795 drivers/pci/endpoint/pci-epc-core.c

   785	
   786	/**
   787	 * pci_epc_dstate_notity() - Notify the EPF driver that EPC device D-state
   788	 *			has changed
   789	 * @epc: the EPC device which has change in D-state
   790	 * @state: the changed D-state
   791	 *
   792	 * Invoke to Notify the EPF device that the EPC device has D-state has
   793	 * changed.
   794	 */
 > 795	void pci_epc_dstate_notity(struct pci_epc *epc, pci_power_t state)
   796	{
   797		struct pci_epf *epf;
   798	
   799		if (!epc || IS_ERR(epc))
   800			return;
   801	
   802		mutex_lock(&epc->list_lock);
   803		list_for_each_entry(epf, &epc->pci_epf, list) {
   804			mutex_lock(&epf->lock);
   805			if (epf->event_ops && epf->event_ops->dstate_notify)
   806				epf->event_ops->dstate_notify(epf, state);
   807			mutex_unlock(&epf->lock);
   808		}
   809		mutex_unlock(&epc->list_lock);
   810	}
   811	EXPORT_SYMBOL_GPL(pci_epc_dstate_notity);
   812	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v5 2/4] PCI: qcom-ep: Add support for D-state change notification
  2023-08-02  3:51 ` [PATCH v5 2/4] PCI: qcom-ep: Add support for D-state change notification Krishna chaitanya chundru
@ 2023-08-03 10:53   ` kernel test robot
  0 siblings, 0 replies; 13+ messages in thread
From: kernel test robot @ 2023-08-03 10:53 UTC (permalink / raw)
  To: Krishna chaitanya chundru, manivannan.sadhasivam
  Cc: oe-kbuild-all, helgaas, linux-pci, linux-arm-msm, linux-kernel,
	quic_vbadigan, quic_nitegupt, quic_skananth, quic_ramkri,
	quic_parass, krzysztof.kozlowski, Krishna chaitanya chundru,
	Manivannan Sadhasivam, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Rob Herring

Hi Krishna,

kernel test robot noticed the following build errors:

[auto build test ERROR on pci/next]
[also build test ERROR on pci/for-linus linus/master v6.5-rc4 next-20230803]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Krishna-chaitanya-chundru/PCI-endpoint-Add-D-state-change-notifier-support/20230802-115309
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next
patch link:    https://lore.kernel.org/r/1690948281-2143-3-git-send-email-quic_krichai%40quicinc.com
patch subject: [PATCH v5 2/4] PCI: qcom-ep: Add support for D-state change notification
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20230803/202308031857.u3v2s0bm-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230803/202308031857.u3v2s0bm-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308031857.u3v2s0bm-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/pci/controller/dwc/pcie-qcom-ep.c: In function 'qcom_pcie_ep_global_irq_thread':
>> drivers/pci/controller/dwc/pcie-qcom-ep.c:597:17: error: implicit declaration of function 'pci_epc_dstate_notify'; did you mean 'pci_epc_bme_notify'? [-Werror=implicit-function-declaration]
     597 |                 pci_epc_dstate_notify(pci->ep.epc, state);
         |                 ^~~~~~~~~~~~~~~~~~~~~
         |                 pci_epc_bme_notify
   cc1: some warnings being treated as errors


vim +597 drivers/pci/controller/dwc/pcie-qcom-ep.c

   555	
   556	/* TODO: Notify clients about PCIe state change */
   557	static irqreturn_t qcom_pcie_ep_global_irq_thread(int irq, void *data)
   558	{
   559		struct qcom_pcie_ep *pcie_ep = data;
   560		struct dw_pcie *pci = &pcie_ep->pci;
   561		struct device *dev = pci->dev;
   562		u32 status = readl_relaxed(pcie_ep->parf + PARF_INT_ALL_STATUS);
   563		u32 mask = readl_relaxed(pcie_ep->parf + PARF_INT_ALL_MASK);
   564		pci_power_t state;
   565		u32 dstate, val;
   566	
   567		writel_relaxed(status, pcie_ep->parf + PARF_INT_ALL_CLEAR);
   568		status &= mask;
   569	
   570		if (FIELD_GET(PARF_INT_ALL_LINK_DOWN, status)) {
   571			dev_dbg(dev, "Received Linkdown event\n");
   572			pcie_ep->link_status = QCOM_PCIE_EP_LINK_DOWN;
   573			pci_epc_linkdown(pci->ep.epc);
   574		} else if (FIELD_GET(PARF_INT_ALL_BME, status)) {
   575			dev_dbg(dev, "Received BME event. Link is enabled!\n");
   576			pcie_ep->link_status = QCOM_PCIE_EP_LINK_ENABLED;
   577			pci_epc_bme_notify(pci->ep.epc);
   578		} else if (FIELD_GET(PARF_INT_ALL_PM_TURNOFF, status)) {
   579			dev_dbg(dev, "Received PM Turn-off event! Entering L23\n");
   580			val = readl_relaxed(pcie_ep->parf + PARF_PM_CTRL);
   581			val |= PARF_PM_CTRL_READY_ENTR_L23;
   582			writel_relaxed(val, pcie_ep->parf + PARF_PM_CTRL);
   583		} else if (FIELD_GET(PARF_INT_ALL_DSTATE_CHANGE, status)) {
   584			dstate = dw_pcie_readl_dbi(pci, DBI_CON_STATUS) &
   585						   DBI_CON_STATUS_POWER_STATE_MASK;
   586			dev_dbg(dev, "Received D%d state event\n", dstate);
   587			state = dstate;
   588			if (dstate == 3) {
   589				val = readl_relaxed(pcie_ep->parf + PARF_PM_CTRL);
   590				val |= PARF_PM_CTRL_REQ_EXIT_L1;
   591				writel_relaxed(val, pcie_ep->parf + PARF_PM_CTRL);
   592	
   593				state = PCI_D3hot;
   594				if (gpiod_get_value(pcie_ep->reset))
   595					state = PCI_D3cold;
   596			}
 > 597			pci_epc_dstate_notify(pci->ep.epc, state);
   598		} else if (FIELD_GET(PARF_INT_ALL_LINK_UP, status)) {
   599			dev_dbg(dev, "Received Linkup event. Enumeration complete!\n");
   600			dw_pcie_ep_linkup(&pci->ep);
   601			pcie_ep->link_status = QCOM_PCIE_EP_LINK_UP;
   602		} else {
   603			dev_dbg(dev, "Received unknown event: %d\n", status);
   604		}
   605	
   606		return IRQ_HANDLED;
   607	}
   608	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v5 1/4] PCI: endpoint: Add D-state change notifier support
  2023-08-02  3:51 ` [PATCH v5 1/4] PCI: endpoint: Add " Krishna chaitanya chundru
  2023-08-02  5:14   ` kernel test robot
@ 2023-08-03 17:48   ` Bjorn Helgaas
  2023-09-08  4:41     ` Krishna Chaitanya Chundru
  1 sibling, 1 reply; 13+ messages in thread
From: Bjorn Helgaas @ 2023-08-03 17:48 UTC (permalink / raw)
  To: Krishna chaitanya chundru
  Cc: manivannan.sadhasivam, linux-pci, linux-arm-msm, linux-kernel,
	quic_vbadigan, quic_nitegupt, quic_skananth, quic_ramkri,
	quic_parass, krzysztof.kozlowski, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam,
	Kishon Vijay Abraham I, Bjorn Helgaas, Jonathan Corbet,
	open list:DOCUMENTATION

On Wed, Aug 02, 2023 at 09:21:18AM +0530, Krishna chaitanya chundru wrote:
> Add support to notify the EPF device about the D-state change event
> from the EPC device.
> 
> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
> ---
>  Documentation/PCI/endpoint/pci-endpoint.rst |  4 ++++
>  drivers/pci/endpoint/pci-epc-core.c         | 27 +++++++++++++++++++++++++++
>  include/linux/pci-epc.h                     |  1 +
>  include/linux/pci-epf.h                     |  1 +
>  4 files changed, 33 insertions(+)
> 
> diff --git a/Documentation/PCI/endpoint/pci-endpoint.rst b/Documentation/PCI/endpoint/pci-endpoint.rst
> index 4f5622a..66f3191 100644
> --- a/Documentation/PCI/endpoint/pci-endpoint.rst
> +++ b/Documentation/PCI/endpoint/pci-endpoint.rst
> @@ -78,6 +78,10 @@ by the PCI controller driver.
>     Cleanup the pci_epc_mem structure allocated during pci_epc_mem_init().
>  
>  
> +* pci_epc_dstate_notity()

s/notity/notify/ (several instances)

> +
> +   Notify all the function drivers that the EPC device has changed its D-state.
> +
>  EPC APIs for the PCI Endpoint Function Driver
>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  
> diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
> index 6c54fa5..4cf9c82 100644
> --- a/drivers/pci/endpoint/pci-epc-core.c
> +++ b/drivers/pci/endpoint/pci-epc-core.c
> @@ -785,6 +785,33 @@ void pci_epc_bme_notify(struct pci_epc *epc)
>  EXPORT_SYMBOL_GPL(pci_epc_bme_notify);
>  
>  /**
> + * pci_epc_dstate_notity() - Notify the EPF driver that EPC device D-state
> + *			has changed
> + * @epc: the EPC device which has change in D-state
> + * @state: the changed D-state
> + *
> + * Invoke to Notify the EPF device that the EPC device has D-state has
> + * changed.

s/device has D-state/device D-state/

> + */
> +void pci_epc_dstate_notity(struct pci_epc *epc, pci_power_t state)
> +{
> +	struct pci_epf *epf;
> +
> +	if (!epc || IS_ERR(epc))
> +		return;

Is this needed?  Looks like a programming error if we return here.  I
don't like silently ignoring errors like this.  I generally prefer
taking the NULL pointer dereference oops so we know the caller is
broken and can fix it.

> +	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->dstate_notify)
> +			epf->event_ops->dstate_notify(epf, state);
> +		mutex_unlock(&epf->lock);
> +	}
> +	mutex_unlock(&epc->list_lock);
> +}
> +EXPORT_SYMBOL_GPL(pci_epc_dstate_notity);
> +
> +/**
>   * 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 5cb6940..26a1108 100644
> --- a/include/linux/pci-epc.h
> +++ b/include/linux/pci-epc.h
> @@ -251,4 +251,5 @@ void __iomem *pci_epc_mem_alloc_addr(struct pci_epc *epc,
>  				     phys_addr_t *phys_addr, size_t size);
>  void pci_epc_mem_free_addr(struct pci_epc *epc, phys_addr_t phys_addr,
>  			   void __iomem *virt_addr, size_t size);
> +void pci_epc_dstate_change(struct pci_epc *epc, pci_power_t state);
>  #endif /* __LINUX_PCI_EPC_H */
> diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h
> index 3f44b6a..529075b 100644
> --- a/include/linux/pci-epf.h
> +++ b/include/linux/pci-epf.h
> @@ -79,6 +79,7 @@ struct pci_epc_event_ops {
>  	int (*link_up)(struct pci_epf *epf);
>  	int (*link_down)(struct pci_epf *epf);
>  	int (*bme)(struct pci_epf *epf);
> +	int (*dstate_notify)(struct pci_epf *epf, pci_power_t state);
>  };
>  
>  /**
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v5 3/4] PCI: qcom-ep: Update the D-state log
  2023-08-02  3:51 ` [PATCH v5 3/4] PCI: qcom-ep: Update the D-state log Krishna chaitanya chundru
@ 2023-08-03 17:58   ` Bjorn Helgaas
  2023-09-08  4:43     ` Krishna Chaitanya Chundru
  0 siblings, 1 reply; 13+ messages in thread
From: Bjorn Helgaas @ 2023-08-03 17:58 UTC (permalink / raw)
  To: Krishna chaitanya chundru
  Cc: manivannan.sadhasivam, linux-pci, linux-arm-msm, linux-kernel,
	quic_vbadigan, quic_nitegupt, quic_skananth, quic_ramkri,
	quic_parass, krzysztof.kozlowski, Manivannan Sadhasivam,
	Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
	Bjorn Helgaas

In subject:

  PCI: qcom-ep: Print D-state name to distinguish D3hot/D3cold

("Update" doesn't give any hint about what the change does.)

On Wed, Aug 02, 2023 at 09:21:20AM +0530, Krishna chaitanya chundru wrote:
> Now that the state event is stored as pci_power_t, let's use the PCI helper
> pci_power_name() to print the state event.

s/let's use/use/

The main change is this, right?

  D3 -> D3hot
  D4 -> D3cold

> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
> ---
>  drivers/pci/controller/dwc/pcie-qcom-ep.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
> index 22545ff..0c69a61 100644
> --- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
> +++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
> @@ -583,7 +583,6 @@ static irqreturn_t qcom_pcie_ep_global_irq_thread(int irq, void *data)
>  	} else if (FIELD_GET(PARF_INT_ALL_DSTATE_CHANGE, status)) {
>  		dstate = dw_pcie_readl_dbi(pci, DBI_CON_STATUS) &
>  					   DBI_CON_STATUS_POWER_STATE_MASK;
> -		dev_dbg(dev, "Received D%d state event\n", dstate);
>  		state = dstate;
>  		if (dstate == 3) {

Can this check for "state == PCI_D3hot" to be clearer?

>  			val = readl_relaxed(pcie_ep->parf + PARF_PM_CTRL);
> @@ -594,6 +593,7 @@ static irqreturn_t qcom_pcie_ep_global_irq_thread(int irq, void *data)
>  			if (gpiod_get_value(pcie_ep->reset))
>  				state = PCI_D3cold;
>  		}
> +		dev_dbg(dev, "Received %s event\n", pci_power_name(state));

Not really sure why this needs to be moved (the diff would be clearer
if it stayed in the same spot), but it doesn't look like it really
matters.

>  		pci_epc_dstate_notify(pci->ep.epc, state);
>  	} else if (FIELD_GET(PARF_INT_ALL_LINK_UP, status)) {
>  		dev_dbg(dev, "Received Linkup event. Enumeration complete!\n");
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v5 1/4] PCI: endpoint: Add D-state change notifier support
  2023-08-02  5:14   ` kernel test robot
@ 2023-08-23  6:19     ` Manivannan Sadhasivam
  2023-09-08  4:44       ` Krishna Chaitanya Chundru
  0 siblings, 1 reply; 13+ messages in thread
From: Manivannan Sadhasivam @ 2023-08-23  6:19 UTC (permalink / raw)
  To: kernel test robot
  Cc: Krishna chaitanya chundru, manivannan.sadhasivam, oe-kbuild-all,
	helgaas, linux-pci, linux-arm-msm, linux-kernel, quic_vbadigan,
	quic_nitegupt, quic_skananth, quic_ramkri, quic_parass,
	krzysztof.kozlowski, Lorenzo Pieralisi, Krzysztof Wilczyński,
	Kishon Vijay Abraham I, Jonathan Corbet, linux-doc

On Wed, Aug 02, 2023 at 01:14:44PM +0800, kernel test robot wrote:
> Hi Krishna,
> 
> kernel test robot noticed the following build warnings:
> 
> [auto build test WARNING on pci/next]
> [also build test WARNING on pci/for-linus linus/master v6.5-rc4 next-20230801]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Krishna-chaitanya-chundru/PCI-endpoint-Add-D-state-change-notifier-support/20230802-115309
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next
> patch link:    https://lore.kernel.org/r/1690948281-2143-2-git-send-email-quic_krichai%40quicinc.com
> patch subject: [PATCH v5 1/4] PCI: endpoint: Add D-state change notifier support
> config: loongarch-allyesconfig (https://download.01.org/0day-ci/archive/20230802/202308021312.obgu7FWM-lkp@intel.com/config)
> compiler: loongarch64-linux-gcc (GCC) 12.3.0
> reproduce: (https://download.01.org/0day-ci/archive/20230802/202308021312.obgu7FWM-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202308021312.obgu7FWM-lkp@intel.com/
> 
> All warnings (new ones prefixed by >>):
> 
> >> drivers/pci/endpoint/pci-epc-core.c:795:6: warning: no previous prototype for 'pci_epc_dstate_notity' [-Wmissing-prototypes]
>      795 | void pci_epc_dstate_notity(struct pci_epc *epc, pci_power_t state)

This tells that you haven't build tested the series before sending. Please
always do both build and functionality testing before sending each iteration.

- Mani

>          |      ^~~~~~~~~~~~~~~~~~~~~
> 
> 
> vim +/pci_epc_dstate_notity +795 drivers/pci/endpoint/pci-epc-core.c
> 
>    785	
>    786	/**
>    787	 * pci_epc_dstate_notity() - Notify the EPF driver that EPC device D-state
>    788	 *			has changed
>    789	 * @epc: the EPC device which has change in D-state
>    790	 * @state: the changed D-state
>    791	 *
>    792	 * Invoke to Notify the EPF device that the EPC device has D-state has
>    793	 * changed.
>    794	 */
>  > 795	void pci_epc_dstate_notity(struct pci_epc *epc, pci_power_t state)
>    796	{
>    797		struct pci_epf *epf;
>    798	
>    799		if (!epc || IS_ERR(epc))
>    800			return;
>    801	
>    802		mutex_lock(&epc->list_lock);
>    803		list_for_each_entry(epf, &epc->pci_epf, list) {
>    804			mutex_lock(&epf->lock);
>    805			if (epf->event_ops && epf->event_ops->dstate_notify)
>    806				epf->event_ops->dstate_notify(epf, state);
>    807			mutex_unlock(&epf->lock);
>    808		}
>    809		mutex_unlock(&epc->list_lock);
>    810	}
>    811	EXPORT_SYMBOL_GPL(pci_epc_dstate_notity);
>    812	
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki

-- 
மணிவண்ணன் சதாசிவம்

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v5 1/4] PCI: endpoint: Add D-state change notifier support
  2023-08-03 17:48   ` Bjorn Helgaas
@ 2023-09-08  4:41     ` Krishna Chaitanya Chundru
  0 siblings, 0 replies; 13+ messages in thread
From: Krishna Chaitanya Chundru @ 2023-09-08  4:41 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: manivannan.sadhasivam, linux-pci, linux-arm-msm, linux-kernel,
	quic_vbadigan, quic_nitegupt, quic_skananth, quic_ramkri,
	quic_parass, krzysztof.kozlowski, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam,
	Kishon Vijay Abraham I, Bjorn Helgaas, Jonathan Corbet,
	open list:DOCUMENTATION


On 8/3/2023 11:18 PM, Bjorn Helgaas wrote:
> On Wed, Aug 02, 2023 at 09:21:18AM +0530, Krishna chaitanya chundru wrote:
>> Add support to notify the EPF device about the D-state change event
>> from the EPC device.
>>
>> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
>> ---
>>   Documentation/PCI/endpoint/pci-endpoint.rst |  4 ++++
>>   drivers/pci/endpoint/pci-epc-core.c         | 27 +++++++++++++++++++++++++++
>>   include/linux/pci-epc.h                     |  1 +
>>   include/linux/pci-epf.h                     |  1 +
>>   4 files changed, 33 insertions(+)
>>
>> diff --git a/Documentation/PCI/endpoint/pci-endpoint.rst b/Documentation/PCI/endpoint/pci-endpoint.rst
>> index 4f5622a..66f3191 100644
>> --- a/Documentation/PCI/endpoint/pci-endpoint.rst
>> +++ b/Documentation/PCI/endpoint/pci-endpoint.rst
>> @@ -78,6 +78,10 @@ by the PCI controller driver.
>>      Cleanup the pci_epc_mem structure allocated during pci_epc_mem_init().
>>   
>>   
>> +* pci_epc_dstate_notity()
> s/notity/notify/ (several instances)

sorry for late reply, till now I was using a different branch which has 
some out of tree patches for testing and rebasing the patch on 
linux-next to send them because of that few things are getting missed.

Now I took time to completely move to the linux next so that testing and 
sending patches will be on same code base.

>> +
>> +   Notify all the function drivers that the EPC device has changed its D-state.
>> +
>>   EPC APIs for the PCI Endpoint Function Driver
>>   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>   
>> diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
>> index 6c54fa5..4cf9c82 100644
>> --- a/drivers/pci/endpoint/pci-epc-core.c
>> +++ b/drivers/pci/endpoint/pci-epc-core.c
>> @@ -785,6 +785,33 @@ void pci_epc_bme_notify(struct pci_epc *epc)
>>   EXPORT_SYMBOL_GPL(pci_epc_bme_notify);
>>   
>>   /**
>> + * pci_epc_dstate_notity() - Notify the EPF driver that EPC device D-state
>> + *			has changed
>> + * @epc: the EPC device which has change in D-state
>> + * @state: the changed D-state
>> + *
>> + * Invoke to Notify the EPF device that the EPC device has D-state has
>> + * changed.
> s/device has D-state/device D-state/
>
>> + */
>> +void pci_epc_dstate_notity(struct pci_epc *epc, pci_power_t state)
>> +{
>> +	struct pci_epf *epf;
>> +
>> +	if (!epc || IS_ERR(epc))
>> +		return;
> Is this needed?  Looks like a programming error if we return here.  I
> don't like silently ignoring errors like this.  I generally prefer
> taking the NULL pointer dereference oops so we know the caller is
> broken and can fix it.
sure I will remove this check in the next patch series.
>
>> +	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->dstate_notify)
>> +			epf->event_ops->dstate_notify(epf, state);
>> +		mutex_unlock(&epf->lock);
>> +	}
>> +	mutex_unlock(&epc->list_lock);
>> +}
>> +EXPORT_SYMBOL_GPL(pci_epc_dstate_notity);
>> +
>> +/**
>>    * 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 5cb6940..26a1108 100644
>> --- a/include/linux/pci-epc.h
>> +++ b/include/linux/pci-epc.h
>> @@ -251,4 +251,5 @@ void __iomem *pci_epc_mem_alloc_addr(struct pci_epc *epc,
>>   				     phys_addr_t *phys_addr, size_t size);
>>   void pci_epc_mem_free_addr(struct pci_epc *epc, phys_addr_t phys_addr,
>>   			   void __iomem *virt_addr, size_t size);
>> +void pci_epc_dstate_change(struct pci_epc *epc, pci_power_t state);
>>   #endif /* __LINUX_PCI_EPC_H */
>> diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h
>> index 3f44b6a..529075b 100644
>> --- a/include/linux/pci-epf.h
>> +++ b/include/linux/pci-epf.h
>> @@ -79,6 +79,7 @@ struct pci_epc_event_ops {
>>   	int (*link_up)(struct pci_epf *epf);
>>   	int (*link_down)(struct pci_epf *epf);
>>   	int (*bme)(struct pci_epf *epf);
>> +	int (*dstate_notify)(struct pci_epf *epf, pci_power_t state);
>>   };
>>   
>>   /**
>> -- 
>> 2.7.4
>>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v5 3/4] PCI: qcom-ep: Update the D-state log
  2023-08-03 17:58   ` Bjorn Helgaas
@ 2023-09-08  4:43     ` Krishna Chaitanya Chundru
  0 siblings, 0 replies; 13+ messages in thread
From: Krishna Chaitanya Chundru @ 2023-09-08  4:43 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: manivannan.sadhasivam, linux-pci, linux-arm-msm, linux-kernel,
	quic_vbadigan, quic_nitegupt, quic_skananth, quic_ramkri,
	quic_parass, krzysztof.kozlowski, Manivannan Sadhasivam,
	Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
	Bjorn Helgaas


On 8/3/2023 11:28 PM, Bjorn Helgaas wrote:
> In subject:
>
>    PCI: qcom-ep: Print D-state name to distinguish D3hot/D3cold
>
> ("Update" doesn't give any hint about what the change does.)
I will update it as suggested.
> On Wed, Aug 02, 2023 at 09:21:20AM +0530, Krishna chaitanya chundru wrote:
>> Now that the state event is stored as pci_power_t, let's use the PCI helper
>> pci_power_name() to print the state event.
> s/let's use/use/
>
> The main change is this, right?
>
>    D3 -> D3hot
>    D4 -> D3cold
Yes this is the main change.
>> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
>> ---
>>   drivers/pci/controller/dwc/pcie-qcom-ep.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
>> index 22545ff..0c69a61 100644
>> --- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
>> +++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
>> @@ -583,7 +583,6 @@ static irqreturn_t qcom_pcie_ep_global_irq_thread(int irq, void *data)
>>   	} else if (FIELD_GET(PARF_INT_ALL_DSTATE_CHANGE, status)) {
>>   		dstate = dw_pcie_readl_dbi(pci, DBI_CON_STATUS) &
>>   					   DBI_CON_STATUS_POWER_STATE_MASK;
>> -		dev_dbg(dev, "Received D%d state event\n", dstate);
>>   		state = dstate;
>>   		if (dstate == 3) {
> Can this check for "state == PCI_D3hot" to be clearer?
I will modify this.
>
>>   			val = readl_relaxed(pcie_ep->parf + PARF_PM_CTRL);
>> @@ -594,6 +593,7 @@ static irqreturn_t qcom_pcie_ep_global_irq_thread(int irq, void *data)
>>   			if (gpiod_get_value(pcie_ep->reset))
>>   				state = PCI_D3cold;
>>   		}
>> +		dev_dbg(dev, "Received %s event\n", pci_power_name(state));
> Not really sure why this needs to be moved (the diff would be clearer
> if it stayed in the same spot), but it doesn't look like it really
> matters.

As we know if the link is in D3hot or D3cold moving the log here so that 
we can log correct Dstate.

- KC

>>   		pci_epc_dstate_notify(pci->ep.epc, state);
>>   	} else if (FIELD_GET(PARF_INT_ALL_LINK_UP, status)) {
>>   		dev_dbg(dev, "Received Linkup event. Enumeration complete!\n");
>> -- 
>> 2.7.4
>>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v5 1/4] PCI: endpoint: Add D-state change notifier support
  2023-08-23  6:19     ` Manivannan Sadhasivam
@ 2023-09-08  4:44       ` Krishna Chaitanya Chundru
  0 siblings, 0 replies; 13+ messages in thread
From: Krishna Chaitanya Chundru @ 2023-09-08  4:44 UTC (permalink / raw)
  To: Manivannan Sadhasivam, kernel test robot
  Cc: manivannan.sadhasivam, oe-kbuild-all, helgaas, linux-pci,
	linux-arm-msm, linux-kernel, quic_vbadigan, quic_nitegupt,
	quic_skananth, quic_ramkri, quic_parass, krzysztof.kozlowski,
	Lorenzo Pieralisi, Krzysztof Wilczyński,
	Kishon Vijay Abraham I, Jonathan Corbet, linux-doc


On 8/23/2023 11:49 AM, Manivannan Sadhasivam wrote:
> On Wed, Aug 02, 2023 at 01:14:44PM +0800, kernel test robot wrote:
>> Hi Krishna,
>>
>> kernel test robot noticed the following build warnings:
>>
>> [auto build test WARNING on pci/next]
>> [also build test WARNING on pci/for-linus linus/master v6.5-rc4 next-20230801]
>> [If your patch is applied to the wrong git tree, kindly drop us a note.
>> And when submitting patch, we suggest to use '--base' as documented in
>> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>>
>> url:    https://github.com/intel-lab-lkp/linux/commits/Krishna-chaitanya-chundru/PCI-endpoint-Add-D-state-change-notifier-support/20230802-115309
>> base:   https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next
>> patch link:    https://lore.kernel.org/r/1690948281-2143-2-git-send-email-quic_krichai%40quicinc.com
>> patch subject: [PATCH v5 1/4] PCI: endpoint: Add D-state change notifier support
>> config: loongarch-allyesconfig (https://download.01.org/0day-ci/archive/20230802/202308021312.obgu7FWM-lkp@intel.com/config)
>> compiler: loongarch64-linux-gcc (GCC) 12.3.0
>> reproduce: (https://download.01.org/0day-ci/archive/20230802/202308021312.obgu7FWM-lkp@intel.com/reproduce)
>>
>> If you fix the issue in a separate patch/commit (i.e. not just a new version of
>> the same patch/commit), kindly add following tags
>> | Reported-by: kernel test robot <lkp@intel.com>
>> | Closes: https://lore.kernel.org/oe-kbuild-all/202308021312.obgu7FWM-lkp@intel.com/
>>
>> All warnings (new ones prefixed by >>):
>>
>>>> drivers/pci/endpoint/pci-epc-core.c:795:6: warning: no previous prototype for 'pci_epc_dstate_notity' [-Wmissing-prototypes]
>>       795 | void pci_epc_dstate_notity(struct pci_epc *epc, pci_power_t state)
> This tells that you haven't build tested the series before sending. Please
> always do both build and functionality testing before sending each iteration.
>
> - Mani

sorry for late reply, till now I was using a different branch which has 
some out of tree patches for testing and rebasing the patch on 
linux-next to send them because of that few things are getting missed.

Now I took time to completely move to the linux next so that testing and 
sending patches will be on same code base.

I will correct this in next patch series.

- KC

>>           |      ^~~~~~~~~~~~~~~~~~~~~
>>
>>
>> vim +/pci_epc_dstate_notity +795 drivers/pci/endpoint/pci-epc-core.c
>>
>>     785	
>>     786	/**
>>     787	 * pci_epc_dstate_notity() - Notify the EPF driver that EPC device D-state
>>     788	 *			has changed
>>     789	 * @epc: the EPC device which has change in D-state
>>     790	 * @state: the changed D-state
>>     791	 *
>>     792	 * Invoke to Notify the EPF device that the EPC device has D-state has
>>     793	 * changed.
>>     794	 */
>>   > 795	void pci_epc_dstate_notity(struct pci_epc *epc, pci_power_t state)
>>     796	{
>>     797		struct pci_epf *epf;
>>     798	
>>     799		if (!epc || IS_ERR(epc))
>>     800			return;
>>     801	
>>     802		mutex_lock(&epc->list_lock);
>>     803		list_for_each_entry(epf, &epc->pci_epf, list) {
>>     804			mutex_lock(&epf->lock);
>>     805			if (epf->event_ops && epf->event_ops->dstate_notify)
>>     806				epf->event_ops->dstate_notify(epf, state);
>>     807			mutex_unlock(&epf->lock);
>>     808		}
>>     809		mutex_unlock(&epc->list_lock);
>>     810	}
>>     811	EXPORT_SYMBOL_GPL(pci_epc_dstate_notity);
>>     812	
>>
>> -- 
>> 0-DAY CI Kernel Test Service
>> https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-09-08  4:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-02  3:51 [PATCH v5 0/4] PCI: endpoint: add D-state change notifier support Krishna chaitanya chundru
2023-08-02  3:51 ` [PATCH v5 1/4] PCI: endpoint: Add " Krishna chaitanya chundru
2023-08-02  5:14   ` kernel test robot
2023-08-23  6:19     ` Manivannan Sadhasivam
2023-09-08  4:44       ` Krishna Chaitanya Chundru
2023-08-03 17:48   ` Bjorn Helgaas
2023-09-08  4:41     ` Krishna Chaitanya Chundru
2023-08-02  3:51 ` [PATCH v5 2/4] PCI: qcom-ep: Add support for D-state change notification Krishna chaitanya chundru
2023-08-03 10:53   ` kernel test robot
2023-08-02  3:51 ` [PATCH v5 3/4] PCI: qcom-ep: Update the D-state log Krishna chaitanya chundru
2023-08-03 17:58   ` Bjorn Helgaas
2023-09-08  4:43     ` Krishna Chaitanya Chundru
2023-08-02  3:51 ` [PATCH v5 4/4] PCI: epf-mhi: Add support for handling D-state notify from EPC Krishna chaitanya chundru

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).