soc: qcom: secure_buffer: Trace hyp_assign calls
Add trace events to log the caller for hyp_assign_table(), as well as other relevant information, such as source/destination VMIDs, permissions, and the sizes and physical bases of the regions affected by the call to hyp_assign(). Change-Id: Iea37d539e2409465889ad244e74ab4a9e3344e35 Signed-off-by: Sudarshan Rajagopalan <sudaraja@codeaurora.org> Signed-off-by: Chris Goldsworthy <cgoldswo@codeaurora.org>
This commit is contained in:
parent
054eb1553d
commit
5c6c859b29
@ -14,6 +14,9 @@
|
||||
#include <soc/qcom/scm.h>
|
||||
#include <soc/qcom/secure_buffer.h>
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include "trace_secure_buffer.h"
|
||||
|
||||
DEFINE_MUTEX(secure_buffer_mutex);
|
||||
|
||||
struct cp2_mem_chunks {
|
||||
@ -216,9 +219,13 @@ static int batched_hyp_assign(struct sg_table *table, struct scm_desc *desc)
|
||||
unsigned int entries_size;
|
||||
unsigned int batch_start = 0;
|
||||
unsigned int batches_processed;
|
||||
unsigned int i = 0;
|
||||
u64 total_delta;
|
||||
struct scatterlist *curr_sgl = table->sgl;
|
||||
struct scatterlist *next_sgl;
|
||||
int ret = 0;
|
||||
ktime_t batch_assign_start_ts;
|
||||
ktime_t first_assign_ts;
|
||||
struct mem_prot_info *sg_table_copy = kcalloc(BATCH_MAX_SECTIONS,
|
||||
sizeof(*sg_table_copy),
|
||||
GFP_KERNEL);
|
||||
@ -226,6 +233,7 @@ static int batched_hyp_assign(struct sg_table *table, struct scm_desc *desc)
|
||||
if (!sg_table_copy)
|
||||
return -ENOMEM;
|
||||
|
||||
first_assign_ts = ktime_get();
|
||||
while (batch_start < table->nents) {
|
||||
batches_processed = get_batches_from_sgl(sg_table_copy,
|
||||
curr_sgl, &next_sgl);
|
||||
@ -236,8 +244,13 @@ static int batched_hyp_assign(struct sg_table *table, struct scm_desc *desc)
|
||||
desc->args[0] = virt_to_phys(sg_table_copy);
|
||||
desc->args[1] = entries_size;
|
||||
|
||||
trace_hyp_assign_batch_start(sg_table_copy, batches_processed);
|
||||
batch_assign_start_ts = ktime_get();
|
||||
ret = scm_call2(SCM_SIP_FNID(SCM_SVC_MP,
|
||||
MEM_PROT_ASSIGN_ID), desc);
|
||||
trace_hyp_assign_batch_end(ret, ktime_us_delta(ktime_get(),
|
||||
batch_assign_start_ts));
|
||||
i++;
|
||||
if (ret) {
|
||||
pr_info("%s: Failed to assign memory protection, ret = %d\n",
|
||||
__func__, ret);
|
||||
@ -251,7 +264,8 @@ static int batched_hyp_assign(struct sg_table *table, struct scm_desc *desc)
|
||||
|
||||
batch_start += batches_processed;
|
||||
}
|
||||
|
||||
total_delta = ktime_us_delta(ktime_get(), first_assign_ts);
|
||||
trace_hyp_assign_end(total_delta, total_delta / i);
|
||||
kfree(sg_table_copy);
|
||||
return ret;
|
||||
}
|
||||
@ -276,7 +290,7 @@ static int __hyp_assign_table(struct sg_table *table,
|
||||
size_t dest_vm_copy_size;
|
||||
|
||||
if (!table || !table->sgl || !source_vm_list || !source_nelems ||
|
||||
!dest_vmids || !dest_perms || !dest_nelems)
|
||||
!dest_vmids || !dest_perms || !dest_nelems || !table->nents)
|
||||
return -EINVAL;
|
||||
|
||||
/*
|
||||
@ -321,6 +335,8 @@ static int __hyp_assign_table(struct sg_table *table,
|
||||
dmac_flush_range(dest_vm_copy,
|
||||
(void *)dest_vm_copy + dest_vm_copy_size);
|
||||
|
||||
trace_hyp_assign_info(source_vm_list, source_nelems, dest_vmids,
|
||||
dest_perms, dest_nelems);
|
||||
ret = batched_hyp_assign(table, &desc);
|
||||
|
||||
mutex_unlock(&secure_buffer_mutex);
|
||||
|
Loading…
Reference in New Issue
Block a user