From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPE2n-0002XR-3C for qemu-devel@nongnu.org; Tue, 01 May 2012 10:27:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SPE2l-00036J-9Z for qemu-devel@nongnu.org; Tue, 01 May 2012 10:27:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56922) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPE2l-000369-0e for qemu-devel@nongnu.org; Tue, 01 May 2012 10:27:07 -0400 Message-ID: <4F9FF2AF.6020307@redhat.com> Date: Tue, 01 May 2012 17:26:55 +0300 From: Avi Kivity MIME-Version: 1.0 References: <4F9D797E.500@ilande.co.uk> <4F9D97F3.8080608@codemonkey.ws> <4F9E5028.7010306@redhat.com> <4F9E82C7.10706@ilande.co.uk> <4F9E9268.70408@redhat.com> <4F9E9569.5000700@redhat.com> <4F9FD997.9000403@redhat.com> <4F9FDA38.6030108@redhat.com> <4F9FDB80.4020604@redhat.com> <4F9FDEBC.2030806@redhat.com> <4F9FEA24.3070603@codemonkey.ws> <4F9FEE83.70306@redhat.com> <4F9FF00C.2070000@codemonkey.ws> In-Reply-To: <4F9FF00C.2070000@codemonkey.ws> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Memory API: handling unassigned physical memory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Peter Maydell , Mark Cave-Ayland , qemu-devel@nongnu.org On 05/01/2012 05:15 PM, Anthony Liguori wrote: >>> I think a nice fix would be to make it_shift as memory region mutator >>> and allow it to be set after initialization. >> >> Indeed I wanted to make it_shift as part of the memory core. But a >> mutator? It doesn't change in real hardware, so this looks artificial. >> So far all mutators really change at runtime. > > > QOM has a concept of initialization and realize. You can change > properties after initialization but not before realize. > > So as long as it_shift can be set after initialization but before > realize (which I think is roughly memory_region_add_subregion) it > doesn't need to be a mutator. Ok, good. > >> What is the problem with delaying region initialization until realize? > > We need to initialize the MemoryRegion in order to expose it as a > property. We want to do that during initialize. Here's an example: > > qom-create isa-i8259 foo > qom-set /peripheral/foo/io it_shift 1 > qom-set /peripheral/foo/realize true > > For this to work, it_shift needs to be a QOM property of the "io" > MemoryRegion. The MemoryRegion needs to be created in instance_init. So it looks like we need two phase initialization for memory regions as well? Not so pretty. > >>> b) There's some duplication in MemoryRegions with respect to QOM. >>> Memory regions want to have a name but with QOM they'll be addressable >>> via a path. I go back and forth about how aggressively we want to >>> refactor MemoryRegions. >> >> These days region names are purely for debugging. The ABI bit was moved >> to a separate function. > > Fair enough. > > BTW, in the branch I've posted, I've got a number of memory API > conversions or removal of legacy interfaces. Nice. But you use get_system_io(), which is bad. -- error compiling committee.c: too many arguments to function