From owner-svn-src-all@freebsd.org Tue Jul 12 08:07:28 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0AA8B9364C; Tue, 12 Jul 2016 08:07:28 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [96.47.72.37]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3BCE61589; Tue, 12 Jul 2016 08:06:50 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6C7nc5t011470; Tue, 12 Jul 2016 07:49:38 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6C7nc5C011465; Tue, 12 Jul 2016 07:49:38 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201607120749.u6C7nc5C011465@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Tue, 12 Jul 2016 07:49:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r302630 - head/sys/dev/hyperv/vmbus X-SVN-Group: head 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.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jul 2016 08:07:28 -0000 Author: sephe Date: Tue Jul 12 07:49:38 2016 New Revision: 302630 URL: https://svnweb.freebsd.org/changeset/base/302630 Log: hyperv/vmbus: Move GPADL index into vmbus_softc MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D6954 Modified: head/sys/dev/hyperv/vmbus/hv_channel.c head/sys/dev/hyperv/vmbus/hv_connection.c head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h head/sys/dev/hyperv/vmbus/vmbus.c head/sys/dev/hyperv/vmbus/vmbus_var.h Modified: head/sys/dev/hyperv/vmbus/hv_channel.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 12 07:33:39 2016 (r302629) +++ head/sys/dev/hyperv/vmbus/hv_channel.c Tue Jul 12 07:49:38 2016 (r302630) @@ -343,8 +343,7 @@ hv_vmbus_channel_establish_gpadl(struct /* * Allocate GPADL id. */ - gpadl = atomic_fetchadd_int( - &hv_vmbus_g_connection.next_gpadl_handle, 1); + gpadl = vmbus_gpadl_alloc(sc); *gpadl0 = gpadl; /* Modified: head/sys/dev/hyperv/vmbus/hv_connection.c ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_connection.c Tue Jul 12 07:33:39 2016 (r302629) +++ head/sys/dev/hyperv/vmbus/hv_connection.c Tue Jul 12 07:49:38 2016 (r302630) @@ -47,8 +47,7 @@ * Globals */ hv_vmbus_connection hv_vmbus_g_connection = - { .connect_state = HV_DISCONNECTED, - .next_gpadl_handle = 0xE1E10, }; + { .connect_state = HV_DISCONNECTED }; /** * Send a connect request on the partition service connection Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h ============================================================================== --- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jul 12 07:33:39 2016 (r302629) +++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h Tue Jul 12 07:49:38 2016 (r302630) @@ -107,7 +107,6 @@ typedef enum { typedef struct { hv_vmbus_connect_state connect_state; - uint32_t next_gpadl_handle; /** * List of primary channels. Sub channels will be linked Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 12 07:33:39 2016 (r302629) +++ head/sys/dev/hyperv/vmbus/vmbus.c Tue Jul 12 07:49:38 2016 (r302630) @@ -70,6 +70,8 @@ __FBSDID("$FreeBSD$"); #include "acpi_if.h" #include "vmbus_if.h" +#define VMBUS_GPADL_START 0xe1e10 + struct vmbus_msghc { struct hypercall_postmsg_in *mh_inprm; struct hypercall_postmsg_in mh_inprm_save; @@ -372,6 +374,12 @@ vmbus_msghc_wakeup(struct vmbus_softc *s wakeup(&mhc->mhc_active); } +uint32_t +vmbus_gpadl_alloc(struct vmbus_softc *sc) +{ + return atomic_fetchadd_int(&sc->vmbus_gpadl, 1); +} + static int vmbus_connect(struct vmbus_softc *sc, uint32_t version) { @@ -1121,6 +1129,7 @@ vmbus_doattach(struct vmbus_softc *sc) sc->vmbus_flags |= VMBUS_FLAG_ATTACHED; mtx_init(&sc->vmbus_scan_lock, "vmbus scan", NULL, MTX_DEF); + sc->vmbus_gpadl = VMBUS_GPADL_START; /* * Create context for "post message" Hypercalls Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus_var.h Tue Jul 12 07:33:39 2016 (r302629) +++ head/sys/dev/hyperv/vmbus/vmbus_var.h Tue Jul 12 07:49:38 2016 (r302630) @@ -86,6 +86,7 @@ struct vmbus_softc { int vmbus_idtvec; uint32_t vmbus_flags; /* see VMBUS_FLAG_ */ uint32_t vmbus_version; + uint32_t vmbus_gpadl; /* Shared memory for vmbus_{rx,tx}_evtflags */ void *vmbus_evtflags; @@ -148,4 +149,6 @@ void vmbus_msghc_reset(struct vmbus_msgh void vmbus_scan_done(struct vmbus_softc *); void vmbus_scan_newchan(struct vmbus_softc *); +uint32_t vmbus_gpadl_alloc(struct vmbus_softc *); + #endif /* !_VMBUS_VAR_H_ */