From owner-svn-src-all@freebsd.org  Fri Aug 17 06:31:31 2018
Return-Path: <owner-svn-src-all@freebsd.org>
Delivered-To: svn-src-all@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 351BD108464A;
 Fri, 17 Aug 2018 06:31:31 +0000 (UTC) (envelope-from dim@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id DE8D18F1B3;
 Fri, 17 Aug 2018 06:31:30 +0000 (UTC) (envelope-from dim@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC62924AC1;
 Fri, 17 Aug 2018 06:31:30 +0000 (UTC) (envelope-from dim@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w7H6VUfq015052;
 Fri, 17 Aug 2018 06:31:30 GMT (envelope-from dim@FreeBSD.org)
Received: (from dim@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7H6VU1j015051;
 Fri, 17 Aug 2018 06:31:30 GMT (envelope-from dim@FreeBSD.org)
Message-Id: <201808170631.w7H6VU1j015051@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org
 using -f
From: Dimitry Andric <dim@FreeBSD.org>
Date: Fri, 17 Aug 2018 06:31:30 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject: svn commit: r337959 - in stable: 10/sys/dev/hyperv/pcib
 11/sys/dev/hyperv/pcib
X-SVN-Group: stable-10
X-SVN-Commit-Author: dim
X-SVN-Commit-Paths: in stable: 10/sys/dev/hyperv/pcib 11/sys/dev/hyperv/pcib
X-SVN-Commit-Revision: 337959
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.27
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for &quot;
 user&quot; and &quot; projects&quot; \)" <svn-src-all.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all/>
List-Post: <mailto:svn-src-all@freebsd.org>
List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 17 Aug 2018 06:31:31 -0000

Author: dim
Date: Fri Aug 17 06:31:30 2018
New Revision: 337959
URL: https://svnweb.freebsd.org/changeset/base/337959

Log:
  MFC r337322:
  
  Fix build of hyperv with base gcc on i386
  
  Summary:
  Base gcc fails to compile `sys/dev/hyperv/pcib/vmbus_pcib.c` for i386,
  with the following -Werror warnings:
  
  cc1: warnings being treated as errors
  /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'new_pcichild_device':
  /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:567: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'vmbus_pcib_on_channel_callback':
  /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:940: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'hv_pci_protocol_negotiation':
  /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:1012: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'hv_pci_enter_d0':
  /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:1073: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'hv_send_resources_allocated':
  /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:1125: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c: In function 'vmbus_pcib_map_msi':
  /usr/src/sys/dev/hyperv/pcib/vmbus_pcib.c:1730: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  
  This is because on i386, several casts from `uint64_t` to a pointer
  reduce the value from 64 bit to 32 bit.
  
  For gcc, this can be fixed by an intermediate cast to uintptr_t. Note
  that I am assuming the incoming values will always fit into 32 bit!
  
  Differential Revision: https://reviews.freebsd.org/D15753

Modified:
  stable/10/sys/dev/hyperv/pcib/vmbus_pcib.c
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/dev/hyperv/pcib/vmbus_pcib.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/10/sys/dev/hyperv/pcib/vmbus_pcib.c
==============================================================================
--- stable/10/sys/dev/hyperv/pcib/vmbus_pcib.c	Fri Aug 17 04:40:01 2018	(r337958)
+++ stable/10/sys/dev/hyperv/pcib/vmbus_pcib.c	Fri Aug 17 06:31:30 2018	(r337959)
@@ -564,7 +564,7 @@ new_pcichild_device(struct hv_pcibus *hbus, struct pci
 
 	ret = vmbus_chan_send(hbus->sc->chan,
 	    VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
-	    res_req, sizeof(*res_req), (uint64_t)&ctxt.pkt);
+	    res_req, sizeof(*res_req), (uint64_t)(uintptr_t)&ctxt.pkt);
 	if (ret)
 		goto err;
 
@@ -937,7 +937,8 @@ vmbus_pcib_on_channel_callback(struct vmbus_channel *c
 
 		switch (pkt->cph_type) {
 		case VMBUS_CHANPKT_TYPE_COMP:
-			comp_packet = (struct pci_packet *)pkt->cph_xactid;
+			comp_packet =
+			    (struct pci_packet *)(uintptr_t)pkt->cph_xactid;
 			response = (struct pci_response *)pkt;
 			comp_packet->completion_func(comp_packet->compl_ctxt,
 			    response, bytes_rxed);
@@ -1009,7 +1010,7 @@ hv_pci_protocol_negotiation(struct hv_pcibus *hbus)
 
 	ret = vmbus_chan_send(hbus->sc->chan, VMBUS_CHANPKT_TYPE_INBAND,
 	    VMBUS_CHANPKT_FLAG_RC, version_req, sizeof(*version_req),
-	    (uint64_t)&ctxt.pkt);
+	    (uint64_t)(uintptr_t)&ctxt.pkt);
 	if (ret)
 		goto out;
 
@@ -1070,7 +1071,7 @@ hv_pci_enter_d0(struct hv_pcibus *hbus)
 
 	ret = vmbus_chan_send(hbus->sc->chan, VMBUS_CHANPKT_TYPE_INBAND,
 	    VMBUS_CHANPKT_FLAG_RC, d0_entry, sizeof(*d0_entry),
-	    (uint64_t)&ctxt.pkt);
+	    (uint64_t)(uintptr_t)&ctxt.pkt);
 	if (ret)
 		goto out;
 
@@ -1122,7 +1123,8 @@ hv_send_resources_allocated(struct hv_pcibus *hbus)
 
 		ret = vmbus_chan_send(hbus->sc->chan,
 		    VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
-		    &pkt->message, sizeof(*res_assigned), (uint64_t)pkt);
+		    &pkt->message, sizeof(*res_assigned),
+		    (uint64_t)(uintptr_t)pkt);
 		if (ret) {
 			free_completion(&comp_pkt.host_event);
 			break;
@@ -1727,7 +1729,7 @@ vmbus_pcib_map_msi(device_t pcib, device_t child, int 
 
 	ret = vmbus_chan_send(sc->chan,	VMBUS_CHANPKT_TYPE_INBAND,
 	    VMBUS_CHANPKT_FLAG_RC, int_pkt, sizeof(*int_pkt),
-	    (uint64_t)&ctxt.pkt);
+	    (uint64_t)(uintptr_t)&ctxt.pkt);
 	if (ret) {
 		free_completion(&comp.comp_pkt.host_event);
 		return (ret);