Sat Dec 7 11:45:45 2019 UTC ()
Get a Hyper-V virtual processor id in cpu_hatch().

Currently, it is got in config_interrupts context.
However, since it is required when attaching a device,
it is got earlier than now.


(nonaka)
diff -r1.177 -r1.178 src/sys/arch/x86/x86/cpu.c
diff -r1.5 -r1.6 src/sys/arch/x86/x86/hyperv.c
diff -r1.1 -r1.2 src/sys/arch/x86/x86/hypervvar.h
diff -r1.3 -r1.4 src/sys/dev/hyperv/hyperv_common.c
diff -r1.2 -r1.3 src/sys/dev/hyperv/hypervvar.h
diff -r1.2 -r1.3 src/sys/dev/hyperv/vmbusvar.h
diff -r1.6 -r1.7 src/sys/dev/hyperv/vmbus.c

cvs diff -r1.177 -r1.178 src/sys/arch/x86/x86/cpu.c (expand / switch to unified diff)

--- src/sys/arch/x86/x86/cpu.c 2019/11/27 06:24:33 1.177
+++ src/sys/arch/x86/x86/cpu.c 2019/12/07 11:45:45 1.178
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: cpu.c,v 1.177 2019/11/27 06:24:33 maxv Exp $ */ 1/* $NetBSD: cpu.c,v 1.178 2019/12/07 11:45:45 nonaka Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000-2012 NetBSD Foundation, Inc. 4 * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Bill Sommerfeld of RedBack Networks Inc, and by Andrew Doran. 8 * by Bill Sommerfeld of RedBack Networks Inc, and by Andrew Doran.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -52,27 +52,27 @@ @@ -52,27 +52,27 @@
52 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 52 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
53 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 53 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
54 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR AND CONTRIBUTORS BE LIABLE 54 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR AND CONTRIBUTORS BE LIABLE
55 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 55 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
56 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 56 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
57 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 57 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
58 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 58 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
59 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 59 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
60 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 60 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
61 * SUCH DAMAGE. 61 * SUCH DAMAGE.
62 */ 62 */
63 63
64#include <sys/cdefs.h> 64#include <sys/cdefs.h>
65__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.177 2019/11/27 06:24:33 maxv Exp $"); 65__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.178 2019/12/07 11:45:45 nonaka Exp $");
66 66
67#include "opt_ddb.h" 67#include "opt_ddb.h"
68#include "opt_mpbios.h" /* for MPDEBUG */ 68#include "opt_mpbios.h" /* for MPDEBUG */
69#include "opt_mtrr.h" 69#include "opt_mtrr.h"
70#include "opt_multiprocessor.h" 70#include "opt_multiprocessor.h"
71#include "opt_svs.h" 71#include "opt_svs.h"
72 72
73#include "lapic.h" 73#include "lapic.h"
74#include "ioapic.h" 74#include "ioapic.h"
75 75
76#include <sys/param.h> 76#include <sys/param.h>
77#include <sys/proc.h> 77#include <sys/proc.h>
78#include <sys/systm.h> 78#include <sys/systm.h>
@@ -108,26 +108,33 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.17 @@ -108,26 +108,33 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.17
108 108
109#if NLAPIC > 0 109#if NLAPIC > 0
110#include <machine/apicvar.h> 110#include <machine/apicvar.h>
111#include <machine/i82489reg.h> 111#include <machine/i82489reg.h>
112#include <machine/i82489var.h> 112#include <machine/i82489var.h>
113#endif 113#endif
114 114
115#include <dev/ic/mc146818reg.h> 115#include <dev/ic/mc146818reg.h>
116#include <i386/isa/nvram.h> 116#include <i386/isa/nvram.h>
117#include <dev/isa/isareg.h> 117#include <dev/isa/isareg.h>
118 118
119#include "tsc.h" 119#include "tsc.h"
120 120
 121#ifndef XEN
 122#include "hyperv.h"
 123#if NHYPERV > 0
 124#include <x86/x86/hypervvar.h>
 125#endif
 126#endif
 127
121static int cpu_match(device_t, cfdata_t, void *); 128static int cpu_match(device_t, cfdata_t, void *);
122static void cpu_attach(device_t, device_t, void *); 129static void cpu_attach(device_t, device_t, void *);
123static void cpu_defer(device_t); 130static void cpu_defer(device_t);
124static int cpu_rescan(device_t, const char *, const int *); 131static int cpu_rescan(device_t, const char *, const int *);
125static void cpu_childdetached(device_t, device_t); 132static void cpu_childdetached(device_t, device_t);
126static bool cpu_stop(device_t); 133static bool cpu_stop(device_t);
127static bool cpu_suspend(device_t, const pmf_qual_t *); 134static bool cpu_suspend(device_t, const pmf_qual_t *);
128static bool cpu_resume(device_t, const pmf_qual_t *); 135static bool cpu_resume(device_t, const pmf_qual_t *);
129static bool cpu_shutdown(device_t, int); 136static bool cpu_shutdown(device_t, int);
130 137
131struct cpu_softc { 138struct cpu_softc {
132 device_t sc_dev; /* device tree glue */ 139 device_t sc_dev; /* device tree glue */
133 struct cpu_info *sc_info; /* pointer to CPU info */ 140 struct cpu_info *sc_info; /* pointer to CPU info */
@@ -853,26 +860,29 @@ cpu_hatch(void *v) @@ -853,26 +860,29 @@ cpu_hatch(void *v)
853 struct pcb *pcb; 860 struct pcb *pcb;
854 int s, i; 861 int s, i;
855 862
856 /* ------------------------------------------------------------- */ 863 /* ------------------------------------------------------------- */
857 864
858 /* 865 /*
859 * This section of code must be compiled with SSP disabled, to 866 * This section of code must be compiled with SSP disabled, to
860 * prevent a race against cpu0. See sys/conf/ssp.mk. 867 * prevent a race against cpu0. See sys/conf/ssp.mk.
861 */ 868 */
862 869
863 cpu_init_msrs(ci, true); 870 cpu_init_msrs(ci, true);
864 cpu_probe(ci); 871 cpu_probe(ci);
865 cpu_speculation_init(ci); 872 cpu_speculation_init(ci);
 873#if NHYPERV > 0
 874 hyperv_init_cpu(ci);
 875#endif
866 876
867 ci->ci_data.cpu_cc_freq = cpu_info_primary.ci_data.cpu_cc_freq; 877 ci->ci_data.cpu_cc_freq = cpu_info_primary.ci_data.cpu_cc_freq;
868 /* cpu_get_tsc_freq(ci); */ 878 /* cpu_get_tsc_freq(ci); */
869 879
870 KDASSERT((ci->ci_flags & CPUF_PRESENT) == 0); 880 KDASSERT((ci->ci_flags & CPUF_PRESENT) == 0);
871 881
872 /* 882 /*
873 * Synchronize the TSC for the first time. Note that interrupts are 883 * Synchronize the TSC for the first time. Note that interrupts are
874 * off at this point. 884 * off at this point.
875 */ 885 */
876 wbinvd(); 886 wbinvd();
877 atomic_or_32(&ci->ci_flags, CPUF_PRESENT); 887 atomic_or_32(&ci->ci_flags, CPUF_PRESENT);
878 tsc_sync_ap(ci); 888 tsc_sync_ap(ci);

cvs diff -r1.5 -r1.6 src/sys/arch/x86/x86/hyperv.c (expand / switch to unified diff)

--- src/sys/arch/x86/x86/hyperv.c 2019/11/30 05:28:28 1.5
+++ src/sys/arch/x86/x86/hyperv.c 2019/12/07 11:45:45 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: hyperv.c,v 1.5 2019/11/30 05:28:28 nonaka Exp $ */ 1/* $NetBSD: hyperv.c,v 1.6 2019/12/07 11:45:45 nonaka Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2009-2012,2016-2017 Microsoft Corp. 4 * Copyright (c) 2009-2012,2016-2017 Microsoft Corp.
5 * Copyright (c) 2012 NetApp Inc. 5 * Copyright (c) 2012 NetApp Inc.
6 * Copyright (c) 2012 Citrix Inc. 6 * Copyright (c) 2012 Citrix Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice unmodified, this list of conditions, and the following 13 * notice unmodified, this list of conditions, and the following
14 * disclaimer. 14 * disclaimer.
@@ -23,27 +23,27 @@ @@ -23,27 +23,27 @@
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31/** 31/**
32 * Implements low-level interactions with Hyper-V/Azuree 32 * Implements low-level interactions with Hyper-V/Azuree
33 */ 33 */
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35#ifdef __KERNEL_RCSID 35#ifdef __KERNEL_RCSID
36__KERNEL_RCSID(0, "$NetBSD: hyperv.c,v 1.5 2019/11/30 05:28:28 nonaka Exp $"); 36__KERNEL_RCSID(0, "$NetBSD: hyperv.c,v 1.6 2019/12/07 11:45:45 nonaka Exp $");
37#endif 37#endif
38#ifdef __FBSDID 38#ifdef __FBSDID
39__FBSDID("$FreeBSD: head/sys/dev/hyperv/vmbus/hyperv.c 331757 2018-03-30 02:25:12Z emaste $"); 39__FBSDID("$FreeBSD: head/sys/dev/hyperv/vmbus/hyperv.c 331757 2018-03-30 02:25:12Z emaste $");
40#endif 40#endif
41 41
42#ifdef _KERNEL_OPT 42#ifdef _KERNEL_OPT
43#include "lapic.h" 43#include "lapic.h"
44#include "genfb.h" 44#include "genfb.h"
45#include "opt_ddb.h" 45#include "opt_ddb.h"
46#include "vmbus.h" 46#include "vmbus.h"
47#include "wsdisplay.h" 47#include "wsdisplay.h"
48#endif 48#endif
49 49
@@ -103,26 +103,28 @@ static u_int hyperv_ver_major; @@ -103,26 +103,28 @@ static u_int hyperv_ver_major;
103static u_int hyperv_features; /* CPUID_HV_MSR_ */ 103static u_int hyperv_features; /* CPUID_HV_MSR_ */
104static u_int hyperv_recommends; 104static u_int hyperv_recommends;
105 105
106static u_int hyperv_pm_features; 106static u_int hyperv_pm_features;
107static u_int hyperv_features3; 107static u_int hyperv_features3;
108 108
109static char hyperv_version_str[64]; 109static char hyperv_version_str[64];
110static char hyperv_features_str[256]; 110static char hyperv_features_str[256];
111static char hyperv_pm_features_str[256]; 111static char hyperv_pm_features_str[256];
112static char hyperv_features3_str[256]; 112static char hyperv_features3_str[256];
113 113
114static int hyperv_idtvec; 114static int hyperv_idtvec;
115 115
 116uint32_t hyperv_vcpuid[MAXCPUS];
 117
116static struct timecounter hyperv_timecounter = { 118static struct timecounter hyperv_timecounter = {
117 .tc_get_timecount = hyperv_get_timecount, 119 .tc_get_timecount = hyperv_get_timecount,
118 .tc_counter_mask = 0xffffffff, 120 .tc_counter_mask = 0xffffffff,
119 .tc_frequency = HYPERV_TIMER_FREQ, 121 .tc_frequency = HYPERV_TIMER_FREQ,
120 .tc_name = "Hyper-V", 122 .tc_name = "Hyper-V",
121 .tc_quality = 2000, 123 .tc_quality = 2000,
122}; 124};
123 125
124static void hyperv_proc_dummy(void *, struct cpu_info *); 126static void hyperv_proc_dummy(void *, struct cpu_info *);
125 127
126struct hyperv_proc { 128struct hyperv_proc {
127 hyperv_proc_t func; 129 hyperv_proc_t func;
128 void *arg; 130 void *arg;
@@ -485,32 +487,65 @@ hyperv_identify(void) @@ -485,32 +487,65 @@ hyperv_identify(void)
485 x86_cpuid(CPUID_LEAF_HV_HWFEATURES, regs); 487 x86_cpuid(CPUID_LEAF_HV_HWFEATURES, regs);
486 aprint_verbose(" HW Features: %08x, AMD: %08x\n", 488 aprint_verbose(" HW Features: %08x, AMD: %08x\n",
487 regs[0], regs[3]); 489 regs[0], regs[3]);
488 } 490 }
489 491
490 return true; 492 return true;
491} 493}
492 494
493void 495void
494hyperv_early_init(void) 496hyperv_early_init(void)
495{ 497{
496 u_int features, pm_features, features3; 498 u_int features, pm_features, features3;
497 u_int maxleaf; 499 u_int maxleaf;
 500 int i;
498 501
499 if (!hyperv_probe(&maxleaf, &features, &pm_features, &features3)) 502 if (!hyperv_probe(&maxleaf, &features, &pm_features, &features3))
500 return; 503 return;
501 504
502 if (features & CPUID_HV_MSR_TIME_REFCNT) 505 if (features & CPUID_HV_MSR_TIME_REFCNT)
503 x86_delay = delay_func = delay_msr; 506 x86_delay = delay_func = delay_msr;
 507
 508 if (features & CPUID_HV_MSR_VP_INDEX) {
 509 /* Save virtual processor id. */
 510 hyperv_vcpuid[0] = rdmsr(MSR_HV_VP_INDEX);
 511 } else {
 512 /* Set virtual processor id to 0 for compatibility. */
 513 hyperv_vcpuid[0] = 0;
 514 }
 515 for (i = 1; i < MAXCPUS; i++)
 516 hyperv_vcpuid[i] = hyperv_vcpuid[0];
 517}
 518
 519void
 520hyperv_init_cpu(struct cpu_info *ci)
 521{
 522 u_int features, pm_features, features3;
 523 u_int maxleaf;
 524
 525 if (!hyperv_probe(&maxleaf, &features, &pm_features, &features3))
 526 return;
 527
 528 if (features & CPUID_HV_MSR_VP_INDEX)
 529 hyperv_vcpuid[ci->ci_index] = rdmsr(MSR_HV_VP_INDEX);
 530}
 531
 532uint32_t
 533hyperv_get_vcpuid(cpuid_t cpu)
 534{
 535
 536 if (cpu < MAXCPUS)
 537 return hyperv_vcpuid[cpu];
 538 return 0;
504} 539}
505 540
506static bool 541static bool
507hyperv_init(void) 542hyperv_init(void)
508{ 543{
509 544
510 if (!hyperv_identify()) { 545 if (!hyperv_identify()) {
511 /* Not Hyper-V; reset guest id to the generic one. */ 546 /* Not Hyper-V; reset guest id to the generic one. */
512 if (vm_guest == VM_GUEST_HV) 547 if (vm_guest == VM_GUEST_HV)
513 vm_guest = VM_GUEST_VM; 548 vm_guest = VM_GUEST_VM;
514 return false; 549 return false;
515 } 550 }
516 551
@@ -788,34 +823,26 @@ vmbus_deinit_interrupts_md(struct vmbus_ @@ -788,34 +823,26 @@ vmbus_deinit_interrupts_md(struct vmbus_
788 hyperv_idtvec = 0; 823 hyperv_idtvec = 0;
789 } 824 }
790} 825}
791 826
792void 827void
793vmbus_init_synic_md(struct vmbus_softc *sc, cpuid_t cpu) 828vmbus_init_synic_md(struct vmbus_softc *sc, cpuid_t cpu)
794{ 829{
795 struct vmbus_percpu_data *pd; 830 struct vmbus_percpu_data *pd;
796 uint64_t val, orig; 831 uint64_t val, orig;
797 uint32_t sint; 832 uint32_t sint;
798 833
799 pd = &sc->sc_percpu[cpu]; 834 pd = &sc->sc_percpu[cpu];
800 835
801 if (hyperv_features & CPUID_HV_MSR_VP_INDEX) { 
802 /* Save virtual processor id. */ 
803 pd->vcpuid = rdmsr(MSR_HV_VP_INDEX); 
804 } else { 
805 /* Set virtual processor id to 0 for compatibility. */ 
806 pd->vcpuid = 0; 
807 } 
808 
809 /* 836 /*
810 * Setup the SynIC message. 837 * Setup the SynIC message.
811 */ 838 */
812 orig = rdmsr(MSR_HV_SIMP); 839 orig = rdmsr(MSR_HV_SIMP);
813 val = MSR_HV_SIMP_ENABLE | (orig & MSR_HV_SIMP_RSVD_MASK) | 840 val = MSR_HV_SIMP_ENABLE | (orig & MSR_HV_SIMP_RSVD_MASK) |
814 (atop(hyperv_dma_get_paddr(&pd->simp_dma)) << MSR_HV_SIMP_PGSHIFT); 841 (atop(hyperv_dma_get_paddr(&pd->simp_dma)) << MSR_HV_SIMP_PGSHIFT);
815 wrmsr(MSR_HV_SIMP, val); 842 wrmsr(MSR_HV_SIMP, val);
816 843
817 /* 844 /*
818 * Setup the SynIC event flags. 845 * Setup the SynIC event flags.
819 */ 846 */
820 orig = rdmsr(MSR_HV_SIEFP); 847 orig = rdmsr(MSR_HV_SIEFP);
821 val = MSR_HV_SIEFP_ENABLE | (orig & MSR_HV_SIEFP_RSVD_MASK) | 848 val = MSR_HV_SIEFP_ENABLE | (orig & MSR_HV_SIEFP_RSVD_MASK) |

cvs diff -r1.1 -r1.2 src/sys/arch/x86/x86/hypervvar.h (expand / switch to unified diff)

--- src/sys/arch/x86/x86/hypervvar.h 2019/05/24 14:28:48 1.1
+++ src/sys/arch/x86/x86/hypervvar.h 2019/12/07 11:45:45 1.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: hypervvar.h,v 1.1 2019/05/24 14:28:48 nonaka Exp $ */ 1/* $NetBSD: hypervvar.h,v 1.2 2019/12/07 11:45:45 nonaka Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2009-2012,2016 Microsoft Corp. 4 * Copyright (c) 2009-2012,2016 Microsoft Corp.
5 * Copyright (c) 2012 NetApp Inc. 5 * Copyright (c) 2012 NetApp Inc.
6 * Copyright (c) 2012 Citrix Inc. 6 * Copyright (c) 2012 Citrix Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice unmodified, this list of conditions, and the following 13 * notice unmodified, this list of conditions, and the following
14 * disclaimer. 14 * disclaimer.
@@ -22,16 +22,17 @@ @@ -22,16 +22,17 @@
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31#ifndef _X86_HYPERVVAR_H_ 31#ifndef _X86_HYPERVVAR_H_
32#define _X86_HYPERVVAR_H_ 32#define _X86_HYPERVVAR_H_
33 33
34void hyperv_early_init(void); 34void hyperv_early_init(void);
 35void hyperv_init_cpu(struct cpu_info *);
35device_t device_hyperv_register(device_t, void *); 36device_t device_hyperv_register(device_t, void *);
36 37
37#endif /* _X86_HYPERVVAR_H_ */ 38#endif /* _X86_HYPERVVAR_H_ */

cvs diff -r1.3 -r1.4 src/sys/dev/hyperv/hyperv_common.c (expand / switch to unified diff)

--- src/sys/dev/hyperv/hyperv_common.c 2019/12/06 12:46:06 1.3
+++ src/sys/dev/hyperv/hyperv_common.c 2019/12/07 11:45:45 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: hyperv_common.c,v 1.3 2019/12/06 12:46:06 nonaka Exp $ */ 1/* $NetBSD: hyperv_common.c,v 1.4 2019/12/07 11:45:45 nonaka Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2009-2012,2016-2017 Microsoft Corp. 4 * Copyright (c) 2009-2012,2016-2017 Microsoft Corp.
5 * Copyright (c) 2012 NetApp Inc. 5 * Copyright (c) 2012 NetApp Inc.
6 * Copyright (c) 2012 Citrix Inc. 6 * Copyright (c) 2012 Citrix Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice unmodified, this list of conditions, and the following 13 * notice unmodified, this list of conditions, and the following
14 * disclaimer. 14 * disclaimer.
@@ -19,53 +19,54 @@ @@ -19,53 +19,54 @@
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31#include <sys/cdefs.h> 31#include <sys/cdefs.h>
32__KERNEL_RCSID(0, "$NetBSD: hyperv_common.c,v 1.3 2019/12/06 12:46:06 nonaka Exp $"); 32__KERNEL_RCSID(0, "$NetBSD: hyperv_common.c,v 1.4 2019/12/07 11:45:45 nonaka Exp $");
33 33
34#include "hyperv.h" 34#include "hyperv.h"
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/kernel.h> 38#include <sys/kernel.h>
39#include <sys/bus.h> 39#include <sys/bus.h>
40#include <sys/kmem.h> 40#include <sys/kmem.h>
41 41
42#include <dev/hyperv/hypervreg.h> 42#include <dev/hyperv/hypervreg.h>
43#include <dev/hyperv/hypervvar.h> 43#include <dev/hyperv/hypervvar.h>
44 44
45hyperv_tc64_t hyperv_tc64; 45hyperv_tc64_t hyperv_tc64;
46 46
47int hyperv_nullop(void); 47int hyperv_nullop(void);
48void hyperv_voidop(void); 48void hyperv_voidop(void);
49uint64_t hyperv_hypercall_error(uint64_t, paddr_t, paddr_t); 49uint64_t hyperv_hypercall_error(uint64_t, paddr_t, paddr_t);
50 50
51__weak_alias(hyperv_hypercall, hyperv_hypercall_error); 51__weak_alias(hyperv_hypercall, hyperv_hypercall_error);
52__weak_alias(hyperv_hypercall_enabled, hyperv_nullop); 52__weak_alias(hyperv_hypercall_enabled, hyperv_nullop);
53__weak_alias(hyperv_synic_supported, hyperv_nullop); 53__weak_alias(hyperv_synic_supported, hyperv_nullop);
54__weak_alias(hyperv_is_gen1, hyperv_nullop); 54__weak_alias(hyperv_is_gen1, hyperv_nullop);
55__weak_alias(hyperv_set_event_proc, hyperv_voidop); 55__weak_alias(hyperv_set_event_proc, hyperv_voidop);
56__weak_alias(hyperv_set_message_proc, hyperv_voidop); 56__weak_alias(hyperv_set_message_proc, hyperv_voidop);
57__weak_alias(hyperv_send_eom, hyperv_voidop); 57__weak_alias(hyperv_send_eom, hyperv_voidop);
58__weak_alias(hyperv_intr, hyperv_voidop); 58__weak_alias(hyperv_intr, hyperv_voidop);
 59__weak_alias(hyperv_get_vcpuid, hyperv_nullop);
59__weak_alias(vmbus_init_interrupts_md, hyperv_voidop); 60__weak_alias(vmbus_init_interrupts_md, hyperv_voidop);
60__weak_alias(vmbus_deinit_interrupts_md, hyperv_voidop); 61__weak_alias(vmbus_deinit_interrupts_md, hyperv_voidop);
61__weak_alias(vmbus_init_synic_md, hyperv_voidop); 62__weak_alias(vmbus_init_synic_md, hyperv_voidop);
62__weak_alias(vmbus_deinit_synic_md, hyperv_voidop); 63__weak_alias(vmbus_deinit_synic_md, hyperv_voidop);
63 64
64int 65int
65hyperv_nullop(void) 66hyperv_nullop(void)
66{ 67{
67 return 0; 68 return 0;
68} 69}
69 70
70void 71void
71hyperv_voidop(void) 72hyperv_voidop(void)

cvs diff -r1.2 -r1.3 src/sys/dev/hyperv/hypervvar.h (expand / switch to unified diff)

--- src/sys/dev/hyperv/hypervvar.h 2019/05/24 14:28:48 1.2
+++ src/sys/dev/hyperv/hypervvar.h 2019/12/07 11:45:45 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: hypervvar.h,v 1.2 2019/05/24 14:28:48 nonaka Exp $ */ 1/* $NetBSD: hypervvar.h,v 1.3 2019/12/07 11:45:45 nonaka Exp $ */
2 2
3/*- 3/*-
4 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 4 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
5 * 5 *
6 * Copyright (c) 2009-2012,2016-2017 Microsoft Corp. 6 * Copyright (c) 2009-2012,2016-2017 Microsoft Corp.
7 * Copyright (c) 2012 NetApp Inc. 7 * Copyright (c) 2012 NetApp Inc.
8 * Copyright (c) 2012 Citrix Inc. 8 * Copyright (c) 2012 Citrix Inc.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -55,26 +55,27 @@ struct hyperv_reftsc { @@ -55,26 +55,27 @@ struct hyperv_reftsc {
55 volatile int64_t tsc_ofs; 55 volatile int64_t tsc_ofs;
56} __packed __aligned(PAGE_SIZE); 56} __packed __aligned(PAGE_SIZE);
57#ifdef __CTASSERT 57#ifdef __CTASSERT
58__CTASSERT(sizeof(struct hyperv_reftsc) == PAGE_SIZE); 58__CTASSERT(sizeof(struct hyperv_reftsc) == PAGE_SIZE);
59#endif 59#endif
60 60
61#if defined(_KERNEL) 61#if defined(_KERNEL)
62 62
63int hyperv_hypercall_enabled(void); 63int hyperv_hypercall_enabled(void);
64int hyperv_synic_supported(void); 64int hyperv_synic_supported(void);
65int hyperv_is_gen1(void); 65int hyperv_is_gen1(void);
66void hyperv_send_eom(void); 66void hyperv_send_eom(void);
67void hyperv_intr(void); 67void hyperv_intr(void);
 68uint32_t hyperv_get_vcpuid(cpuid_t);
68 69
69struct vmbus_softc; 70struct vmbus_softc;
70void vmbus_init_interrupts_md(struct vmbus_softc *); 71void vmbus_init_interrupts_md(struct vmbus_softc *);
71void vmbus_deinit_interrupts_md(struct vmbus_softc *); 72void vmbus_deinit_interrupts_md(struct vmbus_softc *);
72void vmbus_init_synic_md(struct vmbus_softc *, cpuid_t); 73void vmbus_init_synic_md(struct vmbus_softc *, cpuid_t);
73void vmbus_deinit_synic_md(struct vmbus_softc *, cpuid_t); 74void vmbus_deinit_synic_md(struct vmbus_softc *, cpuid_t);
74 75
75#define HYPERV_GUID_STRLEN 40 76#define HYPERV_GUID_STRLEN 40
76struct hyperv_guid; 77struct hyperv_guid;
77int hyperv_guid2str(const struct hyperv_guid *, char *, size_t); 78int hyperv_guid2str(const struct hyperv_guid *, char *, size_t);
78 79
79/* 80/*
80 * hyperv_tc64 could be NULL, if there were no suitable Hyper-V 81 * hyperv_tc64 could be NULL, if there were no suitable Hyper-V

cvs diff -r1.2 -r1.3 src/sys/dev/hyperv/vmbusvar.h (expand / switch to unified diff)

--- src/sys/dev/hyperv/vmbusvar.h 2019/05/24 14:28:48 1.2
+++ src/sys/dev/hyperv/vmbusvar.h 2019/12/07 11:45:45 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: vmbusvar.h,v 1.2 2019/05/24 14:28:48 nonaka Exp $ */ 1/* $NetBSD: vmbusvar.h,v 1.3 2019/12/07 11:45:45 nonaka Exp $ */
2/* $OpenBSD: hypervvar.h,v 1.13 2017/06/23 19:05:42 mikeb Exp $ */ 2/* $OpenBSD: hypervvar.h,v 1.13 2017/06/23 19:05:42 mikeb Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 2016 Mike Belopuhov <mike@esdenera.com> 5 * Copyright (c) 2016 Mike Belopuhov <mike@esdenera.com>
6 * 6 *
7 * Permission to use, copy, modify, and distribute this software for any 7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above 8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies. 9 * copyright notice and this permission notice appear in all copies.
10 * 10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
@@ -136,27 +136,26 @@ struct vmbus_attach_args { @@ -136,27 +136,26 @@ struct vmbus_attach_args {
136 bus_space_tag_t aa_iot; 136 bus_space_tag_t aa_iot;
137 bus_space_tag_t aa_memt; 137 bus_space_tag_t aa_memt;
138}; 138};
139 139
140struct vmbus_dev { 140struct vmbus_dev {
141 struct vmbus_attach_args dv_aa; 141 struct vmbus_attach_args dv_aa;
142 SLIST_ENTRY(vmbus_dev) dv_entry; 142 SLIST_ENTRY(vmbus_dev) dv_entry;
143}; 143};
144SLIST_HEAD(vmbus_devices, vmbus_dev); 144SLIST_HEAD(vmbus_devices, vmbus_dev);
145 145
146struct vmbus_percpu_data { 146struct vmbus_percpu_data {
147 void *simp; /* Synthetic Interrupt Message Page */ 147 void *simp; /* Synthetic Interrupt Message Page */
148 void *siep; /* Synthetic Interrupt Event Flags Page */ 148 void *siep; /* Synthetic Interrupt Event Flags Page */
149 uint32_t vcpuid; /* Virtual cpuid */ 
150 149
151 /* Rarely used fields */ 150 /* Rarely used fields */
152 struct hyperv_dma simp_dma; 151 struct hyperv_dma simp_dma;
153 struct hyperv_dma siep_dma; 152 struct hyperv_dma siep_dma;
154} __aligned(CACHE_LINE_SIZE); 153} __aligned(CACHE_LINE_SIZE);
155 154
156struct vmbus_softc { 155struct vmbus_softc {
157 device_t sc_dev; 156 device_t sc_dev;
158 bus_space_tag_t sc_iot; 157 bus_space_tag_t sc_iot;
159 bus_space_tag_t sc_memt; 158 bus_space_tag_t sc_memt;
160 bus_dma_tag_t sc_dmat; 159 bus_dma_tag_t sc_dmat;
161 160
162 pool_cache_t sc_msgpool; 161 pool_cache_t sc_msgpool;

cvs diff -r1.6 -r1.7 src/sys/dev/hyperv/vmbus.c (expand / switch to unified diff)

--- src/sys/dev/hyperv/vmbus.c 2019/12/06 12:46:06 1.6
+++ src/sys/dev/hyperv/vmbus.c 2019/12/07 11:45:45 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: vmbus.c,v 1.6 2019/12/06 12:46:06 nonaka Exp $ */ 1/* $NetBSD: vmbus.c,v 1.7 2019/12/07 11:45:45 nonaka Exp $ */
2/* $OpenBSD: hyperv.c,v 1.43 2017/06/27 13:56:15 mikeb Exp $ */ 2/* $OpenBSD: hyperv.c,v 1.43 2017/06/27 13:56:15 mikeb Exp $ */
3 3
4/*- 4/*-
5 * Copyright (c) 2009-2012 Microsoft Corp. 5 * Copyright (c) 2009-2012 Microsoft Corp.
6 * Copyright (c) 2012 NetApp Inc. 6 * Copyright (c) 2012 NetApp Inc.
7 * Copyright (c) 2012 Citrix Inc. 7 * Copyright (c) 2012 Citrix Inc.
8 * Copyright (c) 2016 Mike Belopuhov <mike@esdenera.com> 8 * Copyright (c) 2016 Mike Belopuhov <mike@esdenera.com>
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -25,27 +25,27 @@ @@ -25,27 +25,27 @@
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33/* 33/*
34 * The OpenBSD port was done under funding by Esdenera Networks GmbH. 34 * The OpenBSD port was done under funding by Esdenera Networks GmbH.
35 */ 35 */
36 36
37#include <sys/cdefs.h> 37#include <sys/cdefs.h>
38__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.6 2019/12/06 12:46:06 nonaka Exp $"); 38__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.7 2019/12/07 11:45:45 nonaka Exp $");
39 39
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/systm.h> 41#include <sys/systm.h>
42#include <sys/device.h> 42#include <sys/device.h>
43#include <sys/atomic.h> 43#include <sys/atomic.h>
44#include <sys/bitops.h> 44#include <sys/bitops.h>
45#include <sys/bus.h> 45#include <sys/bus.h>
46#include <sys/cpu.h> 46#include <sys/cpu.h>
47#include <sys/intr.h> 47#include <sys/intr.h>
48#include <sys/kmem.h> 48#include <sys/kmem.h>
49#include <sys/module.h> 49#include <sys/module.h>
50#include <sys/mutex.h> 50#include <sys/mutex.h>
51#include <sys/xcall.h> 51#include <sys/xcall.h>
@@ -1083,27 +1083,27 @@ void @@ -1083,27 +1083,27 @@ void
1083vmbus_channel_cpu_set(struct vmbus_channel *ch, int cpu) 1083vmbus_channel_cpu_set(struct vmbus_channel *ch, int cpu)
1084{ 1084{
1085 struct vmbus_softc *sc = ch->ch_sc; 1085 struct vmbus_softc *sc = ch->ch_sc;
1086 1086
1087 KASSERTMSG(cpu >= 0 && cpu < ncpu, "invalid cpu %d", cpu); 1087 KASSERTMSG(cpu >= 0 && cpu < ncpu, "invalid cpu %d", cpu);
1088 1088
1089 if (sc->sc_proto == VMBUS_VERSION_WS2008 || 1089 if (sc->sc_proto == VMBUS_VERSION_WS2008 ||
1090 sc->sc_proto == VMBUS_VERSION_WIN7) { 1090 sc->sc_proto == VMBUS_VERSION_WIN7) {
1091 /* Only cpu0 is supported */ 1091 /* Only cpu0 is supported */
1092 cpu = 0; 1092 cpu = 0;
1093 } 1093 }
1094 1094
1095 ch->ch_cpuid = cpu; 1095 ch->ch_cpuid = cpu;
1096 ch->ch_vcpu = sc->sc_percpu[cpu].vcpuid; 1096 ch->ch_vcpu = hyperv_get_vcpuid(cpu);
1097} 1097}
1098 1098
1099void 1099void
1100vmbus_channel_cpu_rr(struct vmbus_channel *ch) 1100vmbus_channel_cpu_rr(struct vmbus_channel *ch)
1101{ 1101{
1102 static uint32_t vmbus_channel_nextcpu; 1102 static uint32_t vmbus_channel_nextcpu;
1103 int cpu; 1103 int cpu;
1104 1104
1105 cpu = atomic_add_32_nv(&vmbus_channel_nextcpu, 1) % ncpu; 1105 cpu = atomic_add_32_nv(&vmbus_channel_nextcpu, 1) % ncpu;
1106 vmbus_channel_cpu_set(ch, cpu); 1106 vmbus_channel_cpu_set(ch, cpu);
1107} 1107}
1108 1108
1109static void 1109static void