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

Commit 4faca7cd authored by Yong Ding's avatar Yong Ding
Browse files

soc: qcom: hab: add hab statistics support



This allows user to read back hab runtime information.

Change-Id: Id266dd17b9c9d38f0e93aa600510ae1c6b12cca5
Signed-off-by: default avatarYong Ding <yongding@codeaurora.org>
parent 7adc4e13
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -9,7 +9,8 @@ msm_hab-objs = \
	hab_mem_linux.o \
	hab_pipe.o \
	hab_parser.o \
	khab_test.o
	khab_test.o \
	hab_stat.o

ifdef CONFIG_GHS_VMM
msm_hab_hyp-objs = \
+7 −2
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@
	.openlock = __SPIN_LOCK_UNLOCKED(&hab_devices[__num__].openlock)\
	}

static const char hab_info_str[] = "Change: 16239527 Revision: #65";
static const char hab_info_str[] = "Change: 16764735 Revision: #76";

/*
 * The following has to match habmm definitions, order does not matter if
@@ -283,7 +283,7 @@ struct virtual_channel *frontend_open(struct uhab_context *ctx,
		pr_err("vchan alloc failed\n");
		ret = -ENOMEM;
		goto err;
	} else
	}

	/* Send Init sequence */
	hab_open_request_init(&request, HAB_PAYLOAD_TYPE_INIT, pchan,
@@ -667,6 +667,7 @@ int hab_vchan_open(struct uhab_context *ctx,
			}
		} else {
			pr_err("failed to find device, mmid %d\n", mmid);
			return -ENODEV;
		}
	}

@@ -1368,6 +1369,9 @@ static int __init hab_init(void)
		} else
			set_dma_ops(hab_driver.dev, &hab_dma_ops);
	}

	hab_stat_init(&hab_driver);

	return result;

err:
@@ -1387,6 +1391,7 @@ static void __exit hab_exit(void)
	dev_t dev;

	hab_hypervisor_unregister();
	hab_stat_deinit(&hab_driver);
	hab_ctx_put(hab_driver.kctx);
	dev = MKDEV(MAJOR(hab_driver.major), 0);
	device_destroy(hab_driver.class, dev);
+15 −1
Original line number Diff line number Diff line
@@ -43,6 +43,8 @@
#include <linux/dma-mapping.h>
#include <linux/jiffies.h>
#include <linux/reboot.h>
#include <linux/kobject.h>
#include <linux/sysfs.h>

enum hab_payload_type {
	HAB_PAYLOAD_TYPE_MSG = 0x0,
@@ -338,6 +340,8 @@ struct hab_driver {
	int b_loopback;

	void *hyp_priv; /* hypervisor plug-in storage */

	void *hab_vmm_handle;
};

struct virtual_channel {
@@ -412,6 +416,7 @@ int hab_vchan_recv(struct uhab_context *ctx,
void hab_vchan_stop(struct virtual_channel *vchan);
void hab_vchans_stop(struct physical_channel *pchan);
void hab_vchan_stop_notify(struct virtual_channel *vchan);
void hab_vchans_empty_wait(int vmid);

int hab_mem_export(struct uhab_context *ctx,
		struct hab_export *param, int kernel);
@@ -456,7 +461,7 @@ int habmm_imp_hyp_unmap(void *imp_ctx, struct export_desc *exp, int kernel);

int habmem_imp_hyp_mmap(struct file *flip, struct vm_area_struct *vma);


int habmm_imp_hyp_map_check(void *imp_ctx, struct export_desc *exp);

void hab_msg_free(struct hab_message *message);
int hab_msg_dequeue(struct virtual_channel *vchan,
@@ -563,6 +568,15 @@ int hab_open_cancel_notify(struct hab_open_request *request);
int hab_open_receive_cancel(struct physical_channel *pchan,
		size_t sizebytes);

int hab_stat_init(struct hab_driver *drv);
int hab_stat_deinit(struct hab_driver *drv);
int hab_stat_show_vchan(struct hab_driver *drv, char *buf, int sz);
int hab_stat_show_ctx(struct hab_driver *drv, char *buf, int sz);
int hab_stat_show_expimp(struct hab_driver *drv, int pid, char *buf, int sz);

int hab_stat_init_sub(struct hab_driver *drv);
int hab_stat_deinit_sub(struct hab_driver *drv);

/* Global singleton HAB instance */
extern struct hab_driver hab_driver;

+19 −0
Original line number Diff line number Diff line
@@ -751,3 +751,22 @@ int habmem_imp_hyp_mmap(struct file *filp, struct vm_area_struct *vma)

	return 0;
}

int habmm_imp_hyp_map_check(void *imp_ctx, struct export_desc *exp)
{
	struct importer_context *priv = imp_ctx;
	struct pages_list *pglist;
	int found = 0;

	read_lock(&priv->implist_lock);
	list_for_each_entry(pglist, &priv->imp_list, list) {
		if (pglist->export_id == exp->export_id &&
			pglist->vcid == exp->vcid_remote) {
			found = 1;
			break;
		}
	}
	read_unlock(&priv->implist_lock);

	return found;
}
+4 −3
Original line number Diff line number Diff line
@@ -104,8 +104,8 @@ static struct export_desc *habmem_add_export(struct virtual_channel *vchan,
	exp->vchan = vchan;
	exp->vcid_local = vchan->id;
	exp->vcid_remote = vchan->otherend_id;
	exp->domid_local = -1; /* dom id, provided on the importer */
	exp->domid_remote = vchan->pchan->dom_id;
	exp->domid_local = vchan->pchan->vmid_local;
	exp->domid_remote = vchan->pchan->vmid_remote;
	exp->ctx = vchan->ctx;
	exp->pchan = vchan->pchan;

@@ -124,7 +124,8 @@ void habmem_remove_export(struct export_desc *exp)
	struct uhab_context *ctx;

	if (!exp || !exp->ctx || !exp->pchan) {
		pr_err("failed to find valid info in exp %pK\n", exp);
		pr_err("failed to find valid info in exp %pK ctx %pK pchan %pK\n",
			   exp, exp->ctx, exp->pchan);
		return;
	}

Loading