mbox series

[v3,0/5] In-kernel QMI helpers and sysmon

Message ID 20171115201012.25892-1-bjorn.andersson@linaro.org
Headers show
Series In-kernel QMI helpers and sysmon | expand

Message

Bjorn Andersson Nov. 15, 2017, 8:10 p.m. UTC
This series introduces a helper library for drivers that needs to implement
clients or services in the kernel for communicating with QMI encoded messages.

This is used by a set of drivers in order to implement control signaling that
needs to happen between a driver and a service on a remote processor, such as
the synchronization of states during a remoteproc shutdown/restart; as seen in
the sysmon implementation.

Finally a sample driver provides an implementation of the "test" protocol,
which is a service typically implemented by Qualcomm remoteproc firmware.

Changes since v2:
- Fix reported typos
- Checkpatch fixes
- Use non-gpl EXPORT_SYMBOL

Changes since v1:
- Lot of modifications to QMI interface, from feedback and implementation and
  testing of sysmon.
- Added sysmon driver.
- Added patch for remoteproc to pass gracefulness on subdev remove.
- QRTR patches part of v1 was merged separately

Bjorn Andersson (5):
  soc: qcom: Introduce QMI encoder/decoder
  soc: qcom: Introduce QMI helpers
  remoteproc: Pass type of shutdown to subdev remove
  remoteproc: qcom: Introduce sysmon
  samples: Introduce Qualcomm QMI sample client

 drivers/remoteproc/Kconfig           |  17 +
 drivers/remoteproc/Makefile          |   1 +
 drivers/remoteproc/qcom_adsp_pil.c   |  12 +
 drivers/remoteproc/qcom_common.c     |   6 +-
 drivers/remoteproc/qcom_common.h     |  21 +
 drivers/remoteproc/qcom_q6v5_pil.c   |   3 +
 drivers/remoteproc/qcom_sysmon.c     | 585 ++++++++++++++++++++++++
 drivers/remoteproc/qcom_wcnss.c      |   4 +
 drivers/remoteproc/remoteproc_core.c |  18 +-
 drivers/soc/qcom/Kconfig             |   9 +
 drivers/soc/qcom/Makefile            |   3 +
 drivers/soc/qcom/qmi_encdec.c        | 821 +++++++++++++++++++++++++++++++++
 drivers/soc/qcom/qmi_interface.c     | 849 +++++++++++++++++++++++++++++++++++
 include/linux/remoteproc.h           |   4 +-
 include/linux/soc/qcom/qmi.h         | 272 +++++++++++
 samples/Kconfig                      |   9 +
 samples/Makefile                     |   2 +-
 samples/qmi/Makefile                 |   1 +
 samples/qmi/qmi_sample_client.c      | 631 ++++++++++++++++++++++++++
 19 files changed, 3253 insertions(+), 15 deletions(-)
 create mode 100644 drivers/remoteproc/qcom_sysmon.c
 create mode 100644 drivers/soc/qcom/qmi_encdec.c
 create mode 100644 drivers/soc/qcom/qmi_interface.c
 create mode 100644 include/linux/soc/qcom/qmi.h
 create mode 100644 samples/qmi/Makefile
 create mode 100644 samples/qmi/qmi_sample_client.c

-- 
2.15.0

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Chris Lew Nov. 16, 2017, 8:05 p.m. UTC | #1
Hi Bjorn,

Question about the SSR events for sysmon.

Thanks,
Chris

On 11/15/2017 12:10 PM, Bjorn Andersson wrote:

[..]
> +/**

> + * ssctl_send_event() - send notification of other remote's SSR event

> + * @sysmon:	sysmon context

> + * @name:	other remote's name

> + */

> +static void ssctl_send_event(struct qcom_sysmon *sysmon, const char *name)

> +{

> +	struct ssctl_subsys_event_resp resp;

> +	struct ssctl_subsys_event_req req;

> +	struct qmi_txn txn;

> +	int ret;

> +

> +	memset(&resp, 0, sizeof(resp));

> +	ret = qmi_txn_init(&sysmon->qmi, &txn, ssctl_subsys_event_resp_ei, &resp);

> +	if (ret < 0) {

> +		dev_err(sysmon->dev, "failed to allocate QMI txn\n");

> +		return;

> +	}

> +

> +	memset(&req, 0, sizeof(req));

> +	strlcpy(req.subsys_name, name, sizeof(req.subsys_name));

> +	req.subsys_name_len = strlen(req.subsys_name);

> +	req.event = SSCTL_SSR_EVENT_BEFORE_SHUTDOWN;


Are there plans to add the other SSR events to sysmon notifiers? I think 
the SSCTL service expects to receive events about remote procs starting 
as well.

> +	req.evt_driven_valid = true;

> +	req.evt_driven = SSCTL_SSR_EVENT_FORCED;

> +

> +	ret = qmi_send_request(&sysmon->qmi, &sysmon->ssctl, &txn,

> +			       SSCTL_SUBSYS_EVENT_REQ, 40,

> +			       ssctl_subsys_event_req_ei, &req);

> +	if (ret < 0) {

> +		dev_err(sysmon->dev, "failed to send shutdown request\n");

> +		qmi_txn_cancel(&txn);

> +		return;

> +	}

> +

> +	ret = qmi_txn_wait(&txn, 5 * HZ);

> +	if (ret < 0)

> +		dev_err(sysmon->dev, "failed receiving QMI response\n");

> +	else if (resp.resp.result)

> +		dev_err(sysmon->dev, "ssr event send failed\n");

> +	else

> +		dev_dbg(sysmon->dev, "ssr event send completed\n");

> +}


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bjorn Andersson Nov. 17, 2017, 5:58 a.m. UTC | #2
On Thu 16 Nov 12:05 PST 2017, Chris Lew wrote:
> > +	req.event = SSCTL_SSR_EVENT_BEFORE_SHUTDOWN;

> 

> Are there plans to add the other SSR events to sysmon notifiers? I think the

> SSCTL service expects to receive events about remote procs starting as well.

> 


We could easily add support here to send out the AFTER_BOOTUP
notification, beyond that we would need to extend the subdev notifiers
as well.

But the downstream code paths does confuse me, can you confirm that
these messages are actually sent to the remote ssctl services?

Regards,
Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Chris Lew Nov. 18, 2017, 1:27 a.m. UTC | #3
On 11/16/2017 9:58 PM, Bjorn Andersson wrote:
> On Thu 16 Nov 12:05 PST 2017, Chris Lew wrote:

>>> +	req.event = SSCTL_SSR_EVENT_BEFORE_SHUTDOWN;

>>

>> Are there plans to add the other SSR events to sysmon notifiers? I think the

>> SSCTL service expects to receive events about remote procs starting as well.

>>

> 

> We could easily add support here to send out the AFTER_BOOTUP

> notification, beyond that we would need to extend the subdev notifiers

> as well.

> 

> But the downstream code paths does confuse me, can you confirm that

> these messages are actually sent to the remote ssctl services?

> 

> Regards,

> Bjorn

> 


Yea the other three events are definitely sent to the remote. The remote 
side posts the events for other modules to query. I'm not sure if all of 
the events are used by other other modules though.

Thanks,
Chris
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html