From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UP8Fw-0000Gc-IU for qemu-devel@nongnu.org; Mon, 08 Apr 2013 05:21:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UP8Fn-00082r-LR for qemu-devel@nongnu.org; Mon, 08 Apr 2013 05:20:52 -0400 Received: from e23smtp09.au.ibm.com ([202.81.31.142]:33502) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UP8Fm-00081N-TE for qemu-devel@nongnu.org; Mon, 08 Apr 2013 05:20:43 -0400 Received: from /spool/local by e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 8 Apr 2013 19:11:53 +1000 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [9.190.235.21]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id 3C4253578050 for ; Mon, 8 Apr 2013 19:20:33 +1000 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r389JvTf8520074 for ; Mon, 8 Apr 2013 19:19:58 +1000 Received: from d23av03.au.ibm.com (loopback [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r389K1Mx022661 for ; Mon, 8 Apr 2013 19:20:02 +1000 Message-ID: <51628BBD.3010604@linux.vnet.ibm.com> Date: Mon, 08 Apr 2013 17:19:57 +0800 From: Xiao Guangrong MIME-Version: 1.0 References: <1363717469-30980-1-git-send-email-peter.maydell@linaro.org> <87y5dh2o3j.fsf@blackfin.pond.sub.org> <51625E6C.5050105@linux.vnet.ibm.com> <20130408084311.GE17919@redhat.com> In-Reply-To: <20130408084311.GE17919@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Use of flash for x86 BIOS List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gleb Natapov Cc: Peter Maydell , Anthony Liguori , Juan Quintela , "Justen, Jordan L" , Patch Tracking , qemu-devel , Markus Armbruster , Jordan Justen On 04/08/2013 04:43 PM, Gleb Natapov wrote: > On Mon, Apr 08, 2013 at 01:18:10AM -0700, Jordan Justen wrote: >> On Sun, Apr 7, 2013 at 11:06 PM, Xiao Guangrong >> wrote: >>> On 03/23/2013 03:09 AM, Jordan Justen wrote: >>> >>>> Admittedly, I've been completely ineffectual in resolving the kvm >>>> portion. More recently I tried to make use of KVM_MEM_READONLY to >>>> address this. I was able to get an VM exit on writes to flash, but not >>>> able to get the memory region to convert to full device mode so VM >>>> exits would occur on reads as well. I am once again stalled... >>> >>> Hi Jordan, >>> >>> What's memory region you want to get? I should admit that I do not >>> have enough background of flash, could you please explain this >>> requirement more detail? >> >> The flash memory requires two modes. >> >> Read/Execute mode: >> * Initial state >> * Writes will trap to QEMU, and may transition to Device mode based on >> QEMU device emulation >> >> Device mode: >> * Region is not executable >> * All reads & writes will trap to QEMU >> * May transition back to Read/Execute mode based on QEMU device emulation >> >> Using KVM_MEM_READONLY I was able to get Read/Execute mode to work, >> but I was not able to get the memory region to transition to Device >> mode. (I couldn't get reads to trap to QEMU.) >> > You need to drop memslot when you transition to Device mode. Yes. After delete the memslot, you can intercept both write and read. ;)