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_ */
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to