[Sound-open-firmware] [PATCH v2] intel-ipc: fix host ring buffer size not page aligned issue

Liam Girdwood liam.r.girdwood at linux.intel.com
Wed Nov 15 22:05:21 CET 2017


On Wed, 2017-11-15 at 08:55 -0600, Pierre-Louis Bossart wrote:
> On 11/15/17 3:41 AM, 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 at linux.intel.com>
> > ---
> >   src/ipc/intel-ipc.c | 10 ++++++++++
> >   1 file changed, 10 insertions(+)
> > 
> > diff --git a/src/ipc/intel-ipc.c b/src/ipc/intel-ipc.c
> > index 56bd8ba..7de533a 100644
> > --- a/src/ipc/intel-ipc.c
> > +++ b/src/ipc/intel-ipc.c
> > @@ -175,6 +175,12 @@ static int parse_page_descriptors(struct intel_ipc_data *iipc,
> >   		host = (struct sof_ipc_comp_host *)&cd->comp;
> >   	}
> >   

It's best to comment here what you are testing prior to the if() i.e.

/* is ring size a multiple of HOST_PAGE_SIZE ? */

> > +	if (HOST_PAGE_SIZE * ring->pages < ring->size) {

Btw, what happens if PAGE * pages > ring->size ? We should reject this
too. 

Liam



More information about the Sound-open-firmware mailing list