From: Alexander Graf
...
> > +   page = pfn_to_page(pfn);
> > +   eaddr = (unsigned long)kmap_atomic(page);
> > +   eaddr |= addr & ~PAGE_MASK;
> > +   *instr = *(u32 *)eaddr;
> > +   kunmap_atomic((u32 *)eaddr);
> 
> I think I'd rather write this as
> 
>    *instr = *(u32 *)(eaddr | (addr & ~PAGE));
>    kunmap_atomic((void*)eaddr);
> 
> to make sure we pass the unmap function the same value we got from the
> map function.
> 
> Otherwise looks good to me.

Is there any mileage in keeping a virtual address page allocated (per cpu)
for this (and similar) accesses to physical memory?
Not having to search for a free VA page might speed things up (if that matters).

You also probably want the page mapped uncached - no point polluting the data
cache.

        David

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to