From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xb4BW-0005UX-CV for qemu-devel@nongnu.org; Mon, 06 Oct 2014 05:02:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xb4BQ-0004OU-8q for qemu-devel@nongnu.org; Mon, 06 Oct 2014 05:02:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4627) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xb4BQ-0004OC-1A for qemu-devel@nongnu.org; Mon, 06 Oct 2014 05:02:20 -0400 Date: Mon, 6 Oct 2014 10:02:14 +0100 From: Stefan Hajnoczi Message-ID: <20141006090214.GA2694@stefanha-thinkpad.redhat.com> References: <1409847879-9783-1-git-send-email-marc.mari.barcelo@gmail.com> <1409847879-9783-2-git-send-email-marc.mari.barcelo@gmail.com> <20141002120225.GA29693@stefanha-thinkpad.redhat.com> <20141003135313.347ad73f@crunchbang> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Nq2Wo0NMKNjxTN9z" Content-Disposition: inline In-Reply-To: <20141003135313.347ad73f@crunchbang> Subject: Re: [Qemu-devel] [PATCH 1/3] libqos: Remove PCI assumptions in virtio driver List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marc =?iso-8859-1?Q?Mar=ED?= Cc: Paolo Bonzini , qemu-devel@nongnu.org --Nq2Wo0NMKNjxTN9z Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 03, 2014 at 01:53:13PM +0200, Marc Mar=C3=AD wrote: > El Thu, 2 Oct 2014 13:02:25 +0100 > Stefan Hajnoczi escribi=C3=B3: > > On Thu, Sep 04, 2014 at 06:24:37PM +0200, Marc Mar=C3=AD wrote: > > > @@ -60,25 +60,25 @@ static void > > > qvirtio_pci_assign_device(QVirtioDevice *d, void *data) *vpcidev =3D > > > (QVirtioPCIDevice *)d; } > > > =20 > > > -static uint8_t qvirtio_pci_config_readb(QVirtioDevice *d, void > > > *addr) +static uint8_t qvirtio_pci_config_readb(QVirtioDevice *d, > > > uint64_t addr) { > > > QVirtioPCIDevice *dev =3D (QVirtioPCIDevice *)d; > > > - return qpci_io_readb(dev->pdev, addr); > > > + return qpci_io_readb(dev->pdev, (void *)addr); > >=20 > > You do not need casts in C for void* to any pointer type or any > > pointer type to void*. Please drop them. >=20 > addr is of type uint64_t, not a pointer. So if there's no cast it will > fail to compile (expected =E2=80=98void *=E2=80=99 but argument is of typ= e =E2=80=98uint64_t=E2=80=99) Hmm...on 32-bit hosts that causes an error: a.c:7:17: warning: cast to pointer from integer of different size [-Wint-to= -pointer-cast] printf("%p\n", (void*)u64); You need to cast to uintptr_t first: (void*)(uintptr_t)addr This assumes that PCI IO Space addresses are 32-bit when running 32-bit hosts. Not sure whether or not that's true, but at least for x86 it works since the legacy PIO address space is 16-bit. Stefan --Nq2Wo0NMKNjxTN9z Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJUMlqWAAoJEJykq7OBq3PIeUQH/A+lQhvj9qYXyT8YzMQ/eksl wXmXbfvZA23CS3+nwVxh72ek6e+BBnXrSmaYVfTxWTgGQ3muYdsdYf5SaoWFy+55 tMup+nrzPugv4806m78G6nzxIFZTJu3xa6FVTHetsqVNZTT5VFSKNSTDcWuPDilI 5mOadT8S950hzA372C4S16grnl+e6g6IJGBl8fi2QCBb2kNu7KDDt6JxOiHRbkJt Powy/ojPL5EDu0XHJCU3s8Sn58GN9jCxjOlI073UsVMn4Hl3+GWo9wjbJaYfE3xt ixuXlqj4olD5RvR975jZWgfdsDgaxtcb9f5RifTfikqCHlUMIF0DEqf3fFOwFnY= =gc8O -----END PGP SIGNATURE----- --Nq2Wo0NMKNjxTN9z--