From owner-svn-src-head@freebsd.org Sat Aug 4 14:57:24 2018 Return-Path: Delivered-To: svn-src-head@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 821E1106DDF0; Sat, 4 Aug 2018 14:57:24 +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 365DB7AF5E; Sat, 4 Aug 2018 14:57:24 +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 16BBD10FC0; Sat, 4 Aug 2018 14:57:24 +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 w74EvNRj035917; Sat, 4 Aug 2018 14:57:23 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w74EvNHc035916; Sat, 4 Aug 2018 14:57:23 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201808041457.w74EvNHc035916@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 4 Aug 2018 14:57:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r337322 - head/sys/dev/hyperv/pcib X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/sys/dev/hyperv/pcib X-SVN-Commit-Revision: 337322 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Aug 2018 14:57:24 -0000 Author: dim Date: Sat Aug 4 14:57:23 2018 New Revision: 337322 URL: https://svnweb.freebsd.org/changeset/base/337322 Log: 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 MFC after: 3 days Modified: head/sys/dev/hyperv/pcib/vmbus_pcib.c Modified: head/sys/dev/hyperv/pcib/vmbus_pcib.c ============================================================================== --- head/sys/dev/hyperv/pcib/vmbus_pcib.c Sat Aug 4 14:52:32 2018 (r337321) +++ head/sys/dev/hyperv/pcib/vmbus_pcib.c Sat Aug 4 14:57:23 2018 (r337322) @@ -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);