diff options
author | sephe <sephe@FreeBSD.org> | 2016-06-21 02:36:03 +0000 |
---|---|---|
committer | sephe <sephe@FreeBSD.org> | 2016-06-21 02:36:03 +0000 |
commit | cd5dbe91134dbf5ceacf682753d1a8cc95430b3b (patch) | |
tree | 1e90e1212b8d5e81e911cc04c9ddc5ea33e2d76a | |
parent | 031a6dfccc0ce6febdebe2f7ebda37f1421672be (diff) | |
download | FreeBSD-src-cd5dbe91134dbf5ceacf682753d1a8cc95430b3b.zip FreeBSD-src-cd5dbe91134dbf5ceacf682753d1a8cc95430b3b.tar.gz |
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
-rw-r--r-- | sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c | 7 | ||||
-rw-r--r-- | sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c | 7 | ||||
-rw-r--r-- | sys/dev/hyperv/vmbus/hv_connection.c | 11 | ||||
-rw-r--r-- | sys/dev/hyperv/vmbus/hv_hv.c | 4 | ||||
-rw-r--r-- | sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c | 24 |
5 files changed, 10 insertions, 43 deletions
diff --git a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c index 2207ec9..9f4570d 100644 --- a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c +++ b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c @@ -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_device *device_obj, uint32_t status) { hn_softc_t *sc = device_get_softc(device_obj->device); - if (sc == NULL) { - return; - } - if (status == 1) { sc->hn_carrier = 1; } else { diff --git a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c index 7e0034b..3bf9e47 100644 --- a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c +++ b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c @@ -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); diff --git a/sys/dev/hyperv/vmbus/hv_connection.c b/sys/dev/hyperv/vmbus/hv_connection.c index 5b828bb..075606d 100644 --- a/sys/dev/hyperv/vmbus/hv_connection.c +++ b/sys/dev/hyperv/vmbus/hv_connection.c @@ -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; } diff --git a/sys/dev/hyperv/vmbus/hv_hv.c b/sys/dev/hyperv/vmbus/hv_hv.c index a6e5881..797bb8c 100644 --- a/sys/dev/hyperv/vmbus/hv_hv.c +++ b/sys/dev/hyperv/vmbus/hv_hv.c @@ -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_ */ diff --git a/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c b/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c index 4e37013..b81aa5e 100644 --- a/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c +++ b/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c @@ -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); } |