summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/soc/qcom/hab/hab.c6
-rw-r--r--drivers/soc/qcom/hab/hab_msg.c16
-rw-r--r--drivers/soc/qcom/hab/qvm_comm.c7
-rw-r--r--include/uapi/linux/habmm.h8
4 files changed, 36 insertions, 1 deletions
diff --git a/drivers/soc/qcom/hab/hab.c b/drivers/soc/qcom/hab/hab.c
index 019f93b63b28..eb228a02ce90 100644
--- a/drivers/soc/qcom/hab/hab.c
+++ b/drivers/soc/qcom/hab/hab.c
@@ -311,7 +311,11 @@ long hab_vchan_send(struct uhab_context *ctx,
return -ENODEV;
HAB_HEADER_SET_SIZE(header, sizebytes);
- HAB_HEADER_SET_TYPE(header, HAB_PAYLOAD_TYPE_MSG);
+ if (flags & HABMM_SOCKET_SEND_FLAGS_XING_VM_STAT)
+ HAB_HEADER_SET_TYPE(header, HAB_PAYLOAD_TYPE_PROFILE);
+ else
+ HAB_HEADER_SET_TYPE(header, HAB_PAYLOAD_TYPE_MSG);
+
HAB_HEADER_SET_ID(header, vchan->otherend_id);
while (1) {
diff --git a/drivers/soc/qcom/hab/hab_msg.c b/drivers/soc/qcom/hab/hab_msg.c
index f08cc83fe9fc..88aa86897b70 100644
--- a/drivers/soc/qcom/hab/hab_msg.c
+++ b/drivers/soc/qcom/hab/hab_msg.c
@@ -139,6 +139,7 @@ void hab_msg_recv(struct physical_channel *pchan,
uint32_t vchan_id = HAB_HEADER_GET_ID(*header);
struct virtual_channel *vchan = NULL;
struct export_desc *exp_desc;
+ struct timeval tv;
/* get the local virtual channel if it isn't an open message */
if (payload_type != HAB_PAYLOAD_TYPE_INIT &&
@@ -200,6 +201,21 @@ void hab_msg_recv(struct physical_channel *pchan,
hab_vchan_stop(vchan);
break;
+ case HAB_PAYLOAD_TYPE_PROFILE:
+ do_gettimeofday(&tv);
+
+ /* pull down the incoming data */
+ message = hab_msg_alloc(pchan, sizebytes);
+ if (!message) {
+ pr_err("msg alloc failed\n");
+ break;
+ }
+
+ ((uint64_t *)message->data)[2] = tv.tv_sec;
+ ((uint64_t *)message->data)[3] = tv.tv_usec;
+ hab_msg_queue(vchan, message);
+ break;
+
default:
break;
}
diff --git a/drivers/soc/qcom/hab/qvm_comm.c b/drivers/soc/qcom/hab/qvm_comm.c
index 20a631e13794..d8399777eb6a 100644
--- a/drivers/soc/qcom/hab/qvm_comm.c
+++ b/drivers/soc/qcom/hab/qvm_comm.c
@@ -40,6 +40,7 @@ int physical_channel_send(struct physical_channel *pchan,
int sizebytes = HAB_HEADER_GET_SIZE(*header);
struct qvm_channel *dev = (struct qvm_channel *)pchan->hyp_data;
int total_size = sizeof(*header) + sizebytes;
+ struct timeval tv;
if (total_size > dev->pipe_ep->tx_info.sh_buf->size)
return -EINVAL; /* too much data for ring */
@@ -60,6 +61,12 @@ int physical_channel_send(struct physical_channel *pchan,
return -EIO;
}
+ if (HAB_HEADER_GET_TYPE(*header) == HAB_PAYLOAD_TYPE_PROFILE) {
+ do_gettimeofday(&tv);
+ ((uint64_t *)payload)[0] = tv.tv_sec;
+ ((uint64_t *)payload)[1] = tv.tv_usec;
+ }
+
if (sizebytes) {
if (hab_pipe_write(dev->pipe_ep,
(unsigned char *)payload,
diff --git a/include/uapi/linux/habmm.h b/include/uapi/linux/habmm.h
index c05146550b2e..59b603a0fcf7 100644
--- a/include/uapi/linux/habmm.h
+++ b/include/uapi/linux/habmm.h
@@ -117,6 +117,14 @@ struct hab_unimport {
#define HABMM_SOCKET_SEND_FLAGS_NON_BLOCKING 0x00000001
+/*
+ * Collect cross-VM stats: client provides stat-buffer large enough to allow 2
+ * ets of a 2-uint64_t pair to collect seconds and nano-seconds at the
+ * beginning of the stat-buffer. Stats are collected when the stat-buffer leaves
+ * VM1, then enters VM2
+ */
+#define HABMM_SOCKET_SEND_FLAGS_XING_VM_STAT 0x00000002
+
#define HABMM_SOCKET_RECV_FLAGS_NON_BLOCKING 0x00000001
#define HABMM_EXP_MEM_TYPE_DMA 0x00000001