Thu Apr 16 17:47:37 2020 UTC ()
fail silently if hypervisor is not found.


(bouyer)
diff -r1.73.2.2 -r1.73.2.3 src/sys/arch/xen/xen/hypervisor.c

cvs diff -r1.73.2.2 -r1.73.2.3 src/sys/arch/xen/xen/hypervisor.c (expand / switch to unified diff)

--- src/sys/arch/xen/xen/hypervisor.c 2020/04/11 21:21:16 1.73.2.2
+++ src/sys/arch/xen/xen/hypervisor.c 2020/04/16 17:47:37 1.73.2.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: hypervisor.c,v 1.73.2.2 2020/04/11 21:21:16 bouyer Exp $ */ 1/* $NetBSD: hypervisor.c,v 1.73.2.3 2020/04/16 17:47:37 bouyer Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2005 Manuel Bouyer. 4 * Copyright (c) 2005 Manuel Bouyer.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -43,27 +43,27 @@ @@ -43,27 +43,27 @@
43 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 43 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
44 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 44 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
45 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 45 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
46 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
47 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 47 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
48 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 48 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
49 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 49 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
50 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 50 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
51 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 51 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52 */ 52 */
53 53
54 54
55#include <sys/cdefs.h> 55#include <sys/cdefs.h>
56__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.73.2.2 2020/04/11 21:21:16 bouyer Exp $"); 56__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.73.2.3 2020/04/16 17:47:37 bouyer Exp $");
57 57
58#include <sys/param.h> 58#include <sys/param.h>
59#include <sys/systm.h> 59#include <sys/systm.h>
60#include <sys/device.h> 60#include <sys/device.h>
61#include <sys/sysctl.h> 61#include <sys/sysctl.h>
62 62
63#include "xenbus.h" 63#include "xenbus.h"
64#include "xencons.h" 64#include "xencons.h"
65#include "isa.h" 65#include "isa.h"
66#include "pci.h" 66#include "pci.h"
67#include "acpica.h" 67#include "acpica.h"
68 68
69#include "opt_xen.h" 69#include "opt_xen.h"
@@ -240,28 +240,26 @@ hypervisor_match(device_t parent, cfdata @@ -240,28 +240,26 @@ hypervisor_match(device_t parent, cfdata
240 * be any reason to spill over the arbitrary number of 1 240 * be any reason to spill over the arbitrary number of 1
241 * hypercall page. This is what we allocate in locore.S 241 * hypercall page. This is what we allocate in locore.S
242 * anyway. Make sure the allocation matches the registration. 242 * anyway. Make sure the allocation matches the registration.
243 */ 243 */
244 244
245 KASSERT(descs[0] == 1); 245 KASSERT(descs[0] == 1);
246 246
247 /* XXX: vtophys(&hypercall_page) */ 247 /* XXX: vtophys(&hypercall_page) */
248 wrmsr(descs[1], (uintptr_t)&hypercall_page - KERNBASE); 248 wrmsr(descs[1], (uintptr_t)&hypercall_page - KERNBASE);
249 249
250 vm_guest = VM_GUEST_XENPVHVM; /* Be more specific */ 250 vm_guest = VM_GUEST_XENPVHVM; /* Be more specific */
251 251
252 } else { 252 } else {
253 aprint_normal("%s: Xen HVM mode not identified. Exiting.\n", 
254 haa->haa_busname); 
255 return 0; 253 return 0;
256 } 254 }
257 255
258 if (-1 != HYPERVISOR_xen_version(XENVER_version, NULL)) { 256 if (-1 != HYPERVISOR_xen_version(XENVER_version, NULL)) {
259 printf("%s: detected functional hypercall page.\n", 257 printf("%s: detected functional hypercall page.\n",
260 haa->haa_busname); 258 haa->haa_busname);
261 259
262 xen_init_features(); 260 xen_init_features();
263 } 261 }
264 262
265 /* Init various preset boot time data structures */ 263 /* Init various preset boot time data structures */
266 264
267 /* XEN xenstore shared page address, event channel */ 265 /* XEN xenstore shared page address, event channel */
@@ -415,27 +413,27 @@ hypervisor_match(device_t parent, cfdata @@ -415,27 +413,27 @@ hypervisor_match(device_t parent, cfdata
415 * 413 *
416 * We need to do this because the HVM domain loader uses the 414 * We need to do this because the HVM domain loader uses the
417 * regular BIOS based native boot(8) procedure, which sets the 415 * regular BIOS based native boot(8) procedure, which sets the
418 * boot device to the native driver/partition of whatever was 416 * boot device to the native driver/partition of whatever was
419 * detected by the native bootloader. 417 * detected by the native bootloader.
420 */ 418 */
421 419
422 struct btinfo_rootdevice bi; 420 struct btinfo_rootdevice bi;
423 snprintf(bi.devname, 6, "xbd0a"); 421 snprintf(bi.devname, 6, "xbd0a");
424 bi.common.type = BTINFO_ROOTDEVICE; 422 bi.common.type = BTINFO_ROOTDEVICE;
425 bi.common.len = sizeof(struct btinfo_rootdevice); 423 bi.common.len = sizeof(struct btinfo_rootdevice);
426 424
427 /* From i386/multiboot.c */ 425 /* From i386/multiboot.c */
428 /* $NetBSD: hypervisor.c,v 1.73.2.2 2020/04/11 21:21:16 bouyer Exp $ */ 426 /* $NetBSD: hypervisor.c,v 1.73.2.3 2020/04/16 17:47:37 bouyer Exp $ */
429 int i, len; 427 int i, len;
430 vaddr_t data; 428 vaddr_t data;
431 extern struct bootinfo bootinfo; 429 extern struct bootinfo bootinfo;
432 struct bootinfo *bip = (struct bootinfo *)&bootinfo; 430 struct bootinfo *bip = (struct bootinfo *)&bootinfo;
433 len = bi.common.len; 431 len = bi.common.len;
434 432
435 data = (vaddr_t)&bip->bi_data; 433 data = (vaddr_t)&bip->bi_data;
436 for (i = 0; i < bip->bi_nentries; i++) { 434 for (i = 0; i < bip->bi_nentries; i++) {
437 struct btinfo_common *tmp; 435 struct btinfo_common *tmp;
438 436
439 tmp = (struct btinfo_common *)data; 437 tmp = (struct btinfo_common *)data;
440 data += tmp->len; 438 data += tmp->len;
441 } 439 }