Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/sys/arch/x86/x86 Pull up following revision(s) (requested...



details:   https://anonhg.NetBSD.org/src/rev/ae98293e7cdf
branches:  netbsd-8
changeset: 434360:ae98293e7cdf
user:      snj <snj%NetBSD.org@localhost>
date:      Wed Oct 25 07:05:55 2017 +0000

description:
Pull up following revision(s) (requested by maya in ticket #325):
        sys/arch/x86/x86/vmt.c: revision 1.18
Check that the host supports GET_SPEED as well as GET_VERSION
before deciding vmt_probe has succeeded.
qemu supports GET_VERSION but not the RPC protocol so the probe succeeds
but the attach fails, resulting in "vmt0: failed to open backdoor RPC
channel (TCLO protocol)".  All known versions of vmware support GET_SPEED
and no known qemu versions do, so this prevents it from attempting to
attach (and failing) on qemu while still working on vmware.
stop checking vmt_type to avoid having to adapt this code.
- Taken from openbsd

diffstat:

 sys/arch/x86/x86/vmt.c |  55 ++++++++++++++++++++------------------------------
 1 files changed, 22 insertions(+), 33 deletions(-)

diffs (91 lines):

diff -r 6a6e3b9c4543 -r ae98293e7cdf sys/arch/x86/x86/vmt.c
--- a/sys/arch/x86/x86/vmt.c    Wed Oct 25 07:03:10 2017 +0000
+++ b/sys/arch/x86/x86/vmt.c    Wed Oct 25 07:05:55 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vmt.c,v 1.17 2017/06/01 02:45:08 chs Exp $ */
+/* $NetBSD: vmt.c,v 1.17.2.1 2017/10/25 07:05:55 snj Exp $ */
 /* $OpenBSD: vmt.c,v 1.11 2011/01/27 21:29:25 dtucker Exp $ */
 
 /*
@@ -126,28 +126,34 @@
 
 extern char hostname[MAXHOSTNAMELEN];
 
+static void
+vmt_probe_cmd(struct vm_backdoor *frame, uint16_t cmd)
+{
+       memset(frame, 0, sizeof(*frame));
+
+       (frame->eax).word = VM_MAGIC;
+       (frame->ebx).word = ~VM_MAGIC;
+       (frame->ecx).part.low = cmd;
+       (frame->ecx).part.high = 0xffff;
+       (frame->edx).part.low  = VM_PORT_CMD;
+       (frame->edx).part.high = 0;
+
+       vm_cmd(frame);
+}
+
 static bool
-vmt_probe(uint32_t *type)
+vmt_probe(void)
 {
        struct vm_backdoor frame;
 
-       memset(&frame, 0, sizeof(frame));
-
-       frame.eax.word = VM_MAGIC;
-       frame.ebx.word = ~VM_MAGIC;
-       frame.ecx.part.low = VM_CMD_GET_VERSION;
-       frame.ecx.part.high = 0xffff;
-       frame.edx.part.low  = VM_PORT_CMD;
-       frame.edx.part.high = 0;
-
-       vm_cmd(&frame);
-
+       vmt_probe_cmd(&frame, VM_CMD_GET_VERSION);
        if (frame.eax.word == 0xffffffff ||
            frame.ebx.word != VM_MAGIC)
                return false;
 
-       if (type)
-               *type = frame.ecx.word;
+       vmt_probe_cmd(&frame, VM_CMD_GET_SPEED);
+       if (frame.eax.word == VM_MAGIC)
+               return false;
 
        return true;
 }
@@ -163,23 +169,7 @@
        if ((ci->ci_flags & (CPUF_BSP|CPUF_SP|CPUF_PRIMARY)) == 0)
                return 0;
 
-       return vmt_probe(NULL);
-}
-
-static const char *
-vmt_type(void)
-{
-       uint32_t vmwaretype = 0;
-
-       vmt_probe(&vmwaretype);
-
-       switch (vmwaretype) {
-       case 1: return "Express";
-       case 2: return "ESX Server";
-       case 3: return "VMware Server";
-       case 4: return "Workstation";
-       default: return "Unknown";
-       }
+       return vmt_probe();
 }
 
 static void
@@ -189,7 +179,6 @@
        struct vmt_softc *sc = device_private(self);
 
        aprint_naive("\n");
-       aprint_normal(": %s\n", vmt_type());
 
        sc->sc_dev = self;
        sc->sc_log = NULL;



Home | Main Index | Thread Index | Old Index