summaryrefslogtreecommitdiff
path: root/sys/dev/hyperv
diff options
context:
space:
mode:
authornonaka <nonaka@NetBSD.org>2019-12-07 11:45:45 +0000
committernonaka <nonaka@NetBSD.org>2019-12-07 11:45:45 +0000
commitc8f387398e2d81a019c137b9f2e803b199cfe27b (patch)
tree27dd4ad934119a76e9c779046d4035176117a6ee /sys/dev/hyperv
parenta7282be7245266bb1e5e0739e4240b678d53165c (diff)
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.
Diffstat (limited to 'sys/dev/hyperv')
-rw-r--r--sys/dev/hyperv/hyperv_common.c5
-rw-r--r--sys/dev/hyperv/hypervvar.h3
-rw-r--r--sys/dev/hyperv/vmbus.c6
-rw-r--r--sys/dev/hyperv/vmbusvar.h3
4 files changed, 9 insertions, 8 deletions
diff --git a/sys/dev/hyperv/hyperv_common.c b/sys/dev/hyperv/hyperv_common.c
index bc062c621ab..56c3b6e9275 100644
--- a/sys/dev/hyperv/hyperv_common.c
+++ b/sys/dev/hyperv/hyperv_common.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hyperv_common.c,v 1.3 2019/12/06 12:46:06 nonaka Exp $ */
+/* $NetBSD: hyperv_common.c,v 1.4 2019/12/07 11:45:45 nonaka Exp $ */
/*-
* Copyright (c) 2009-2012,2016-2017 Microsoft Corp.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hyperv_common.c,v 1.3 2019/12/06 12:46:06 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperv_common.c,v 1.4 2019/12/07 11:45:45 nonaka Exp $");
#include "hyperv.h"
@@ -56,6 +56,7 @@ __weak_alias(hyperv_set_event_proc, hyperv_voidop);
__weak_alias(hyperv_set_message_proc, hyperv_voidop);
__weak_alias(hyperv_send_eom, hyperv_voidop);
__weak_alias(hyperv_intr, hyperv_voidop);
+__weak_alias(hyperv_get_vcpuid, hyperv_nullop);
__weak_alias(vmbus_init_interrupts_md, hyperv_voidop);
__weak_alias(vmbus_deinit_interrupts_md, hyperv_voidop);
__weak_alias(vmbus_init_synic_md, hyperv_voidop);
diff --git a/sys/dev/hyperv/hypervvar.h b/sys/dev/hyperv/hypervvar.h
index 8fe3607e510..7f7759cfb81 100644
--- a/sys/dev/hyperv/hypervvar.h
+++ b/sys/dev/hyperv/hypervvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervvar.h,v 1.2 2019/05/24 14:28:48 nonaka Exp $ */
+/* $NetBSD: hypervvar.h,v 1.3 2019/12/07 11:45:45 nonaka Exp $ */
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -65,6 +65,7 @@ int hyperv_synic_supported(void);
int hyperv_is_gen1(void);
void hyperv_send_eom(void);
void hyperv_intr(void);
+uint32_t hyperv_get_vcpuid(cpuid_t);
struct vmbus_softc;
void vmbus_init_interrupts_md(struct vmbus_softc *);
diff --git a/sys/dev/hyperv/vmbus.c b/sys/dev/hyperv/vmbus.c
index d618ad61366..41ef07394d6 100644
--- a/sys/dev/hyperv/vmbus.c
+++ b/sys/dev/hyperv/vmbus.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vmbus.c,v 1.6 2019/12/06 12:46:06 nonaka Exp $ */
+/* $NetBSD: vmbus.c,v 1.7 2019/12/07 11:45:45 nonaka Exp $ */
/* $OpenBSD: hyperv.c,v 1.43 2017/06/27 13:56:15 mikeb Exp $ */
/*-
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.6 2019/12/06 12:46:06 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.7 2019/12/07 11:45:45 nonaka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1093,7 +1093,7 @@ vmbus_channel_cpu_set(struct vmbus_channel *ch, int cpu)
}
ch->ch_cpuid = cpu;
- ch->ch_vcpu = sc->sc_percpu[cpu].vcpuid;
+ ch->ch_vcpu = hyperv_get_vcpuid(cpu);
}
void
diff --git a/sys/dev/hyperv/vmbusvar.h b/sys/dev/hyperv/vmbusvar.h
index 88073190457..63dee73bbf6 100644
--- a/sys/dev/hyperv/vmbusvar.h
+++ b/sys/dev/hyperv/vmbusvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: vmbusvar.h,v 1.2 2019/05/24 14:28:48 nonaka Exp $ */
+/* $NetBSD: vmbusvar.h,v 1.3 2019/12/07 11:45:45 nonaka Exp $ */
/* $OpenBSD: hypervvar.h,v 1.13 2017/06/23 19:05:42 mikeb Exp $ */
/*
@@ -146,7 +146,6 @@ SLIST_HEAD(vmbus_devices, vmbus_dev);
struct vmbus_percpu_data {
void *simp; /* Synthetic Interrupt Message Page */
void *siep; /* Synthetic Interrupt Event Flags Page */
- uint32_t vcpuid; /* Virtual cpuid */
/* Rarely used fields */
struct hyperv_dma simp_dma;