Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/sys Pull up following revision(s) (requested by nonaka in...
details: https://anonhg.NetBSD.org/src/rev/966887406827
branches: netbsd-8
changeset: 451933:966887406827
user: martin <martin%NetBSD.org@localhost>
date: Wed Jun 12 10:17:32 2019 +0000
description:
Pull up following revision(s) (requested by nonaka in ticket #1280):
sys/arch/x86/x86/consinit.c: revision 1.29
sys/dev/hyperv/vmbusvar.h: revision 1.2
sys/dev/hyperv/genfb_vmbusvar.h: revision 1.1
sys/arch/x86/x86/x86_autoconf.c: revision 1.78
sys/arch/x86/x86/identcpu.c: revision 1.91
sys/arch/x86/x86/hyperv.c: revision 1.2
sys/arch/x86/x86/hyperv.c: revision 1.3
sys/arch/x86/x86/hyperv.c: revision 1.4
sys/arch/i386/conf/GENERIC: revision 1.1207
sys/dev/wscons/wsconsio.h: revision 1.123
sys/arch/x86/x86/hypervvar.h: revision 1.1
sys/arch/amd64/conf/GENERIC: revision 1.528
sys/dev/hyperv/files.hyperv: revision 1.2
sys/arch/x86/include/autoconf.h: revision 1.6
sys/dev/hyperv/hyperv_common.c: revision 1.2
sys/arch/xen/x86/autoconf.c: revision 1.23
sys/arch/x86/pci/pci_machdep.c: revision 1.86
sys/dev/hyperv/hvkbd.c: revision 1.1
sys/dev/hyperv/hypervvar.h: revision 1.2
sys/dev/acpi/vmbus_acpi.c: revision 1.2
sys/dev/hyperv/vmbus.c: revision 1.3
sys/dev/hyperv/hvkbdvar.h: revision 1.1
sys/dev/hyperv/genfb_vmbus.c: revision 1.1
Added drivers for Hyper-V Synthetic Keyboard and Video device.
Avoid undefined reference to `hyperv_guid_video' without vmbus(4).
Avoid undefined reference to `hyperv_is_gen1' without hyperv(4).
Use efi_probe().
diffstat:
sys/arch/amd64/conf/GENERIC | 7 +-
sys/arch/i386/conf/GENERIC | 7 +-
sys/arch/x86/include/autoconf.h | 4 +-
sys/arch/x86/pci/pci_machdep.c | 9 +-
sys/arch/x86/x86/consinit.c | 16 +-
sys/arch/x86/x86/hyperv.c | 238 ++++++++++++++-
sys/arch/x86/x86/hypervvar.h | 37 ++
sys/arch/x86/x86/identcpu.c | 18 +-
sys/arch/x86/x86/x86_autoconf.c | 14 +-
sys/arch/xen/x86/autoconf.c | 5 +-
sys/dev/acpi/vmbus_acpi.c | 6 +-
sys/dev/hyperv/files.hyperv | 9 +-
sys/dev/hyperv/genfb_vmbus.c | 158 +++++++++
sys/dev/hyperv/genfb_vmbusvar.h | 40 ++
sys/dev/hyperv/hvkbd.c | 644 ++++++++++++++++++++++++++++++++++++++++
sys/dev/hyperv/hvkbdvar.h | 8 +
sys/dev/hyperv/hyperv_common.c | 5 +-
sys/dev/hyperv/hypervvar.h | 3 +-
sys/dev/hyperv/vmbus.c | 8 +-
sys/dev/hyperv/vmbusvar.h | 6 +-
sys/dev/wscons/wsconsio.h | 3 +-
21 files changed, 1205 insertions(+), 40 deletions(-)
diffs (truncated from 1686 to 300 lines):
diff -r 2966207770a1 -r 966887406827 sys/arch/amd64/conf/GENERIC
--- a/sys/arch/amd64/conf/GENERIC Sun Jun 02 08:30:16 2019 +0000
+++ b/sys/arch/amd64/conf/GENERIC Wed Jun 12 10:17:32 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.459.2.14 2019/03/09 17:10:20 martin Exp $
+# $NetBSD: GENERIC,v 1.459.2.15 2019/06/12 10:17:33 martin Exp $
#
# GENERIC machine description file
#
@@ -22,7 +22,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.459.2.14 $"
+#ident "GENERIC-$Revision: 1.459.2.15 $"
maxusers 64 # estimated number of users
@@ -1059,6 +1059,9 @@
# Hyper-V devices
vmbus* at acpi? # Hyper-V VMBus
+genfb* at vmbus? # Hyper-V Synthetic Video Framebuffer
+hvkbd* at vmbus? # Hyper-V Synthetic Keyboard
+wskbd* at hvkbd? console ? mux 1
hvn* at vmbus? # Hyper-V NetVSC
hvs* at vmbus? # Hyper-V StorVSC
hvheartbeat* at vmbus? # Hyper-V Heartbeat Service
diff -r 2966207770a1 -r 966887406827 sys/arch/i386/conf/GENERIC
--- a/sys/arch/i386/conf/GENERIC Sun Jun 02 08:30:16 2019 +0000
+++ b/sys/arch/i386/conf/GENERIC Wed Jun 12 10:17:32 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1156.2.14 2019/03/09 17:10:20 martin Exp $
+# $NetBSD: GENERIC,v 1.1156.2.15 2019/06/12 10:17:32 martin Exp $
#
# GENERIC machine description file
#
@@ -22,7 +22,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.1156.2.14 $"
+#ident "GENERIC-$Revision: 1.1156.2.15 $"
maxusers 64 # estimated number of users
@@ -1439,6 +1439,9 @@
# Hyper-V devices
vmbus* at acpi? # Hyper-V VMBus
+genfb* at vmbus? # Hyper-V Synthetic Video Framebuffer
+hvkbd* at vmbus? # Hyper-V Synthetic Keyboard
+wskbd* at hvkbd? console ? mux 1
hvn* at vmbus? # Hyper-V NetVSC
hvs* at vmbus? # Hyper-V StorVSC
hvheartbeat* at vmbus? # Hyper-V Heartbeat Service
diff -r 2966207770a1 -r 966887406827 sys/arch/x86/include/autoconf.h
--- a/sys/arch/x86/include/autoconf.h Sun Jun 02 08:30:16 2019 +0000
+++ b/sys/arch/x86/include/autoconf.h Wed Jun 12 10:17:32 2019 +0000
@@ -1,9 +1,11 @@
-/* $NetBSD: autoconf.h,v 1.4 2016/09/21 00:00:07 jmcneill Exp $ */
+/* $NetBSD: autoconf.h,v 1.4.8.1 2019/06/12 10:17:33 martin Exp $ */
#ifndef _X86_AUTOCONF_H_
#define _X86_AUTOCONF_H_
#include <sys/device.h>
+extern int x86_found_console;
+
void device_pci_props_register(device_t, void *);
device_t device_pci_register(device_t, void *);
device_t device_isa_register(device_t, void *);
diff -r 2966207770a1 -r 966887406827 sys/arch/x86/pci/pci_machdep.c
--- a/sys/arch/x86/pci/pci_machdep.c Sun Jun 02 08:30:16 2019 +0000
+++ b/sys/arch/x86/pci/pci_machdep.c Wed Jun 12 10:17:32 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.c,v 1.79.2.1 2018/04/11 14:53:50 martin Exp $ */
+/* $NetBSD: pci_machdep.c,v 1.79.2.2 2019/06/12 10:17:33 martin Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.79.2.1 2018/04/11 14:53:50 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.79.2.2 2019/06/12 10:17:33 martin Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -1020,7 +1020,6 @@
device_t
device_pci_register(device_t dev, void *aux)
{
- static bool found_console = false;
device_t parent = device_parent(dev);
device_pci_props_register(dev, aux);
@@ -1074,7 +1073,7 @@
}
}
if (parent && device_is_a(parent, "pci") &&
- found_console == false) {
+ x86_found_console == false) {
struct btinfo_framebuffer *fbinfo;
struct pci_attach_args *pa = aux;
prop_dictionary_t dict;
@@ -1177,7 +1176,7 @@
vga_posth = vga_post_init(pa->pa_bus, pa->pa_device,
pa->pa_function);
#endif
- found_console = true;
+ x86_found_console = true;
return NULL;
}
}
diff -r 2966207770a1 -r 966887406827 sys/arch/x86/x86/consinit.c
--- a/sys/arch/x86/x86/consinit.c Sun Jun 02 08:30:16 2019 +0000
+++ b/sys/arch/x86/x86/consinit.c Wed Jun 12 10:17:32 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: consinit.c,v 1.28 2015/01/11 19:54:23 is Exp $ */
+/* $NetBSD: consinit.c,v 1.28.10.1 2019/06/12 10:17:32 martin Exp $ */
/*
* Copyright (c) 1998
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.28 2015/01/11 19:54:23 is Exp $");
+__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.28.10.1 2019/06/12 10:17:32 martin Exp $");
#include "opt_kgdb.h"
#include "opt_puc.h"
@@ -36,6 +36,7 @@
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/bus.h>
+#include <sys/cpu.h>
#include <machine/bootinfo.h>
#include <arch/x86/include/genfb_machdep.h>
@@ -90,6 +91,13 @@
#include <dev/usb/ukbdvar.h>
#endif
+#ifndef XEN
+#include "hvkbd.h"
+#if NHVKBD > 0
+#include <dev/hyperv/hvkbdvar.h>
+#endif
+#endif
+
#ifndef CONSDEVNAME
#define CONSDEVNAME "pc"
#endif
@@ -205,6 +213,10 @@
error = pckbc_cnattach(x86_bus_space_io, IO_KBD, KBCMDP,
PCKBC_KBD_SLOT, 0);
#endif
+#if (NHVKBD > 0)
+ if (error && vm_guest == VM_GUEST_HV)
+ error = hvkbd_cnattach();
+#endif
#if (NUKBD > 0)
if (error)
error = ukbd_cnattach();
diff -r 2966207770a1 -r 966887406827 sys/arch/x86/x86/hyperv.c
--- a/sys/arch/x86/x86/hyperv.c Sun Jun 02 08:30:16 2019 +0000
+++ b/sys/arch/x86/x86/hyperv.c Wed Jun 12 10:17:32 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hyperv.c,v 1.1.2.2 2019/03/09 17:10:19 martin Exp $ */
+/* $NetBSD: hyperv.c,v 1.1.2.3 2019/06/12 10:17:32 martin Exp $ */
/*-
* Copyright (c) 2009-2012,2016-2017 Microsoft Corp.
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
#ifdef __KERNEL_RCSID
-__KERNEL_RCSID(0, "$NetBSD: hyperv.c,v 1.1.2.2 2019/03/09 17:10:19 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperv.c,v 1.1.2.3 2019/06/12 10:17:32 martin Exp $");
#endif
#ifdef __FBSDID
__FBSDID("$FreeBSD: head/sys/dev/hyperv/vmbus/hyperv.c 331757 2018-03-30 02:25:12Z emaste $");
@@ -41,6 +41,10 @@
#ifdef _KERNEL_OPT
#include "lapic.h"
+#include "genfb.h"
+#include "opt_ddb.h"
+#include "vmbus.h"
+#include "wsdisplay.h"
#endif
#include <sys/param.h>
@@ -57,13 +61,27 @@
#include <uvm/uvm_extern.h>
+#include <machine/autoconf.h>
+#include <machine/bootinfo.h>
#include <machine/cpufunc.h>
#include <machine/cputypes.h>
#include <machine/cpuvar.h>
#include <machine/cpu_counter.h>
+#include <x86/efi.h>
+
+#include <dev/wsfb/genfbvar.h>
+#include <arch/x86/include/genfb_machdep.h>
#include <x86/x86/hypervreg.h>
+#include <x86/x86/hypervvar.h>
#include <dev/hyperv/vmbusvar.h>
+#include <dev/hyperv/genfb_vmbusvar.h>
+
+#ifdef DDB
+#include <machine/db_machdep.h>
+#include <ddb/db_sym.h>
+#include <ddb/db_extern.h>
+#endif
struct hyperv_softc {
device_t sc_dev;
@@ -299,6 +317,26 @@
} while (now < end);
}
+static void
+delay_msr(unsigned int n)
+{
+ uint64_t end, now;
+ u_int last, u;
+
+ now = 0;
+ end = HYPERV_TIMER_FREQ * n / 1000000ULL;
+ last = (u_int)rdmsr(MSR_HV_TIME_REF_COUNT);
+ do {
+ x86_pause();
+ u = (u_int)rdmsr(MSR_HV_TIME_REF_COUNT);
+ if (u < last)
+ now += 0xffffffff - last + u + 1;
+ else
+ now += u - last;
+ last = u;
+ } while (now < end);
+}
+
static __inline uint64_t
hyperv_hypercall_md(volatile void *hc_addr, uint64_t in_val, uint64_t in_paddr,
uint64_t out_paddr)
@@ -341,18 +379,17 @@
}
static bool
-hyperv_identify(void)
+hyperv_probe(u_int *maxleaf, u_int *features, u_int *pm_features,
+ u_int *features3)
{
- char buf[256];
u_int regs[4];
- u_int maxleaf;
if (vm_guest != VM_GUEST_HV)
return false;
x86_cpuid(CPUID_LEAF_HV_MAXLEAF, regs);
- maxleaf = regs[0];
- if (maxleaf < CPUID_LEAF_HV_LIMITS)
+ *maxleaf = regs[0];
+ if (*maxleaf < CPUID_LEAF_HV_LIMITS)
return false;
x86_cpuid(CPUID_LEAF_HV_INTERFACE, regs);
@@ -368,9 +405,23 @@
return false;
}
- hyperv_features = regs[0];
- hyperv_pm_features = regs[2];
- hyperv_features3 = regs[3];
+ *features = regs[0];
+ *pm_features = regs[2];
+ *features3 = regs[3];
+
+ return true;
+}
+
+static bool
+hyperv_identify(void)
+{
+ char buf[256];
+ u_int regs[4];
+ u_int maxleaf;
+
+ if (!hyperv_probe(&maxleaf, &hyperv_features, &hyperv_pm_features,
+ &hyperv_features3))
+ return false;
x86_cpuid(CPUID_LEAF_HV_IDENTITY, regs);
Home |
Main Index |
Thread Index |
Old Index