Re: [RFC] ARM/ARM64: KVM: Implement KVM_FLUSH_DCACHE_GPA ioctl

Paolo Bonzini
2015-05-15T15:24:55Z

On 15/05/2015 17:12, Christoffer Dall wrote:
>>> > > Can you find out what memory attributes the guest is using for the
>>> > > memory---and if it's uncached, why?
>> >
>> > For USB, see "drivers/usb/core/hcd-pci.c", function usb_hcd_pci_probe():
>> > it uses ioremap_nocache().
>> >
>> > On the "why", that ioremap_nocache() call can be tracked to
>> >
>> > http://git.kernel.org/cgit/linux/kernel/git/tglx/history.git/commit/?id=a914dd8b
>> >
>> > (Feb 2002), which predates the kernel's move to git. I guess
>> > ioremap_nocache() is used simply because USB host controllers are
>> > supposed to programmed like that.
>> >
>> > And, from "arch/arm64/include/asm/io.h":
>> >
>> > #define ioremap_nocache(addr, size) __ioremap((addr), (size),
>> > __pgprot(PROT_DEVICE_nGnRE))
>> >
> So this just means that these devices should be mapped as device memory
> (like the VGA case before) right? And therefore should work with Drew's
> patches (assuming they are actually correct and you add the right QEMU
> annotations to set the memory regions and non-cacheable), correct?

As far as I understand ioremap_nocache() is used on a MMIO BAR. QEMU
does not back those with RAM at all, each access causes a userspace exit.

Paolo