From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [Qemu-devel] [PATCH v3 13/39] rtl8139: convert to memory API Date: Fri, 05 Aug 2011 09:21:32 -0500 Message-ID: <4E3BFC6C.7010403@codemonkey.ws> References: <1312463195-13605-1-git-send-email-avi@redhat.com> <1312463195-13605-14-git-send-email-avi@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, "Michael S. Tsirkin" To: Avi Kivity Return-path: Received: from mail-gw0-f46.google.com ([74.125.83.46]:52409 "EHLO mail-gw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753237Ab1HEOVf (ORCPT ); Fri, 5 Aug 2011 10:21:35 -0400 Received: by gwaa12 with SMTP id a12so1702776gwa.19 for ; Fri, 05 Aug 2011 07:21:34 -0700 (PDT) In-Reply-To: <1312463195-13605-14-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 08/04/2011 08:06 AM, Avi Kivity wrote: > Reviewed-by: Richard Henderson > Signed-off-by: Avi Kivity > --- > hw/rtl8139.c | 72 ++++++++++++++++++++++++++++++--------------------------- > 1 files changed, 38 insertions(+), 34 deletions(-) > > diff --git a/hw/rtl8139.c b/hw/rtl8139.c > index 5214b8c..dfbab90 100644 > --- a/hw/rtl8139.c > +++ b/hw/rtl8139.c > @@ -474,7 +474,6 @@ typedef struct RTL8139State { > > NICState *nic; > NICConf conf; > - int rtl8139_mmio_io_addr; > > /* C ring mode */ > uint32_t currTxDesc; > @@ -506,6 +505,9 @@ typedef struct RTL8139State { > QEMUTimer *timer; > int64_t TimerExpire; > > + MemoryRegion bar_io; > + MemoryRegion bar_mem; > + > /* Support migration to/from old versions */ > int rtl8139_mmio_io_addr_dummy; > } RTL8139State; > @@ -3283,7 +3285,7 @@ static void rtl8139_pre_save(void *opaque) > rtl8139_set_next_tctr_time(s, current_time); > s->TCTR = muldiv64(current_time - s->TCTR_base, PCI_FREQUENCY, > get_ticks_per_sec()); > - s->rtl8139_mmio_io_addr_dummy = s->rtl8139_mmio_io_addr; > + s->rtl8139_mmio_io_addr_dummy = 0; > } > > static const VMStateDescription vmstate_rtl8139 = { > @@ -3379,31 +3381,35 @@ static const VMStateDescription vmstate_rtl8139 = { > /***********************************************************/ > /* PCI RTL8139 definitions */ > > -static void rtl8139_ioport_map(PCIDevice *pci_dev, int region_num, > - pcibus_t addr, pcibus_t size, int type) > -{ > - RTL8139State *s = DO_UPCAST(RTL8139State, dev, pci_dev); > - > - register_ioport_write(addr, 0x100, 1, rtl8139_ioport_writeb, s); > - register_ioport_read( addr, 0x100, 1, rtl8139_ioport_readb, s); > - > - register_ioport_write(addr, 0x100, 2, rtl8139_ioport_writew, s); > - register_ioport_read( addr, 0x100, 2, rtl8139_ioport_readw, s); > - > - register_ioport_write(addr, 0x100, 4, rtl8139_ioport_writel, s); > - register_ioport_read( addr, 0x100, 4, rtl8139_ioport_readl, s); > -} > +static const MemoryRegionPortio rtl8139_portio[] = { > + { 0, 0x100, 1, .read = rtl8139_ioport_readb, }, > + { 0, 0x100, 1, .write = rtl8139_ioport_writeb, }, > + { 0, 0x100, 2, .read = rtl8139_ioport_readw, }, > + { 0, 0x100, 2, .write = rtl8139_ioport_writew, }, > + { 0, 0x100, 4, .read = rtl8139_ioport_readl, }, > + { 0, 0x100, 4, .write = rtl8139_ioport_writel, }, > + PORTIO_END Hrm, I missed this #define when it was introduced. Elsewhere we use: VMSTATE_END_OF_LIST() DEFINE_PROP_END_OF_LIST() For consistency, we ought to use PORTIO_END_OF_LIST() Otherwise: Reviewed-by: Anthony Liguori Regards, Anthony Liguori