From: "Doyu Hiroshi (Nokia-D/Helsinki)" <hiroshi.doyu@xxxxxxxxx> Subject: [PATCH 1/1] DSPBRIDGE: cache operation against kernel address instead of user's Date: Fri, 6 Nov 2009 13:34:21 +0100 > From: Hiroshi DOYU <Hiroshi.DOYU@xxxxxxxxx> > > Based on the discussion: > http://www.spinics.net/lists/arm-kernel/msg72810.html > > HACK: export "follow_page()" for dspbridge cache operation > > Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@xxxxxxxxx> > --- > drivers/dsp/bridge/rmgr/proc.c | 76 +++++++++++++++++++++++++++++++--------- > mm/memory.c | 1 + > 2 files changed, 60 insertions(+), 17 deletions(-) > > diff --git a/drivers/dsp/bridge/rmgr/proc.c b/drivers/dsp/bridge/rmgr/proc.c > index a75b64a..dc37beb 100644 > --- a/drivers/dsp/bridge/rmgr/proc.c > +++ b/drivers/dsp/bridge/rmgr/proc.c > @@ -159,6 +159,8 @@ > #define PWR_TIMEOUT 500 /* Sleep/wake timout in msec */ > #define EXTEND "_EXT_END" /* Extmem end addr in DSP binary */ > > +#define DSP_CACHE_LINE 128 > + > extern char *iva_img; > > /* ----------------------------------- Globals */ > @@ -679,8 +681,48 @@ DSP_STATUS PROC_EnumNodes(DSP_HPROCESSOR hProcessor, OUT DSP_HNODE *aNodeTab, > return status; > } > > +/* Cache operation against kernel address instead of users */ > +static int memory_sync_page(struct vm_area_struct *vma, unsigned long start, > + ssize_t len, enum DSP_FLUSHTYPE ftype) > +{ > + struct page *page; > + void *kaddr; > + unsigned long offset; > + ssize_t rest; > + > +#ifdef CHECK_DSP_CACHE_LINE > + if ((start & DSP_CACHE_LINE) || (len & DSP_CACHE_LINE)) > + pr_warning("%s: not aligned: %08lx(%d)\n", __func__, > + start, len); > +#endif > + while (len) { > + page = follow_page(vma, start, FOLL_GET); > + if (!page) { > + pr_err("%s: no page for %08lx\n", __func__, start); > + return -EINVAL; > + } else if (IS_ERR(page)) { > + pr_err("%s: err page for %08lx(%lu)\n", __func__, start, > + IS_ERR(page)); > + return IS_ERR(page); > + } > + > + offset = start & ~PAGE_SIZE; should be: + offset = start & ~PAGE_MASK; The fixed version is attached.
Attachment:
0001-DSPBRIDGE-cache-operation-against-kernel-address-in.patch
Description: Binary data