Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Apr 2013 11:48:56 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Ian Lepore <ian@FreeBSD.org>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r246713 - in head/sys: arm/arm cam cam/ctl cam/scsi conf dev/aac dev/advansys dev/aha dev/ahb dev/ahci dev/aic dev/aic7xxx dev/amr dev/arcmsr dev/ata dev/buslogic dev/ciss dev/dpt dev/f...
Message-ID:  <20130401084856.GQ3794@kib.kiev.ua>
In-Reply-To: <1364775617.1312.4.camel@revolution.hippie.lan>
References:  <201302121657.r1CGvKb5007795@svn.freebsd.org> <1364775617.1312.4.camel@revolution.hippie.lan>

next in thread | previous in thread | raw e-mail | index | archive | help

--gc60dUbPCPq6wSWX
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Mar 31, 2013 at 06:20:17PM -0600, Ian Lepore wrote:
> On Tue, 2013-02-12 at 16:57 +0000, Konstantin Belousov wrote:
> > Author: kib
> > Date: Tue Feb 12 16:57:20 2013
> > New Revision: 246713
> > URL: http://svnweb.freebsd.org/changeset/base/246713
> >=20
> > Log:
> >   Reform the busdma API so that new types may be added without modifying
> >   every architecture's busdma_machdep.c.  It is done by unifying the
> >   bus_dmamap_load_buffer() routines so that they may be called from MI
> >   code.  The MD busdma is then given a chance to do any final processing
> >   in the complete() callback.
> >  =20
> >   The cam changes unify the bus_dmamap_load* handling in cam drivers.
> >  =20
> >   The arm and mips implementations are updated to track virtual
> >   addresses for sync().  Previously this was done in a type specific
> >   way.  Now it is done in a generic way by recording the list of
> >   virtuals in the map.
> >  =20
> >   Submitted by:	jeff (sponsored by EMC/Isilon)
> >   Reviewed by:	kan (previous version), scottl,
> >   	mjacob (isp(4), no objections for target mode changes)
> >   Discussed with:	     ian (arm changes)
> >   Tested by:	marius (sparc64), mips (jmallet), isci(4) on x86 (jharris),
> >   	amd64 (Fabian Keil <freebsd-listen@fabiankeil.de>)
> >=20
> > Added:
> >   head/sys/kern/subr_bus_dma.c   (contents, props changed)
> >   [...]
>=20
> I've just discovered that _bus_dmamap_load_vlist() gets a compile
> warning when building tinderbox on an i386 host, while building for PAE
> and XEN:
>=20
> cc1: warnings being treated as errors
> /local/build/staging/freebsd/head/src/sys/kern/subr_bus_dma.c: In functio=
n '_bus_dmamap_load_vlist':
> /local/build/staging/freebsd/head/src/sys/kern/subr_bus_dma.c:69: warning=
: cast to pointer from integer of different size [-Wint-to-pointer-cast]
>=20
> My build machine is i386 PAE running 8.3 (needs to be that old for our
> build system at $work), so if this is a bogus error caused by building
> -current on such a downlevel system, I appologize in advance for the
> noise.

The warning is bogus in a sense that the code is correct. The bus_addr_t
on the PAE i386 is uint64_t, and since void * is 32bit, the warning
is emited. On the other hand, the promise of the caller of the
_bus_dmamap_load_vlist() is to have the virtual addresses stored in the
ds_addr, so the cast is not problematic.

The warning is useful only in the other direction, IMO, i.e. when casting
wide pointer to narrow integer type.

The warning is obviously specific to the version of the compiler you use.
It is not hard to fix it, could you, please, verify the patch below ?

diff --git a/sys/kern/subr_bus_dma.c b/sys/kern/subr_bus_dma.c
index 45fa9bb..4528601 100644
--- a/sys/kern/subr_bus_dma.c
+++ b/sys/kern/subr_bus_dma.c
@@ -66,8 +66,8 @@ _bus_dmamap_load_vlist(bus_dma_tag_t dmat, bus_dmamap_t m=
ap,
 	error =3D 0;
 	for (; sglist_cnt > 0; sglist_cnt--, list++) {
 		error =3D _bus_dmamap_load_buffer(dmat, map,
-		    (void *)list->ds_addr, list->ds_len, pmap, flags, NULL,
-		    nsegs);
+		    (void *)(uintptr_t)list->ds_addr, list->ds_len, pmap,
+		    flags, NULL, nsegs);
 		if (error)
 			break;
 	}

--gc60dUbPCPq6wSWX
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (FreeBSD)

iQIcBAEBAgAGBQJRWUn3AAoJEJDCuSvBvK1BNd0QAI76T7GivfL7CRBGosCgg28N
CfRqOM35CYc1r28NwzVY4Zs/EjiVIzsejK/yRfATm+eNpHjZwPm+46yWYcX8J0HL
TWxCZfWAowUrDnyio4DmE2C1yS55J5RWd3nPmFCuCmotflUOU1BV/xTPH8gBlmdk
CsrOsqxsvQq0ahN/jls9gMmlBM4m7u1P2WDPtGGl7Dj7qO3fomUQJ/yWXuL8LWBd
thxHrclHDeuPhzb1O6Nj3gdWWXLvgcQfHFFaUjyQJ/PU3w04JYc2ivgFnSt/olGD
v0HtxT2wlaZWED3pBGH+8gFChFuUmYVhkQYi7K716cozhcQCURkFtyFemAdxxpB9
PaukBXFW0T08kLvynu/BDRvnRCo5vL6GMLuBbSrMDtv80cvhXNR7voCr2ambeYCe
cBAWbLh6hM7BsB89rp7Jg/nrqrGFbOz4zhUEWZqYFXekU5kDYZNDvbhJTn63xCpl
Th+TCFZfmlQxGfSVu22arppFxgylOsU+SS2BEMHrhxijJkMQd7xjSyeth2l3Syt0
okAcrCtqqc6JNKZpPTDnq9KqovK7eVD8n70ANeBbnQWxnDy5FUQnZn2GF284anrr
z1LElL0xH7rYdQSlG9eoGAsLs9p1RzPB80zxrshPy9Q3OnWVN3xnqYKWjJ2FY1lw
BiuGzWDS5NcAkz4d0Pf4
=9IXv
-----END PGP SIGNATURE-----

--gc60dUbPCPq6wSWX--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130401084856.GQ3794>