From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TAjef-0005aj-JQ for qemu-devel@nongnu.org; Sun, 09 Sep 2012 11:42:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TAjee-0001Y1-Gn for qemu-devel@nongnu.org; Sun, 09 Sep 2012 11:42:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3814) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TAjee-0001Xv-8K for qemu-devel@nongnu.org; Sun, 09 Sep 2012 11:42:36 -0400 Message-ID: <504CB8E5.8040509@redhat.com> Date: Sun, 09 Sep 2012 18:42:29 +0300 From: Avi Kivity MIME-Version: 1.0 References: <1347006389-543-1-git-send-email-liusheng@linux.vnet.ibm.com> <1347006389-543-4-git-send-email-liusheng@linux.vnet.ibm.com> In-Reply-To: <1347006389-543-4-git-send-email-liusheng@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/3] support readonly memory feature in qemu List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liu Sheng Cc: aliguori@us.ibm.com, mtosatti@redhat.com, qemu-devel@nongnu.org, kvm@vger.kernel.org, xiaoguangrong@linux.vnet.ibm.com On 09/07/2012 11:26 AM, Liu Sheng wrote: > as readonly memory is support in kvm, this patch supports this feature > in qemu, mainly pluging the memory region with KVM_MEM_READONLY flag > to kvm. > > @@ -1607,10 +1623,19 @@ int kvm_cpu_exec(CPUArchState *env) > break; > case KVM_EXIT_MMIO: > DPRINTF("handle_mmio\n"); > - cpu_physical_memory_rw(run->mmio.phys_addr, > - run->mmio.data, > - run->mmio.len, > - run->mmio.is_write); > + if (run->mmio.write_readonly_mem) { > + fprintf(stderr, "Guest is writing readonly memory, " > + "phys_addr: %llx, len:%x, data[0]:%c, skip it.\n", > + run->mmio.phys_addr, > + run->mmio.len, > + run->mmio.data[0]); > + } else { > + cpu_physical_memory_rw(run->mmio.phys_addr, > + run->mmio.data, > + run->mmio.len, > + run->mmio.is_write); > + } > + > ret = 0; I don't think this is needed. A cpu_physical_memory_rw() to a ROM ought to be ignored (and btw, it may not be a ROM - it could be a ROM/Device, in which case it ought not to be ignored). -- error compiling committee.c: too many arguments to function