Index: sys/dev/hyperv/vmbus/hv_connection.c =================================================================== --- sys/dev/hyperv/vmbus/hv_connection.c +++ sys/dev/hyperv/vmbus/hv_connection.c @@ -337,9 +337,9 @@ * On Host with Win8 or above, the event page can be checked directly * to get the id of the channel that has the pending interrupt. */ - event = VMBUS_SC_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT; + event = VMBUS_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT; vmbus_event_flags_proc(event->flagsul, - VMBUS_SC_PCPU_GET(sc, event_flag_cnt, cpu)); + VMBUS_PCPU_GET(sc, event_flag_cnt, cpu)); } void @@ -347,7 +347,7 @@ { hv_vmbus_synic_event_flags *event; - event = VMBUS_SC_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT; + event = VMBUS_PCPU_GET(sc, event_flag, cpu) + HV_VMBUS_MESSAGE_SINT; if (atomic_testandclear_int(&event->flags32[0], 0)) { vmbus_event_flags_proc( hv_vmbus_g_connection.recv_interrupt_page, @@ -415,7 +415,8 @@ int flag_cnt; flag_cnt = (chan->offer_msg.child_rel_id / HV_CHANNEL_ULONG_LEN) + 1; - flag_cnt_ptr = VMBUS_PCPU_PTR(event_flag_cnt, chan->target_cpu); + flag_cnt_ptr = VMBUS_PCPU_PTR(vmbus_get_softc(), event_flag_cnt, + chan->target_cpu); for (;;) { int old_flag_cnt; Index: sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c =================================================================== --- sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c +++ sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c @@ -78,7 +78,7 @@ struct vmbus_softc *sc = xsc; hv_vmbus_message *msg; - msg = VMBUS_SC_PCPU_GET(sc, message, curcpu) + HV_VMBUS_MESSAGE_SINT; + msg = VMBUS_PCPU_GET(sc, message, curcpu) + HV_VMBUS_MESSAGE_SINT; for (;;) { const hv_vmbus_channel_msg_table_entry *entry; hv_vmbus_channel_msg_header *hdr; @@ -141,7 +141,7 @@ sc->vmbus_event_proc(sc, cpu); /* Check if there are actual msgs to be process */ - msg_base = VMBUS_SC_PCPU_GET(sc, message, cpu); + msg_base = VMBUS_PCPU_GET(sc, message, cpu); msg = msg_base + HV_VMBUS_TIMER_SINT; /* we call eventtimer process the message */ @@ -196,7 +196,7 @@ /* * Do a little interrupt counting. */ - (*VMBUS_SC_PCPU_GET(sc, intr_cnt, cpu))++; + (*VMBUS_PCPU_GET(sc, intr_cnt, cpu))++; hv_vmbus_isr(sc, trap_frame, cpu); @@ -231,7 +231,7 @@ simp.as_uint64_t = rdmsr(HV_X64_MSR_SIMP); simp.u.simp_enabled = 1; simp.u.base_simp_gpa = - VMBUS_SC_PCPU_GET(sc, message_dma.hv_paddr, cpu) >> PAGE_SHIFT; + VMBUS_PCPU_GET(sc, message_dma.hv_paddr, cpu) >> PAGE_SHIFT; wrmsr(HV_X64_MSR_SIMP, simp.as_uint64_t); @@ -241,7 +241,7 @@ siefp.as_uint64_t = rdmsr(HV_X64_MSR_SIEFP); siefp.u.siefp_enabled = 1; siefp.u.base_siefp_gpa = - VMBUS_SC_PCPU_GET(sc, event_flag_dma.hv_paddr, cpu) >> PAGE_SHIFT; + VMBUS_PCPU_GET(sc, event_flag_dma.hv_paddr, cpu) >> PAGE_SHIFT; wrmsr(HV_X64_MSR_SIEFP, siefp.as_uint64_t); @@ -328,13 +328,13 @@ /* * Per-cpu messages and event flags. */ - VMBUS_SC_PCPU_GET(sc, message, cpu) = hyperv_dmamem_alloc( + VMBUS_PCPU_GET(sc, message, cpu) = hyperv_dmamem_alloc( bus_get_dma_tag(sc->vmbus_dev), PAGE_SIZE, 0, PAGE_SIZE, - VMBUS_SC_PCPU_PTR(sc, message_dma, cpu), + VMBUS_PCPU_PTR(sc, message_dma, cpu), BUS_DMA_WAITOK | BUS_DMA_ZERO); - VMBUS_SC_PCPU_GET(sc, event_flag, cpu) = hyperv_dmamem_alloc( + VMBUS_PCPU_GET(sc, event_flag, cpu) = hyperv_dmamem_alloc( bus_get_dma_tag(sc->vmbus_dev), PAGE_SIZE, 0, PAGE_SIZE, - VMBUS_SC_PCPU_PTR(sc, event_flag_dma, cpu), + VMBUS_PCPU_PTR(sc, event_flag_dma, cpu), BUS_DMA_WAITOK | BUS_DMA_ZERO); } } @@ -345,17 +345,17 @@ int cpu; CPU_FOREACH(cpu) { - if (VMBUS_SC_PCPU_GET(sc, message, cpu) != NULL) { + if (VMBUS_PCPU_GET(sc, message, cpu) != NULL) { hyperv_dmamem_free( - VMBUS_SC_PCPU_PTR(sc, message_dma, cpu), - VMBUS_SC_PCPU_GET(sc, message, cpu)); - VMBUS_SC_PCPU_GET(sc, message, cpu) = NULL; + VMBUS_PCPU_PTR(sc, message_dma, cpu), + VMBUS_PCPU_GET(sc, message, cpu)); + VMBUS_PCPU_GET(sc, message, cpu) = NULL; } - if (VMBUS_SC_PCPU_GET(sc, event_flag, cpu) != NULL) { + if (VMBUS_PCPU_GET(sc, event_flag, cpu) != NULL) { hyperv_dmamem_free( - VMBUS_SC_PCPU_PTR(sc, event_flag_dma, cpu), - VMBUS_SC_PCPU_GET(sc, event_flag, cpu)); - VMBUS_SC_PCPU_GET(sc, event_flag, cpu) = NULL; + VMBUS_PCPU_PTR(sc, event_flag_dma, cpu), + VMBUS_PCPU_GET(sc, event_flag, cpu)); + VMBUS_PCPU_GET(sc, event_flag, cpu) = NULL; } } } @@ -548,7 +548,7 @@ CPU_FOREACH(cpu) { snprintf(buf, sizeof(buf), "cpu%d:hyperv", cpu); - intrcnt_add(buf, VMBUS_SC_PCPU_PTR(sc, intr_cnt, cpu)); + intrcnt_add(buf, VMBUS_PCPU_PTR(sc, intr_cnt, cpu)); } /* Index: sys/dev/hyperv/vmbus/vmbus_var.h =================================================================== --- sys/dev/hyperv/vmbus/vmbus_var.h +++ sys/dev/hyperv/vmbus/vmbus_var.h @@ -65,12 +65,8 @@ return vmbus_sc->vmbus_dev; } -#define VMBUS_SC_PCPU_GET(sc, field, cpu) (sc)->vmbus_pcpu[(cpu)].field -#define VMBUS_SC_PCPU_PTR(sc, field, cpu) &(sc)->vmbus_pcpu[(cpu)].field -#define VMBUS_PCPU_GET(field, cpu) \ - VMBUS_SC_PCPU_GET(vmbus_get_softc(), field, (cpu)) -#define VMBUS_PCPU_PTR(field, cpu) \ - VMBUS_SC_PCPU_PTR(vmbus_get_softc(), field, (cpu)) +#define VMBUS_PCPU_GET(sc, field, cpu) (sc)->vmbus_pcpu[(cpu)].field +#define VMBUS_PCPU_PTR(sc, field, cpu) &(sc)->vmbus_pcpu[(cpu)].field void vmbus_on_channel_open(const struct hv_vmbus_channel *); void vmbus_event_proc(struct vmbus_softc *, int);