[PATCH] arm/arm64: KVM: Support KVM_CAP_READONLY_MEM

Peter Maydell peter.maydell at linaro.org
Fri Aug 15 05:21:59 PDT 2014


On 15 August 2014 10:15, Christoffer Dall <christoffer.dall at linaro.org> wrote:
> On Thu, Aug 14, 2014 at 04:46:20PM +0100, Marc Zyngier wrote:
>> So the consequence of a write to a ROM region would be to do an IO
>> emulation? That seems a bit weird. Shouldn't we have a separate error
>> path for this (possibly ignoring the write entierely)?

> It's part of the ABI, see Documentation/virtual/kvm/api.txt section
> 4.35:
>
> "The latter [KVM_KVM_READONLY] can be set, if KVM_CAP_READONLY_MEM
> capability allows it, to make a new slot read-only.  In this case,
> writes to this memory will be posted to userspace as KVM_EXIT_MMIO
> exits."

...and the reason for this is so we can execute out of things
like NOR flash devices, which typically have "reads just read
but writes are interpreted as command bytes to do block
erase or write of the flash device" semantics. If userspace
wants "reads should fault" behaviour it can implement it
itself (well, it could if the KVM MMIO API supported having
an MMIO exit return "this should fault", but that's a separate
thing.)

-- PMM



More information about the linux-arm-kernel mailing list