From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrOfT-0007A5-29 for qemu-devel@nongnu.org; Thu, 11 Aug 2011 02:23:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QrOfO-0008S8-EQ for qemu-devel@nongnu.org; Thu, 11 Aug 2011 02:22:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26659) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QrOfO-0008Rv-0n for qemu-devel@nongnu.org; Thu, 11 Aug 2011 02:22:54 -0400 Message-ID: <4E437539.2020207@redhat.com> Date: Thu, 11 Aug 2011 09:22:49 +0300 From: Avi Kivity MIME-Version: 1.0 References: <1313015300-23920-1-git-send-email-rth@twiddle.net> <1313015300-23920-6-git-send-email-rth@twiddle.net> In-Reply-To: <1313015300-23920-6-git-send-email-rth@twiddle.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 05/11] cs4231a: Convert to MemoryRegion. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: qemu-devel@nongnu.org On 08/11/2011 01:28 AM, Richard Henderson wrote: > } > }; > > +static const MemoryRegionOps cs_ioport_ops = { > + .read = cs_read, > + .write = cs_write, > + .impl = { > + .min_access_size = 1, > + .max_access_size = 1, > + } > +}; Should be .valid, not .impl. .impl means the implementation only supports this access size; emulate other sizes by using a supported size (e.g. crack a 4-byte access into 4 1-byte accesses). .valid means what the device actually supports; if the guest uses another size something bus-defined happens. > + > static int cs4231a_initfn (ISADevice *dev) > { > CSState *s = DO_UPCAST (CSState, dev, dev); > - int i; > > isa_init_irq (dev,&s->pic, s->irq); > > - for (i = 0; i< 4; i++) { > - isa_init_ioport(dev, i); > - register_ioport_write (s->port + i, 1, 1, cs_write, s); > - register_ioport_read (s->port + i, 1, 1, cs_read, s); > - } > + memory_region_init_io(&s->ioports,&cs_ioport_ops, s, "cs4231a", 4); > + isa_register_ioport(dev,&s->ioports, s->port); > > DMA_register_channel (s->dma, cs_dma_read, s); > -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.