On 11.12.2013, at 15:07, Peter Maydell <peter.mayd...@linaro.org> wrote:
> On 11 December 2013 13:35, Alexander Graf <ag...@suse.de> wrote: >> How would KVM know when things changed inside of a memory region? >> It's up to user space to manage the contents of a memory region, no? > > If the architecture spec says that a freshly reset physical CPU has > coherent icache and dcache, then resetting the vCPU should also > ensure the icache and dcache are coherent, so one way to solve > this would be just to make sure that vcpu reset did the right thing. Well, this really is a simplified view of the world. On real hardware the system boots up with caches disabled. Firmware is then responsible for enabling caches and flushing things as it goes. Firmware loads the kernel into ram, flushing the icache on those regions it wrote to along the way. The kernel boots and every time it faults in a page, it flushes caches for that page. So really the problem is that we're skipping the "cache disabled firmware" step. With this patch, we're simulating a bootloader's behavior when writing a blob into guest memory. Since that's really what we are trying to behave like - a bootloader. Alex