From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43394) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqkOV-00037a-TZ for qemu-devel@nongnu.org; Wed, 11 Dec 2013 09:04:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VqkOP-0007JU-Ua for qemu-devel@nongnu.org; Wed, 11 Dec 2013 09:04:07 -0500 Message-ID: <52A870C4.8010406@redhat.com> Date: Wed, 11 Dec 2013 15:03:48 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1386768216-33686-1-git-send-email-agraf@suse.de> <52A86847.8060209@redhat.com> <1C26F4F8-7257-4096-88FA-432755A892A0@suse.de> In-Reply-To: <1C26F4F8-7257-4096-88FA-432755A892A0@suse.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] roms: Flush icache when writing roms to guest memory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: "Bogdan.Vlad@freescale.com" , QEMU Developers , "qemu-ppc@nongnu.org" , "Varun.Sethi@freescale.com" , Scott Wood , "mihai.caraman@freescale.com" 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? I'd prefer the above snippet to be replaced by a function in kvm-stub.c/kvm-all.c (kvm_flush_icache_range). 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? Paolo