Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a7ad7d62 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "soc: qcom: hab: benchmark cross VM schdule latency"

parents e2a4721c 69cca92b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -566,6 +566,14 @@ long hab_vchan_send(struct uhab_context *ctx,
				sizeof(struct habmm_xing_vm_stat));
			return -EINVAL;
		}
	} else if (flags & HABMM_SOCKET_XVM_SCHE_TEST) {
		HAB_HEADER_SET_TYPE(header, HAB_PAYLOAD_TYPE_SCHE_MSG);
	} else if (flags & HABMM_SOCKET_XVM_SCHE_TEST_ACK) {
		HAB_HEADER_SET_TYPE(header, HAB_PAYLOAD_TYPE_SCHE_MSG_ACK);
	} else if (flags & HABMM_SOCKET_XVM_SCHE_RESULT_REQ) {
		HAB_HEADER_SET_TYPE(header, HAB_PAYLOAD_TYPE_SCHE_RESULT_REQ);
	} else if (flags & HABMM_SOCKET_XVM_SCHE_RESULT_RSP) {
		HAB_HEADER_SET_TYPE(header, HAB_PAYLOAD_TYPE_SCHE_RESULT_RSP);
	} else {
		HAB_HEADER_SET_TYPE(header, HAB_PAYLOAD_TYPE_MSG);
	}
+4 −0
Original line number Diff line number Diff line
@@ -58,6 +58,10 @@ enum hab_payload_type {
	HAB_PAYLOAD_TYPE_PROFILE,
	HAB_PAYLOAD_TYPE_CLOSE,
	HAB_PAYLOAD_TYPE_INIT_CANCEL,
	HAB_PAYLOAD_TYPE_SCHE_MSG,
	HAB_PAYLOAD_TYPE_SCHE_MSG_ACK,
	HAB_PAYLOAD_TYPE_SCHE_RESULT_REQ,
	HAB_PAYLOAD_TYPE_SCHE_RESULT_RSP,
	HAB_PAYLOAD_TYPE_MAX,
};
#define LOOPBACK_DOM 0xFF
+16 −0
Original line number Diff line number Diff line
@@ -206,6 +206,7 @@ int hab_msg_recv(struct physical_channel *pchan,
	struct virtual_channel *vchan = NULL;
	struct export_desc *exp_desc;
	struct timeval tv;
	unsigned long long rx_mpm_tv;

	/* get the local virtual channel if it isn't an open message */
	if (payload_type != HAB_PAYLOAD_TYPE_INIT &&
@@ -262,6 +263,8 @@ int hab_msg_recv(struct physical_channel *pchan,

	switch (payload_type) {
	case HAB_PAYLOAD_TYPE_MSG:
	case HAB_PAYLOAD_TYPE_SCHE_RESULT_REQ:
	case HAB_PAYLOAD_TYPE_SCHE_RESULT_RSP:
		message = hab_msg_alloc(pchan, sizebytes);
		if (!message)
			break;
@@ -357,6 +360,19 @@ int hab_msg_recv(struct physical_channel *pchan,
		}
		break;

	case HAB_PAYLOAD_TYPE_SCHE_MSG:
	case HAB_PAYLOAD_TYPE_SCHE_MSG_ACK:
		rx_mpm_tv = msm_timer_get_sclk_ticks();
		/* pull down the incoming data */
		message = hab_msg_alloc(pchan, sizebytes);
		if (!message)
			pr_err("failed to allocate msg Arrived msg will be lost\n");
		else {
			((unsigned long long *)message->data)[0] = rx_mpm_tv;
			hab_msg_queue(vchan, message);
		}
		break;

	default:
		pr_err("unknown msg received, payload type %d, vchan id %x, sizebytes %zx, session %d\n",
			   payload_type, vchan_id, sizebytes, session_id);
+12 −0
Original line number Diff line number Diff line
@@ -13,6 +13,8 @@
#include "hab.h"
#include "hab_qvm.h"

static unsigned long long xvm_sche_tx_tv_buffer[2];

inline void habhyp_notify(void *commdev)
{
	struct qvm_channel *dev = (struct qvm_channel *)commdev;
@@ -79,6 +81,12 @@ int physical_channel_send(struct physical_channel *pchan,
			spin_unlock_bh(&dev->io_lock);
			return -EINVAL;
		}
	} else if (HAB_HEADER_GET_TYPE(*header)
		== HAB_PAYLOAD_TYPE_SCHE_RESULT_REQ) {
		((unsigned long long *)payload)[0] = xvm_sche_tx_tv_buffer[0];
	} else if (HAB_HEADER_GET_TYPE(*header)
		== HAB_PAYLOAD_TYPE_SCHE_RESULT_RSP) {
		((unsigned long long *)payload)[2] = xvm_sche_tx_tv_buffer[1];
	}

	if (sizebytes) {
@@ -92,6 +100,10 @@ int physical_channel_send(struct physical_channel *pchan,

	hab_pipe_write_commit(dev->pipe_ep);
	spin_unlock_bh(&dev->io_lock);
	if (HAB_HEADER_GET_TYPE(*header) == HAB_PAYLOAD_TYPE_SCHE_MSG)
		xvm_sche_tx_tv_buffer[0] = msm_timer_get_sclk_ticks();
	else if (HAB_HEADER_GET_TYPE(*header) == HAB_PAYLOAD_TYPE_SCHE_MSG_ACK)
		xvm_sche_tx_tv_buffer[1] = msm_timer_get_sclk_ticks();
	habhyp_notify(dev);
	++pchan->sequence_tx;
	return 0;
+31 −0
Original line number Diff line number Diff line
@@ -105,6 +105,37 @@ int32_t habmm_socket_close(int32_t handle);
 */
#define HABMM_SOCKET_SEND_FLAGS_XING_VM_STAT 0x00000002

/* start to measure cross-vm schedule latency: VM1 send msg with this flag
 * to VM2 to kick off the measurement. In the hab driver level, the VM1 hab
 * driver shall record the time of schdule out with mpm_timer, and buffer
 * it for later usage. The VM2 hab driver shall record the time of schedule
 * in with mpm_timer and pass it to "habtest" application.
 */
#define HABMM_SOCKET_XVM_SCHE_TEST 0x00000004

/* VM2 responds this message to VM1 for HABMM_SOCKET_XVM_SCHE_TEST.
 * In the hab driver level, the VM2 hab driver shall record the time of schedule
 * out with mpm_timer, and buffer it for later usage; the VM1 hab driver
 * shall record the time of schedule in with mpm_timer and pass it to "habtest"
 * application.
 */
#define HABMM_SOCKET_XVM_SCHE_TEST_ACK 0x00000008

/* VM1 sends this message to VM2 asking for collect all the mpm_timer values
 * to calculate the latency of schduling between VM1 and VM2. In the hab driver
 * level, the VM1 hab driver shall save the previous restored schduling out
 * time to the message buffer
 */
#define HABMM_SOCKET_XVM_SCHE_RESULT_REQ 0x00000010

/* VM2 responds this message to VM2 for HABMM_SOCKET_XVM_SCHE_RESULT_REQ.
 * In the habtest application level, VM2 shall save the previous restored
 * scheduling in time into message buffer, in the hab driver level, VM2
 * shall save the previous restored scheduling out time to the message
 * buffer.
 */
#define HABMM_SOCKET_XVM_SCHE_RESULT_RSP 0x00000020

struct habmm_xing_vm_stat {
	uint64_t tx_sec;
	uint64_t tx_usec;