Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Jun 2016 02:36:03 +0000 (UTC)
From:      Sepherosa Ziehau <sephe@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r302040 - in stable/10/sys/dev/hyperv: netvsc storvsc vmbus
Message-ID:  <201606210236.u5L2a39L030518@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sephe
Date: Tue Jun 21 02:36:03 2016
New Revision: 302040
URL: https://svnweb.freebsd.org/changeset/base/302040

Log:
  MFC 297815,297841,297908,297913
  
  297815
      hyperv: Typo
  
      Noticed by: kib
      MFC after:  1 week
      Sponsored by:       Microsoft OSTC
  
  297841
      hyperv: Replace 0 w/ NULL
  
      Submitted by:       pfg
      MFC after:  1 week
      Sponsored by:       Microsoft OSTC
  
  297908
      hyperv/vmbus: Merge duplicated version check for events
  
      Submitted by:       Jun Su <junsu microsoft com>
      Reviewed by:        sephe
      MFC after:  1 week
      Sponsored by:       Microsoft OSTC
      Differential Revision:      https://reviews.freebsd.org/D5911
  
  297913
      hyperv: device_get_softc does not return NULL
  
      MFC after:  1 week
      Sponsored by:       Microsoft OSTC

Modified:
  stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
  stable/10/sys/dev/hyperv/vmbus/hv_connection.c
  stable/10/sys/dev/hyperv/vmbus/hv_hv.c
  stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==============================================================================
--- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c	Tue Jun 21 00:01:02 2016	(r302039)
+++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c	Tue Jun 21 02:36:03 2016	(r302040)
@@ -433,9 +433,6 @@ netvsc_attach(device_t dev)
 	int tso_maxlen;
 
 	sc = device_get_softc(dev);
-	if (sc == NULL) {
-		return (ENOMEM);
-	}
 
 	bzero(sc, sizeof(hn_softc_t));
 	sc->hn_unit = unit;
@@ -1186,10 +1183,6 @@ netvsc_linkstatus_callback(struct hv_dev
 {
 	hn_softc_t *sc = device_get_softc(device_obj->device);
 
-	if (sc == NULL) {
-		return;
-	}
-
 	if (status == 1) {
 		sc->hn_carrier = 1;
 	} else {

Modified: stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==============================================================================
--- stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Tue Jun 21 00:01:02 2016	(r302039)
+++ stable/10/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c	Tue Jun 21 02:36:03 2016	(r302040)
@@ -324,9 +324,6 @@ get_stor_device(struct hv_device *device
 	struct storvsc_softc *sc;
 
 	sc = device_get_softc(device->device);
-	if (sc == NULL) {
-		return NULL;
-	}
 
 	if (outbound) {
 		/*
@@ -1009,10 +1006,6 @@ storvsc_attach(device_t dev)
 	root_mount_token = root_mount_hold("storvsc");
 
 	sc = device_get_softc(dev);
-	if (sc == NULL) {
-		ret = ENOMEM;
-		goto cleanup;
-	}
 
 	stor_type = storvsc_get_storage_type(dev);
 

Modified: stable/10/sys/dev/hyperv/vmbus/hv_connection.c
==============================================================================
--- stable/10/sys/dev/hyperv/vmbus/hv_connection.c	Tue Jun 21 00:01:02 2016	(r302039)
+++ stable/10/sys/dev/hyperv/vmbus/hv_connection.c	Tue Jun 21 02:36:03 2016	(r302040)
@@ -308,14 +308,18 @@ hv_vmbus_on_events(int cpu)
 	KASSERT(cpu <= mp_maxid, ("VMBUS: hv_vmbus_on_events: "
 	    "cpu out of range!"));
 
+	page_addr = hv_vmbus_g_context.syn_ic_event_page[cpu];
+	event = (hv_vmbus_synic_event_flags *)
+	    page_addr + HV_VMBUS_MESSAGE_SINT;
 	if ((hv_vmbus_protocal_version == HV_VMBUS_VERSION_WS2008) ||
 	    (hv_vmbus_protocal_version == HV_VMBUS_VERSION_WIN7)) {
 		maxdword = HV_MAX_NUM_CHANNELS_SUPPORTED >> 5;
 		/*
 		 * receive size is 1/2 page and divide that by 4 bytes
 		 */
-		recv_interrupt_page =
-		    hv_vmbus_g_connection.recv_interrupt_page;
+		if (synch_test_and_clear_bit(0, &event->flags32[0]))
+			recv_interrupt_page =
+			    hv_vmbus_g_connection.recv_interrupt_page;
 	} else {
 		/*
 		 * On Host with Win8 or above, the event page can be
@@ -323,9 +327,6 @@ hv_vmbus_on_events(int cpu)
 		 * that has the pending interrupt.
 		 */
 		maxdword = HV_EVENT_FLAGS_DWORD_COUNT;
-		page_addr = hv_vmbus_g_context.syn_ic_event_page[cpu];
-		event = (hv_vmbus_synic_event_flags *)
-		    page_addr + HV_VMBUS_MESSAGE_SINT;
 		recv_interrupt_page = event->flags32;
 	}
 

Modified: stable/10/sys/dev/hyperv/vmbus/hv_hv.c
==============================================================================
--- stable/10/sys/dev/hyperv/vmbus/hv_hv.c	Tue Jun 21 00:01:02 2016	(r302039)
+++ stable/10/sys/dev/hyperv/vmbus/hv_hv.c	Tue Jun 21 02:36:03 2016	(r302040)
@@ -127,7 +127,7 @@ int
 hv_vmbus_init(void) 
 {
 	hv_vmbus_x64_msr_hypercall_contents	hypercall_msr;
-	void* 					virt_addr = 0;
+	void* 					virt_addr = NULL;
 
 	memset(
 	    hv_vmbus_g_context.syn_ic_event_page,
@@ -445,7 +445,7 @@ hyperv_identify(void)
 	    "\003SYNIC"		/* MSRs for SynIC */
 	    "\004SYNTM"		/* MSRs for SynTimer */
 	    "\005APIC"		/* MSR_{EOI,ICR,TPR} */
-	    "\006HYERCALL"	/* MSR_{GUEST_OS_ID,HYPERCALL} */
+	    "\006HYPERCALL"	/* MSR_{GUEST_OS_ID,HYPERCALL} */
 	    "\007VPINDEX"	/* MSR_VP_INDEX */
 	    "\010RESET"		/* MSR_RESET */
 	    "\011STATS"		/* MSR_STATS_ */

Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
==============================================================================
--- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c	Tue Jun 21 00:01:02 2016	(r302039)
+++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c	Tue Jun 21 02:36:03 2016	(r302040)
@@ -145,7 +145,6 @@ hv_vmbus_isr(struct trapframe *frame)
 {
 	int				cpu;
 	hv_vmbus_message*		msg;
-	hv_vmbus_synic_event_flags*	event;
 	void*				page_addr;
 
 	cpu = PCPU_GET(cpuid);
@@ -156,26 +155,7 @@ hv_vmbus_isr(struct trapframe *frame)
 	 * in Windows when running as a guest in Hyper-V
 	 */
 
-	page_addr = hv_vmbus_g_context.syn_ic_event_page[cpu];
-	event = (hv_vmbus_synic_event_flags*)
-		    page_addr + HV_VMBUS_MESSAGE_SINT;
-
-	if ((hv_vmbus_protocal_version == HV_VMBUS_VERSION_WS2008) ||
-	    (hv_vmbus_protocal_version == HV_VMBUS_VERSION_WIN7)) {
-		/* Since we are a child, we only need to check bit 0 */
-		if (synch_test_and_clear_bit(0, &event->flags32[0])) {
-			hv_vmbus_on_events(cpu);
-		}
-	} else {
-		/*
-		 * On host with Win8 or above, we can directly look at
-		 * the event page. If bit n is set, we have an interrupt 
-		 * on the channel with id n.
-		 * Directly schedule the event software interrupt on
-		 * current cpu.
-		 */
-		hv_vmbus_on_events(cpu);
-	}
+	hv_vmbus_on_events(cpu);
 
 	/* Check if there are actual msgs to be process */
 	page_addr = hv_vmbus_g_context.syn_ic_msg_page[cpu];
@@ -672,7 +652,7 @@ vmbus_bus_exit(void)
 	smp_rendezvous(NULL, hv_vmbus_synic_cleanup, NULL, NULL);
 
 	for(i = 0; i < 2 * MAXCPU; i++) {
-		if (setup_args.page_buffers[i] != 0)
+		if (setup_args.page_buffers[i] != NULL)
 			free(setup_args.page_buffers[i], M_DEVBUF);
 	}
 



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