From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:53077) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPDjN-0003cl-Vj for qemu-devel@nongnu.org; Tue, 01 May 2012 10:07:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SPDjM-0004Jl-42 for qemu-devel@nongnu.org; Tue, 01 May 2012 10:07:05 -0400 Received: from mail-qc0-f173.google.com ([209.85.216.173]:65351) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPDjL-0004Jb-WA for qemu-devel@nongnu.org; Tue, 01 May 2012 10:07:04 -0400 Received: by qcsc20 with SMTP id c20so2034333qcs.4 for ; Tue, 01 May 2012 07:07:02 -0700 (PDT) Message-ID: <4F9FEDFE.3030403@codemonkey.ws> Date: Tue, 01 May 2012 09:06:54 -0500 From: Anthony Liguori 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> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed 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: Peter Maydell Cc: Mark Cave-Ayland , Avi Kivity , qemu-devel@nongnu.org On 05/01/2012 09:00 AM, Peter Maydell wrote: > On 1 May 2012 14:50, Anthony Liguori wrote: >>> On 05/01/2012 03:49 PM, Peter Maydell wrote: >>>> When QOM supports (1) exporting gpio signals and >> >> This is trivial. It'll come in as soon as 1.2 opens up. > > You need to get it through code review first... Obviously. > > (just as a random example, this commit: > https://github.com/aliguori/qemu/commit/46483049813fca2c23fb7cd04eeab89905500c4c > is going down the wrong path because it's incorrectly introducing > knowledge of device internals to the utility i8259_init() > function.) Eh? Do you mean: - qdev_connect_gpio_out(&dev->qdev, 0, irq_set[2]); + pin_connect_qemu_irq(&s->int_out[0], irq_set[2]); There are three ways to do this: 1) pin_connect_qemu_irq(i8259_get_int_out(s), irq_set[2]); 2) pin_connect_qemu_irq(&s->int_out[0], irq_set[2]); 3) pin_connect_qemu_irq(PIN(object_get_child(s, "int_out[0]")), irq_set[2]); Having converted a lot of devices by hand, I prefer (2). I'd like to move to a model of: typedef struct PICDevice { DeviceState parent; Pin int_out[0]; MemoryRegion io; /*< private >*/ PICState *priv; } PICDevice; This let's us use (2), while still embedding devices and keeping the gory state details private to the implementation. Regards, Anthony Liguori > > -- PMM