qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] KVM/QEMU: Support executing from flash device
@ 2012-03-04  6:56 Jordan Justen
  2012-03-04  8:12 ` Gleb Natapov
  2012-03-04 10:44 ` Avi Kivity
  0 siblings, 2 replies; 7+ messages in thread
From: Jordan Justen @ 2012-03-04  6:56 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Jordan Justen, qemu-devel, kvm-devel, Alexander Graf

On Tue, Oct 25, 2011 at 00:47, Avi Kivity <avi@redhat.com> 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.
3. qemu should be able to then restore the region
   to the initial state.

Here is my plan:
1. Add KVM_CAP_REGION_WRITE_TRAP
2. Add kvm_memory_region::flags
   KVM_MEMSLOT_TRAP_WRITES
3. Update page table creation to trap on writes when
   KVM_MEMSLOT_TRAP_WRITES is set

Is this plan heading in the right direction?

Regarding emulating ROM (as you mentioned above): I think that it can
trap to qemu and QEMU can ignore it.  This would be a performance hit,
but I don't think it is expected that lots of writes to a ROM will
occur.  Do you agree?

-Jordan

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-03-04 21:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-04  6:56 [Qemu-devel] KVM/QEMU: Support executing from flash device Jordan Justen
2012-03-04  8:12 ` Gleb Natapov
2012-03-04 10:36   ` Avi Kivity
2012-03-04 10:38     ` Gleb Natapov
2012-03-04 10:46       ` Avi Kivity
2012-03-04 21:11         ` Jordan Justen
2012-03-04 10:44 ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).