From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S48y0-0000NF-Ns for qemu-devel@nongnu.org; Sun, 04 Mar 2012 05:47:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S48xy-00055s-Rb for qemu-devel@nongnu.org; Sun, 04 Mar 2012 05:47:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58878) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S48xy-00055h-JQ for qemu-devel@nongnu.org; Sun, 04 Mar 2012 05:47:02 -0500 Message-ID: <4F53481F.6040303@redhat.com> Date: Sun, 04 Mar 2012 12:46:55 +0200 From: Avi Kivity MIME-Version: 1.0 References: <20120304081234.GL10743@redhat.com> <4F5345A4.1090507@redhat.com> <20120304103807.GO10743@redhat.com> In-Reply-To: <20120304103807.GO10743@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] KVM/QEMU: Support executing from flash device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gleb Natapov Cc: Jordan Justen , Jordan Justen , qemu-devel@nongnu.org, kvm-devel , Alexander Graf On 03/04/2012 12:38 PM, Gleb Natapov wrote: > On Sun, Mar 04, 2012 at 12:36:20PM +0200, Avi Kivity wrote: > > On 03/04/2012 10:12 AM, Gleb Natapov wrote: > > > On Sat, Mar 03, 2012 at 10:56:02PM -0800, Jordan Justen wrote: > > > > On Tue, Oct 25, 2011 at 00:47, Avi Kivity wrote: > > > > > The core issue that kvm (the kernel part) supports two styles of memory: > > > > > read/write RAM, and read/write MMIO. ROM wants writes to be ignored, > > > > > and rom/device wants reads serviced from memory and writes serviced by > > > > > userspace (as MMIO). > > > > > > > > > > It should not be too hard to patch kvm to support these additional two > > > > > styles. The entry point is the KVM_SET_USER_MEMORY_REGION ioctl to > > > > > define the new attributes for the region, and kvm_mmu_page_fault() to > > > > > map these pages as read-only and emulate writes (for ROM/device regions). > > > > > > > > Additional context for CC'd kvm-devel: I would like to support > > > > executing from an emulated flash memory on kvm. The flash memory > > > > would be a CFI (Firmware Hub-like) device which is programmed via MMIO > > > > at the same addresses in memory where the execution would occur. > > > > > > > > What is needed is: > > > > 1. The ability to set a region to allow read/exec, > > > > but trap to qemu on writes. > > > > 2. qemu should then be able to set the region > > > > to trap on reads/exec/writes. > > > Do you want to execute code from a flash while it traps on read/exec? > > > KVM emulator can't do that. > > > > No, he wants read/exec to go to RAM, and writes to be handled as mmio. > > This should work. > > > That's mode 1 from above and will obviously work. I am asking about mode > 2 from above. > Mode 2 is pure mmio. You're right that kvm won't run code from that. Jordan, what's the use for mode 2? Is it just used during programming? -- error compiling committee.c: too many arguments to function