[PATCH v2 4/4] KVM: PPC: Bookehv: Get vcpu's last instruction for emulation
David.Laight at ACULAB.COM
Fri May 2 20:12:51 EST 2014
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));
> 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
More information about the Linuxppc-dev