Received: from eggs.gnu.org ([2001:4830:134:3::10]:34175) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxVEo-0001wN-G0 for qemu-devel@nongnu.org; Fri, 21 Oct 2016 04:31:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bxVEk-000493-IV for qemu-devel@nongnu.org; Fri, 21 Oct 2016 04:31:38 -0400 References: <1477012792-3326-1-git-send-email-david@gibson.dropbear.id.au> <1477012792-3326-9-git-send-email-david@gibson.dropbear.id.au> From: Laurent Vivier Message-ID: <8f01103a-9c90-21d2-131c-1e58828615d4@redhat.com> Date: Fri, 21 Oct 2016 10:31:27 +0200 MIME-Version: 1.0 In-Reply-To: <1477012792-3326-9-git-send-email-david@gibson.dropbear.id.au> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCHv4 08/11] tests: Clean up IO handling in ide-test List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson , pbonzini@redhat.com, qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, agraf@suse.de, stefanha@redhat.com, mst@redhat.com, aik@ozlabs.ru, mdroth@linux.vnet.ibm.com, groug@kaod.org, thuth@redhat.com On 21/10/2016 03:19, David Gibson wrote: > ide-test uses many explicit inb() / outb() operations for its IO, which > means it's not portable to non-x86 platforms. This cleans it up to use > the libqos PCI accessors instead. > > Signed-off-by: David Gibson > --- > tests/ide-test.c | 179 ++++++++++++++++++++++++++++++++++++------------------- > 1 file changed, 118 insertions(+), 61 deletions(-) > > diff --git a/tests/ide-test.c b/tests/ide-test.c > index a8a4081..86c4373 100644 > --- a/tests/ide-test.c > +++ b/tests/ide-test.c ... > @@ -654,7 +700,8 @@ typedef struct Read10CDB { > uint16_t padding; > } __attribute__((__packed__)) Read10CDB; > > -static void send_scsi_cdb_read10(uint64_t lba, int nblocks) > +static void send_scsi_cdb_read10(QPCIDevice *dev, void *ide_base, > + uint64_t lba, int nblocks) > { > Read10CDB pkt = { .padding = 0 }; > int i; > @@ -670,7 +717,8 @@ static void send_scsi_cdb_read10(uint64_t lba, int nblocks) > > /* Send Packet */ > for (i = 0; i < sizeof(Read10CDB)/2; i++) { > - outw(IDE_BASE + reg_data, cpu_to_le16(((uint16_t *)&pkt)[i])); > + qpci_io_writew(dev, ide_base + reg_data, > + le16_to_cpu(((uint16_t *)&pkt)[i])); > } > } > ... > @@ -780,7 +836,8 @@ static void cdrom_pio_impl(int nblocks) > > /* HP4: Transfer_Data */ > for (j = 0; j < MIN((limit / 2), rem); j++) { > - rx[offset + j] = le16_to_cpu(inw(IDE_BASE + reg_data)); > + rx[offset + j] = cpu_to_le16(qpci_io_readw(dev, > + ide_base + reg_data)); > } > } Why do you swap le16_to_cpu() and cpu_to_le16()? I think this is not semantically correct and the purpose of this patch is only to replace inX()/outX() functions. Laurent