From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 3/3] support readonly memory feature in qemu Date: Sun, 09 Sep 2012 18:42:29 +0300 Message-ID: <504CB8E5.8040509@redhat.com> References: <1347006389-543-1-git-send-email-liusheng@linux.vnet.ibm.com> <1347006389-543-4-git-send-email-liusheng@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, mtosatti@redhat.com, xiaoguangrong@linux.vnet.ibm.com, qemu-devel@nongnu.org, aliguori@us.ibm.com To: Liu Sheng Return-path: Received: from mx1.redhat.com ([209.132.183.28]:57328 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753255Ab2IIPmh (ORCPT ); Sun, 9 Sep 2012 11:42:37 -0400 In-Reply-To: <1347006389-543-4-git-send-email-liusheng@linux.vnet.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: 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