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

Commit 061fadf4 authored by Elliot Berman's avatar Elliot Berman
Browse files

haven: Improve print statements



Improve print statements around errors to provide more useful
information and add hex dumps of data being sent to RM and over message
queues. Hex dump of the message is invaluable to validating whether
messages are correctly being formatted.

Change-Id: I95dc665ce00795f347d4820178e09bf43b8f31c3
Signed-off-by: default avatarElliot Berman <eberman@codeaurora.org>
parent aba06b68
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ static int __hh_msgq_recv(struct hh_msgq_cap_table *cap_table_entry,
	spin_unlock_irqrestore(&cap_table_entry->rx_lock, flags);

	if (ret != 0 && ret != -EAGAIN)
		pr_err("%s: Failed to recv the message. Error: %d\n",
		pr_err("%s: Failed to recv from msgq. Hypercall error: %d\n",
			__func__, hh_ret);

	return ret;
@@ -190,6 +190,10 @@ int hh_msgq_recv(void *msgq_client_desc,
					recv_size, flags);
	} while (ret == -EAGAIN);

	if (!ret)
		print_hex_dump_debug("hh_msgq_recv: ", DUMP_PREFIX_OFFSET,
				     4, 1, buff, *recv_size, false);

	return ret;

err:
@@ -209,6 +213,9 @@ static int __hh_msgq_send(struct hh_msgq_cap_table *cap_table_entry,
	/* Discard the driver specific flags, and keep only HVC specifics */
	tx_flags &= HH_MSGQ_HVC_FLAGS_MASK;

	print_hex_dump_debug("hh_msgq_send: ", DUMP_PREFIX_OFFSET,
			     4, 1, buff, size, false);

	spin_lock_irqsave(&cap_table_entry->tx_lock, flags);
	hh_ret = hh_hcall_msgq_send(cap_table_entry->tx_cap_id,
					size, buff, tx_flags, &resp);
@@ -229,7 +236,7 @@ static int __hh_msgq_send(struct hh_msgq_cap_table *cap_table_entry,
	spin_unlock_irqrestore(&cap_table_entry->tx_lock, flags);

	if (ret != 0 && ret != -EAGAIN)
		pr_err("%s: Failed to send the message. Error: %d\n",
		pr_err("%s: Failed to send on msgq. Hypercall error: %d\n",
			__func__, hh_ret);

	return ret;
+12 −2
Original line number Diff line number Diff line
@@ -414,7 +414,7 @@ static void hh_rm_process_recv_work(struct work_struct *work)

	/* All the processing functions would have trimmed-off the header
	 * and copied the data to connection->recv_buff. Hence, it's okay
	 * to release the original packet that arrived.
	 * to release the original packet that arrived and free the msgq_data.
	 */
	kfree(recv_buff);
	kfree(msgq_data);
@@ -456,6 +456,9 @@ static int hh_rm_recv_task_fn(void *data)
			continue;
		}

		print_hex_dump_debug("hh_rm_recv: ", DUMP_PREFIX_OFFSET,
				     4, 1, recv_buff, recv_buff_size, false);

		msgq_data->recv_buff = recv_buff;
		msgq_data->recv_buff_size = recv_buff_size;
		INIT_WORK(&msgq_data->recv_work, hh_rm_process_recv_work);
@@ -572,6 +575,9 @@ void *hh_rm_call(hh_rm_msgid_t message_id,
	if (IS_ERR_OR_NULL(connection))
		return connection;

	pr_debug("%s TX msg_id: %x\n", __func__, message_id);
	print_hex_dump_debug("hh_rm_call TX: ", DUMP_PREFIX_OFFSET, 4, 1,
			     req_buff, req_buff_size, false);
	/* Send the request to the Resource Manager VM */
	req_ret = hh_rm_send_request(message_id,
					req_buff, req_buff_size,
@@ -589,12 +595,16 @@ void *hh_rm_call(hh_rm_msgid_t message_id,

	*reply_err_code = connection->reply_err_code;
	if (connection->reply_err_code) {
		pr_err("%s: Reply for seq:%d failed with err: %d\n",
		pr_err("%s: Reply for seq:%d failed with RM err: %d\n",
			__func__, connection->seq, connection->reply_err_code);
		ret = ERR_PTR(hh_remap_error(connection->reply_err_code));
		goto out;
	}

	print_hex_dump_debug("hh_rm_call RX: ", DUMP_PREFIX_OFFSET, 4, 1,
			     connection->recv_buff, connection->recv_buff_size,
			     false);

	ret = connection->recv_buff;
	*resp_buff_size = connection->recv_buff_size;

+6 −5
Original line number Diff line number Diff line
@@ -49,7 +49,8 @@ int hh_rm_get_vmid(enum hh_vm_names vm_name, hh_vmid_t *vmid)
	hh_vmid_t _vmid = hh_vm_table[vm_name].vmid;

	if (!_vmid && vm_name != HH_SELF_VM) {
		pr_err("%s: No vmid associated with the vm\n", __func__);
		pr_err("%s: No vmid associated with the vm%d\n", __func__,
			vm_name);
		return -EINVAL;
	}

@@ -163,7 +164,7 @@ hh_rm_vm_get_hyp_res(hh_vmid_t vmid, u32 *n_entries)
int hh_rm_vm_irq_accept(hh_virq_handle_t virq_handle, int virq)
{
	struct hh_vm_irq_accept_resp_payload *resp_payload;
	struct hh_vm_irq_accept_req_payload req_payload;
	struct hh_vm_irq_accept_req_payload req_payload = {0};
	size_t resp_payload_size;
	int ret, reply_err_code;

@@ -209,7 +210,7 @@ static int hh_rm_vm_irq_lend(hh_vmid_t vmid, int virq, int label,
			     hh_virq_handle_t *virq_handle)
{
	struct hh_vm_irq_lend_resp_payload *resp_payload;
	struct hh_vm_irq_lend_req_payload req_payload;
	struct hh_vm_irq_lend_req_payload req_payload = {0};
	size_t resp_payload_size;
	int ret = 0, reply_err_code;

@@ -338,7 +339,7 @@ int hh_rm_vm_irq_lend_notify(hh_vmid_t vmid, int virq, int label)
int hh_rm_vm_alloc_vmid(enum hh_vm_names vm_name)
{
	struct hh_vm_allocate_resp_payload *resp_payload;
	struct hh_vm_allocate_req_payload req_payload;
	struct hh_vm_allocate_req_payload req_payload = {0};
	size_t resp_payload_size;
	struct hh_vm_property vm_prop;
	int err, reply_err_code;
@@ -393,7 +394,7 @@ EXPORT_SYMBOL(hh_rm_vm_alloc_vmid);
int hh_rm_vm_start(int vmid)
{
	struct hh_vm_start_resp_payload *resp_payload;
	struct hh_vm_start_req_payload req_payload;
	struct hh_vm_start_req_payload req_payload = {0};
	size_t resp_payload_size;
	int err, reply_err_code;