qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] roms: Flush icache when writing roms to guest m


From: Alexander Graf
Subject: Re: [Qemu-devel] [PATCH] roms: Flush icache when writing roms to guest memory
Date: Wed, 11 Dec 2013 15:20:47 +0100

On 11.12.2013, at 15:03, Paolo Bonzini <address@hidden> wrote:

> Il 11/12/2013 14:35, Alexander Graf ha scritto:
>>>>>> +            if (kvm_enabled()) {
>>>>>> +                /*
>>>>>> +                 * The guest may want to directly execute from the rom 
>>>>>> region,
>>>>>> +                 * so we better invalidate its icache
>>>>>> +                 */
>>>>>> +                flush_icache_range((uintptr_t)ptr, (uintptr_t)ptr + l);
>>>>>> +            }
>>>> 
>>>> Shouldn't KVM itself do that when a memslot is registered?  There should
>>>> be no reason for non-TCG QEMU to flush the icache.
>> 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?
> 
> Yeah, that is true.  BTW, shouldn't the same happen when you do migration?

Fortunately no, because migration always happens on a clean plate, so the 
icache is not populated yet for the regions that the guest's memory get written 
to :).

> I'd prefer the above snippet to be replaced by a function in
> kvm-stub.c/kvm-all.c (kvm_flush_icache_range).

That makes sense.

> I wonder if there would be a reason to add a KVM_FLUSH_ICACHE ioctl
> though.  Could a virtually-indexed/virtually-tagged icache require
> flushing by guest address instead of host address?

No PPC platform I care about has vi/vt icache. I don't know if ARM has any - 
but I'd prefer to keep this as simple as possible for as long as we can. Newer 
POWER chips even just do cache snooping and don't need all this manual cache 
synchronization nonsense anymore.


Alex




reply via email to

[Prev in Thread] Current Thread [Next in Thread]