[Sound-open-firmware] [PATCH v3] intel-ipc: fix host ring buffer size not page aligned issue
The host ring buffer size may be not page aligned, but the last page was utilized by host component wrongly, which may introduce beating noise.
Here change to correct size for the last element, which will fix the issue.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com --- src/ipc/intel-ipc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/src/ipc/intel-ipc.c b/src/ipc/intel-ipc.c index 56bd8ba..e13b541 100644 --- a/src/ipc/intel-ipc.c +++ b/src/ipc/intel-ipc.c @@ -175,6 +175,17 @@ static int parse_page_descriptors(struct intel_ipc_data *iipc, host = (struct sof_ipc_comp_host *)&cd->comp; }
+ /* the ring size may be not multiple of the page size, the last + * page may be not full used. The used size should be in range + * of (ring->pages - 1, ring->pages] * PAGES. + */ + if ((ring->size <= HOST_PAGE_SIZE * (ring->pages - 1)) || + (ring->size > HOST_PAGE_SIZE * ring->pages)) { + /* error buffer size */ + trace_ipc_error("eBs"); + return -EINVAL; + } + for (i = 0; i < ring->pages; i++) {
idx = (((i << 2) + i)) >> 1; @@ -192,6 +203,10 @@ static int parse_page_descriptors(struct intel_ipc_data *iipc, else elem.dest = phy_addr;
+ /* the last page may be not full used */ + if (i == (ring->pages - 1)) + elem.size = ring->size - HOST_PAGE_SIZE * i; + if (is_trace) err = dma_trace_host_buffer(d, &elem, ring->size); else
On Thu, 2017-11-16 at 22:48 +0800, Keyon Jie wrote:
The host ring buffer size may be not page aligned, but the last page was utilized by host component wrongly, which may introduce beating noise.
Here change to correct size for the last element, which will fix the issue.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com
src/ipc/intel-ipc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
Applied.
Thanks
Liam
--------------------------------------------------------------------- Intel Corporation (UK) Limited Registered No. 1134945 (England) Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
participants (2)
-
Keyon Jie
-
Liam Girdwood