xref: /illumos-gate/usr/src/uts/intel/zfs/spa_boot.c (revision 30c304d9)
1e7cbe64fSgw /*
2e7cbe64fSgw  * CDDL HEADER START
3e7cbe64fSgw  *
4e7cbe64fSgw  * The contents of this file are subject to the terms of the
5e7cbe64fSgw  * Common Development and Distribution License (the "License").
6e7cbe64fSgw  * You may not use this file except in compliance with the License.
7e7cbe64fSgw  *
8e7cbe64fSgw  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9e7cbe64fSgw  * or http://www.opensolaris.org/os/licensing.
10e7cbe64fSgw  * See the License for the specific language governing permissions
11e7cbe64fSgw  * and limitations under the License.
12e7cbe64fSgw  *
13e7cbe64fSgw  * When distributing Covered Code, include this CDDL HEADER in each
14e7cbe64fSgw  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15e7cbe64fSgw  * If applicable, add the following below this CDDL HEADER, with the
16e7cbe64fSgw  * fields enclosed by brackets "[]" replaced with your own identifying
17e7cbe64fSgw  * information: Portions Copyright [yyyy] [name of copyright owner]
18e7cbe64fSgw  *
19e7cbe64fSgw  * CDDL HEADER END
20e7cbe64fSgw  */
21e7cbe64fSgw 
22e7cbe64fSgw /*
23b24ab676SJeff Bonwick  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24e7cbe64fSgw  * Use is subject to license terms.
25e7cbe64fSgw  */
26e7cbe64fSgw 
27283b8460SGeorge.Wilson /*
28283b8460SGeorge.Wilson  * Copyright (c) 2012 by Delphix. All rights reserved.
29*30c304d9SJoshua M. Clulow  * Copyright 2020 Joshua M. Clulow <josh@sysmgr.org>
30283b8460SGeorge.Wilson  */
31283b8460SGeorge.Wilson 
32b24ab676SJeff Bonwick #include <sys/zio.h>
33e7cbe64fSgw #include <sys/spa.h>
34e7cbe64fSgw #include <sys/sunddi.h>
35283b8460SGeorge.Wilson #include <sys/x86_archext.h>
36283b8460SGeorge.Wilson 
37283b8460SGeorge.Wilson extern int zfs_deadman_enabled;
38e7cbe64fSgw 
39e7cbe64fSgw char *
spa_get_bootprop(const char * propname)40*30c304d9SJoshua M. Clulow spa_get_bootprop(const char *propname)
41e7cbe64fSgw {
42051aabe6Staylor 	char *value;
43e7cbe64fSgw 
44e7cbe64fSgw 	if (ddi_prop_lookup_string(DDI_DEV_T_ANY, ddi_root_node(),
45*30c304d9SJoshua M. Clulow 	    DDI_PROP_DONTPASS, (char *)propname, &value) != DDI_SUCCESS) {
46e7cbe64fSgw 		return (NULL);
47*30c304d9SJoshua M. Clulow 	}
48*30c304d9SJoshua M. Clulow 
49051aabe6Staylor 	return (value);
50e7cbe64fSgw }
51e7cbe64fSgw 
52e7cbe64fSgw void
spa_free_bootprop(char * value)53051aabe6Staylor spa_free_bootprop(char *value)
54e7cbe64fSgw {
55*30c304d9SJoshua M. Clulow 	if (value == NULL) {
56*30c304d9SJoshua M. Clulow 		return;
57*30c304d9SJoshua M. Clulow 	}
58*30c304d9SJoshua M. Clulow 
59051aabe6Staylor 	ddi_prop_free(value);
60e7cbe64fSgw }
61283b8460SGeorge.Wilson 
62283b8460SGeorge.Wilson void
spa_arch_init(void)63283b8460SGeorge.Wilson spa_arch_init(void)
64283b8460SGeorge.Wilson {
65283b8460SGeorge.Wilson 	/*
66283b8460SGeorge.Wilson 	 * Configure the default settings for the zfs deadman unless
67283b8460SGeorge.Wilson 	 * overriden by /etc/system.
68283b8460SGeorge.Wilson 	 */
69283b8460SGeorge.Wilson 	if (zfs_deadman_enabled == -1) {
70283b8460SGeorge.Wilson 		/*
71283b8460SGeorge.Wilson 		 * Disable the zfs deadman logic on VMware deployments.
72283b8460SGeorge.Wilson 		 */
73283b8460SGeorge.Wilson 		if (get_hwenv() == HW_VMWARE)
74283b8460SGeorge.Wilson 			zfs_deadman_enabled = 0;
75283b8460SGeorge.Wilson 		else
76283b8460SGeorge.Wilson 			zfs_deadman_enabled = 1;
77283b8460SGeorge.Wilson 	}
78283b8460SGeorge.Wilson }
79