lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210616115913.138778-6-manivannan.sadhasivam@linaro.org>
Date:   Wed, 16 Jun 2021 17:29:13 +0530
From:   Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
To:     kishon@...com, lorenzo.pieralisi@....com, bhelgaas@...gle.com
Cc:     linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-msm@...r.kernel.org, hemantk@...eaurora.org,
        smohanad@...eaurora.org,
        Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
Subject: [PATCH 5/5] PCI: endpoint: Add custom notifier support

Add support for notifying the EPF device about the custom notifications
received by the EPC device from the Root complex. These notifications
are EPC/vendor specific and are shared with the specific EPF devices.

For instance, the Qcom EPC device generates events such as MHI_A7,
MHI_Q6, DEBUG, MMIO_WRITE, CFG_WRITE etc... These events can be passed
to the EPF device using this notifier.

EPC
---

```
static irqreturn_t pcie_ep_irq(int irq, void *data)
{
...
	case PCIE_EP_INT_MHI_A7:
		pci_epc_custom_notify(epc, PCIE_EP_INT_MHI_A7);
		break;
	case PCIE_EP_INT_MHI_Q6:
		pci_epc_custom_notify(epc, PCIE_EP_INT_MHI_Q6);
		break;
	case PCIE_EP_INT_MMIO_WRITE:
		pci_epc_custom_notify(epc, PCIE_EP_INT_MMIO_WRITE);
		break;
...
}
```

EPF
---

```
static int pci_epf_notifier(struct notifier_block *nb, unsigned long val,
			    void *data)
{
...
	case CUSTOM:
		cus_event = data;
		if (cus_event == PCIE_EP_INT_MHI_A7)
			/* Handle MHI A7 event */
		else if (cus_event == PCIE_EP_INT_MHI_Q6)
			/* Handle MHI Q6 event */
		else if (cus_event == PCIE_EP_INT_MMIO_WRITE)
			/* Handle MMIO WRITE event */
		break;
...
}
```

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.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 b4a7bb3caa97..b963a4aa0af4 100644
--- a/drivers/pci/endpoint/pci-epc-core.c
+++ b/drivers/pci/endpoint/pci-epc-core.c
@@ -728,6 +728,25 @@ void pci_epc_d_state_notify(struct pci_epc *epc, void *data)
 }
 EXPORT_SYMBOL_GPL(pci_epc_d_state_notify);
 
+/**
+ * pci_epc_custom_notify() - Notify the EPF device that the EPC device has
+ *			     received the custom events from the Root complex
+ * @epc: EPC device that received the custom event
+ * @data: Data for the CUSTOM notifier
+ *
+ * Invoke to notify the EPF device that the EPC device has received the Custom
+ * event from the Root complex. The custom event is EPC/vendor specific and is
+ * 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 94c66fae8a88..943d31a83f6e 100644
--- a/include/linux/pci-epc.h
+++ b/include/linux/pci-epc.h
@@ -207,6 +207,7 @@ void pci_epc_init_notify(struct pci_epc *epc);
 void pci_epc_bme_notify(struct pci_epc *epc);
 void pci_epc_pme_notify(struct pci_epc *epc, void *data);
 void pci_epc_d_state_notify(struct pci_epc *epc, void *data);
+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 ca020c080431..2fa3b90399b9 100644
--- a/include/linux/pci-epf.h
+++ b/include/linux/pci-epf.h
@@ -24,6 +24,7 @@ enum pci_notify_event {
 	BME,
 	PME,
 	D_STATE,
+	CUSTOM,
 };
 
 enum pci_barno {
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ