Hi,
On 30/06/2020 13:33, Michał Leszczyński wrote:
+static int vmtrace_alloc_buffers(struct vcpu *v)
+{
+ struct page_info *pg;
+ uint64_t size = v->domain->vmtrace_pt_size;
+
+ if ( size < PAGE_SIZE || size > GB(4) || (size & (size - 1)) )
+ {
+ /*
+ * We don't accept trace buffer size smaller than single page
+ * and the upper bound is defined as 4GB in the specification.
This is common code, so what specification are you talking about?
I am guessing this is an Intel one, but I don't think Intel should
dictate the common code implementation.
+ * The buffer size must be also a power of 2.
+ */
+ return -EINVAL;
+ }
+
+ pg = alloc_domheap_pages(v->domain, get_order_from_bytes(size),
+ MEMF_no_refcount);
+
+ if ( !pg )
+ return -ENOMEM;
+
+ v->arch.vmtrace.pt_buf = pg;
v->arch.vmtrace.pt_buf is not defined on Arm. Please make sure common
code build on all arch.
Cheers,
--
Julien Grall