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
This commit is contained in:
Sepherosa Ziehau 2016-06-21 02:36:03 +00:00
parent 86abd7fe2f
commit 1b107df2d5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/stable/10/; revision=302040
5 changed files with 10 additions and 43 deletions

View File

@ -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 {

View File

@ -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);

View File

@ -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;
}

View File

@ -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_ */

View File

@ -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);
}